mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 09:43:00 +01:00
Compare commits
1187 Commits
1.3.11
...
1.4.00-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84dce845a5 | ||
|
|
0a68b82078 | ||
|
|
3dc1afde7e | ||
|
|
e50eb1963f | ||
|
|
fdd6c0a0d8 | ||
|
|
c589c5556b | ||
|
|
17a85c94c6 | ||
|
|
4284fe1029 | ||
|
|
dec3c10ec1 | ||
|
|
c805a48a87 | ||
|
|
918d81198f | ||
|
|
1d87de0a3e | ||
|
|
fdeadde7f0 | ||
|
|
760432fb41 | ||
|
|
240589e9ea | ||
|
|
400c93fb7d | ||
|
|
1bcf43db63 | ||
|
|
79bcd76aa0 | ||
|
|
8833ceb3b5 | ||
|
|
ccc265edf9 | ||
|
|
b18a4da0d9 | ||
|
|
e956988c60 | ||
|
|
1b6d66d4b0 | ||
|
|
fd47d77800 | ||
|
|
5c76ef312f | ||
|
|
f189907ff8 | ||
|
|
6e32843fb4 | ||
|
|
a99d6eb9f8 | ||
|
|
bb37a5982e | ||
|
|
a43a5a0861 | ||
|
|
4ff1e79cc0 | ||
|
|
d28794a587 | ||
|
|
19292c8007 | ||
|
|
a67dd1d9d7 | ||
|
|
9c0f763949 | ||
|
|
6571864b16 | ||
|
|
701822c69f | ||
|
|
2eab93292e | ||
|
|
29fb8b83c2 | ||
|
|
ad68f50b14 | ||
|
|
519485f155 | ||
|
|
45fbb47ccf | ||
|
|
cf0f075acb | ||
|
|
d9aad67ca5 | ||
|
|
083a89c1a3 | ||
|
|
671be42472 | ||
|
|
add4bc24df | ||
|
|
1da1bb7218 | ||
|
|
d0d9527d39 | ||
|
|
c39827ed59 | ||
|
|
5d6a35d4ef | ||
|
|
0d62688343 | ||
|
|
80b7cc717f | ||
|
|
05a9c8b7e5 | ||
|
|
e78cbcfcc8 | ||
|
|
f7b1aea7e0 | ||
|
|
2744fb122c | ||
|
|
77638bf56a | ||
|
|
57e6e5400b | ||
|
|
f2b03896e2 | ||
|
|
8a795e6091 | ||
|
|
946513cb66 | ||
|
|
1fe182babe | ||
|
|
f61aed9f6c | ||
|
|
08882e58b6 | ||
|
|
4c6f2da78a | ||
|
|
3550310e5c | ||
|
|
cedd8da9ba | ||
|
|
3cb269de4b | ||
|
|
91010f2958 | ||
|
|
f3e823997b | ||
|
|
4ae276d1d7 | ||
|
|
f6b38ab32a | ||
|
|
6f96a5026b | ||
|
|
4071f259ad | ||
|
|
a9ed1a1850 | ||
|
|
72a2e24c98 | ||
|
|
593975a255 | ||
|
|
b16cc87ffb | ||
|
|
c5e8b90d71 | ||
|
|
88a6326f87 | ||
|
|
0603ea0fc4 | ||
|
|
c4aedd5323 | ||
|
|
6eb125c913 | ||
|
|
704f7374d2 | ||
|
|
009396cad9 | ||
|
|
a38b7ca9fa | ||
|
|
c5daaffeb1 | ||
|
|
83debde0a1 | ||
|
|
9c2ab19404 | ||
|
|
ef1a777180 | ||
|
|
77014b03ef | ||
|
|
9143051d9f | ||
|
|
f496ecf7b1 | ||
|
|
fc3afc4340 | ||
|
|
fd138eb0b5 | ||
|
|
6d5835849f | ||
|
|
800ebf5b64 | ||
|
|
9df149c489 | ||
|
|
efcf80899e | ||
|
|
c1b12c027a | ||
|
|
476ea80c4e | ||
|
|
bf4d70e8be | ||
|
|
284002bf8b | ||
|
|
b92b9c6507 | ||
|
|
a8cfcf31ab | ||
|
|
d14821e385 | ||
|
|
5e8b036481 | ||
|
|
27ba4ff800 | ||
|
|
c80bb45cad | ||
|
|
dedcf0469b | ||
|
|
9ec6a6d1aa | ||
|
|
1ce01d2043 | ||
|
|
0701169a7e | ||
|
|
2d0cf6413e | ||
|
|
4cf658b629 | ||
|
|
8d21883c20 | ||
|
|
fca0847929 | ||
|
|
1d19dab71d | ||
|
|
49fe98ac57 | ||
|
|
bc9e946618 | ||
|
|
3d3a1abf7b | ||
|
|
1ef1d53fd9 | ||
|
|
0419dca385 | ||
|
|
11bd473f55 | ||
|
|
5947ad5004 | ||
|
|
894218cac9 | ||
|
|
4ce06de18a | ||
|
|
6c4ea34811 | ||
|
|
34736836cc | ||
|
|
9c09c168f8 | ||
|
|
c61e710341 | ||
|
|
63753b8197 | ||
|
|
20f436c646 | ||
|
|
092b9096e6 | ||
|
|
caa1b0d14c | ||
|
|
d39ff036c7 | ||
|
|
6702256b4c | ||
|
|
110fbe9478 | ||
|
|
128c24c8f6 | ||
|
|
6cc2497182 | ||
|
|
615288e635 | ||
|
|
1b814b937b | ||
|
|
01e26f321d | ||
|
|
e8319aee81 | ||
|
|
ca5bf0bd09 | ||
|
|
88b05cd5aa | ||
|
|
132fcb8c74 | ||
|
|
1492fa473f | ||
|
|
9bd33ab3df | ||
|
|
7d826a0cdb | ||
|
|
ec6fc30f47 | ||
|
|
25a54ea802 | ||
|
|
dda9c82940 | ||
|
|
55b88f0274 | ||
|
|
f4da69a205 | ||
|
|
3a919f3e4c | ||
|
|
6cfd124804 | ||
|
|
0879e1f326 | ||
|
|
8312570825 | ||
|
|
7110e6ec3d | ||
|
|
1455a9b3a4 | ||
|
|
2ad73e9b2c | ||
|
|
b1db0d037d | ||
|
|
776821a988 | ||
|
|
1380e64c0b | ||
|
|
0319e2cbff | ||
|
|
7350fdb99c | ||
|
|
25061e7f71 | ||
|
|
0cd8d2b333 | ||
|
|
28dca6e66f | ||
|
|
491a70ad82 | ||
|
|
aa0acf767b | ||
|
|
e37f5e765e | ||
|
|
fe1cf40bbb | ||
|
|
9be6a7cf3b | ||
|
|
0684b1d425 | ||
|
|
12a2107601 | ||
|
|
163b3d19f9 | ||
|
|
15113ba7e4 | ||
|
|
5e9f01ac57 | ||
|
|
ec718f04d7 | ||
|
|
bb96c00cb9 | ||
|
|
697cfeea64 | ||
|
|
0528139c2c | ||
|
|
cbe68e7879 | ||
|
|
074a798213 | ||
|
|
e9b016903b | ||
|
|
8f4d5442b1 | ||
|
|
2160eef1af | ||
|
|
b66c5d7023 | ||
|
|
b21d5bdcc4 | ||
|
|
574770c289 | ||
|
|
adda85a660 | ||
|
|
92473cc56d | ||
|
|
d7e74b9fe0 | ||
|
|
9db2d50676 | ||
|
|
048a979375 | ||
|
|
761fb3b811 | ||
|
|
505d6e258f | ||
|
|
9f22382506 | ||
|
|
f486492c37 | ||
|
|
6f1ddee0ac | ||
|
|
2fac0170e7 | ||
|
|
56056797bc | ||
|
|
bbc2091b77 | ||
|
|
51493fab48 | ||
|
|
5d693c5d8f | ||
|
|
8cd9942be6 | ||
|
|
b2575c9b8f | ||
|
|
a60a6355d2 | ||
|
|
6acfba1315 | ||
|
|
ab731302e0 | ||
|
|
5a48d5c5f8 | ||
|
|
e92c6b8f26 | ||
|
|
200ac53078 | ||
|
|
288907cfd4 | ||
|
|
c822be4a53 | ||
|
|
70f588cce1 | ||
|
|
e5c7e81b08 | ||
|
|
45ebc2b89b | ||
|
|
76523d2988 | ||
|
|
98a64a0948 | ||
|
|
2d6fb72b9d | ||
|
|
e66ff53ca4 | ||
|
|
e8ac3c812f | ||
|
|
a597a7d281 | ||
|
|
1c0e392552 | ||
|
|
59a52a73bb | ||
|
|
0aeff40aaa | ||
|
|
bcd8906315 | ||
|
|
de9249e523 | ||
|
|
5160f5c380 | ||
|
|
5da51e78cc | ||
|
|
2be57414ad | ||
|
|
c2293396be | ||
|
|
cdbc19570d | ||
|
|
ccedd23342 | ||
|
|
46b5746dcc | ||
|
|
97dafc45fa | ||
|
|
adf62fd332 | ||
|
|
98bb865062 | ||
|
|
d50123085f | ||
|
|
b628b9eb4d | ||
|
|
317a39177b | ||
|
|
73924543df | ||
|
|
457754b6f1 | ||
|
|
c659f8a9a9 | ||
|
|
74df4a4fb6 | ||
|
|
b60d9032be | ||
|
|
a2cbfa2668 | ||
|
|
340c47eebd | ||
|
|
ae5f39253e | ||
|
|
3df5f529eb | ||
|
|
0fae8be816 | ||
|
|
f97e9bd19f | ||
|
|
400d551295 | ||
|
|
4957366beb | ||
|
|
27e4a2c290 | ||
|
|
a424d36e96 | ||
|
|
9c0518f251 | ||
|
|
794071efb8 | ||
|
|
787c4e5b73 | ||
|
|
33d3cd0522 | ||
|
|
e14f8ad93c | ||
|
|
7a357634c7 | ||
|
|
ef5f72f56c | ||
|
|
ae3a95dd34 | ||
|
|
6d9db06305 | ||
|
|
35f243a6e6 | ||
|
|
ea25558ac9 | ||
|
|
1f09cb29f0 | ||
|
|
9e4b06e0b6 | ||
|
|
114858505c | ||
|
|
3da062c4cc | ||
|
|
291393d45d | ||
|
|
3cc5cd4a04 | ||
|
|
70ba4a0f3d | ||
|
|
9de6b4724a | ||
|
|
79b96c380d | ||
|
|
3ccf79cff5 | ||
|
|
02bccf6dc1 | ||
|
|
e397de99df | ||
|
|
911f036723 | ||
|
|
af1288b6f8 | ||
|
|
366940fc14 | ||
|
|
4f45431dd3 | ||
|
|
6c266a8926 | ||
|
|
c3f83302c5 | ||
|
|
57063246fb | ||
|
|
29f47d5ca7 | ||
|
|
e0180881e2 | ||
|
|
7c579a1040 | ||
|
|
59219e3f33 | ||
|
|
b67a308a34 | ||
|
|
d5550c8fd1 | ||
|
|
d0ca2b9d4b | ||
|
|
84fb7eec36 | ||
|
|
c04b5dc4d6 | ||
|
|
4b4fb7fd39 | ||
|
|
215bd0f4a2 | ||
|
|
a13d28a6ec | ||
|
|
bcdd235b9f | ||
|
|
6be0714872 | ||
|
|
7e70c4001b | ||
|
|
9326921e2a | ||
|
|
7a0f8ea2dd | ||
|
|
2799bab206 | ||
|
|
ba4d0451ff | ||
|
|
40773ee6f6 | ||
|
|
cd190eebc9 | ||
|
|
c13593def1 | ||
|
|
bbfbe1e72c | ||
|
|
bb88812668 | ||
|
|
94a9230525 | ||
|
|
c7a0841c2e | ||
|
|
b843970033 | ||
|
|
4931ff6e4a | ||
|
|
b9ef701ff1 | ||
|
|
c07364f775 | ||
|
|
64d3430455 | ||
|
|
7e4188e776 | ||
|
|
3f6c07ba6a | ||
|
|
419937f62e | ||
|
|
ab92aa3ffa | ||
|
|
2d9dc92f83 | ||
|
|
0f214496f2 | ||
|
|
9103914bc9 | ||
|
|
aad14169fb | ||
|
|
3550c25b7d | ||
|
|
2764368089 | ||
|
|
e46dcb69da | ||
|
|
ef7aeb752e | ||
|
|
81ba0404b2 | ||
|
|
9af470536b | ||
|
|
5349b46122 | ||
|
|
0de7e22408 | ||
|
|
03f96daba3 | ||
|
|
f6aca88b36 | ||
|
|
ea32cb9e12 | ||
|
|
1c328e7ac7 | ||
|
|
89eef2ce07 | ||
|
|
433c99e239 | ||
|
|
e2faeac505 | ||
|
|
263cb2823c | ||
|
|
5769c8dea9 | ||
|
|
3cff8aba16 | ||
|
|
e5e19f77b9 | ||
|
|
4d93f3271d | ||
|
|
0683745dd2 | ||
|
|
49ef013152 | ||
|
|
3153bbc973 | ||
|
|
717a258430 | ||
|
|
bb945a765c | ||
|
|
6d486401b5 | ||
|
|
07df5edc86 | ||
|
|
ae5ab13533 | ||
|
|
fc40f545fe | ||
|
|
37e01f992d | ||
|
|
b497853e8a | ||
|
|
85dc6e51d2 | ||
|
|
6d5ce1357e | ||
|
|
ac1d556895 | ||
|
|
4aceadd777 | ||
|
|
49de6614c0 | ||
|
|
cc50428646 | ||
|
|
b60bdc9b17 | ||
|
|
35cdcb62b7 | ||
|
|
458f7f5f5b | ||
|
|
284bab397a | ||
|
|
5f306447a0 | ||
|
|
44b862c0bb | ||
|
|
74c367c069 | ||
|
|
c3db026fd9 | ||
|
|
958095d11b | ||
|
|
b21dc8631a | ||
|
|
03354ed1cb | ||
|
|
1a63fc7638 | ||
|
|
6498c711ba | ||
|
|
57c8c94db7 | ||
|
|
15f212c384 | ||
|
|
dee384c8b9 | ||
|
|
93ffd950e9 | ||
|
|
b01d80b1f4 | ||
|
|
84d01362f9 | ||
|
|
939586ce1a | ||
|
|
2888fdff9e | ||
|
|
b048cc1e55 | ||
|
|
3c94074533 | ||
|
|
2de8962887 | ||
|
|
e37e913f6a | ||
|
|
51305118fa | ||
|
|
52bd48cde7 | ||
|
|
ecf32da760 | ||
|
|
1dbe56b026 | ||
|
|
f51bdad6b4 | ||
|
|
97d47c19b7 | ||
|
|
a1ab6f286b | ||
|
|
6d871c9bdb | ||
|
|
12faebca27 | ||
|
|
c231a68bb2 | ||
|
|
bd3db4a425 | ||
|
|
5801981147 | ||
|
|
727cb029a6 | ||
|
|
dd0933c584 | ||
|
|
e92b57c50c | ||
|
|
2e3c1d53f5 | ||
|
|
a67e0c1433 | ||
|
|
a42a1f4a9f | ||
|
|
8f17ec96f0 | ||
|
|
b11e28c880 | ||
|
|
a16d5b62cf | ||
|
|
e9425625e2 | ||
|
|
12324017d7 | ||
|
|
8aabe1c148 | ||
|
|
76ff0374ce | ||
|
|
09373c45f3 | ||
|
|
d0a5454333 | ||
|
|
9ea693d3ce | ||
|
|
ebca9fc2da | ||
|
|
c43e8f8f19 | ||
|
|
b6b03369f7 | ||
|
|
0b6e854520 | ||
|
|
55b17e7d2b | ||
|
|
c15fdae32e | ||
|
|
0fe232e1f5 | ||
|
|
fc33f27899 | ||
|
|
e40095977a | ||
|
|
d1f499f6fd | ||
|
|
610bc42815 | ||
|
|
2006356ccd | ||
|
|
63e827aefb | ||
|
|
1898537149 | ||
|
|
60033d47ec | ||
|
|
b633f36131 | ||
|
|
749443454d | ||
|
|
d68dfe2a32 | ||
|
|
f3b119b91b | ||
|
|
aca3d5c4c6 | ||
|
|
b0acea3353 | ||
|
|
862f5d73e1 | ||
|
|
52bf73aecc | ||
|
|
54e5be1961 | ||
|
|
7fbf3d4f27 | ||
|
|
2df285fd7c | ||
|
|
a3e9d12f6a | ||
|
|
89e5e16aad | ||
|
|
cec132092f | ||
|
|
01723b2d36 | ||
|
|
b463e4ce6f | ||
|
|
8c7fd7b1a6 | ||
|
|
2762a9d1fd | ||
|
|
137864dc04 | ||
|
|
ef775f1c24 | ||
|
|
56617a1c1c | ||
|
|
77e048471e | ||
|
|
7d83dd8283 | ||
|
|
d0c0b9a089 | ||
|
|
75894c4419 | ||
|
|
d3c8a5565a | ||
|
|
bd2cd07f46 | ||
|
|
cd35df17ec | ||
|
|
a1d710fe3d | ||
|
|
c34d269f33 | ||
|
|
01c8b8ad4a | ||
|
|
fc5dda78f5 | ||
|
|
d6e78beb72 | ||
|
|
f324181190 | ||
|
|
5c13661c47 | ||
|
|
8b514d631c | ||
|
|
13a65e875f | ||
|
|
a1d4a4b3f8 | ||
|
|
610b87f462 | ||
|
|
374b758700 | ||
|
|
d32e0962b0 | ||
|
|
1cb9f93f0e | ||
|
|
4a24ade442 | ||
|
|
3f6bd7894d | ||
|
|
cbb941116f | ||
|
|
bcaa7ecacb | ||
|
|
b8eb6186ed | ||
|
|
6d5cf2b139 | ||
|
|
5e6b1fe362 | ||
|
|
1c0cafc6c8 | ||
|
|
8eee0cb0b0 | ||
|
|
bfe8403d75 | ||
|
|
8a852ce22e | ||
|
|
64fc7bcaf8 | ||
|
|
599bbe73b4 | ||
|
|
852872f55c | ||
|
|
62a037a4fd | ||
|
|
637442149c | ||
|
|
9a89c7c49f | ||
|
|
c6ef053aac | ||
|
|
d3b0da4186 | ||
|
|
d09cd49f01 | ||
|
|
bfa29cbf02 | ||
|
|
74d9fa422f | ||
|
|
b43538ee78 | ||
|
|
755b9bc2a1 | ||
|
|
ae49f0b6e4 | ||
|
|
063de93eb8 | ||
|
|
ec997bd2b6 | ||
|
|
20aa312173 | ||
|
|
48b0050451 | ||
|
|
c04b14c751 | ||
|
|
3d8aa29b52 | ||
|
|
ac7ed67d91 | ||
|
|
20f6a55df2 | ||
|
|
60041a1253 | ||
|
|
1e7b54ef0d | ||
|
|
d2cb88d93b | ||
|
|
659e982c47 | ||
|
|
5bf1e49e43 | ||
|
|
5b862a4cee | ||
|
|
2aec202e6d | ||
|
|
f5259decab | ||
|
|
0a17bf69c0 | ||
|
|
6db78d3cda | ||
|
|
0692dd82ad | ||
|
|
088d4ac14a | ||
|
|
92262d0e47 | ||
|
|
1549f66fd7 | ||
|
|
1118cd8ca1 | ||
|
|
d744c6a46d | ||
|
|
765199eba3 | ||
|
|
cb46040309 | ||
|
|
abd8223e41 | ||
|
|
e061acb44a | ||
|
|
cc6850b37d | ||
|
|
a3c92b07cb | ||
|
|
e61581c4e6 | ||
|
|
43dbb94a7f | ||
|
|
d43e61a49c | ||
|
|
7ccadae489 | ||
|
|
251c152efa | ||
|
|
a8fa625b5c | ||
|
|
5151be05b9 | ||
|
|
3f44bd8eac | ||
|
|
2eb593e163 | ||
|
|
2356fda67a | ||
|
|
bff7919c21 | ||
|
|
f1075f800f | ||
|
|
473b9e8bbe | ||
|
|
00c84e775f | ||
|
|
a1a630bad2 | ||
|
|
b91b88a74b | ||
|
|
56e16acce4 | ||
|
|
4692a461eb | ||
|
|
3e04bacf73 | ||
|
|
a0a52a3433 | ||
|
|
188ad359fe | ||
|
|
d601496173 | ||
|
|
85b909a7ab | ||
|
|
18a4f5ed40 | ||
|
|
c4ec9a6df9 | ||
|
|
a4aebdc643 | ||
|
|
b61410b6eb | ||
|
|
51d681974c | ||
|
|
071f7edade | ||
|
|
46f1157030 | ||
|
|
3cca6d9ab4 | ||
|
|
91e8051cee | ||
|
|
c220f0dee5 | ||
|
|
a7be57241c | ||
|
|
a35af4dbe6 | ||
|
|
329f779781 | ||
|
|
95fa688306 | ||
|
|
3d275a4f53 | ||
|
|
06cf0ff2c2 | ||
|
|
ba7ebe1319 | ||
|
|
3efc2138d6 | ||
|
|
9b0cba9dbe | ||
|
|
62a5d2db5c | ||
|
|
96d59a2e81 | ||
|
|
f5179cdcea | ||
|
|
4639b8b939 | ||
|
|
9cdfebda9a | ||
|
|
7c59621c9e | ||
|
|
8736aae2ef | ||
|
|
76a987e1e0 | ||
|
|
9dac898c1c | ||
|
|
ab677e941d | ||
|
|
29d796b6af | ||
|
|
276800f999 | ||
|
|
8d22df0411 | ||
|
|
8d077ff4f2 | ||
|
|
58b01021c1 | ||
|
|
5a6dc8511f | ||
|
|
b7bb3f4487 | ||
|
|
bba23de31c | ||
|
|
973279ed40 | ||
|
|
a4494f0873 | ||
|
|
121354e489 | ||
|
|
531e92bda3 | ||
|
|
135bfc2627 | ||
|
|
a01882aea5 | ||
|
|
a8b5b438bf | ||
|
|
8ccaf3caf2 | ||
|
|
1337c45f1d | ||
|
|
a968019799 | ||
|
|
0a9e1ba42e | ||
|
|
7e91776cfb | ||
|
|
9689c50603 | ||
|
|
bb2eb053da | ||
|
|
de5110310f | ||
|
|
64137995c2 | ||
|
|
6f45e479bd | ||
|
|
53ac857b43 | ||
|
|
6f0e2437e0 | ||
|
|
56d27c3d78 | ||
|
|
7919e591cb | ||
|
|
aabbc2f238 | ||
|
|
fb31cef68b | ||
|
|
2a89e912f8 | ||
|
|
ee91ed8708 | ||
|
|
69475f92c7 | ||
|
|
dc2452231d | ||
|
|
1bbb245e32 | ||
|
|
1548863a21 | ||
|
|
9169f53465 | ||
|
|
b5542effc2 | ||
|
|
6b0e7a9c61 | ||
|
|
00d50953ad | ||
|
|
397dd96383 | ||
|
|
cac5f15a37 | ||
|
|
74c32c4e59 | ||
|
|
e048a6d0d0 | ||
|
|
65d71db72f | ||
|
|
b4fffe154d | ||
|
|
716c4d3783 | ||
|
|
5a9ca96a0f | ||
|
|
cedfb1a538 | ||
|
|
176ffcc3d1 | ||
|
|
91b318e8f7 | ||
|
|
3cc9672ff3 | ||
|
|
946d845987 | ||
|
|
eef5df33b3 | ||
|
|
f0f7dee3c2 | ||
|
|
ddbf5a559a | ||
|
|
67fd45ef25 | ||
|
|
7f8beca33c | ||
|
|
0fcf033ecc | ||
|
|
ea4048dce9 | ||
|
|
0a295f7738 | ||
|
|
0711454e31 | ||
|
|
900623461a | ||
|
|
9512879cc7 | ||
|
|
299c7ff804 | ||
|
|
0276294569 | ||
|
|
06b75386b9 | ||
|
|
16bc359f99 | ||
|
|
c8013421e6 | ||
|
|
c1e82b566e | ||
|
|
f7aba26be2 | ||
|
|
77ffc9c3c2 | ||
|
|
9a6ebb0b9a | ||
|
|
57d1cd5f63 | ||
|
|
b7354779d4 | ||
|
|
0cdb50e538 | ||
|
|
37469232b0 | ||
|
|
0c52260a89 | ||
|
|
a85c9679a9 | ||
|
|
d625edf53e | ||
|
|
643af1c32b | ||
|
|
e7ceef479e | ||
|
|
0545ed434d | ||
|
|
b9bf3f96d2 | ||
|
|
f184e7bd01 | ||
|
|
e1804cded4 | ||
|
|
09eabe98c4 | ||
|
|
173cb001cb | ||
|
|
7d6a4d11fd | ||
|
|
11ea6b269e | ||
|
|
372950071a | ||
|
|
b424ecfd3e | ||
|
|
fc38bbd179 | ||
|
|
00f24fd5bd | ||
|
|
50de88a0a0 | ||
|
|
ca2673f258 | ||
|
|
7d416a90de | ||
|
|
d09526e470 | ||
|
|
ed68f227ac | ||
|
|
f72b1e7eec | ||
|
|
bbd756f0d3 | ||
|
|
87a9c12827 | ||
|
|
ebd83e1f19 | ||
|
|
5b4b99f44e | ||
|
|
d153e3e25c | ||
|
|
e3b3b7cfdb | ||
|
|
2c78bac8f7 | ||
|
|
db1c0647ed | ||
|
|
2f16dbc9b5 | ||
|
|
7e7ab249c2 | ||
|
|
1d2298e5f6 | ||
|
|
b53b5bbc6c | ||
|
|
0dfd2fe9ef | ||
|
|
c0b3a4e929 | ||
|
|
5830bf461d | ||
|
|
857bb00c8a | ||
|
|
c5ae4ca615 | ||
|
|
abb0184e49 | ||
|
|
b11762da99 | ||
|
|
946d00cce6 | ||
|
|
0262255bea | ||
|
|
38a8a6f2ff | ||
|
|
a6446563d8 | ||
|
|
225adb5cce | ||
|
|
a9c722de67 | ||
|
|
49610e372f | ||
|
|
a33768de1b | ||
|
|
790b31c60e | ||
|
|
37c92b8d7c | ||
|
|
07211611a6 | ||
|
|
ea7fee2a53 | ||
|
|
89da8b832f | ||
|
|
5f4c83b6a1 | ||
|
|
2e751b1438 | ||
|
|
1a888d3116 | ||
|
|
2a4fe4aa48 | ||
|
|
4c81eb3058 | ||
|
|
64c20d0e24 | ||
|
|
ff186d5d9d | ||
|
|
734d691e00 | ||
|
|
51777dbe85 | ||
|
|
fb1d48fcae | ||
|
|
41ae8cbbf3 | ||
|
|
9717be3da8 | ||
|
|
67a4efa03e | ||
|
|
fd4f0f4096 | ||
|
|
957605d46b | ||
|
|
55f824e0c8 | ||
|
|
faa22002e3 | ||
|
|
5d0e85452a | ||
|
|
8c61e35fde | ||
|
|
bdfdc61e7f | ||
|
|
b333916f56 | ||
|
|
737d4e2d65 | ||
|
|
c0dfcfd9f6 | ||
|
|
c073c7ed3a | ||
|
|
7fa1a8c6c7 | ||
|
|
037fd890dc | ||
|
|
d673676a8a | ||
|
|
793538d4ef | ||
|
|
92fc00bb0a | ||
|
|
9d70a2a9a6 | ||
|
|
46a5245a1d | ||
|
|
9b94fba3a6 | ||
|
|
a6144f6dee | ||
|
|
615eb9666e | ||
|
|
94a4f628c7 | ||
|
|
d440876bbb | ||
|
|
32c62fd7eb | ||
|
|
65f78ba447 | ||
|
|
9c9a097ff3 | ||
|
|
ff6cdc3e9d | ||
|
|
24367b350d | ||
|
|
e0da44b34a | ||
|
|
ea13ce09c9 | ||
|
|
ef69217b81 | ||
|
|
7e297ac884 | ||
|
|
e6e8470851 | ||
|
|
89a36ae47e | ||
|
|
137c46b8ce | ||
|
|
5512bd7df6 | ||
|
|
96e2cfaad6 | ||
|
|
f7d482e7bc | ||
|
|
6c67308a1f | ||
|
|
6bbdbee669 | ||
|
|
9204b23d51 | ||
|
|
7203a0fcad | ||
|
|
5bdf4b5dcc | ||
|
|
105f088576 | ||
|
|
f40433fc99 | ||
|
|
bbbd12d461 | ||
|
|
81dae8c43d | ||
|
|
ec6a7e79d6 | ||
|
|
630b64462e | ||
|
|
72b8eb85b0 | ||
|
|
a92843533b | ||
|
|
83855268d5 | ||
|
|
67e1defdb8 | ||
|
|
724aad8504 | ||
|
|
5b1337ed07 | ||
|
|
a64e177c21 | ||
|
|
e7aafb7242 | ||
|
|
75e52bbe66 | ||
|
|
348887f799 | ||
|
|
8915a535c6 | ||
|
|
0587741437 | ||
|
|
dd766d5363 | ||
|
|
8e2707d33e | ||
|
|
3390c2dbf2 | ||
|
|
268db10361 | ||
|
|
ed5120eead | ||
|
|
aab532f475 | ||
|
|
00ee75bb29 | ||
|
|
e7e680fd8e | ||
|
|
7b334601c6 | ||
|
|
050cb8c5f4 | ||
|
|
cb8af637e1 | ||
|
|
c1bbc685e6 | ||
|
|
d5d6f7e860 | ||
|
|
c2738d247a | ||
|
|
f73d0dbc40 | ||
|
|
395e243730 | ||
|
|
4d1bcf1cc0 | ||
|
|
eb2c552316 | ||
|
|
664239c567 | ||
|
|
06df8e7f7b | ||
|
|
21a0849a5b | ||
|
|
1f660c8c5b | ||
|
|
14f5a25633 | ||
|
|
606195c78a | ||
|
|
6a7f92b4e2 | ||
|
|
0e1646e3a7 | ||
|
|
ea5af0397e | ||
|
|
6ed0038b1e | ||
|
|
00640fe39b | ||
|
|
4fb7d60eee | ||
|
|
c54755b9c1 | ||
|
|
07c9b614bc | ||
|
|
7bea8f5120 | ||
|
|
ea97dcdb55 | ||
|
|
931bafe962 | ||
|
|
a3a6509410 | ||
|
|
5e26f2e707 | ||
|
|
54ef85e1a3 | ||
|
|
6f29e475ee | ||
|
|
e6607783e9 | ||
|
|
2021a0b065 | ||
|
|
0871a96399 | ||
|
|
2ed5e8e717 | ||
|
|
0c61cc8bdc | ||
|
|
c2bad4419b | ||
|
|
d0e2358fab | ||
|
|
db95085b26 | ||
|
|
08592cbacf | ||
|
|
487e67d208 | ||
|
|
a8abfdae5e | ||
|
|
6496816692 | ||
|
|
364c18b842 | ||
|
|
e20098d462 | ||
|
|
d25a314d3a | ||
|
|
3dde331f9d | ||
|
|
f7e56d9833 | ||
|
|
b554fb342a | ||
|
|
6d9ef91315 | ||
|
|
ce42da5806 | ||
|
|
5b5413c1a2 | ||
|
|
6cdb27aef0 | ||
|
|
2205ad0772 | ||
|
|
637e826c1b | ||
|
|
b19395b40d | ||
|
|
085a25306c | ||
|
|
88c39dbb72 | ||
|
|
91670d3945 | ||
|
|
bdfd7d9839 | ||
|
|
e01b6f175c | ||
|
|
3f899380d9 | ||
|
|
2513b4ca23 | ||
|
|
93180ccd06 | ||
|
|
f43b4ebdc5 | ||
|
|
ff4832a6a2 | ||
|
|
8267a10f41 | ||
|
|
771ef6e16e | ||
|
|
f7ef2b768f | ||
|
|
74c3ce0552 | ||
|
|
67b63f84f1 | ||
|
|
f8c5c380b1 | ||
|
|
2708449089 | ||
|
|
bcfec56300 | ||
|
|
ec6b9d4387 | ||
|
|
621f739831 | ||
|
|
607d2b8bd7 | ||
|
|
c1463c3257 | ||
|
|
e036b7ac70 | ||
|
|
4a4db675f1 | ||
|
|
e193da2cd7 | ||
|
|
c60cbe824c | ||
|
|
8b9432d1d9 | ||
|
|
75a5ffcb10 | ||
|
|
6cc2fc7a6e | ||
|
|
4bb6f68e6f | ||
|
|
00e1521d46 | ||
|
|
1055186e86 | ||
|
|
fc17448473 | ||
|
|
1839f6ce8c | ||
|
|
39e9e426ef | ||
|
|
7c2d590951 | ||
|
|
551b73ea74 | ||
|
|
fca095689e | ||
|
|
e76078fc89 | ||
|
|
2b6b7b899e | ||
|
|
4e6086e8ed | ||
|
|
97a59cd21e | ||
|
|
9ef0ed8516 | ||
|
|
3c919c3af7 | ||
|
|
fbe3c70b85 | ||
|
|
46bf22e36b | ||
|
|
003c89c3a4 | ||
|
|
793bd04afe | ||
|
|
0249ae2724 | ||
|
|
32e0be481a | ||
|
|
e5592c5da8 | ||
|
|
b0500332bc | ||
|
|
78b8ac663e | ||
|
|
e41ab3ac18 | ||
|
|
36d97bbcaf | ||
|
|
f3c89fe48b | ||
|
|
9b31520684 | ||
|
|
660e68b0a3 | ||
|
|
08b46e1a7c | ||
|
|
b78299bbbd | ||
|
|
c8687bfc74 | ||
|
|
a5219055ef | ||
|
|
f79a9e5182 | ||
|
|
3904b172ad | ||
|
|
e0da506d1a | ||
|
|
d2f6191615 | ||
|
|
7c211fa50c | ||
|
|
fadec1a846 | ||
|
|
d2aa19e31f | ||
|
|
ccfe1181be | ||
|
|
85fb12a4ec | ||
|
|
84994c2b2f | ||
|
|
1a2dfb9b19 | ||
|
|
753652dcf9 | ||
|
|
b99d261084 | ||
|
|
aee4bcd65e | ||
|
|
159ec3f04d | ||
|
|
57ff84cd4d | ||
|
|
2933f80d69 | ||
|
|
3d38892f7e | ||
|
|
1d990979ac | ||
|
|
d69cf09d4e | ||
|
|
b8d346d890 | ||
|
|
5d58d85eae | ||
|
|
bc4d34f2fc | ||
|
|
6565d84cf9 | ||
|
|
95ed33b2ce | ||
|
|
e8f6d4107b | ||
|
|
deb0b211b4 | ||
|
|
83888f80d4 | ||
|
|
974862a60a | ||
|
|
2965f35d6d | ||
|
|
6aa300dac0 | ||
|
|
00020a9cbb | ||
|
|
99c6c46d54 | ||
|
|
d183b1b940 | ||
|
|
49fc2a93fa | ||
|
|
1c3066aaf7 | ||
|
|
cdd9745341 | ||
|
|
d0c051a9c2 | ||
|
|
d444e088c4 | ||
|
|
9ae74e0fba | ||
|
|
447aafd106 | ||
|
|
376b79cab3 | ||
|
|
b95ac44a4c | ||
|
|
4161952566 | ||
|
|
5b18abbea0 | ||
|
|
66cc9bc6db | ||
|
|
4f8337c11a | ||
|
|
3aee334fbd | ||
|
|
6d76a14ed0 | ||
|
|
48150e2002 | ||
|
|
d741d9a11e | ||
|
|
3194baffd7 | ||
|
|
7a49fbb0bb | ||
|
|
1ff1704697 | ||
|
|
aeaad41c45 | ||
|
|
15cdf3bfd6 | ||
|
|
146fa474a1 | ||
|
|
11468abc98 | ||
|
|
ef6d47b801 | ||
|
|
bfdb825e0b | ||
|
|
707a388c51 | ||
|
|
d33334708d | ||
|
|
0e853d44b7 | ||
|
|
c598f202f8 | ||
|
|
e607e04af4 | ||
|
|
802d1dfa8e | ||
|
|
00279502e4 | ||
|
|
cc18794a93 | ||
|
|
905e92fa4d | ||
|
|
7a503ea76c | ||
|
|
eed8a57ff9 | ||
|
|
2968803f29 | ||
|
|
6cf6e8ab54 | ||
|
|
3668249267 | ||
|
|
28b092a4e3 | ||
|
|
c0bba7dead | ||
|
|
7fc8d432b5 | ||
|
|
34027ee7c4 | ||
|
|
dc675162c9 | ||
|
|
db370418f8 | ||
|
|
43de871392 | ||
|
|
5e9c483892 | ||
|
|
17169903b4 | ||
|
|
aa70c82824 | ||
|
|
73a5143a17 | ||
|
|
d35e56fd37 | ||
|
|
cafed2d98c | ||
|
|
cd5df82d72 | ||
|
|
5404371b35 | ||
|
|
899bbfee40 | ||
|
|
b9f2aa5eff | ||
|
|
0a028afe7f | ||
|
|
6f1ee88b78 | ||
|
|
e5cc06e822 | ||
|
|
e13ba010bf | ||
|
|
f6bc473eb4 | ||
|
|
b491090037 | ||
|
|
0416f5f4a8 | ||
|
|
5177bf6c1f | ||
|
|
fcd2fb0f12 | ||
|
|
37115d238b | ||
|
|
2c8bfd6573 | ||
|
|
de3bae41ae | ||
|
|
bd1850db69 | ||
|
|
11b5c54c69 | ||
|
|
6f081eb1e4 | ||
|
|
d367dbf767 | ||
|
|
8237bd52b5 | ||
|
|
71471d3bbc | ||
|
|
34169aebaf | ||
|
|
07e98ab79f | ||
|
|
9af66a8e69 | ||
|
|
5e965aec2c | ||
|
|
ecb38693db | ||
|
|
36d5344ded | ||
|
|
6b3bde585d | ||
|
|
f7ea25be61 | ||
|
|
9136530618 | ||
|
|
f4e7e6c74a | ||
|
|
c4766ad3fb | ||
|
|
894a78c0f9 | ||
|
|
c082290cf1 | ||
|
|
4cac324e9f | ||
|
|
493353e774 | ||
|
|
3289215e19 | ||
|
|
cdb5fed5a5 | ||
|
|
bb1dbab984 | ||
|
|
8a97718dd4 | ||
|
|
01142b67c6 | ||
|
|
e0bba80f55 | ||
|
|
34276539fa | ||
|
|
4511dd79fa | ||
|
|
7500685115 | ||
|
|
658e7d64c2 | ||
|
|
569079fed0 | ||
|
|
b042d78186 | ||
|
|
abd051d07b | ||
|
|
8c5b22a8fb | ||
|
|
de93b11c25 | ||
|
|
7f16339bd9 | ||
|
|
42dc6e7c4f | ||
|
|
3153973c2b | ||
|
|
cc044fe41b | ||
|
|
fd5de7b218 | ||
|
|
0037524cfd | ||
|
|
082fa2ca0d | ||
|
|
b1cf9d139a | ||
|
|
9854360ab7 | ||
|
|
b8755b808e | ||
|
|
139812b3bc | ||
|
|
6adbe9a29b | ||
|
|
52f7120392 | ||
|
|
0d2abb95b5 | ||
|
|
6b2adc9359 | ||
|
|
325f89a80d | ||
|
|
e8152a3475 | ||
|
|
6d42d14575 | ||
|
|
2b269ebf54 | ||
|
|
d2493e89ca | ||
|
|
a61423aa99 | ||
|
|
506efec858 | ||
|
|
8e3320ad72 | ||
|
|
ff279bf633 | ||
|
|
a582b07549 | ||
|
|
1e7fef4557 | ||
|
|
f8b44cd8ce | ||
|
|
b0681c10b9 | ||
|
|
1bf0cd1d15 | ||
|
|
01f38537de | ||
|
|
adbb20d7c9 | ||
|
|
c3c7fe08b6 | ||
|
|
4a52135a0b | ||
|
|
a56f805787 | ||
|
|
3a467b3da4 | ||
|
|
4500c4d407 | ||
|
|
eebda74bb7 | ||
|
|
e6e8c12735 | ||
|
|
212b42c8b9 | ||
|
|
9c4ff30ce7 | ||
|
|
d7510b83c8 | ||
|
|
9a9e0cc7de | ||
|
|
a8a90ee815 | ||
|
|
7859660ece | ||
|
|
b93dafee63 | ||
|
|
a1a61e9d4a | ||
|
|
464d6bdd35 | ||
|
|
2c613d5b99 | ||
|
|
d1f683b8a5 | ||
|
|
f4bb8ccb7d | ||
|
|
00364afd8f | ||
|
|
f5f07f7016 | ||
|
|
2bdeeb2d6e | ||
|
|
f023529d37 | ||
|
|
b8d37cb223 | ||
|
|
88ed14fe5c | ||
|
|
cd30771775 | ||
|
|
00a5bc5cf3 | ||
|
|
a17d58fe32 | ||
|
|
c21286dbc3 | ||
|
|
7fc99630e0 | ||
|
|
69a5cd1017 | ||
|
|
3129acfc19 | ||
|
|
c3dd777e44 | ||
|
|
c5120b9c72 | ||
|
|
91a18fe7a2 | ||
|
|
62f5185a1b | ||
|
|
f4cb83319e | ||
|
|
c7b3b7a826 | ||
|
|
01fb245da3 | ||
|
|
83e072dad1 | ||
|
|
eb5ac80714 | ||
|
|
b57cc7bd59 | ||
|
|
d532164cd6 | ||
|
|
61ae4826d1 | ||
|
|
be4e62fe9d | ||
|
|
d9346ab260 | ||
|
|
87c4f318a4 | ||
|
|
30b87e8035 | ||
|
|
26a85846fc | ||
|
|
cd40507609 | ||
|
|
a9ea2e0137 | ||
|
|
6964f7adfc | ||
|
|
70231b6ae0 | ||
|
|
9354831729 | ||
|
|
ab7a83b37e | ||
|
|
8dfa8c20f3 | ||
|
|
67499eeff7 | ||
|
|
d43ff6263f | ||
|
|
058dc8c611 | ||
|
|
8871964be0 | ||
|
|
42aa426991 | ||
|
|
7cee94e0b8 | ||
|
|
fa96a6beec | ||
|
|
efc0edf3ef | ||
|
|
f1d785777c | ||
|
|
db0168205d | ||
|
|
2a20ed95fa | ||
|
|
11f1889f1f | ||
|
|
703b5b2f3f | ||
|
|
58a15e61dd | ||
|
|
896f57f0b4 | ||
|
|
34ae64706e | ||
|
|
43fe92fe3f | ||
|
|
31513d52d7 | ||
|
|
70a16fe344 | ||
|
|
4570ffb8f5 | ||
|
|
22f6ed324d | ||
|
|
e29484e14b | ||
|
|
7e21fdd862 | ||
|
|
01e69cdf5e | ||
|
|
9ad7840236 | ||
|
|
e97ec36094 | ||
|
|
ef318eeaec | ||
|
|
3314b18318 | ||
|
|
5f04ecfdd4 | ||
|
|
91d294acff | ||
|
|
283cdeed6c | ||
|
|
a283fce4ec | ||
|
|
f8d525d797 | ||
|
|
80dabad10e | ||
|
|
8181989e98 | ||
|
|
0f7bf13834 | ||
|
|
c1d6e79a41 | ||
|
|
6f073250f4 | ||
|
|
c084ccde40 | ||
|
|
b73a06b9ab | ||
|
|
740c1131ea | ||
|
|
0a798aec30 | ||
|
|
9089e70155 | ||
|
|
f532630d1b | ||
|
|
7b47d32a96 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -24,7 +24,7 @@
|
||||
/world
|
||||
|
||||
# Mac filesystem dust
|
||||
/.DS_Store
|
||||
*.DS_Store
|
||||
|
||||
# intellij
|
||||
*.iml
|
||||
@@ -39,4 +39,4 @@
|
||||
*.jar
|
||||
|
||||
# Atlassian Stuff
|
||||
/atlassian-ide-plugin.xml
|
||||
/atlassian-ide-plugin.xml
|
||||
|
||||
229
Changelog.txt
229
Changelog.txt
@@ -7,11 +7,214 @@ Key:
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 1.4.00-dev
|
||||
+ Added new Child Skill - Smelting!
|
||||
+ Added a version check, admins will get notified when a new version is available!
|
||||
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
|
||||
+ Added config options for Hylian Luck skill
|
||||
+ Added display values to Unarmed command for Iron Grip
|
||||
+ Added '/party create <name>' command, use this to create a party
|
||||
+ Added '/party disband' command, kicks out all members and deletes the party
|
||||
+ Added '/ptp toggle' command, to disable party teleportation.
|
||||
+ Added '/ptp accept' and '/ptp acceptall' commands
|
||||
+ Added an automatic party kick when a party member has been offline for 7 days (default)
|
||||
+ Added a permission to allow friendly fire in parties, both attacker and defender must have it for friendly fire to occur
|
||||
+ Added timeout on party teleport requests
|
||||
+ Added XP bonus for Archery based on distance from shooter to target
|
||||
+ Added ability to config Hylian Luck drops through treasures.yml
|
||||
+ Added party XP sharing, when more party members are near the share bonus increases.
|
||||
+ Added vanilla XP boost for Fishing - includes permissions, config options, etc
|
||||
+ Added particle effect for bleeding
|
||||
+ Added methods to check if a player is in party or admin chat to the ChatAPI
|
||||
+ Added /mcpurge functionality for Flatfile users
|
||||
+ Added basic support for Mo' Creatures (and other entity mods) - specify mob info in entities.yml
|
||||
+ Added Shears, Buckets, Fishing Rods, Flint & Steel, Carrot Sticks, and Bows to the list of items that can be Salvaged
|
||||
+ Added the "wait" music disc to the default fishing treasures
|
||||
+ Added "Chinese (Taiwan)" localization files (zh_TW)
|
||||
+ Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
|
||||
+ Added Block Cracker to Unarmed's Berserk, turn smooth brick into cracked smooth brick
|
||||
+ Added config option to disable automatic zip backups.
|
||||
+ Added particle effects for many abilities.
|
||||
+ Added '/mcnotify' command to toggle ability notifications on/off
|
||||
= Fixed Green Thumb on wheat not working properly at rank 4
|
||||
= Fixed Green Thumb and Green Terra consuming twice the amount of seed needed
|
||||
= Fixed Green Terra not also checking Green Thumb permissions
|
||||
= Fixed bug where splash potions could raise a player's unarmed level
|
||||
= Fixed bug where fired arrows could raise skill levels other than Archery
|
||||
= Fixed /ptp telporting the target to the player, rather than the other way around.
|
||||
= Fixed Impact reducing the durability of non-armor equipped blocks
|
||||
= Fixed Impact reducing improperly the durability of armors (as a consequence it is now more effective)
|
||||
= Fixed multiple commands not working properly on offline players
|
||||
= Fixed /mmoedit not giving feedback when modifying another players stats
|
||||
= Fixed the guide usage string showing up every time /skillname was called
|
||||
= Fixed Spout not being able to precache our resources properly, and therefore making our XP bars fail
|
||||
= Fixed Spout config files loading / generating when they shouldn't have
|
||||
= Fixed mod config files loading / generating when they shouldn't have
|
||||
= Fixed bug where Green Terra could activate on crops that weren't fully grown.
|
||||
= Fixed several typos relating to locale string display
|
||||
= Fixed bug where all skill guide headers appeared as "Skillname Guide Guide"
|
||||
= Fixed bug where Impact was applied incorrectly due to an inverted method call
|
||||
= Fixed bug where Impact improperly determined the defender's armor
|
||||
= Fixed a bug which made it impossible to join other players' parties
|
||||
= Fixed ArrayIndexOutOfBoundsException resulting from being unranked in a skill when using FlatFile
|
||||
= Fixed Woodcutting accidentally using Mining double drop values.
|
||||
= Fixed Hylian Luck not removing the block-placed flag from flowers.
|
||||
= Fixed Hylian Luck not checking the block-placed flag on flowers.
|
||||
= Fixed Leaf Blower not respecting the unlock level set in advanced.yml
|
||||
= Fixed abilities activating with the wrong tool in hand
|
||||
= Fixed Experience.Gains.Mobspawners.Enabled not being used correctly (the check was inverted)
|
||||
= Fixed bug where Iron Grip was using the attacker's skill values rather than the defender's.
|
||||
= Fixed a bug where /party kick would trigger the PartyChangeEvent for the wrong player
|
||||
= Fixed /party kick not working on offline players
|
||||
= Fixed a bug where party join messages weren't displayed
|
||||
= Fixed a bug where a new party leader wasn't appointed, after the previous party leader left
|
||||
= Fixed a bug where Disarm and Deflect had wrong values
|
||||
= Fixed Magic Hunter (Fishing ability) favoring certain enchants
|
||||
! Changed Green Terra blocks to be determined via permissions instead of the config file
|
||||
! Config files are now backed up even when running in SQL mode
|
||||
! Changed /p and /a to use /partychat and /adminchat as the default command name. The use of /p, /pc, /a, and /ac is still supported.
|
||||
! We're now using Bukkit sounds instead of Spout sounds.
|
||||
! It is now possible to use a negative number for Max_Level in treasures.yml to not use a maximum level, changed default file accordingly
|
||||
! A Fishing catch will now always contains a fish even if a treasure is found
|
||||
! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent
|
||||
! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR.
|
||||
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
||||
! Changed Tree Feller to work on huge mushrooms
|
||||
! Changed Fisherman's Diet and Farmer's Diet to use two seperate config values
|
||||
! Major refactoring - please take note, this WILL break any mcMMO-related plugin not properly hooking into the API.
|
||||
! Changed the way party commands work, use /party ? to check how to use the new commands
|
||||
! Changed McMMOChatEvent to contain the plugin that the event originated from.
|
||||
! 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
|
||||
! 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.
|
||||
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
|
||||
- Removed unused "healthbar" files from the resources
|
||||
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
|
||||
- Removed /mcc command. Replaced with /mcmmo [?|help|commands]
|
||||
- Removed options to allow Mining & Excavation without a tool due to the changes to their abilities
|
||||
|
||||
Version 1.3.14
|
||||
+ Added new Hylian Luck skill to Herbalism.
|
||||
= Fixed a memory leak involving mob tracking
|
||||
- Removed extra durability loss from Leaf Blower
|
||||
|
||||
Version 1.3.13
|
||||
+ Added task & command to prune old and powerless users from the SQL database.
|
||||
+ Added Craftbukkit 1.4.6 / 1.4.7 compatibility
|
||||
+ Added new /mcrank command for showing a players leader board ranking for all skills in one place
|
||||
+ Added a configurable durability cap for ArmorImpact to advanced.yml
|
||||
+ Added the version number to /mcmmo
|
||||
+ Added bats, giants, witches, withers, and wither skeletons to the mcMMO combat experience list, and makes their experience drops configurable
|
||||
+ Added the ability to track mobs spawned by mob spawners or the Taming ability when the chunks they are in unload and reload
|
||||
+ Added wooden button to the list of items that shouldn't trigger abilities
|
||||
+ Added a new feature to fishing. Players will have +10% chance of finding enchanted items when fishing while it's raining
|
||||
+ Added displaying bonus perks on skill commands
|
||||
+ Added config option to disable gaining Acrobatics XP from dodging lightning
|
||||
+ Added missing skill guides. They're finally here!
|
||||
+ Added more localization
|
||||
+ Added a very secret easter egg
|
||||
= Fix issue with Sand/Gravel tracking
|
||||
= Fix possible NPE when using the PartyAPI to add a player to a party that doesn't exist.
|
||||
= Fix mcremove command for mySQL
|
||||
= Fix a java.io.FileNotFoundException when using SQL
|
||||
= Impact now works with mobs wearing armor
|
||||
= Fixed issue with Tree Feller dropping player-placed blocks
|
||||
= Fixed issue with missing default cases from several switch/case statements
|
||||
= Fixed issue with Mining using actual skill level rather than max skill level
|
||||
= Fixed some issues with static access
|
||||
= Fixed ItemStack deprecation issues
|
||||
= Fixed Async deprecation issues
|
||||
= Fixed a bug with MySQL databases (non-alphanumeric characters preventing MySQL access)
|
||||
= Fixed a bug where the /skillreset command was broken
|
||||
= Fixed a bug where skill commands displaying .x% instead of 0.x%
|
||||
= Fixed a bug Unbreaking enchantments being ignored when using Treefelling and when hit by Armor Impact
|
||||
= Fixed a bug where only 1 diamond was needed to fully repair a broken item: Repaired the Repair skill!
|
||||
= Fixed a bug where a infinite loop of errors caused by mySQL database could cause the server to crash
|
||||
= Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties
|
||||
= Fixed a bug which caused advanced.yml not to work for Swords
|
||||
= Fixed a bug which caused advanced.yml not to respect every MaxChance node
|
||||
= Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml
|
||||
= Fixed a bug where Repair would remove enchantments but the glow effect remained
|
||||
= Fixed a bug where dropped items did not retain custom NBT data
|
||||
= Fixed a bug which caused a potentially infinite recursion in a btree structure
|
||||
= Fixed a NPE with custom blocks
|
||||
= Fixed a bug with Blast Mining never dropping debris blocks
|
||||
= Fixed a bug with Blast Mining incorrectly handling reduced TNT damage
|
||||
= Fixed a bug with conflicting fishing enchantments
|
||||
= Fixed a bug where triple drops wouldn't happen
|
||||
= Fixed a bug which caused fishing to ignore max/min levels in treasures.yml
|
||||
= Fixed a bug where treefeller affected player-placed blocks
|
||||
= Fixed bug where Skull Splitter would be applied twice.
|
||||
! GJ stopped being a lazy slacker and got stuff done
|
||||
! Nossr50 actually committed something
|
||||
! Changed code that uses SpoutPlugin to make it compatible with the latest version
|
||||
! Reimplemented skill level and power level caps.
|
||||
! Moved Arcane Forging and Fishing setting from config.yml to advanced.yml
|
||||
! Overall SQL query improvements
|
||||
! Reduced number of SQL queries for mcTop command from 11 to 1, speeding it up immensely
|
||||
! Changed FFS Leaderboards to hold information in memory rather than doing IO work (optimizations)
|
||||
! Improved chunk conversion (less errors)
|
||||
! Changed Fishing Treasure Hunter, chance has increased and now actually is level dependent
|
||||
! Indexed most used mySQL columns for faster queries
|
||||
- Removed dead code relating to null profiles
|
||||
- Removed unused imports
|
||||
- Removed ChunkletUnloader and dependents, since they are no longer necessary.
|
||||
|
||||
Version 1.3.12
|
||||
+ Added Craftbukkit 1.4.5 compatibility
|
||||
+ Added the new 1.3.2 items, xp and double drops for Cocoa beans & Emeralds, EnderChest to the list of blocks that shouldn't trigger abilities
|
||||
+ Added new items from Minecraft 1.4 to Herbalism (potatoes & carrots)
|
||||
+ Added new configuration file for advanced users.
|
||||
+ Added new permission nodes to greenthumb for the 1.4 items
|
||||
+ Added new mobs from Minecraft 1.4 checks for every ability
|
||||
+ Added new active ability for Repair: Salvage
|
||||
+ Added options to 'config.yml' configure shake chance
|
||||
+ Added the option to negate experience earned for Herbalism while in a minecart to prevent afk leveling
|
||||
+ Added Green thumb now converts cobble walls to mossy cobble walls
|
||||
+ Added beacons and anvils to list of blocks that don't trigger abilities
|
||||
+ Added a configuration option to disable experience gains when in a minecraft for Acrobatics and Herbalism, to prevent AFK leveling
|
||||
+ Added a new passive ability for Fishing, Fishermans diet. Increases hunger restored from fish
|
||||
+ Added a feature to display all active perks on login
|
||||
! Changed Fishing, Shake drops changed from guaranteed to based upon fishing level and perks
|
||||
! Changed Woodcutting, the amount of experience earned when using Tree Feller on jungle trees has increased
|
||||
! Changed Herbalism double drop rates for melons and netherwart
|
||||
! Changed filesystem usage, it's reduced a lot. Should help reduce lag on larger servers
|
||||
! Changed database connection handling. Support for aggressive connection timeouts, with exponential backoff for multiple failures
|
||||
! Changed Cobblestone walls are now mossy-able with Greenthumb
|
||||
! Changed the skull drop rates of the shake ability to 3%
|
||||
= Fixed a NPE when Citizens perform certain tasks
|
||||
= Fixed a NPE with Woodcutting, excessive null chunk before earning Woodcutting experience
|
||||
= Fixed a NPE related to skill cooldowns
|
||||
= Fixed a NPE when a players profile was null
|
||||
= Fixed a NPE involving certain explosions
|
||||
= Fixed a dupe bug when for players who were using a 'nuker' client
|
||||
= Fixed a dupe bug where pistons were used to dupe ores
|
||||
= Fixed a dupe bug with Salvage when players were in Creative mode
|
||||
= Fixed a bug where the player was displayed an incorrect cooldown time
|
||||
= Fixed a bug where players could earn experience when they were dealing 0 damage
|
||||
= Fixed a bug where players could get double drops from mossified Cobblestone
|
||||
= Fixed a bug where Herablism magically converted potatoes to carrots
|
||||
= Fixed a bug where you couldn't modify the stats of offline players
|
||||
= Fixed a bug where treefeller didn't work properly on tree's with side-way logs
|
||||
= Fixed a bug where the Arcane forging downgrade chance should've been 0, but actually wasn't
|
||||
= Fixed a bug where Fishing would sometimes give items with empty enchantments
|
||||
= Fixed a bug where the lucky perk for Fishing was actually an unlucky perk
|
||||
- Removed nothing
|
||||
|
||||
Version 1.3.11
|
||||
= Fixed bug where mcMMO would ignore other block-protection plugins for various abilities
|
||||
|
||||
! Changed axes to start with 1 durability damage instead of 5, gain 1 durability damage every 50 levels instead of 30, and only have a 25% chance on hit to damage armor (per armor piece)
|
||||
+ Added compatibility with bow-wielding NPCs from Citizens/NPC mods
|
||||
+ Added compatibility for pvp-prevention plugins for Serrated Strikes
|
||||
= Fixed bug where mcMMO could throw NPE errors if trees cut down were from a custom mod and had an id of 17
|
||||
= Fixed dupe bug where mcMMO would ignore other block-protection plugins for various abilities
|
||||
= Fixed NPE with hardcore mode's vampirism
|
||||
|
||||
Version 1.3.10
|
||||
+ Added 1.3.1 compatibility
|
||||
+ Added 1.3.1 compatibility
|
||||
+ Added permission node for Iron Grip ability (mcmmo.ability.unarmed.irongrip)
|
||||
+ Added ability for custom blocks to drop a range of items.
|
||||
+ Added Ability API functions
|
||||
@@ -24,7 +227,7 @@ Version 1.3.10
|
||||
= Fixed menu exit button not working
|
||||
= Fixed Repair enchant downgrade not working
|
||||
= Fixed NPE caused by Spout players after a /reload
|
||||
= Fixed ConcurrentModificationException on world unload
|
||||
= Fixed ConcurrentModificationException on world unload
|
||||
= Fixed players never being removed from memory (memory leak)
|
||||
= Fixed admin chat being seen by everyone
|
||||
= Fixed issue with UTFDataFormatException occurring on occasion when trying to load Chunklets
|
||||
@@ -35,7 +238,7 @@ Version 1.3.10
|
||||
= Fixed custom woodcutting blocks throwing errors.
|
||||
= Fixed possible ClassCastException from catching something other than a mob when using the Shake Mob skill
|
||||
! Changed the format by which Chunklets are stored to be much smaller, and much faster to load
|
||||
! Optimized how player placed blocks are tracked
|
||||
! Optimized how player placed blocks are tracked
|
||||
|
||||
Version 1.3.09
|
||||
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
|
||||
@@ -151,7 +354,7 @@ Version 1.3.06
|
||||
= Fixed NPE error with Metrics on startup
|
||||
= Fixed bug where Herbalism required double drops permission to give XP
|
||||
= Fixed bug where {0} would be displayed in front of your power level in mcstats
|
||||
= Fixed mmoupdate not being useable from console
|
||||
= Fixed mmoupdate not being useable from console
|
||||
= Fixed bug with repairing wooden tools
|
||||
= Fixed bug with Nether Wart not awarding XP
|
||||
= Fixed bug with fishing treasures when treasures list is empty
|
||||
@@ -164,19 +367,19 @@ Version 1.3.06
|
||||
! Changed how we handled the config file to prevent any bugs when returning values
|
||||
! Changed locale files to use a new naming scheme. This breaks ALL old locale files. If you want to assist with re-translating anything, go to getlocalization.com/mcMMO
|
||||
! Changed /mcremove to check for users in the MySQL DB before sending queries to remove them
|
||||
! Changed how the tree feller threshold worked for the better
|
||||
! Changed how the tree feller threshold worked for the better
|
||||
! Changed /mcremove to no longer kick players when they are removed from database
|
||||
! Changed /mcremove to work on offline users for FlatFile
|
||||
! Changed /mcremove to work on offline users for FlatFile
|
||||
! Changed PlayerProfile constructor to always take a boolean
|
||||
! Changed getPlayerProfile function to work for online & offline users
|
||||
! Changed Archery's Daze to deal 4 DMG on proc (2 Hearts)
|
||||
! Changed /addlevel command to work for offline users
|
||||
! Changed party & admin chat handling to be nicer to developers
|
||||
! Changed party & admin chat handling to be nicer to developers
|
||||
! Changed /mcrefresh to work from console
|
||||
! Changed /mcrefresh to work for offline players
|
||||
! Changed /mcrefresh to work for offline players
|
||||
! Changed UpdateXPBar function to hopefully avoid errors
|
||||
! Changed /party to show offline party members
|
||||
! Changed Blast Mining requirements, now asks for the player to be crouching
|
||||
! Changed Blast Mining requirements, now asks for the player to be crouching
|
||||
|
||||
Version 1.3.05
|
||||
+ Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%)
|
||||
@@ -225,7 +428,7 @@ Version 1.3.03
|
||||
+ Added console functionality to mctop
|
||||
= Fixed Green Terra not awarding Triple Drops
|
||||
= Fixed ClassCastException from Taming preventDamage checks
|
||||
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
|
||||
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
|
||||
= Fixed issue with block interaction returning NPEs
|
||||
= Fixed issue where every block broken had a mining check applied
|
||||
= Fixed issue where every block broken had a herbalism check applied
|
||||
@@ -241,7 +444,7 @@ Version 1.3.03
|
||||
! Changed mcMMO to be better about saving player information on server shutdown
|
||||
! Changed PTP to prevent teleporting if you've been hurt in the last 30 seconds (configurable)
|
||||
! Changed Chimera Wing failure check to use the maxWorldHeight.
|
||||
! Changed inspect failed message to say inspect rather than whois
|
||||
! Changed inspect failed message to say inspect rather than whois
|
||||
! Changed Call of the Wild to activate on left-click rather than right-click
|
||||
! Changed Blast Mining to track based on Entity ID vs. Location
|
||||
! Changed mmoedit to save a profile when used (this will make mctop update)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
== mcMMO
|
||||
**The RPG lovers mod**
|
||||
|
||||
=== Forums
|
||||
http://forums.mcmmo.info Talk with developers and the community about mcMMO here
|
||||
=== Dev builds
|
||||
http://ci.mcmmo.info Download the latest dev build of mcMMO here.
|
||||
|
||||
=== Brief Description
|
||||
mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.
|
||||
@@ -20,8 +20,9 @@ Hearing that people enjoy mcMMO and seeing the daily youtube videos about my mod
|
||||
|
||||
Required Libraries:
|
||||
* Spout API
|
||||
* JUnit
|
||||
|
||||
Required to Run:
|
||||
* Bukkit
|
||||
|
||||
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
||||
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
||||
|
||||
98
pom.xml
Normal file → Executable file
98
pom.xml
Normal file → Executable file
@@ -2,12 +2,12 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.3.11</version>
|
||||
<version>1.4.00-beta4</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<issueManagement>
|
||||
<url>http://issues.mcmmo.org</url>
|
||||
<system>JIRA</system>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO/issues</url>
|
||||
<system>GitHub</system>
|
||||
</issueManagement>
|
||||
<build>
|
||||
<finalName>mcMMO</finalName>
|
||||
@@ -19,6 +19,7 @@
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>.jenkins</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
@@ -54,12 +55,12 @@
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>com/gmail/nossr50/locale</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/locale/</directory>
|
||||
<includes>
|
||||
<include>locale*.properties</include>
|
||||
</includes>
|
||||
<targetPath>com/gmail/nossr50/locale</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/locale/</directory>
|
||||
<includes>
|
||||
<include>locale*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
@@ -91,7 +92,40 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.turt2live.metrics:MetricsExtension</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.turt2live.metrics</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.util.mcstats</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>2.2</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -99,7 +133,7 @@
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</snapshots>
|
||||
</snapshots>
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
</repository>
|
||||
@@ -108,9 +142,18 @@
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</snapshots>
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.spout.org/content/groups/public/</url>
|
||||
</snapshots>
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.spout.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</snapshots>
|
||||
<id>Plugin MetricsExtension</id>
|
||||
<url>http://repo.turt2live.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
@@ -123,18 +166,31 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.getspout</groupId>
|
||||
<artifactId>spoutpluginapi</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<artifactId>spoutplugin</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit-dep</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.turt2live.metrics</groupId>
|
||||
<artifactId>MetricsExtension</artifactId>
|
||||
<version>0.0.2-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit-dep</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>mcmmo-repo</id>
|
||||
<url>file:///var/lib/jenkins/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@@ -2,42 +2,46 @@ package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class AbilityAPI {
|
||||
public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.BERSERK);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
|
||||
}
|
||||
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
}
|
||||
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SKULL_SPLIITER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
|
||||
}
|
||||
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
PlayerProfile profile = Users.getPlayer(player).getProfile();
|
||||
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
if (Users.getProfile(player).getAbilityMode(ability)) {
|
||||
if (profile.getAbilityMode(ability)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class ChatAPI {
|
||||
|
||||
private ChatAPI() {}
|
||||
|
||||
/**
|
||||
@@ -18,29 +15,44 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @param displayName The display name of the sender
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
|
||||
ChatManager.handlePartyChat(plugin, PartyManager.getParty(party), sender, displayName, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to all members of a party
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
|
||||
ChatManager.handlePartyChat(plugin, PartyManager.getParty(party), sender, sender, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to all members of a party
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @deprecated Replaced by sendPartyChat(Plugin, String, String, String)
|
||||
*
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
*/
|
||||
@Deprecated
|
||||
public static void sendPartyChat(String sender, String party, String message) {
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") ";
|
||||
|
||||
mcMMO.p.getLogger().info("[P](" + chatEvent.getParty() + ")" + "<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(player).inParty()) {
|
||||
if (Users.getProfile(player).getParty().getName().equalsIgnoreCase(chatEvent.getParty())) {
|
||||
player.sendMessage(pPrefix + chatEvent.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
sendPartyChat(null, party, sender, sender, message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,24 +60,80 @@ public final class ChatAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender
|
||||
* @param displayName The display name of the sender
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
|
||||
ChatManager.handleAdminChat(plugin, sender, displayName, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to administrators
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param plugin The plugin sending the message
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param message The message to send
|
||||
*/
|
||||
public static void sendAdminChat(Plugin plugin, String sender, String message) {
|
||||
ChatManager.handleAdminChat(plugin, sender, sender, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to administrators
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @deprecated Replaced by sendAdminChat(Plugin, String, String)
|
||||
*
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param message The message to send
|
||||
*/
|
||||
@Deprecated
|
||||
public static void sendAdminChat(String sender, String message) {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
sendAdminChat(null, sender, sender, message);
|
||||
}
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Check if a player is currently talking in party chat.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is using party chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingPartyChat(Player player) {
|
||||
return Users.getPlayer(player).getPartyChatMode();
|
||||
}
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} ";
|
||||
/**
|
||||
* Check if a player is currently talking in party chat.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return true if the player is using party chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingPartyChat(String playerName) {
|
||||
return Users.getPlayer(playerName).getPartyChatMode();
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("[A]<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
|
||||
/**
|
||||
* Check if a player is currently talking in admin chat.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is using admin chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingAdminChat(Player player) {
|
||||
return Users.getPlayer(player).getAdminChatMode();
|
||||
}
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
if (Permissions.getInstance().adminChat(player) || player.isOp())
|
||||
player.sendMessage(aPrefix + chatEvent.getMessage());
|
||||
}
|
||||
/**
|
||||
* Check if a player is currently talking in admin chat.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return true if the player is using admin chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingAdminChat(String playerName) {
|
||||
return Users.getPlayer(playerName).getAdminChatMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class ExperienceAPI {
|
||||
|
||||
private ExperienceAPI() {}
|
||||
|
||||
/**
|
||||
@@ -15,32 +15,30 @@ public final class ExperienceAPI {
|
||||
*
|
||||
* @param player The player to check
|
||||
* @param skillType The skill to check
|
||||
* @deprecated Calling this function is no longer needed and should be avoided
|
||||
*/
|
||||
@Deprecated
|
||||
private static void checkXP(Player player, SkillType skillType) {
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
Skills.xpCheckAll(player, Users.getProfile(player));
|
||||
}
|
||||
else {
|
||||
Skills.xpCheckSkill(skillType, player, Users.getProfile(player));
|
||||
}
|
||||
SkillTools.xpCheckSkill(skillType, player, Users.getProfile(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, doesn't calculate for XP Rate or other modifiers.
|
||||
* Adds raw XP to the player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @deprecated Use {@link #addRawXP(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addRawXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getPlayer(player).addXPOverride(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
Users.getPlayer(player).applyXpGain(skillType, XP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate but not skill modifiers.
|
||||
* Adds raw XP to the player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
@@ -48,13 +46,27 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public static void addRawXP(Player player, String skillType, int XP) {
|
||||
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), XP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate only.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @deprecated Use {@link #addMultipliedXP(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getPlayer(player).addXPOverrideBonus(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
Users.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate and skill modifiers.
|
||||
* Adds XP to the player, calculates for XP Rate only.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
@@ -62,9 +74,51 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public static void addMultipliedXP(Player player, String skillType, int XP) {
|
||||
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
* @deprecated Use {@link #addXP(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getPlayer(player).addXP(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
Users.getPlayer(player).beginXpGain(skillType, XP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add XP to
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public static void addXP(Player player, String skillType, int XP) {
|
||||
Users.getPlayer(player).beginXpGain(SkillType.getSkill(skillType), XP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of XP a player has in a specific skill.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get XP for
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
* @deprecated Use {@link #getXP(Player, String)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getXP(Player player, SkillType skillType) {
|
||||
return Users.getPlayer(player).getProfile().getSkillXpLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,8 +130,23 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*/
|
||||
public static int getXP(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillXpLevel(skillType);
|
||||
public static int getXP(Player player, String skillType) {
|
||||
return Users.getPlayer(player).getProfile().getSkillXpLevel(SkillType.getSkill(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of XP left before leveling up.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the XP amount for
|
||||
* @param skillType The skill to get the XP amount for
|
||||
* @return the amount of XP left before leveling up a specifc skill
|
||||
* @deprecated Use {@link #getXPToNextLevel(Player, String)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
return Users.getPlayer(player).getProfile().getXpToLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,8 +158,8 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to get the XP amount for
|
||||
* @return the amount of XP left before leveling up a specifc skill
|
||||
*/
|
||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getXpToLevel(skillType);
|
||||
public static int getXPToNextLevel(Player player, String skillType) {
|
||||
return Users.getPlayer(player).getProfile().getXpToLevel(SkillType.getSkill(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +170,8 @@ public final class ExperienceAPI {
|
||||
* @param player The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
* @param notify True if this should fire a level up notification, false otherwise.
|
||||
* @param notify Unused argument
|
||||
* @deprecated Use addLevel(Player, SKillType, int) instead
|
||||
*/
|
||||
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
|
||||
Users.getProfile(player).addLevels(skillType, levels);
|
||||
@@ -111,6 +181,49 @@ public final class ExperienceAPI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add levels to a skill.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
* @deprecated Use {@link #addLevel(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addLevel(Player player, SkillType skillType, int levels) {
|
||||
Users.getPlayer(player).getProfile().addLevels(skillType, levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add levels to a skill.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add levels to
|
||||
* @param skillType Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*/
|
||||
public static void addLevel(Player player, String skillType, int levels) {
|
||||
Users.getPlayer(player).getProfile().addLevels(SkillType.getSkill(skillType), levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the level a player has in a specific skill.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the level for
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
* @deprecated Use {@link #getLevel(Player, String)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getLevel(Player player, SkillType skillType) {
|
||||
return Users.getPlayer(player).getProfile().getSkillLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the level a player has in a specific skill.
|
||||
* </br>
|
||||
@@ -120,8 +233,8 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
*/
|
||||
public static int getLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillLevel(skillType);
|
||||
public static int getLevel(Player player, String skillType) {
|
||||
return Users.getPlayer(player).getProfile().getSkillLevel(SkillType.getSkill(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,9 +257,39 @@ public final class ExperienceAPI {
|
||||
* @param player The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param skillLevel The value to set the level to
|
||||
* @deprecated Use {@link #setLevel(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
|
||||
Users.getProfile(player).modifySkill(skillType, skillLevel);
|
||||
Users.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the level of a player in a specific skill type.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to set the level of
|
||||
* @param skillType The skill to set the level for
|
||||
* @param skillLevel The value to set the level to
|
||||
*/
|
||||
public static void setLevel(Player player, String skillType, int skillLevel) {
|
||||
Users.getPlayer(player).getProfile().modifySkill(SkillType.getSkill(skillType), skillLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XP of a player in a specific skill type.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to set the XP of
|
||||
* @param skillType The skill to set the XP for
|
||||
* @param newValue The value to set the XP to
|
||||
* @deprecated Use {@link #setXP(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
||||
Users.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,8 +301,23 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to set the XP for
|
||||
* @param newValue The value to set the XP to
|
||||
*/
|
||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
||||
Users.getProfile(player).setSkillXPLevel(skillType, newValue);
|
||||
public static void setXP(Player player, String skillType, int newValue) {
|
||||
Users.getPlayer(player).getProfile().setSkillXpLevel(SkillType.getSkill(skillType), newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes XP from a player in a specific skill type.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to change the XP of
|
||||
* @param skillType The skill to change the XP for
|
||||
* @param xp The amount of XP to remove
|
||||
* @deprecated Use {@link #removeXP(Player, String, int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void removeXP(Player player, SkillType skillType, int xp) {
|
||||
Users.getPlayer(player).getProfile().removeXp(skillType, xp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +329,7 @@ public final class ExperienceAPI {
|
||||
* @param skillType The skill to change the XP for
|
||||
* @param xp The amount of XP to remove
|
||||
*/
|
||||
public static void removeXP(Player player, SkillType skillType, int xp) {
|
||||
Users.getProfile(player).removeXP(skillType, xp);
|
||||
public static void removeXP(Player player, String skillType, int xp) {
|
||||
Users.getPlayer(player).getProfile().removeXp(SkillType.getSkill(skillType), xp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.party.Party;
|
||||
@@ -9,7 +11,6 @@ import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class PartyAPI {
|
||||
|
||||
private PartyAPI() {}
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,7 @@ public final class PartyAPI {
|
||||
* @return the name of the player's party
|
||||
*/
|
||||
public static String getPartyName(Player player) {
|
||||
return Users.getProfile(player).getParty().getName();
|
||||
return Users.getPlayer(player).getParty().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ public final class PartyAPI {
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
return Users.getProfile(player).inParty();
|
||||
return Users.getPlayer(player).inParty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +47,7 @@ public final class PartyAPI {
|
||||
* @return true if the two players are in the same party, false otherwise
|
||||
*/
|
||||
public static boolean inSameParty(Player playera, Player playerb) {
|
||||
return PartyManager.getInstance().inSameParty(playera, playerb);
|
||||
return PartyManager.inSameParty(playera, playerb);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +58,7 @@ public final class PartyAPI {
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public static List<Party> getParties() {
|
||||
return PartyManager.getInstance().getParties();
|
||||
return PartyManager.getParties();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +70,15 @@ public final class PartyAPI {
|
||||
* @param partyName The party to add the player to
|
||||
*/
|
||||
public static void addToParty(Player player, String partyName) {
|
||||
PartyManager.getInstance().addToParty(player.getName(), Users.getProfile(player), PartyManager.getInstance().getParty(partyName)); //TODO this will throw a NPE if the party doesn't exist
|
||||
Party party = PartyManager.getParty(partyName);
|
||||
|
||||
if (party == null) {
|
||||
party = new Party();
|
||||
party.setName(partyName);
|
||||
party.setLeader(player.getName());
|
||||
}
|
||||
|
||||
PartyManager.addToParty(player, Users.getPlayer(player), party);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +89,7 @@ public final class PartyAPI {
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public static void removeFromParty(Player player) {
|
||||
PartyManager.getInstance().removeFromParty(player.getName(), Users.getProfile(player).getParty());
|
||||
PartyManager.removeFromParty(player, Users.getPlayer(player).getParty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +101,7 @@ public final class PartyAPI {
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
return PartyManager.getInstance().getPartyLeader(partyName);
|
||||
return PartyManager.getPartyLeader(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +113,27 @@ public final class PartyAPI {
|
||||
* @param player The player to set as leader
|
||||
*/
|
||||
public static void setPartyLeader(String partyName, String player) {
|
||||
PartyManager.getInstance().setPartyLeader(player, PartyManager.getInstance().getParty(partyName));
|
||||
PartyManager.setPartyLeader(player, PartyManager.getParty(partyName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all players in this player's party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return all the players in the player's party
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<String> getAllMembers(Player player) {
|
||||
List<String> memberNames = new ArrayList<String>();
|
||||
|
||||
for (OfflinePlayer member : PartyManager.getAllMembers(player)) {
|
||||
memberNames.add(member.getName());
|
||||
}
|
||||
|
||||
return memberNames;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,8 +144,8 @@ public final class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return all the players in the player's party
|
||||
*/
|
||||
public static List<String> getAllMembers(Player player) {
|
||||
return PartyManager.getInstance().getAllMembers(player);
|
||||
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
||||
return PartyManager.getAllMembers(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +157,7 @@ public final class PartyAPI {
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(String partyName) {
|
||||
return PartyManager.getInstance().getOnlineMembers(partyName);
|
||||
return PartyManager.getOnlineMembers(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,6 +169,6 @@ public final class PartyAPI {
|
||||
* @return all online players in the player's party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(Player player) {
|
||||
return PartyManager.getInstance().getOnlineMembers(player);
|
||||
return PartyManager.getOnlineMembers(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,18 +5,17 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.ToolType;
|
||||
import com.gmail.nossr50.skills.utilities.ToolType;
|
||||
|
||||
public final class SpoutToolsAPI {
|
||||
|
||||
private SpoutToolsAPI() {}
|
||||
|
||||
public static final List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
|
||||
public static final List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
|
||||
public static final List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
|
||||
public static final List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
|
||||
public static final List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
|
||||
|
||||
private SpoutToolsAPI() {}
|
||||
|
||||
/**
|
||||
* Add a custom Spout tool to mcMMO for XP gain & ability use.
|
||||
* </br>
|
||||
|
||||
66
src/main/java/com/gmail/nossr50/chat/ChatManager.java
Normal file
66
src/main/java/com/gmail/nossr50/chat/ChatManager.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.gmail.nossr50.chat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public final class ChatManager {
|
||||
public ChatManager () {}
|
||||
|
||||
public static void handleAdminChat(Plugin plugin, String playerName, String displayName, String message) {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(plugin, playerName, displayName, message);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Config.getInstance().getAdminDisplayNames())
|
||||
displayName = chatEvent.getDisplayName();
|
||||
else
|
||||
displayName = chatEvent.getSender();
|
||||
|
||||
String adminMessage = chatEvent.getMessage();
|
||||
|
||||
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Commands.AdminChat.Prefix", displayName) + adminMessage, "mcmmo.chat.adminchat");
|
||||
}
|
||||
|
||||
public static void handleAdminChat(Plugin plugin, String senderName, String message) {
|
||||
handleAdminChat(plugin, senderName, senderName, message);
|
||||
}
|
||||
|
||||
public static void handlePartyChat(Plugin plugin, Party party, String playerName, String displayName, String message) {
|
||||
String partyName = party.getName();
|
||||
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(plugin, playerName, displayName, partyName, message);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Config.getInstance().getPartyDisplayNames())
|
||||
displayName = chatEvent.getDisplayName();
|
||||
else
|
||||
displayName = chatEvent.getSender();
|
||||
|
||||
String partyMessage = chatEvent.getMessage();
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Prefix", displayName) + partyMessage);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("[P](" + partyName + ")" + "<" + ChatColor.stripColor(displayName) + "> " + partyMessage);
|
||||
}
|
||||
|
||||
public static void handlePartyChat(Plugin plugin, Party party, String senderName, String message) {
|
||||
handlePartyChat(plugin, party, senderName, senderName, message);
|
||||
}
|
||||
}
|
||||
70
src/main/java/com/gmail/nossr50/chat/ChatMode.java
Normal file
70
src/main/java/com/gmail/nossr50/chat/ChatMode.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.gmail.nossr50.chat;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public enum ChatMode {
|
||||
ADMIN(LocaleLoader.getString("Commands.AdminChat.On"), LocaleLoader.getString("Commands.AdminChat.Off")),
|
||||
PARTY(LocaleLoader.getString("Commands.Party.Chat.On"), LocaleLoader.getString("Commands.Party.Chat.Off"));
|
||||
|
||||
private String enabledMessage;
|
||||
private String disabledMessage;
|
||||
|
||||
private ChatMode (String enabledMessage, String disabledMessage) {
|
||||
this.enabledMessage = enabledMessage;
|
||||
this.disabledMessage = disabledMessage;
|
||||
}
|
||||
|
||||
public boolean isEnabled(McMMOPlayer mcMMOPlayer) {
|
||||
switch (this) {
|
||||
case ADMIN:
|
||||
return mcMMOPlayer.getAdminChatMode();
|
||||
|
||||
case PARTY:
|
||||
return mcMMOPlayer.getPartyChatMode();
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void disable(McMMOPlayer mcMMOPlayer) {
|
||||
switch (this) {
|
||||
case ADMIN:
|
||||
mcMMOPlayer.setAdminChat(false);
|
||||
return;
|
||||
|
||||
case PARTY:
|
||||
mcMMOPlayer.setPartyChat(false);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void enable(McMMOPlayer mcMMOPlayer) {
|
||||
switch (this) {
|
||||
case ADMIN:
|
||||
mcMMOPlayer.setAdminChat(true);
|
||||
mcMMOPlayer.setPartyChat(false);
|
||||
return;
|
||||
|
||||
case PARTY:
|
||||
mcMMOPlayer.setPartyChat(true);
|
||||
mcMMOPlayer.setAdminChat(false);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public String getEnabledMessage() {
|
||||
return enabledMessage;
|
||||
}
|
||||
|
||||
public String getDisabledMessage() {
|
||||
return disabledMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gmail.nossr50.chat.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.chat.ChatMode;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class AdminChatCommand extends ChatCommand {
|
||||
public AdminChatCommand() {
|
||||
super(ChatMode.ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleChatSending(CommandSender sender, String[] args) {
|
||||
String message = buildChatMessage(args, 0);
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
ChatManager.handleAdminChat(mcMMO.p, player.getName(), player.getDisplayName(), message);
|
||||
}
|
||||
else {
|
||||
ChatManager.handleAdminChat(mcMMO.p, LocaleLoader.getString("Commands.Chat.Console"), message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.gmail.nossr50.chat.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public abstract class ChatCommand implements CommandExecutor {
|
||||
protected McMMOPlayer mcMMOPlayer;
|
||||
protected ChatMode chatMode;
|
||||
|
||||
public ChatCommand (ChatMode chatMode) {
|
||||
this.chatMode = chatMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
|
||||
if (chatMode.isEnabled(mcMMOPlayer)) {
|
||||
disableChatMode(sender);
|
||||
}
|
||||
else {
|
||||
enableChatMode(sender);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("on")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
enableChatMode(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
disableChatMode(sender);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
handleChatSending(sender, args);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void enableChatMode(CommandSender sender) {
|
||||
chatMode.enable(mcMMOPlayer);
|
||||
sender.sendMessage(chatMode.getEnabledMessage());
|
||||
}
|
||||
|
||||
private void disableChatMode(CommandSender sender) {
|
||||
chatMode.disable(mcMMOPlayer);
|
||||
sender.sendMessage(chatMode.getDisabledMessage());
|
||||
}
|
||||
|
||||
protected String buildChatMessage(String[] args, int index) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(args[index]);
|
||||
|
||||
for (int i = index + 1; i < args.length; i++) {
|
||||
builder.append(" ");
|
||||
builder.append(args[i]);
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
protected abstract void handleChatSending(CommandSender sender, String[] args);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.gmail.nossr50.chat.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.chat.ChatMode;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PartyChatCommand extends ChatCommand {
|
||||
public PartyChatCommand() {
|
||||
super(ChatMode.PARTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleChatSending(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Party party = Users.getPlayer(player).getParty();
|
||||
|
||||
if (party == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return;
|
||||
}
|
||||
|
||||
ChatManager.handlePartyChat(mcMMO.p, party, player.getName(), player.getDisplayName(), buildChatMessage(args, 0));
|
||||
}
|
||||
else {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
|
||||
return;
|
||||
}
|
||||
|
||||
Party party = PartyManager.getParty(args[0]);
|
||||
|
||||
if (party == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
|
||||
return;
|
||||
}
|
||||
|
||||
ChatManager.handlePartyChat(mcMMO.p, party, LocaleLoader.getString("Commands.Chat.Console"), buildChatMessage(args, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,33 +4,13 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class CommandHelper {
|
||||
|
||||
/**
|
||||
* Checks for command permissions.
|
||||
*
|
||||
* @param sender The command sender
|
||||
* @param permission The permission to check
|
||||
* @return true if the sender is a player without permissions, false otherwise
|
||||
*/
|
||||
public static boolean noCommandPermissions(CommandSender sender, String permission) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!Permissions.getInstance().permission(player, permission)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public final class CommandHelper {
|
||||
private CommandHelper() {}
|
||||
|
||||
public static boolean noConsoleUsage(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
@@ -45,100 +25,98 @@ public class CommandHelper {
|
||||
* Print out details on Gathering skills. Only for online players.
|
||||
*
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param profile The player's profile
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printGatheringSkills(Player inspect, CommandSender display) {
|
||||
if (Skills.hasGatheringSkills(inspect)) {
|
||||
PlayerProfile profile = Users.getProfile(inspect);
|
||||
|
||||
public static void printGatheringSkills(Player inspect, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasGatheringSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
|
||||
if (Permissions.getInstance().excavation(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.EXCAVATION)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().fishing(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.FISHING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().herbalism(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.HERBALISM)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().mining(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.MINING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().woodcutting(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.WOODCUTTING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void printGatheringSkills(Player player) {
|
||||
printGatheringSkills(player, player);
|
||||
public static void printGatheringSkills(Player player, PlayerProfile profile) {
|
||||
printGatheringSkills(player, profile, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out details on Combat skills. Only for online players.
|
||||
*
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param profile The player's profile
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printCombatSkills(Player inspect, CommandSender display) {
|
||||
if (Skills.hasCombatSkills(inspect)) {
|
||||
PlayerProfile profile = Users.getProfile(inspect);
|
||||
|
||||
public static void printCombatSkills(Player inspect, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasCombatSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
|
||||
if (Permissions.getInstance().axes(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.AXES)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().archery(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.ARCHERY)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().swords(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.SWORDS)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().taming(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.TAMING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().unarmed(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.UNARMED)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void printCombatSkills(Player player) {
|
||||
printCombatSkills(player, player);
|
||||
public static void printCombatSkills(Player player, PlayerProfile profile) {
|
||||
printCombatSkills(player, profile, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out details on Misc skills. Only for online players.
|
||||
*
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param profile The player's profile
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printMiscSkills(Player inspect, CommandSender display) {
|
||||
if (Skills.hasMiscSkills(inspect)) {
|
||||
PlayerProfile profile = Users.getProfile(inspect);
|
||||
public static void printMiscSkills(Player inspect, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasMiscSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
|
||||
if (Permissions.getInstance().acrobatics(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.ACROBATICS)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().repair(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) }));
|
||||
if (Permissions.skillEnabled(inspect, SkillType.REPAIR)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void printMiscSkills(Player player) {
|
||||
printMiscSkills(player, player);
|
||||
public static void printMiscSkills(Player player, PlayerProfile profile) {
|
||||
printMiscSkills(player, profile, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,371 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.PluginCommand;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.commands.AdminChatCommand;
|
||||
import com.gmail.nossr50.chat.commands.PartyChatCommand;
|
||||
import com.gmail.nossr50.commands.admin.AddlevelsCommand;
|
||||
import com.gmail.nossr50.commands.admin.AddxpCommand;
|
||||
import com.gmail.nossr50.commands.admin.HardcoreCommand;
|
||||
import com.gmail.nossr50.commands.admin.McgodCommand;
|
||||
import com.gmail.nossr50.commands.admin.McrefreshCommand;
|
||||
import com.gmail.nossr50.commands.admin.MmoeditCommand;
|
||||
import com.gmail.nossr50.commands.admin.SkillresetCommand;
|
||||
import com.gmail.nossr50.commands.admin.VampirismCommand;
|
||||
import com.gmail.nossr50.commands.admin.XprateCommand;
|
||||
import com.gmail.nossr50.commands.player.InspectCommand;
|
||||
import com.gmail.nossr50.commands.player.McabilityCommand;
|
||||
import com.gmail.nossr50.commands.player.McmmoCommand;
|
||||
import com.gmail.nossr50.commands.player.McnotifyCommand;
|
||||
import com.gmail.nossr50.commands.player.McrankCommand;
|
||||
import com.gmail.nossr50.commands.player.McstatsCommand;
|
||||
import com.gmail.nossr50.commands.player.MctopCommand;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.commands.McpurgeCommand;
|
||||
import com.gmail.nossr50.database.commands.McremoveCommand;
|
||||
import com.gmail.nossr50.database.commands.MmoupdateCommand;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.commands.PartyCommand;
|
||||
import com.gmail.nossr50.party.commands.PtpCommand;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryCommand;
|
||||
import com.gmail.nossr50.skills.axes.AxesCommand;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationCommand;
|
||||
import com.gmail.nossr50.skills.fishing.FishingCommand;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismCommand;
|
||||
import com.gmail.nossr50.skills.mining.MiningCommand;
|
||||
import com.gmail.nossr50.skills.repair.RepairCommand;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingCommand;
|
||||
import com.gmail.nossr50.skills.swords.SwordsCommand;
|
||||
import com.gmail.nossr50.skills.taming.TamingCommand;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedCommand;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingCommand;
|
||||
import com.gmail.nossr50.spout.commands.MchudCommand;
|
||||
import com.gmail.nossr50.spout.commands.XplockCommand;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public final class CommandRegistrationHelper {
|
||||
private CommandRegistrationHelper() {};
|
||||
private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
|
||||
|
||||
public static void registerSkillCommands() {
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
String commandName = skill.toString().toLowerCase();
|
||||
String localizedName = SkillTools.getSkillName(skill);
|
||||
|
||||
PluginCommand command;
|
||||
|
||||
command = mcMMO.p.getCommand(commandName);
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.Skill", StringUtils.getCapitalized(localizedName)));
|
||||
command.setPermission("mcmmo.commands." + commandName);
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", localizedName));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", localizedName, "?", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
|
||||
|
||||
switch (skill) {
|
||||
case ACROBATICS:
|
||||
command.setExecutor(new AcrobaticsCommand());
|
||||
break;
|
||||
|
||||
case ARCHERY:
|
||||
command.setExecutor(new ArcheryCommand());
|
||||
break;
|
||||
|
||||
case AXES:
|
||||
command.setExecutor(new AxesCommand());
|
||||
break;
|
||||
|
||||
case EXCAVATION:
|
||||
command.setExecutor(new ExcavationCommand());
|
||||
break;
|
||||
|
||||
case FISHING:
|
||||
command.setExecutor(new FishingCommand());
|
||||
break;
|
||||
|
||||
case HERBALISM:
|
||||
command.setExecutor(new HerbalismCommand());
|
||||
break;
|
||||
|
||||
case MINING:
|
||||
command.setExecutor(new MiningCommand());
|
||||
break;
|
||||
|
||||
case REPAIR:
|
||||
command.setExecutor(new RepairCommand());
|
||||
break;
|
||||
|
||||
case SMELTING:
|
||||
command.setExecutor(new SmeltingCommand());
|
||||
break;
|
||||
|
||||
case SWORDS:
|
||||
command.setExecutor(new SwordsCommand());
|
||||
break;
|
||||
|
||||
case TAMING:
|
||||
command.setExecutor(new TamingCommand());
|
||||
break;
|
||||
|
||||
case UNARMED:
|
||||
command.setExecutor(new UnarmedCommand());
|
||||
break;
|
||||
|
||||
case WOODCUTTING:
|
||||
command.setExecutor(new WoodcuttingCommand());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerAddlevelsCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("addlevels");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.addlevels"));
|
||||
command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
|
||||
command.setExecutor(new AddlevelsCommand());
|
||||
}
|
||||
|
||||
public static void registerAddxpCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("addxp");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.addxp"));
|
||||
command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">"));
|
||||
command.setExecutor(new AddxpCommand());
|
||||
}
|
||||
|
||||
public static void registerMcgodCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcgod");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcgod"));
|
||||
command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
|
||||
command.setExecutor(new McgodCommand());
|
||||
}
|
||||
|
||||
public static void registerMcrefreshCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcrefresh");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh"));
|
||||
command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
|
||||
command.setExecutor(new McrefreshCommand());
|
||||
}
|
||||
|
||||
public static void registerMmoeditCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mmoedit");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit"));
|
||||
command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
|
||||
command.setExecutor(new MmoeditCommand());
|
||||
}
|
||||
|
||||
public static void registerSkillresetCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("skillreset");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
|
||||
command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
|
||||
command.setExecutor(new SkillresetCommand());
|
||||
}
|
||||
|
||||
public static void registerXprateCommand() {
|
||||
List<String> aliasList = new ArrayList<String>();
|
||||
aliasList.add("mcxprate");
|
||||
|
||||
PluginCommand command = mcMMO.p.getCommand("xprate");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.xprate"));
|
||||
command.setPermission("mcmmo.commands.xprate;mcmmo.commands.xprate.reset;mcmmo.commands.xprate.set");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "xprate", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">", "<true|false>"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xprate", "reset"));
|
||||
command.setAliases(aliasList);
|
||||
command.setExecutor(new XprateCommand());
|
||||
}
|
||||
|
||||
public static void registerInspectCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("inspect");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.inspect"));
|
||||
command.setPermission("mcmmo.commands.inspect;mcmmo.commands.inspect.far;mcmmo.commands.inspect.offline");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "inspect", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
command.setExecutor(new InspectCommand());
|
||||
}
|
||||
|
||||
public static void registerMcabilityCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcability");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcability"));
|
||||
command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcability", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
|
||||
command.setExecutor(new McabilityCommand());
|
||||
}
|
||||
|
||||
public static void registerMcmmoCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcmmo");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
|
||||
command.setPermission("mcmmo.commands.mcmmo.description;mcmmo.commands.mcmmo.help");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmo"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "mcmmo", "help"));
|
||||
command.setExecutor(new McmmoCommand());
|
||||
}
|
||||
|
||||
public static void registerMcrankCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcrank");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcrank"));
|
||||
command.setPermission("mcmmo.commands.mcrank;mcmmo.commands.mcrank.others;mcmmo.commands.mcrank.others.far;mcmmo.commands.mcrank.others.offline");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrank", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
|
||||
command.setExecutor(new McrankCommand());
|
||||
}
|
||||
|
||||
public static void registerMcstatsCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcstats");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcstats"));
|
||||
command.setPermission("mcmmo.commands.mcstats");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcstats"));
|
||||
command.setExecutor(new McstatsCommand());
|
||||
}
|
||||
|
||||
public static void registerMctopCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mctop");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mctop"));
|
||||
command.setPermission("mcmmo.commands.mctop"); // Only need the main one, not the individual skill ones
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "mctop", "[" + LocaleLoader.getString("Commands.Usage.Skill") + "]", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
|
||||
command.setExecutor(new MctopCommand());
|
||||
}
|
||||
|
||||
public static void registerMcpurgeCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcpurge");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
|
||||
command.setPermission("mcmmo.commands.mcpurge");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
|
||||
command.setExecutor(new McpurgeCommand());
|
||||
}
|
||||
|
||||
public static void registerMcremoveCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
|
||||
command.setPermission("mcmmo.commands.mcremove");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
command.setExecutor(new McremoveCommand());
|
||||
}
|
||||
|
||||
public static void registerMmoupdateCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mmoupdate");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
|
||||
command.setPermission("mcmmo.commands.mmoupdate");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
|
||||
command.setExecutor(new MmoupdateCommand());
|
||||
}
|
||||
|
||||
public static void registerAdminChatCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("adminchat");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.adminchat"));
|
||||
command.setPermission("mcmmo.chat.adminchat");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "adminchat"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<on|off>"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
|
||||
command.setExecutor(new AdminChatCommand());
|
||||
}
|
||||
|
||||
public static void registerPartyChatCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("partychat");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.partychat"));
|
||||
command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "partychat"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<on|off>"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
|
||||
command.setExecutor(new PartyChatCommand());
|
||||
}
|
||||
|
||||
public static void registerMchudCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mchud");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mchud"));
|
||||
command.setPermission("mcmmo.commands.mchud");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mchud", "<DISABLED | STANDARD | SMALL | RETRO>"));
|
||||
command.setExecutor(new MchudCommand());
|
||||
}
|
||||
|
||||
public static void registerXplockCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("xplock");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.xplock"));
|
||||
command.setPermission("mcmmo.commands.xplock");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "xplock"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<on|off>"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
|
||||
command.setExecutor(new XplockCommand());
|
||||
}
|
||||
|
||||
public static void registerPartyCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("party");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.party"));
|
||||
command.setPermission("mcmmo.commands.party;mcmmo.commands.party.accept;mcmmo.commands.party.create;mcmmo.commands.party.disband;" +
|
||||
"mcmmo.commands.party.expshare;mcmmo.commands.party.invite;mcmmo.commands.party.itemshare;mcmmo.commands.party.join;" +
|
||||
"mcmmo.commands.party.kick;mcmmo.commands.party.lock;mcmmo.commands.party.owner;mcmmo.commands.party.password;" +
|
||||
"mcmmo.commands.party.quit;mcmmo.commands.party.rename;mcmmo.commands.party.unlock");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setExecutor(new PartyCommand());
|
||||
}
|
||||
|
||||
public static void registerPtpCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("ptp");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.ptp"));
|
||||
command.setPermission("mcmmo.commands.ptp;mcmmo.commands.ptp.accept;mcmmo.commands.ptp.acceptall;mcmmo.commands.ptp.toggle");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "ptp", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "ptp", "<toggle|accept|acceptall>"));
|
||||
command.setExecutor(new PtpCommand());
|
||||
}
|
||||
|
||||
public static void registerHardcoreCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("hardcore");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.hardcore"));
|
||||
command.setPermission("mcmmo.commands.hardcore;mcmmo.commands.hardcore.toggle;mcmmo.commands.hardcore.modify");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "hardcore", "[on|off]"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "hardcore", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
|
||||
command.setExecutor(new HardcoreCommand());
|
||||
}
|
||||
|
||||
public static void registerVampirismCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("vampirism");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.vampirism"));
|
||||
command.setPermission("mcmmo.commands.vampirism;mcmmo.commands.vampirism.toggle;mcmmo.commands.vampirism.modify");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "vampirism", "[on|off]"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "vampirism", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
|
||||
command.setExecutor(new VampirismCommand());
|
||||
}
|
||||
|
||||
public static void registerMcnotifyCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcnotify");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify"));
|
||||
command.setPermission("mcmmo.commands.mcnotify");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcnotify"));
|
||||
command.setExecutor(new McnotifyCommand());
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
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.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public abstract class SkillCommand implements CommandExecutor {
|
||||
private SkillType skill;
|
||||
private String skillString;
|
||||
private String permission;
|
||||
|
||||
protected Player player;
|
||||
protected PlayerProfile profile;
|
||||
protected float skillValue;
|
||||
|
||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
protected Permissions permInstance = Permissions.getInstance();
|
||||
|
||||
public SkillCommand(SkillType skill) {
|
||||
this.skill = skill;
|
||||
this.skillString = Misc.getCapitalized(skill.toString());
|
||||
this.permission = "mcmmo.skills." + skillString.toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, permission)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
player = (Player) sender;
|
||||
profile = Users.getProfile(player);
|
||||
|
||||
skillValue = profile.getSkillLevel(skill);
|
||||
dataCalculations();
|
||||
permissionsCheck();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString(skillString + ".SkillName") }));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain." + skillString) }));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill) }));
|
||||
|
||||
if (effectsHeaderPermissions()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
||||
}
|
||||
|
||||
effectsDisplay();
|
||||
|
||||
if (statsHeaderPermissions()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
||||
}
|
||||
|
||||
statsDisplay();
|
||||
|
||||
Page.grabGuidePageForSkill(skill, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract void dataCalculations();
|
||||
|
||||
protected abstract void permissionsCheck();
|
||||
|
||||
protected abstract boolean effectsHeaderPermissions();
|
||||
|
||||
protected abstract void effectsDisplay();
|
||||
|
||||
protected abstract boolean statsHeaderPermissions();
|
||||
|
||||
protected abstract void statsDisplay();
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class AddlevelsCommand implements CommandExecutor{
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
int levels;
|
||||
boolean allSkills = false;
|
||||
SkillType skill = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!Permissions.addlevels(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(args[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
levels = Integer.parseInt(args[1]);
|
||||
profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.addLevels(skillType, levels);
|
||||
}
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
profile.addLevels(skill, levels);
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, SkillTools.getSkillName(skill)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!Permissions.addlevelsOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(args[2])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
levels = Integer.parseInt(args[2]);
|
||||
|
||||
// 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) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.addLevels(skillType, levels);
|
||||
}
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
profile.addLevels(skill, levels);
|
||||
}
|
||||
|
||||
profile.save(); // Since this is a temporary profile, we save it here.
|
||||
}
|
||||
else {
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.addLevels(skillType, levels);
|
||||
}
|
||||
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
profile.addLevels(skill, levels);
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, SkillTools.getSkillName(skill)));
|
||||
}
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillTools.getSkillName(skill), args[0]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
151
src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java
Normal file
151
src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java
Normal file
@@ -0,0 +1,151 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class AddxpCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
int xp;
|
||||
McMMOPlayer mcMMOPlayer;
|
||||
PlayerProfile profile;
|
||||
boolean allSkills = false;
|
||||
SkillType skill = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!Permissions.addxp(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(args[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
xp = Integer.parseInt(args[1]);
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mcMMOPlayer.applyXpGain(skillType, xp);
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
|
||||
mcMMOPlayer.applyXpGain(skill, xp);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, SkillTools.getSkillName(skill)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!Permissions.addxpOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(args[2])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
xp = Integer.parseInt(args[2]);
|
||||
|
||||
// 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) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Currently the offline player doesn't level up automatically
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.setSkillXpLevel(skillType, xp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
profile.setSkillXpLevel(skill, xp);
|
||||
}
|
||||
|
||||
profile.save(); // Since this is a temporary profile, we save it here.
|
||||
}
|
||||
else {
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mcMMOPlayer.applyXpGain(skillType, xp);
|
||||
}
|
||||
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
mcMMOPlayer.applyXpGain(skill, xp);
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, SkillTools.getSkillName(skill)));
|
||||
}
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillTools.getSkillName(skill), args[0]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class HardcoreCommand implements CommandExecutor{
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getHardcoreEnabled()) {
|
||||
disableHardcore();
|
||||
}
|
||||
else {
|
||||
enableHardcore();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
enableHardcore();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
disableHardcore();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isDouble(args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Permissions.hardcoreModify(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
double newPercent = Double.parseDouble(args[0]);
|
||||
|
||||
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercent);
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.PercentageChanged", percent.format(newPercent / 100D)));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void disableHardcore() {
|
||||
Config.getInstance().setHardcoreEnabled(false);
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Disabled"));
|
||||
}
|
||||
|
||||
private void enableHardcore() {
|
||||
Config.getInstance().setHardcoreEnabled(true);
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Enabled"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McgodCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcgod(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (profile == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getGodMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||
}
|
||||
|
||||
profile.toggleGodMode();
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!Permissions.mcgodOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (!player.isOnline()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getGodMode()) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||
}
|
||||
|
||||
profile.toggleGodMode();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrefreshCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcrefresh(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
profile = Users.getPlayer(sender.getName()).getProfile();
|
||||
|
||||
profile.setRecentlyHurt(0);
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!Permissions.mcrefreshOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (!player.isOnline()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.setRecentlyHurt(0);
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class MmoeditCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
int newValue;
|
||||
boolean allSkills = false;
|
||||
SkillType skill = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!Permissions.mmoedit(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(args[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
newValue = Integer.parseInt(args[1]);
|
||||
profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.modifySkill(skillType, newValue);
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
profile.modifySkill(skill, newValue);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillTools.getSkillName(skill), newValue));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!Permissions.mmoeditOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(args[2])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
newValue = Integer.parseInt(args[2]);
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
// 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) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.modifySkill(skillType, newValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
profile.modifySkill(skill, newValue);
|
||||
}
|
||||
|
||||
profile.save(); // Since this is a temporary profile, we save it here.
|
||||
}
|
||||
else {
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.modifySkill(skillType, newValue);
|
||||
}
|
||||
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
profile.modifySkill(skill, newValue);
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillTools.getSkillName(skill), newValue));
|
||||
}
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", SkillTools.getSkillName(skill), args[0]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SkillresetCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
boolean allSkills = false;
|
||||
SkillType skill = null;
|
||||
String skillName = "";
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!Permissions.skillreset(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Permissions.skillreset(sender, skillType)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.modifySkill(skillType, 0);
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
skillName = SkillTools.getSkillName(skill);
|
||||
|
||||
if (!Permissions.skillreset(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.modifySkill(skill, 0);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skillName));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!Permissions.skillresetOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
allSkills = true;
|
||||
}
|
||||
else if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!allSkills) {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skillName = SkillTools.getSkillName(skill);
|
||||
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
// 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) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.modifySkill(skillType, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
profile.modifySkill(skill, 0);
|
||||
}
|
||||
|
||||
profile.save(); // Since this is a temporary profile, we save it here.
|
||||
}
|
||||
else {
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (allSkills) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
profile.modifySkill(skillType, 0);
|
||||
}
|
||||
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
}
|
||||
else {
|
||||
profile.modifySkill(skill, 0);
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.Single", skillName));
|
||||
}
|
||||
}
|
||||
|
||||
if (allSkills) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", skillName, args[0]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class VampirismCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!Config.getInstance().getHardcoreEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getHardcoreVampirismEnabled()) {
|
||||
disableVampirism();
|
||||
}
|
||||
else {
|
||||
enableVampirism();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
enableVampirism();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
disableVampirism();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StringUtils.isDouble(args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Permissions.vampirismModify(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
double newPercent = Double.parseDouble(args[0]);
|
||||
|
||||
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercent);
|
||||
sender.sendMessage(LocaleLoader.getString("Vampirism.PercentageChanged", percent.format(newPercent / 100D)));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void disableVampirism() {
|
||||
Config.getInstance().setHardcoreVampirismEnabled(false);
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Vampirism.Disabled"));
|
||||
}
|
||||
|
||||
private void enableVampirism() {
|
||||
Config.getInstance().setHardcoreVampirismEnabled(true);
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Vampirism.Enabled"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class XprateCommand implements CommandExecutor {
|
||||
private static double originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!args[0].equalsIgnoreCase("reset")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Permissions.xprateReset(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mcMMO.p.isXPEventEnabled()) {
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.over"));
|
||||
mcMMO.p.toggleXpEventEnabled();
|
||||
}
|
||||
|
||||
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!StringUtils.isInt(args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Permissions.xprateSet(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!args[1].equalsIgnoreCase("true") && !args[1].equalsIgnoreCase("false")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mcMMO.p.setXPEventEnabled(Boolean.valueOf(args[1]));
|
||||
int newXpRate = Integer.parseInt(args[0]);
|
||||
Config.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 {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class AddlevelsCommand implements CommandExecutor{
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AddlevelsCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
OfflinePlayer modifiedPlayer;
|
||||
PlayerProfile profile;
|
||||
int levels;
|
||||
SkillType skill;
|
||||
String skillName;
|
||||
String usage = ChatColor.RED + "Proper usage is /addlevels [player] <skill> <level>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (sender instanceof Player) {
|
||||
if (!Skills.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[1])) {
|
||||
modifiedPlayer = (Player) sender;
|
||||
levels = Integer.valueOf(args[1]);
|
||||
skill = Skills.getSkillType(args[0]);
|
||||
profile = Users.getProfile(modifiedPlayer);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
skillName = "all skills";
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
}
|
||||
|
||||
profile.addLevels(skill, levels);
|
||||
sender.sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale.
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
modifiedPlayer = plugin.getServer().getOfflinePlayer(args[0]);
|
||||
String playerName = modifiedPlayer.getName();
|
||||
profile = Users.getProfile(modifiedPlayer);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Skills.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[2])) {
|
||||
levels = Integer.valueOf(args[2]);
|
||||
skill = Skills.getSkillType(args[1]);
|
||||
String message;
|
||||
|
||||
Users.getProfile(modifiedPlayer).addLevels(skill, levels);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
skillName = "all skills";
|
||||
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
|
||||
}
|
||||
|
||||
sender.sendMessage(message);
|
||||
|
||||
if (modifiedPlayer.isOnline()) {
|
||||
((Player) modifiedPlayer).sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale.
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
//TODO: Any way we can make this work for offline use?
|
||||
public class AddxpCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AddxpCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player modifiedPlayer;
|
||||
int xp;
|
||||
SkillType skill;
|
||||
String skillName;
|
||||
String usage = ChatColor.RED + "Proper usage is /addxp [playername] <skill> <xp>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (sender instanceof Player) {
|
||||
if (!Skills.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[1])) {
|
||||
modifiedPlayer = (Player) sender;
|
||||
xp = Integer.valueOf(args[1]);
|
||||
skill = Skills.getSkillType(args[0]);
|
||||
|
||||
PlayerProfile profile = Users.getProfile(modifiedPlayer);
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(modifiedPlayer);
|
||||
mcMMOPlayer.addXPOverride(skill, xp);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
skillName = "all skills";
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
}
|
||||
|
||||
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
Skills.xpCheckAll(modifiedPlayer, profile);
|
||||
}
|
||||
else {
|
||||
Skills.xpCheckSkill(skill, modifiedPlayer, profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
modifiedPlayer = plugin.getServer().getPlayer(args[0]);
|
||||
String playerName = modifiedPlayer.getName();
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(modifiedPlayer);
|
||||
PlayerProfile profile = Users.getProfile(modifiedPlayer);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Skills.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[2])) {
|
||||
xp = Integer.valueOf(args[2]);
|
||||
skill = Skills.getSkillType(args[1]);
|
||||
String message;
|
||||
|
||||
mcMMOPlayer.addXPOverride(skill, xp);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
skillName = "all skills";
|
||||
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
|
||||
}
|
||||
|
||||
sender.sendMessage(message);
|
||||
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
Skills.xpCheckAll(modifiedPlayer, profile);
|
||||
}
|
||||
else {
|
||||
Skills.xpCheckSkill(skill, modifiedPlayer, profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class InspectCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = "Proper usage is /inspect <player>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcmmoPlayer != null) {
|
||||
Player target = mcmmoPlayer.getPlayer();
|
||||
|
||||
if (sender instanceof Player && !sender.isOp() && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.getInstance().inspectDistanceBypass((Player) sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", new Object[] { target.getName() }));
|
||||
CommandHelper.printGatheringSkills(target, sender);
|
||||
CommandHelper.printCombatSkills(target, sender);
|
||||
CommandHelper.printMiscSkills(target, sender);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { mcmmoPlayer.getPowerLevel() }));
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (sender instanceof Player && !sender.isOp() && !Permissions.getInstance().inspectOfflineBypass((Player) sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING) }));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED) }));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS) }));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) }));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McstatsCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||
|
||||
CommandHelper.printGatheringSkills(player);
|
||||
CommandHelper.printCombatSkills(player);
|
||||
CommandHelper.printMiscSkills(player);
|
||||
|
||||
int powerLevelCap = Config.getInstance().getPowerLevelCap();
|
||||
|
||||
if (powerLevelCap > 0)
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", new Object[] { String.valueOf(Users.getPlayer(player).getPowerLevel()), String.valueOf(powerLevelCap) }));
|
||||
else
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { String.valueOf(Users.getPlayer(player).getPowerLevel()) }));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class MmoeditCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
int newValue;
|
||||
SkillType skill;
|
||||
String skillName;
|
||||
String usage = ChatColor.RED + "Proper usage is /mmoedit [player] <skill> <level>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (sender instanceof Player) {
|
||||
if (!Skills.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[1])) {
|
||||
Player player = (Player) sender;
|
||||
newValue = Integer.valueOf(args[1]);
|
||||
skill = Skills.getSkillType(args[0]);
|
||||
profile = Users.getProfile(player);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
skillName = "all skills";
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
}
|
||||
|
||||
profile.modifySkill(skill, newValue);
|
||||
sender.sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!Misc.isInt(args[2])) {
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = Skills.getSkillType(args[1]);
|
||||
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
skillName = "all skills";
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
}
|
||||
|
||||
newValue = Integer.valueOf(args[2]);
|
||||
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcmmoPlayer != null) {
|
||||
profile = mcmmoPlayer.getProfile();
|
||||
|
||||
profile.modifySkill(skill, newValue);
|
||||
mcmmoPlayer.getPlayer().sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
|
||||
sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + args[0] + "."); //TODO: Use locale
|
||||
}
|
||||
else {
|
||||
profile = new PlayerProfile(args[0], false); //Temporary Profile
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.modifySkill(skill, newValue);
|
||||
profile.save();
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.runnables.SQLConversionTask;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class MmoupdateCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public MmoupdateCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
|
||||
Users.clearAll();
|
||||
convertToMySQL();
|
||||
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(x);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert FlatFile data to MySQL data.
|
||||
*/
|
||||
private void convertToMySQL() {
|
||||
if (!Config.getInstance().getUseMySQL()) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new SQLConversionTask(plugin), 1);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SkillResetCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//ensure they have the skillreset perm
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skillreset")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType skillType = null; //simple initialization
|
||||
|
||||
//make sure there's only one argument. output at least some kind of error if not
|
||||
if (args.length != 1 && args[0] != null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//parse the skilltype that they sent
|
||||
try
|
||||
{
|
||||
skillType = SkillType.valueOf(args[0].toUpperCase().trim()); //ucase needed to match enum since it's case sensitive. trim to be nice
|
||||
}catch(IllegalArgumentException ex)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
//reset the values in the hash table and persist them
|
||||
PlayerProfile profile = Users.getProfile((Player)sender);
|
||||
profile.resetSkill(skillType);
|
||||
profile.save();
|
||||
|
||||
//display a success message to the user
|
||||
if (skillType == SkillType.ALL)
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
else
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", new Object[] { args[0] }));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class XprateCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
private static double oldRate = Config.getInstance().xpGainMultiplier;
|
||||
private static boolean xpEvent = false;
|
||||
|
||||
public XprateCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage1 = LocaleLoader.getString("Commands.xprate.proper.0");
|
||||
String usage2 = LocaleLoader.getString("Commands.xprate.proper.1");
|
||||
String usage3 = LocaleLoader.getString("Commands.xprate.proper.2");
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("reset")) {
|
||||
if (xpEvent) {
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
x.sendMessage(LocaleLoader.getString("Commands.xprate.over"));
|
||||
}
|
||||
|
||||
xpEvent = !xpEvent;
|
||||
Config.getInstance().xpGainMultiplier = oldRate;
|
||||
}
|
||||
else {
|
||||
Config.getInstance().xpGainMultiplier = oldRate;
|
||||
}
|
||||
}
|
||||
else if (Misc.isInt(args[0])) {
|
||||
sender.sendMessage(usage3);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage2);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (Misc.isInt(args[0])) {
|
||||
oldRate = Config.getInstance().xpGainMultiplier;
|
||||
|
||||
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
|
||||
xpEvent = Boolean.valueOf(args[1]);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage3);
|
||||
}
|
||||
|
||||
Config.getInstance().xpGainMultiplier = Misc.getInt(args[0]);
|
||||
|
||||
if (xpEvent) {
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.0"));
|
||||
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.1", new Object[] {Config.getInstance().xpGainMultiplier}));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage("The XP RATE was modified to " + Config.getInstance().xpGainMultiplier); //TODO: Locale
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage1);
|
||||
sender.sendMessage(usage2);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage1);
|
||||
sender.sendMessage(usage2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isXpEventRunning() {
|
||||
return xpEvent;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ability")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getProfile((Player) sender);
|
||||
|
||||
if (profile.getAbilityUse()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||
}
|
||||
|
||||
profile.toggleAbilityUse();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
//TODO: Rework this whole thing. It's ugly. Also is missing all the admin & spout commands.
|
||||
public class MccCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---"); //TODO: Needs more locale.
|
||||
|
||||
if (Permissions.getInstance().party(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
|
||||
player.sendMessage("/party " + LocaleLoader.getString("Commands.Party"));
|
||||
player.sendMessage("/party q " + LocaleLoader.getString("Commands.Party.Quit"));
|
||||
|
||||
if (Permissions.getInstance().partyChat(player)) {
|
||||
player.sendMessage("/p " + LocaleLoader.getString("Commands.Party.Toggle"));
|
||||
}
|
||||
|
||||
player.sendMessage("/invite " + LocaleLoader.getString("Commands.Party.Invite"));
|
||||
player.sendMessage("/accept " + LocaleLoader.getString("Commands.Party.Accept"));
|
||||
|
||||
if (Permissions.getInstance().partyTeleport(player)) {
|
||||
player.sendMessage("/ptp " + LocaleLoader.getString("Commands.Party.Teleport"));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Other"));
|
||||
player.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
|
||||
player.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
|
||||
|
||||
if (Config.getInstance().getCommandSkillResetEnabled() && Permissions.getInstance().skillReset(player)) {
|
||||
player.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().mcAbility(player)) {
|
||||
player.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().adminChat(player)) {
|
||||
player.sendMessage("/a " + LocaleLoader.getString("Commands.AdminToggle"));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().inspect(player)) {
|
||||
player.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().mmoedit(player)) {
|
||||
player.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
|
||||
}
|
||||
|
||||
if (Permissions.getInstance().mcgod(player)) {
|
||||
player.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
|
||||
player.sendMessage("/mcmmo " + LocaleLoader.getString("Commands.ModDescription"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McgodCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcgod")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getProfile((Player) sender);
|
||||
|
||||
if (profile.getGodMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||
}
|
||||
|
||||
profile.toggleGodMode();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String description = LocaleLoader.getString("mcMMO.Description");
|
||||
String[] mcSplit = description.split(",");
|
||||
sender.sendMessage(mcSplit);
|
||||
|
||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
|
||||
SpoutPlayer spoutPlayer = (SpoutPlayer) sender;
|
||||
|
||||
spoutPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "mcmmodev@gmail.com", Material.DIAMOND);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Donation Info:");
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "mcmmodev@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrefreshCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public McrefreshCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
OfflinePlayer player;
|
||||
PlayerProfile profile;
|
||||
String usage = ChatColor.RED + "Proper usage is /mcrefresh [player]"; //TODO: Needs more locale
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcrefresh")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
profile = Users.getProfile(player);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
player = plugin.getServer().getOfflinePlayer(args[0]);
|
||||
profile = Users.getProfile(player);
|
||||
String playerName = player.getName();
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage("You have refreshed " + playerName + "'s cooldowns!"); //TODO: Use locale
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.setRecentlyHurt(0);
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
|
||||
if (player.isOnline()) {
|
||||
((Player) player).sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.util.Database;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McremoveCommand implements CommandExecutor {
|
||||
private final String location;
|
||||
private final mcMMO plugin;
|
||||
|
||||
public McremoveCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
this.location = mcMMO.getUsersFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String playerName;
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
String databaseName = Config.getInstance().getMySQLDatabaseName();
|
||||
String usage = ChatColor.RED + "Proper usage is /mcremove <player>"; //TODO: Needs more locale.
|
||||
String success;
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcremove")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
playerName = args[0];
|
||||
success = ChatColor.GREEN + playerName + " was successfully removed from the database!"; //TODO: Locale
|
||||
break;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* MySQL */
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
Database database = mcMMO.getPlayerDatabase();
|
||||
int userId = 0;
|
||||
userId = database.getInt("SELECT id FROM " + tablePrefix + "users WHERE user = '" + playerName + "'");
|
||||
|
||||
if (userId > 0) {
|
||||
database.write("DELETE FROM "
|
||||
+ databaseName + "."
|
||||
+ tablePrefix + "users WHERE "
|
||||
+ tablePrefix + "users.id=" + userId);
|
||||
|
||||
database.write("DELETE FROM "
|
||||
+ databaseName + "."
|
||||
+ tablePrefix + "cooldowns WHERE "
|
||||
+ tablePrefix + "cooldowns.user_id=" + userId);
|
||||
|
||||
database.write("DELETE FROM "
|
||||
+ databaseName + "."
|
||||
+ tablePrefix + "huds WHERE "
|
||||
+ tablePrefix + "huds.user_id=" + userId);
|
||||
|
||||
database.write("DELETE FROM "
|
||||
+ databaseName + "."
|
||||
+ tablePrefix + "skills WHERE "
|
||||
+ tablePrefix + "skills.user_id=" + userId);
|
||||
|
||||
database.write("DELETE FROM "
|
||||
+ databaseName + "."
|
||||
+ tablePrefix + "experience WHERE "
|
||||
+ tablePrefix + "experience.user_id=" + userId);
|
||||
|
||||
sender.sendMessage(success);
|
||||
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (removeFlatFileUser(playerName)) {
|
||||
sender.sendMessage(success);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
}
|
||||
}
|
||||
|
||||
//Force PlayerProfile stuff to update
|
||||
McMMOPlayer mcmmoPlayer = Users.getPlayer(playerName);
|
||||
|
||||
if (mcmmoPlayer != null) {
|
||||
Player player = mcmmoPlayer.getPlayer();
|
||||
SpoutHud spoutHud = mcmmoPlayer.getProfile().getSpoutHud();
|
||||
|
||||
if (spoutHud != null) {
|
||||
spoutHud.removeWidgets();
|
||||
}
|
||||
|
||||
Users.remove(playerName);
|
||||
|
||||
if (player.isOnline()) {
|
||||
Users.addUser(player);
|
||||
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutStuff.reloadSpoutPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean removeFlatFileUser(String playerName) {
|
||||
boolean worked = false;
|
||||
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
|
||||
if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
System.out.println("User found, removing...");
|
||||
worked = true;
|
||||
continue; //Skip the player
|
||||
}
|
||||
}
|
||||
|
||||
out = new FileWriter(location); //Write out the new file
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
plugin.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return worked;
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
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.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Database;
|
||||
import com.gmail.nossr50.util.Leaderboard;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
|
||||
public class MctopCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = ChatColor.RED + "Proper usage is /mctop [skill] [page]"; //TODO: Needs more locale.
|
||||
|
||||
if (!Config.getInstance().getUseMySQL()) {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
flatfileDisplay(1, "ALL", sender);
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (Misc.isInt(args[0])) {
|
||||
flatfileDisplay(Integer.valueOf(args[0]), "ALL", sender);
|
||||
}
|
||||
else if (Skills.isSkill(args[0])) {
|
||||
flatfileDisplay(1, args[0].toUpperCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!Skills.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[1])) {
|
||||
flatfileDisplay(Integer.valueOf(args[1]), args[0].toUpperCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
sqlDisplay(1, powerlevel, sender);
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (Misc.isInt(args[0])) {
|
||||
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender);
|
||||
}
|
||||
else if (Skills.isSkill(args[0])) {
|
||||
sqlDisplay(1, args[0].toLowerCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!Skills.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[1])) {
|
||||
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void flatfileDisplay(int page, String skill, CommandSender sender) {
|
||||
String[] info = Leaderboard.retrieveInfo(skill, page);
|
||||
|
||||
if (skill.equals("ALL")) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(skill) }));
|
||||
}
|
||||
|
||||
int n = (page * 10) - 9; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
String digit = String.valueOf(n);
|
||||
|
||||
if (n < 10) {
|
||||
digit = "0" + digit;
|
||||
}
|
||||
|
||||
String[] splitx = x.split(":");
|
||||
|
||||
// Format: 1. Playername - skill value
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sqlDisplay(int page, String query, CommandSender sender) {
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
Database database = mcMMO.getPlayerDatabase();
|
||||
|
||||
HashMap<Integer, ArrayList<String>> userslist = database.read("SELECT " + query + ", user_id FROM " + tablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC ");
|
||||
|
||||
if (query.equals("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(query) }));
|
||||
}
|
||||
|
||||
for (int i = (page * 10) - 9; i <= (page * 10); i++) {
|
||||
if (i > userslist.size() || database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
HashMap<Integer, ArrayList<String>> username = database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ACommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public ACommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
String usage = ChatColor.RED + "Proper usage is /a <message>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (sender instanceof Player) {
|
||||
profile = Users.getProfile((Player) sender);
|
||||
|
||||
if (profile.getPartyChatMode()) {
|
||||
profile.togglePartyChat();
|
||||
}
|
||||
|
||||
profile.toggleAdminChat();
|
||||
|
||||
if (profile.getAdminChatMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(args[0]);
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
buffer.append(" ");
|
||||
buffer.append(args[i]);
|
||||
}
|
||||
|
||||
String message = buffer.toString();
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), message);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
message = chatEvent.getMessage();
|
||||
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
||||
|
||||
plugin.getLogger().info("[A]<" + player.getName() + "> " + message);
|
||||
|
||||
for (Player otherPlayer : plugin.getServer().getOnlinePlayers()) {
|
||||
if (Permissions.getInstance().adminChat(otherPlayer) || otherPlayer.isOp()) {
|
||||
otherPlayer.sendMessage(prefix + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", message);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
message = chatEvent.getMessage();
|
||||
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
|
||||
|
||||
plugin.getLogger().info("[A]<*Console*> " + message);
|
||||
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (Permissions.getInstance().adminChat(player) || player.isOp()) {
|
||||
player.sendMessage(prefix + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class AcceptCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AcceptCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile playerProfile = Users.getProfile(player);
|
||||
|
||||
if (playerProfile.hasPartyInvite()) {
|
||||
PartyManager partyManagerInstance = PartyManager.getInstance();
|
||||
|
||||
if (playerProfile.inParty()) {
|
||||
Party party = playerProfile.getParty();
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), playerProfile.getInvite().getName(), EventReason.CHANGED_PARTIES);
|
||||
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
partyManagerInstance.removeFromParty(player.getName(), party);
|
||||
}
|
||||
else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, playerProfile.getInvite().getName(), EventReason.JOINED_PARTY);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
partyManagerInstance.joinInvitedParty(player, playerProfile);
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
//TODO: Make this work from console.
|
||||
public class InviteCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public InviteCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = ChatColor.RED + "Proper usage is /invite <player>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile playerProfile = Users.getProfile(player);
|
||||
|
||||
if (!playerProfile.inParty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = plugin.getServer().getPlayer(args[0]);
|
||||
|
||||
if (target != null) {
|
||||
if (PartyManager.getInstance().canInvite(player, playerProfile)) {
|
||||
Party party = playerProfile.getParty();
|
||||
|
||||
Users.getProfile(target).setInvite(party);
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", new Object[] {party.getName(), player.getName()}));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Locked"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public PCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
String usage = ChatColor.RED + "Proper usage is /p <party-name> <message>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (sender instanceof Player) {
|
||||
profile = Users.getProfile((Player) sender);
|
||||
|
||||
if (profile.getAdminChatMode()) {
|
||||
profile.toggleAdminChat();
|
||||
}
|
||||
|
||||
profile.togglePartyChat();
|
||||
|
||||
if (profile.getPartyChatMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Party party = Users.getProfile(player).getParty();
|
||||
|
||||
if (party == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(args[0]);
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
buffer.append(" ");
|
||||
buffer.append(args[i]);
|
||||
}
|
||||
|
||||
String message = buffer.toString();
|
||||
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(player.getName(), party.getName(), message);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
message = chatEvent.getMessage();
|
||||
String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
||||
|
||||
plugin.getLogger().info("[P](" + party.getName() + ")" + "<" + player.getName() + "> " + message);
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(prefix + message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!PartyManager.getInstance().isParty(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(args[1]);
|
||||
|
||||
for (int i = 2; i < args.length; i++) {
|
||||
buffer.append(" ");
|
||||
buffer.append(args[i]);
|
||||
}
|
||||
|
||||
String message = buffer.toString();
|
||||
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], message);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
message = chatEvent.getMessage();
|
||||
String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
|
||||
|
||||
plugin.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + message);
|
||||
|
||||
for (Player member : PartyManager.getInstance().getOnlineMembers(args[0])) {
|
||||
member.sendMessage(prefix + message);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,242 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PartyCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public PartyCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
String playerName = player.getName();
|
||||
PlayerProfile playerProfile = Users.getProfile(player);
|
||||
|
||||
PartyManager partyManagerInstance = PartyManager.getInstance();
|
||||
Party party = playerProfile.getParty();
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (party == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.0"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.2"));
|
||||
}
|
||||
else {
|
||||
Server server = plugin.getServer();
|
||||
String leader = party.getLeader();
|
||||
StringBuffer tempList = new StringBuffer();
|
||||
|
||||
for (String otherPlayerName : party.getMembers()) {
|
||||
if (leader.equals(otherPlayerName)) {
|
||||
tempList.append(ChatColor.GOLD);
|
||||
}
|
||||
else if (server.getPlayer(otherPlayerName) != null) {
|
||||
tempList.append(ChatColor.WHITE);
|
||||
}
|
||||
else {
|
||||
tempList.append(ChatColor.GRAY);
|
||||
}
|
||||
|
||||
tempList.append(otherPlayerName + " ");
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.InParty", new Object[] {party.getName()}));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members", new Object[] {tempList}));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("q")) {
|
||||
if (party != null) {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), null, EventReason.LEFT_PARTY);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
partyManagerInstance.removeFromParty(playerName, party);
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage("Commands.Party.None");
|
||||
}
|
||||
}
|
||||
else if (args[0].equals("?")) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.3"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.4"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.5"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.6"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.7"));
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("lock")) {
|
||||
if (party != null) {
|
||||
if (party.getLeader().equals(playerName)) {
|
||||
if (party.isLocked()) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.IsLocked"));
|
||||
}
|
||||
else {
|
||||
party.setLocked(true);
|
||||
player.sendMessage(LocaleLoader.getString("Party.Locked"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage("Commands.Party.None");
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("unlock")) {
|
||||
if (party != null) {
|
||||
if (party.getLeader().equals(playerName)) {
|
||||
if (!party.isLocked()) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.IsntLocked"));
|
||||
}
|
||||
else {
|
||||
party.setLocked(false);
|
||||
player.sendMessage(LocaleLoader.getString("Party.Unlocked"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage("Commands.Party.None");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (party != null) {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), args[0], EventReason.CHANGED_PARTIES);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
partyManagerInstance.removeFromParty(playerName, party);
|
||||
}
|
||||
else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
partyManagerInstance.joinParty(player, playerProfile, args[0], null);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (playerProfile.inParty()) {
|
||||
if (args[0].equalsIgnoreCase("password")) {
|
||||
if (party.getLeader().equals(playerName)) {
|
||||
party.setLocked(true);
|
||||
party.setPassword(args[1]);
|
||||
player.sendMessage(LocaleLoader.getString("Party.PasswordSet", new Object[] {args[1]}));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("kick")) {
|
||||
if (party.getLeader().equals(playerName)) {
|
||||
if (!party.getMembers().contains(args[1])) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
String partyName = party.getName();
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
|
||||
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
partyManagerInstance.removeFromParty(args[1], party);
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("owner")) {
|
||||
if (party.getLeader().equals(playerName)) {
|
||||
if (!party.getMembers().contains(args[1])) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
partyManagerInstance.setPartyLeader(args[1], party);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), args[0], EventReason.CHANGED_PARTIES);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
partyManagerInstance.removeFromParty(playerName, party);
|
||||
partyManagerInstance.joinParty(player, playerProfile, args[0], args[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
partyManagerInstance.joinParty(player, playerProfile, args[0], args[1]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.0"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
|
||||
player.sendMessage(LocaleLoader.getString("Party.Help.2"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PtpCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public PtpCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = ChatColor.RED + "Proper usage is /ptp <player>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ptp")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
if (profile.getRecentlyHurt() + (Config.getInstance().getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", new Object[] { Config.getInstance().getPTPCommandCooldown() }));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = plugin.getServer().getPlayer(args[0]);
|
||||
|
||||
if (player.equals(target)) {
|
||||
player.sendMessage("You can't teleport to yourself!"); //TODO: Use locale
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.isDead()) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PartyManager.getInstance().inSameParty(player, target)) {
|
||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, profile.getParty().getName());
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
player.teleport(target);
|
||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", new Object[] { target.getName() }));
|
||||
target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", new Object[] { player.getName() }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { target.getName() }));
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class InspectCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
// 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) {
|
||||
profile = new PlayerProfile(args[0], false); //Temporary Profile
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Why do we care if this is a player?
|
||||
if (sender instanceof Player && !Permissions.inspectOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", args[0]));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
|
||||
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player inspector = (Player) sender;
|
||||
|
||||
if (!Misc.isNear(inspector.getLocation(), target.getLocation(), 5.0) && !Permissions.inspectFar(inspector)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
|
||||
CommandHelper.printGatheringSkills(target, profile, sender);
|
||||
CommandHelper.printCombatSkills(target, profile, sender);
|
||||
CommandHelper.printMiscSkills(target, profile, sender);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcability(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (profile.getAbilityUse()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||
}
|
||||
|
||||
profile.toggleAbilityUse();
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!Permissions.mcabilityOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (!player.isOnline()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getAbilityUse()) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||
}
|
||||
|
||||
profile.toggleAbilityUse();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.commands.PartySubcommandType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcmmoDescription(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
String description = LocaleLoader.getString("mcMMO.Description");
|
||||
String[] mcSplit = description.split(",");
|
||||
sender.sendMessage(mcSplit);
|
||||
|
||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
|
||||
SpoutPlayer spoutPlayer = (SpoutPlayer) sender;
|
||||
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND);
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("commands")) {
|
||||
if (!Permissions.mcmmoHelp(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcc.Header"));
|
||||
displayPartyCommands(sender);
|
||||
displayOtherCommands(sender);
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void displayPartyCommands(CommandSender sender) {
|
||||
if (Permissions.party(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
|
||||
sender.sendMessage("/party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
|
||||
sender.sendMessage("/party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
|
||||
sender.sendMessage("/party quit " + LocaleLoader.getString("Commands.Party.Quit"));
|
||||
|
||||
if (Permissions.partyChat(sender)) {
|
||||
sender.sendMessage("/party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
|
||||
}
|
||||
|
||||
sender.sendMessage("/party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
|
||||
sender.sendMessage("/party accept " + LocaleLoader.getString("Commands.Party.Accept"));
|
||||
|
||||
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
|
||||
sender.sendMessage("/party teleport " + LocaleLoader.getString("Commands.Party.Teleport"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayOtherCommands(CommandSender sender) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
||||
sender.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
|
||||
sender.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
|
||||
|
||||
if (Permissions.skillreset(sender)) {
|
||||
sender.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
|
||||
}
|
||||
|
||||
if (Permissions.mcability(sender)) {
|
||||
sender.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
|
||||
}
|
||||
|
||||
if (Permissions.adminChat(sender)) {
|
||||
sender.sendMessage("/adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
|
||||
}
|
||||
|
||||
if (Permissions.inspect(sender)) {
|
||||
sender.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
|
||||
}
|
||||
|
||||
if (Permissions.mmoedit(sender)) {
|
||||
sender.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
|
||||
}
|
||||
|
||||
if (Permissions.mcgod(sender)) {
|
||||
sender.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
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.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McnotifyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
PlayerProfile profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (profile.useChatNotifications()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
|
||||
}
|
||||
|
||||
profile.toggleChatNotifications();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.config.Config;
|
||||
import com.gmail.nossr50.database.Leaderboard;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.McRankAsync;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrankCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcrank(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
sqlDisplay(sender, sender.getName());
|
||||
}
|
||||
else {
|
||||
Leaderboard.updateLeaderboards(); // Make sure the information is up to date
|
||||
flatfileDisplay(sender, sender.getName());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!Permissions.mcrankOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !Permissions.mcrankOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.mcrankFar(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
sqlDisplay(sender, args[0]);
|
||||
}
|
||||
else {
|
||||
Leaderboard.updateLeaderboards(); // Make sure the information is up to date
|
||||
flatfileDisplay(sender, args[0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void flatfileDisplay(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
|
||||
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
int[] rankInts = Leaderboard.getPlayerRank(playerName, skillType);
|
||||
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rankInts[1] == 0) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), rankInts[0]));
|
||||
}
|
||||
}
|
||||
|
||||
// Show the powerlevel ranking
|
||||
int[] rankInts = Leaderboard.getPlayerRank(playerName);
|
||||
|
||||
if (rankInts[1] == 0) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Overall", LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Overall", rankInts[0]));
|
||||
}
|
||||
}
|
||||
|
||||
private void sqlDisplay(CommandSender sender, String playerName) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new McRankAsync(playerName, sender));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McstatsCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||
|
||||
CommandHelper.printGatheringSkills(player, profile);
|
||||
CommandHelper.printCombatSkills(player, profile);
|
||||
CommandHelper.printMiscSkills(player, profile);
|
||||
|
||||
int powerLevelCap = Config.getInstance().getPowerLevelCap();
|
||||
|
||||
if (powerLevelCap != Integer.MAX_VALUE) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", mcMMOPlayer.getPowerLevel(), powerLevelCap));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.config.Config;
|
||||
import com.gmail.nossr50.database.Leaderboard;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.McTopAsync;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class MctopCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
boolean useMySQL = Config.getInstance().getUseMySQL();
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
display(1, "ALL", sender, useMySQL, command);
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (StringUtils.isInt(args[0])) {
|
||||
display(Integer.parseInt(args[0]), "ALL", sender, useMySQL, command);
|
||||
}
|
||||
else if (SkillTools.isSkill(args[0])) {
|
||||
display(1, SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!StringUtils.isInt(args[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SkillTools.isSkill(args[0])) {
|
||||
display(Integer.parseInt(args[1]), SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void display(int page, String skill, CommandSender sender, boolean sql, Command command) {
|
||||
if (sql) {
|
||||
if (skill.equalsIgnoreCase("all")) {
|
||||
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender, command);
|
||||
}
|
||||
else {
|
||||
sqlDisplay(page, skill, sender, command);
|
||||
}
|
||||
}
|
||||
else {
|
||||
flatfileDisplay(page, skill, sender, command);
|
||||
}
|
||||
}
|
||||
|
||||
private void flatfileDisplay(int page, String skill, CommandSender sender, Command command) {
|
||||
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
Leaderboard.updateLeaderboards(); //Make sure we have the latest information
|
||||
|
||||
String[] info = Leaderboard.retrieveInfo(skill, page);
|
||||
|
||||
if (skill.equalsIgnoreCase("all")) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", StringUtils.getCapitalized(skill)));
|
||||
}
|
||||
|
||||
int n = (page * 10) - 9; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
String digit = String.valueOf(n);
|
||||
|
||||
if (n < 10) {
|
||||
digit = "0" + digit;
|
||||
}
|
||||
|
||||
String[] splitx = x.split(":");
|
||||
|
||||
// Format: 1. Playername - skill value
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
}
|
||||
|
||||
private void sqlDisplay(int page, String query, CommandSender sender, Command command) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new McTopAsync(page, query, sender, command));
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class AcrobaticsCommand extends SkillCommand {
|
||||
private String dodgeChance;
|
||||
private String rollChance;
|
||||
private String gracefulRollChance;
|
||||
|
||||
private boolean canDodge;
|
||||
private boolean canRoll;
|
||||
private boolean canGracefulRoll;
|
||||
|
||||
public AcrobaticsCommand() {
|
||||
super(SkillType.ACROBATICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
if (skillValue >= 1000) {
|
||||
dodgeChance = "20.00%";
|
||||
rollChance = "100.00%";
|
||||
gracefulRollChance = "100.00%";
|
||||
}
|
||||
else if (skillValue >= 800) {
|
||||
dodgeChance = "20.00%";
|
||||
rollChance = percent.format(skillValue / 1000);
|
||||
gracefulRollChance = "100.00%";
|
||||
}
|
||||
else if (skillValue >= 500) {
|
||||
dodgeChance = percent.format(skillValue / 4000);
|
||||
rollChance = percent.format(skillValue / 1000);
|
||||
gracefulRollChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
dodgeChance = percent.format(skillValue / 4000);
|
||||
rollChance = percent.format(skillValue / 1000);
|
||||
gracefulRollChance = percent.format(skillValue / 500);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canDodge = permInstance.dodge(player);
|
||||
canRoll = permInstance.roll(player);
|
||||
canGracefulRoll = permInstance.gracefulRoll(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canDodge || canGracefulRoll || canRoll;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canRoll) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canGracefulRoll) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canDodge) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canDodge || canGracefulRoll || canRoll;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canRoll) {
|
||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
|
||||
}
|
||||
|
||||
if (canGracefulRoll) {
|
||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
|
||||
}
|
||||
|
||||
if (canDodge) {
|
||||
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class ArcheryCommand extends SkillCommand {
|
||||
private String skillShotBonus;
|
||||
private String dazeChance;
|
||||
private String retrieveChance;
|
||||
|
||||
private boolean canSkillShot;
|
||||
private boolean canDaze;
|
||||
private boolean canRetrieve;
|
||||
|
||||
public ArcheryCommand() {
|
||||
super(SkillType.ARCHERY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
if (skillValue >= 1000) {
|
||||
skillShotBonus = "200.00%";
|
||||
dazeChance = "50.00%";
|
||||
retrieveChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
skillShotBonus = percent.format(((int) skillValue / 50) * 0.1D); //TODO: Not sure if this is the best way to calculate this or not...
|
||||
dazeChance = percent.format(skillValue / 2000);
|
||||
retrieveChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canSkillShot = permInstance.archeryBonus(player);
|
||||
canDaze = permInstance.daze(player);
|
||||
canRetrieve = permInstance.trackArrows(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canSkillShot || canDaze || canRetrieve;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canSkillShot) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canDaze) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canRetrieve) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canSkillShot || canDaze || canRetrieve;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canSkillShot) {
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
|
||||
}
|
||||
|
||||
if (canDaze) {
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
|
||||
}
|
||||
|
||||
if (canRetrieve) {
|
||||
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class AxesCommand extends SkillCommand {
|
||||
private String critChance;
|
||||
private String bonusDamage;
|
||||
private String impactDamage;
|
||||
private String greaterImpactDamage;
|
||||
private String skullSplitterLength;
|
||||
|
||||
private boolean canSkullSplitter;
|
||||
private boolean canCritical;
|
||||
private boolean canBonusDamage;
|
||||
private boolean canImpact;
|
||||
private boolean canGreaterImpact;
|
||||
|
||||
public AxesCommand() {
|
||||
super(SkillType.AXES);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
impactDamage = String.valueOf(5 + ((int) skillValue / 30));
|
||||
skullSplitterLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||
greaterImpactDamage = "2";
|
||||
|
||||
if (skillValue >= 750) {
|
||||
critChance = "37.50";
|
||||
bonusDamage = "4";
|
||||
}
|
||||
else if (skillValue >= 200) {
|
||||
critChance = percent.format(skillValue / 2000);
|
||||
bonusDamage = "4";
|
||||
}
|
||||
else {
|
||||
critChance = percent.format(skillValue / 2000);
|
||||
bonusDamage = String.valueOf((int) skillValue / 50);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canSkullSplitter = permInstance.skullSplitter(player);
|
||||
canCritical = permInstance.criticalHit(player);
|
||||
canBonusDamage = permInstance.axeBonus(player);
|
||||
canImpact = permInstance.impact(player);
|
||||
canGreaterImpact = permInstance.greaterImpact(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canSkullSplitter) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canCritical) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canBonusDamage) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5") }));
|
||||
}
|
||||
|
||||
if (canImpact) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7") }));
|
||||
}
|
||||
|
||||
if (canGreaterImpact) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canBonusDamage) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", new Object[] {bonusDamage}) }));
|
||||
}
|
||||
|
||||
if (canImpact) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", new Object[] {impactDamage}) }));
|
||||
}
|
||||
|
||||
if (canGreaterImpact) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
|
||||
}
|
||||
|
||||
if (canCritical) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }));
|
||||
}
|
||||
|
||||
if (canSkullSplitter) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.SS.Length", new Object[] { skullSplitterLength }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class ExcavationCommand extends SkillCommand {
|
||||
private String gigaDrillBreakerLength;
|
||||
|
||||
private boolean canGigaDrill;
|
||||
private boolean canTreasureHunt;
|
||||
|
||||
public ExcavationCommand() {
|
||||
super(SkillType.EXCAVATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
gigaDrillBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canGigaDrill = permInstance.gigaDrillBreaker(player);
|
||||
canTreasureHunt = permInstance.excavationTreasures(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canGigaDrill || canTreasureHunt;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canGigaDrill) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.0"), LocaleLoader.getString("Excavation.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canTreasureHunt) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.2"), LocaleLoader.getString("Excavation.Effect.3") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canGigaDrill;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canGigaDrill) {
|
||||
player.sendMessage(LocaleLoader.getString("Excavation.Effect.Length", new Object[] { gigaDrillBreakerLength }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.gathering.Fishing;
|
||||
|
||||
public class FishingCommand extends SkillCommand {
|
||||
private int lootTier;
|
||||
private String magicChance;
|
||||
|
||||
private boolean canTreasureHunt;
|
||||
private boolean canMagicHunt;
|
||||
private boolean canShake;
|
||||
|
||||
public FishingCommand() {
|
||||
super(SkillType.FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
lootTier = Fishing.getFishingLootTier(profile);
|
||||
magicChance = percent.format((float) lootTier / 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canTreasureHunt = permInstance.fishingTreasures(player);
|
||||
canMagicHunt = permInstance.fishingMagic(player);
|
||||
canShake = permInstance.shakeMob(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canTreasureHunt || canMagicHunt || canShake;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canTreasureHunt) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canMagicHunt) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canShake) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canTreasureHunt || canMagicHunt || canShake;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canTreasureHunt) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", new Object[] { lootTier }));
|
||||
}
|
||||
|
||||
if (canMagicHunt) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.Enchant.Chance", new Object[] { magicChance }));
|
||||
}
|
||||
|
||||
if (canShake) {
|
||||
//TODO: Do we really need to display this twice? Not like there are any associated stats.
|
||||
if (skillValue < 150) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class HerbalismCommand extends SkillCommand {
|
||||
private String greenTerraLength;
|
||||
private String greenThumbChance;
|
||||
private String greenThumbStage;
|
||||
private String farmersDietRank;
|
||||
private String doubleDropChance;
|
||||
|
||||
private boolean canGreenTerra;
|
||||
private boolean canGreenThumbWheat;
|
||||
private boolean canGreenThumbBlocks;
|
||||
private boolean canFarmersDiet;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean doubleDropsDisabled;
|
||||
|
||||
public HerbalismCommand() {
|
||||
super(SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
greenTerraLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||
|
||||
if (skillValue >= 1500) {
|
||||
greenThumbChance = "100.00%";
|
||||
greenThumbStage = "4";
|
||||
farmersDietRank = "5";
|
||||
doubleDropChance = "100.00%";
|
||||
}
|
||||
else if (skillValue >= 1000) {
|
||||
greenThumbChance = percent.format(skillValue / 1500);
|
||||
greenThumbStage = "4";
|
||||
farmersDietRank = "5";
|
||||
doubleDropChance = "100.00%";
|
||||
}
|
||||
else if (skillValue >= 800) {
|
||||
greenThumbChance = percent.format(skillValue / 1500);
|
||||
greenThumbStage = "4";
|
||||
farmersDietRank = "4";
|
||||
doubleDropChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
else if (skillValue >= 600) {
|
||||
greenThumbChance = percent.format(skillValue / 1500);
|
||||
greenThumbStage = "4";
|
||||
farmersDietRank = "3";
|
||||
doubleDropChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
else if (skillValue >= 400) {
|
||||
greenThumbChance = percent.format(skillValue / 1500);
|
||||
greenThumbStage = "3";
|
||||
farmersDietRank = "2";
|
||||
doubleDropChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
else if (skillValue >= 200) {
|
||||
greenThumbChance = percent.format(skillValue / 1500);
|
||||
greenThumbStage = "2";
|
||||
farmersDietRank = "1";
|
||||
doubleDropChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
else {
|
||||
greenThumbChance = percent.format(skillValue / 1500);
|
||||
greenThumbStage = "1";
|
||||
farmersDietRank = "1";
|
||||
doubleDropChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
Config configInstance = Config.getInstance();
|
||||
|
||||
canGreenTerra = permInstance.greenTerra(player);
|
||||
canGreenThumbWheat = permInstance.greenThumbWheat(player);
|
||||
canGreenThumbBlocks = permInstance.greenThumbBlocks(player);
|
||||
canFarmersDiet = permInstance.farmersDiet(player);
|
||||
canDoubleDrop = permInstance.herbalismDoubleDrops(player);
|
||||
doubleDropsDisabled = configInstance.herbalismDoubleDropsDisabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canGreenTerra || (canDoubleDrop && !doubleDropsDisabled) || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canGreenTerra) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canGreenThumbWheat) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canGreenThumbBlocks) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5") }));
|
||||
}
|
||||
|
||||
if (canFarmersDiet) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7") }));
|
||||
}
|
||||
|
||||
if (canDoubleDrop && !doubleDropsDisabled) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canGreenTerra || (canDoubleDrop && !doubleDropsDisabled) || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canGreenTerra) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
|
||||
}
|
||||
|
||||
if (canGreenThumbBlocks || canGreenThumbWheat) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
|
||||
}
|
||||
|
||||
if (canGreenThumbWheat) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
|
||||
}
|
||||
|
||||
if (canFarmersDiet) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } ));
|
||||
}
|
||||
|
||||
if (canDoubleDrop && !doubleDropsDisabled) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Repairable;
|
||||
|
||||
public class RepairCommand extends SkillCommand {
|
||||
private int arcaneForgingRank;
|
||||
private String repairMasteryBonus;
|
||||
private String superRepairChance;
|
||||
|
||||
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 int diamondLevel;
|
||||
private int goldLevel;
|
||||
private int ironLevel;
|
||||
private int stoneLevel;
|
||||
|
||||
public RepairCommand() {
|
||||
super(SkillType.REPAIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
// We're using pickaxes here, not the best but it works
|
||||
Repairable diamondRepairable = mcMMO.repairManager.getRepairable(278);
|
||||
Repairable goldRepairable = mcMMO.repairManager.getRepairable(285);
|
||||
Repairable ironRepairable = mcMMO.repairManager.getRepairable(257);
|
||||
Repairable stoneRepairable = mcMMO.repairManager.getRepairable(274);
|
||||
|
||||
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
||||
goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel();
|
||||
ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel();
|
||||
stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel();
|
||||
|
||||
repairMasteryBonus = percent.format(skillValue / 500);
|
||||
|
||||
if (skillValue >= 1000) {
|
||||
superRepairChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
superRepairChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
|
||||
arcaneForgingRank = Repair.getArcaneForgingRank(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canSuperRepair = permInstance.repairBonus(player);
|
||||
canMasterRepair = permInstance.repairMastery(player);
|
||||
canArcaneForge = permInstance.arcaneForging(player);
|
||||
canRepairDiamond = permInstance.diamondRepair(player);
|
||||
canRepairGold = permInstance.goldRepair(player);
|
||||
canRepairIron = permInstance.ironRepair(player);
|
||||
canRepairStone = permInstance.stoneRepair(player);
|
||||
canRepairString = permInstance.stringRepair(player);
|
||||
canRepairLeather = permInstance.leatherRepair(player);
|
||||
canRepairWood = permInstance.woodRepair(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canArcaneForge || canRepairDiamond || canRepairGold || canRepairIron || canMasterRepair || canRepairStone || canSuperRepair || canRepairString || canRepairWood || canRepairLeather;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.0"), LocaleLoader.getString("Repair.Effect.1") }));
|
||||
|
||||
if (canMasterRepair) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.2"), LocaleLoader.getString("Repair.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canSuperRepair) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.4"), LocaleLoader.getString("Repair.Effect.5") }));
|
||||
}
|
||||
|
||||
/* Repair Level Requirements */
|
||||
|
||||
if (canRepairStone && stoneLevel > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.14", new Object[] { stoneLevel }), LocaleLoader.getString("Repair.Effect.15") }));
|
||||
}
|
||||
|
||||
if (canRepairIron && ironLevel > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.12", new Object[] { ironLevel }), LocaleLoader.getString("Repair.Effect.13") }));
|
||||
}
|
||||
|
||||
if (canRepairGold && goldLevel > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.10", new Object[] { goldLevel }), LocaleLoader.getString("Repair.Effect.11") }));
|
||||
}
|
||||
|
||||
if (canRepairDiamond && diamondLevel > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.6", new Object[] { diamondLevel }), LocaleLoader.getString("Repair.Effect.7") }));
|
||||
}
|
||||
|
||||
if (canArcaneForge) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canArcaneForge || canMasterRepair || canSuperRepair;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canMasterRepair) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.Mastery", new Object[] { repairMasteryBonus }));
|
||||
}
|
||||
|
||||
if (canSuperRepair) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }));
|
||||
}
|
||||
|
||||
if (canArcaneForge) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank }));
|
||||
|
||||
if (Config.getInstance().getArcaneForgingEnchantLossEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", new Object[] { Repair.getEnchantChance(arcaneForgingRank) }));
|
||||
}
|
||||
|
||||
if (Config.getInstance().getArcaneForgingDowngradeEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", new Object[] { Repair.getDowngradeChance(arcaneForgingRank) }));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class SwordsCommand extends SkillCommand {
|
||||
private String counterAttackChance;
|
||||
private String bleedLength;
|
||||
private String bleedChance;
|
||||
private String serratedStrikesLength;
|
||||
|
||||
private boolean canCounter;
|
||||
private boolean canSerratedStrike;
|
||||
private boolean canBleed;
|
||||
|
||||
public SwordsCommand() {
|
||||
super(SkillType.SWORDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
serratedStrikesLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||
|
||||
if (skillValue >= 750) {
|
||||
bleedLength = "3";
|
||||
bleedChance = "75.00%";
|
||||
counterAttackChance = "30.00%";
|
||||
}
|
||||
else if (skillValue >= 600) {
|
||||
bleedLength = "2";
|
||||
bleedChance = percent.format(skillValue / 1000);
|
||||
counterAttackChance = "30.00%";
|
||||
}
|
||||
else {
|
||||
bleedLength = "2";
|
||||
bleedChance = percent.format(skillValue / 1000);
|
||||
counterAttackChance = percent.format(skillValue / 2000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBleed = permInstance.swordsBleed(player);
|
||||
canCounter = permInstance.counterAttack(player);
|
||||
canSerratedStrike = permInstance.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canBleed || canCounter || canSerratedStrike;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canCounter) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canSerratedStrike) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3") }));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5") }));
|
||||
}
|
||||
|
||||
if (canBleed) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canBleed || canCounter || canSerratedStrike;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canCounter) {
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
|
||||
}
|
||||
|
||||
if (canBleed) {
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
|
||||
}
|
||||
|
||||
if (canSerratedStrike) {
|
||||
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", new Object[] { serratedStrikesLength }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class TamingCommand extends SkillCommand {
|
||||
private String goreChance;
|
||||
|
||||
private boolean canBeastLore;
|
||||
private boolean canGore;
|
||||
private boolean canSharpenedClaws;
|
||||
private boolean canEnvironmentallyAware;
|
||||
private boolean canThickFur;
|
||||
private boolean canShockProof;
|
||||
private boolean canCallWild;
|
||||
private boolean canFastFood;
|
||||
|
||||
public TamingCommand() {
|
||||
super(SkillType.TAMING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
if (skillValue >= 1000) {
|
||||
goreChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
goreChance = percent.format(skillValue / 1000);
|
||||
} }
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBeastLore = permInstance.beastLore(player);
|
||||
canCallWild = permInstance.callOfTheWild(player);
|
||||
canEnvironmentallyAware = permInstance.environmentallyAware(player);
|
||||
canFastFood = permInstance.fastFoodService(player);
|
||||
canGore = permInstance.gore(player);
|
||||
canSharpenedClaws = permInstance.sharpenedClaws(player);
|
||||
canShockProof = permInstance.shockProof(player);
|
||||
canThickFur = permInstance.thickFur(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canBeastLore || canCallWild || canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
Config configInstance = Config.getInstance();
|
||||
|
||||
if (canBeastLore) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canGore) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canSharpenedClaws) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5") }));
|
||||
}
|
||||
|
||||
if (canEnvironmentallyAware) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7") }));
|
||||
}
|
||||
|
||||
if (canThickFur) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9") }));
|
||||
}
|
||||
|
||||
if (canShockProof) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11") }));
|
||||
}
|
||||
|
||||
if (canFastFood) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17") }));
|
||||
}
|
||||
|
||||
if (canCallWild) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13") }));
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Effect.14", new Object[] { configInstance.getTamingCOTWOcelotCost() }));
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Effect.15", new Object[] { configInstance.getTamingCOTWWolfCost() }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canFastFood) {
|
||||
if (skillValue < 50) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.4") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9") }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canEnvironmentallyAware) {
|
||||
if (skillValue < 100) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.0") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1") }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canThickFur) {
|
||||
if (skillValue < 250) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.1") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3") }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canShockProof) {
|
||||
if (skillValue < 500) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.2") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5") }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canSharpenedClaws) {
|
||||
if (skillValue < 750) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.3") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7") }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canGore) {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class UnarmedCommand extends SkillCommand {
|
||||
private String berserkLength;
|
||||
private String deflectChance;
|
||||
private String disarmChance;
|
||||
private String ironArmBonus;
|
||||
|
||||
private boolean canBerserk;
|
||||
private boolean canDisarm;
|
||||
private boolean canBonusDamage;
|
||||
private boolean canDeflect;
|
||||
|
||||
public UnarmedCommand() {
|
||||
super(SkillType.UNARMED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
berserkLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||
|
||||
if (skillValue >= 1000) {
|
||||
disarmChance = "33.33%";
|
||||
deflectChance = "50.00%";
|
||||
ironArmBonus = "8";
|
||||
}
|
||||
else if (skillValue >= 250) {
|
||||
disarmChance = percent.format(skillValue / 3000);
|
||||
deflectChance = percent.format(skillValue / 2000);
|
||||
ironArmBonus = "8";
|
||||
}
|
||||
else {
|
||||
disarmChance = percent.format(skillValue / 3000);
|
||||
deflectChance = percent.format(skillValue / 2000);
|
||||
ironArmBonus = String.valueOf(3 + ((int) skillValue / 50));
|
||||
} }
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBerserk = permInstance.berserk(player);
|
||||
canBonusDamage = permInstance.unarmedBonus(player);
|
||||
canDeflect = permInstance.deflect(player);
|
||||
canDisarm = permInstance.disarm(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canBerserk || canBonusDamage || canDeflect || canDisarm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canBerserk) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.0"), LocaleLoader.getString("Unarmed.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canDisarm) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.2"), LocaleLoader.getString("Unarmed.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canBonusDamage) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.4"), LocaleLoader.getString("Unarmed.Effect.5") }));
|
||||
}
|
||||
|
||||
if (canDeflect) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.6"), LocaleLoader.getString("Unarmed.Effect.7") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canBerserk || canBonusDamage || canDeflect || canDisarm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canBonusDamage) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", new Object[] {ironArmBonus}) }));
|
||||
}
|
||||
|
||||
if (canDeflect) {
|
||||
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }));
|
||||
}
|
||||
|
||||
if (canDisarm) {
|
||||
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }));
|
||||
}
|
||||
|
||||
if (canBerserk) {
|
||||
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Berserk.Length", new Object[] { berserkLength }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.commands.SkillCommand;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class WoodcuttingCommand extends SkillCommand {
|
||||
private String treeFellerLength;
|
||||
private String doubleDropChance;
|
||||
|
||||
private boolean canTreeFell;
|
||||
private boolean canLeafBlow;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean doubleDropsDisabled;
|
||||
|
||||
public WoodcuttingCommand() {
|
||||
super(SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
treeFellerLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||
|
||||
if (skillValue >= 1000) {
|
||||
doubleDropChance = "100.00%";
|
||||
}
|
||||
else {
|
||||
doubleDropChance = percent.format(skillValue / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
Config configInstance = Config.getInstance();
|
||||
|
||||
canTreeFell = permInstance.treeFeller(player);
|
||||
canDoubleDrop = permInstance.woodcuttingDoubleDrops(player);
|
||||
canLeafBlow = permInstance.leafBlower(player);
|
||||
doubleDropsDisabled = configInstance.woodcuttingDoubleDropsDisabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return (canDoubleDrop && !doubleDropsDisabled) || canLeafBlow || canTreeFell;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void effectsDisplay() {
|
||||
if (canTreeFell) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.0"), LocaleLoader.getString("Woodcutting.Effect.1") }));
|
||||
}
|
||||
|
||||
if (canLeafBlow) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.2"), LocaleLoader.getString("Woodcutting.Effect.3") }));
|
||||
}
|
||||
|
||||
if (canDoubleDrop && !doubleDropsDisabled) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.4"), LocaleLoader.getString("Woodcutting.Effect.5") }));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return (canDoubleDrop && !doubleDropsDisabled) || canLeafBlow || canTreeFell;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
//TODO: Remove? Basically duplicates the above.
|
||||
if (canLeafBlow) {
|
||||
if (skillValue < 100) {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Woodcutting.Ability.Locked.0") }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1") }));
|
||||
}
|
||||
}
|
||||
|
||||
if (canDoubleDrop && !doubleDropsDisabled) {
|
||||
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }));
|
||||
}
|
||||
|
||||
if (canTreeFell) {
|
||||
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Length", new Object[] { treeFellerLength }));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.gmail.nossr50.commands.spout;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.SpoutConfig;
|
||||
import com.gmail.nossr50.datatypes.HudType;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class MchudCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = ChatColor.RED + "Proper usage is /mchud <hud-type>"; //TODO: Locale
|
||||
String invalid = ChatColor.RED + "That is not a valid HUD type."; //TODO: Locale
|
||||
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile playerProfile = Users.getProfile(player);
|
||||
SpoutHud spoutHud = playerProfile.getSpoutHud();
|
||||
|
||||
if (spoutHud == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
for (HudType hudType : HudType.values()) {
|
||||
if (hudType.toString().equalsIgnoreCase(args[0])) {
|
||||
playerProfile.setHudType(hudType);
|
||||
spoutHud.initializeXpBar();
|
||||
spoutHud.updateXpBar();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(invalid);
|
||||
return true;
|
||||
|
||||
default:
|
||||
player.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.gmail.nossr50.commands.spout;
|
||||
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.SpoutConfig;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class XplockCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = ChatColor.RED + "Proper usage is /xplock [skill]";
|
||||
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile playerProfile = Users.getProfile(player);
|
||||
SpoutHud spoutHud = playerProfile.getSpoutHud();
|
||||
|
||||
if (spoutHud == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (spoutHud.getXpBarLocked()) {
|
||||
spoutHud.toggleXpBarLocked();
|
||||
player.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType lastGained = spoutHud.getLastGained();
|
||||
|
||||
if (lastGained != null) {
|
||||
spoutHud.toggleXpBarLocked();
|
||||
spoutHud.setSkillLock(lastGained);
|
||||
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(lastGained.toString()) }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (Skills.isSkill(args[0])) {
|
||||
if (Permissions.getInstance().permission(player, "mcmmo.skills." + args[0].toLowerCase())) {
|
||||
spoutHud.setXpBarLocked(true);
|
||||
spoutHud.setSkillLock(Skills.getSkillType(args[0]));
|
||||
spoutHud.updateXpBar();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(args[0]) }));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
player.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
226
src/main/java/com/gmail/nossr50/config/AdvancedConfig.java
Normal file
226
src/main/java/com/gmail/nossr50/config/AdvancedConfig.java
Normal file
@@ -0,0 +1,226 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
public class AdvancedConfig extends ConfigLoader {
|
||||
private static AdvancedConfig instance;
|
||||
|
||||
private AdvancedConfig() {
|
||||
super("advanced.yml");
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
public static AdvancedConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new AdvancedConfig();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
// TODO Do we need to use this?
|
||||
}
|
||||
/* GENERAL */
|
||||
public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); }
|
||||
|
||||
/* ACROBATICS */
|
||||
public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge_ChanceMax", 20.0D); }
|
||||
public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); }
|
||||
|
||||
public double getRollChanceMax() { return config.getDouble("Skills.Acrobatics.Roll_ChanceMax", 100.0D); }
|
||||
public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); }
|
||||
|
||||
public double getGracefulRollChanceMax() { return config.getDouble("Skills.Acrobatics.GracefulRoll_ChanceMax", 100.0D); }
|
||||
public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); }
|
||||
|
||||
public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); }
|
||||
public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); }
|
||||
public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); }
|
||||
|
||||
/* ARCHERY */
|
||||
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); }
|
||||
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); }
|
||||
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot_MaxBonus", 2.0D); }
|
||||
|
||||
public double getDazeBonusMax() { return config.getDouble("Skills.Archery.Daze_MaxChance", 50.0D); }
|
||||
public int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze_MaxBonusLevel", 1000); }
|
||||
public int getDazeModifier() { return config.getInt("Skills.Archery.Daze_BonusDamage", 4); }
|
||||
|
||||
public double getRetrieveChanceMax() { return config.getDouble("Skills.Archery.Retrieve_MaxBonus", 100.0D); }
|
||||
public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); }
|
||||
|
||||
/* AXES */
|
||||
public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); }
|
||||
public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); }
|
||||
|
||||
public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical_MaxChance", 37.50D); }
|
||||
public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical_MaxBonusLevel", 750); }
|
||||
public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5D); }
|
||||
public double getAxesCriticalPVEModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVE_Modifier", 2.0D); }
|
||||
|
||||
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact_Chance", 25.0D); }
|
||||
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); }
|
||||
public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); }
|
||||
|
||||
public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); }
|
||||
public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20.0D); }
|
||||
|
||||
public int getSkullSplitterModifier() { return config.getInt("Skills.Axes.SkullSplitter_DamagerModifier", 2); }
|
||||
|
||||
/* EXCAVATION */
|
||||
//Nothing to configure, everything is already configurable in config.yml
|
||||
|
||||
/* FISHING */
|
||||
public int getFishingTierLevelsTier1() { return config.getInt("Skills.Fishing.Tier_Levels.Tier1", 0); }
|
||||
public int getFishingTierLevelsTier2() { return config.getInt("Skills.Fishing.Tier_Levels.Tier2", 200); }
|
||||
public int getFishingTierLevelsTier3() { return config.getInt("Skills.Fishing.Tier_Levels.Tier3", 400); }
|
||||
public int getFishingTierLevelsTier4() { return config.getInt("Skills.Fishing.Tier_Levels.Tier4", 600); }
|
||||
public int getFishingTierLevelsTier5() { return config.getInt("Skills.Fishing.Tier_Levels.Tier5", 800); }
|
||||
|
||||
public int getFishingMagicMultiplier() { return config.getInt("Skills.Fishing.MagicHunter_Multiplier", 5); }
|
||||
|
||||
public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.Fisherman_Diet_RankChange", 200); }
|
||||
|
||||
/* Shake */
|
||||
public int getShakeUnlockLevel() { return config.getInt("Skills.Fishing.Shake_UnlockLevel", 150); }
|
||||
public int getShakeChanceRank1() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_1", 25); }
|
||||
public int getShakeChanceRank2() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_2", 40); }
|
||||
public int getShakeChanceRank3() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_3", 55); }
|
||||
public int getShakeChanceRank4() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_4", 60); }
|
||||
public int getShakeChanceRank5() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_5", 75); }
|
||||
|
||||
/* Vanilla XP Boost */
|
||||
public int getFishingVanillaXPModifierRank1() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_1", 1); }
|
||||
public int getFishingVanillaXPModifierRank2() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_2", 2); }
|
||||
public int getFishingVanillaXPModifierRank3() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_3", 3); }
|
||||
public int getFishingVanillaXPModifierRank4() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_4", 4); }
|
||||
public int getFishingVanillaXPModifierRank5() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_5", 5); }
|
||||
|
||||
/* HERBALISM */
|
||||
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.Farmer_Diet_RankChange", 200); }
|
||||
|
||||
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb_StageChange", 200); }
|
||||
public double getGreenThumbChanceMax() { return config.getDouble("Skills.Herbalism.GreenThumb_ChanceMax", 100.0D); }
|
||||
public int getGreenThumbMaxLevel() { return config.getInt("Skills.Herbalism.GreenThumb_MaxBonusLevel", 1500); }
|
||||
|
||||
public double getHerbalismDoubleDropsChanceMax() { return config.getDouble("Skills.Herbalism.DoubleDrops_ChanceMax", 100.0D); }
|
||||
public int getHerbalismDoubleDropsMaxLevel() { return config.getInt("Skills.Herbalism.DoubleDrops_MaxBonusLevel", 1000); }
|
||||
|
||||
public double getHylianLuckChanceMax() { return config.getDouble("Skills.Herbalism.HylianLuck_ChanceMax", 10.0D); }
|
||||
public int getHylianLuckMaxLevel() { return config.getInt("Skills.Herbalism.HylianLuck_MaxBonusLevel", 1000); }
|
||||
|
||||
/* MINING */
|
||||
public double getMiningDoubleDropChance() { return config.getDouble("Skills.Mining.DoubleDrops_ChanceMax", 100.0D); }
|
||||
public int getMiningDoubleDropMaxLevel() { return config.getInt("Skills.Mining.DoubleDrops_MaxBonusLevel", 1000); }
|
||||
|
||||
public int getBlastMiningRank1() { return config.getInt("Skills.Mining.BlastMining_Rank1", 125); }
|
||||
public int getBlastMiningRank2() { return config.getInt("Skills.Mining.BlastMining_Rank2", 250); }
|
||||
public int getBlastMiningRank3() { return config.getInt("Skills.Mining.BlastMining_Rank3", 375); }
|
||||
public int getBlastMiningRank4() { return config.getInt("Skills.Mining.BlastMining_Rank4", 500); }
|
||||
public int getBlastMiningRank5() { return config.getInt("Skills.Mining.BlastMining_Rank5", 625); }
|
||||
public int getBlastMiningRank6() { return config.getInt("Skills.Mining.BlastMining_Rank6", 750); }
|
||||
public int getBlastMiningRank7() { return config.getInt("Skills.Mining.BlastMining_Rank7", 875); }
|
||||
public int getBlastMiningRank8() { return config.getInt("Skills.Mining.BlastMining_Rank8", 1000); }
|
||||
|
||||
/* REPAIR */
|
||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery_MaxBonusPercentage", 200.0D); }
|
||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusLevel", 1000); }
|
||||
public double getSuperRepairChanceMax() { return config.getDouble("Skills.Repair.SuperRepair_ChanceMax", 100.0D); }
|
||||
public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); }
|
||||
|
||||
/* Arcane Forging */
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.Arcane_Forging.Downgrades.Enabled", true); }
|
||||
public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_1", 75); }
|
||||
public int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_2", 50); }
|
||||
public int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_3", 25); }
|
||||
public int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_4", 15); }
|
||||
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.Arcane_Forging.May_Lose_Enchants", true); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); }
|
||||
public int getArcaneForgingRankLevels1() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_1", 100); }
|
||||
public int getArcaneForgingRankLevels2() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_2", 250); }
|
||||
public int getArcaneForgingRankLevels3() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_3", 500); }
|
||||
public int getArcaneForgingRankLevels4() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_4", 750); }
|
||||
|
||||
/* SMELTING */
|
||||
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency_MaxBonusLevel", 1000); }
|
||||
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency_Multiplier", 3.0D); }
|
||||
|
||||
public int getSecondSmeltMaxLevel() { return config.getInt("Skills.Smelting.SecondSmelt_MaxBonusLevel", 1000); }
|
||||
public double getSecondSmeltMaxChance() { return config.getDouble("Skills.Smelting.SecondSmelt_MaxBonusChance", 100.0D); }
|
||||
|
||||
public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining_UnlockLevel", 250); }
|
||||
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining_Chance", 33.0D); }
|
||||
|
||||
public int getSmeltingVanillaXPBoostRank1Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank1Level", 100); }
|
||||
public int getSmeltingVanillaXPBoostRank2Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank2Level", 300); }
|
||||
public int getSmeltingVanillaXPBoostRank3Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank3Level", 500); }
|
||||
public int getSmeltingVanillaXPBoostRank4Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank4Level", 700); }
|
||||
public int getSmeltingVanillaXPBoostRank5Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank5Level", 900); }
|
||||
|
||||
public int getSmeltingVanillaXPBoostRank1Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank1Multiplier", 2); }
|
||||
public int getSmeltingVanillaXPBoostRank2Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank2Multiplier", 3); }
|
||||
public int getSmeltingVanillaXPBoostRank3Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank3Multiplier", 4); }
|
||||
public int getSmeltingVanillaXPBoostRank4Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank4Multiplier", 5); }
|
||||
public int getSmeltingVanillaXPBoostRank5Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank5Multiplier", 6); }
|
||||
|
||||
/* SWORDS */
|
||||
public double getBleedChanceMax() { return config.getDouble("Skills.Swords.Bleed_ChanceMax", 75.0D); }
|
||||
public int getBleedMaxBonusLevel() { return config.getInt("Skills.Swords.Bleed_MaxBonusLevel", 750); }
|
||||
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed_MaxTicks", 3); }
|
||||
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed_BaseTicks", 2); }
|
||||
|
||||
public double getCounterChanceMax() { return config.getDouble("Skills.Swords.Counter_ChanceMax", 30.0D); }
|
||||
public int getCounterMaxBonusLevel() { return config.getInt("Skills.Swords.Counter_MaxBonusLevel", 600); }
|
||||
public int getCounterModifier() { return config.getInt("Skills.Swords.Counter_DamageModifier", 2); }
|
||||
|
||||
public int getSerratedStrikesModifier() { return config.getInt("Skills.Swords.SerratedStrikes_DamageModifier", 4); }
|
||||
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes_BleedTicks", 5); }
|
||||
|
||||
/* TAMING */
|
||||
public double getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); }
|
||||
public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); }
|
||||
public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore_BleedTicks", 2); }
|
||||
public int getGoreModifier() { return config.getInt("Skills.Taming.Gore_Modifier", 2); }
|
||||
|
||||
public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood_UnlockLevel", 50); }
|
||||
public double getFastFoodChance() { return config.getInt("Skills.Taming.FastFood_Chance", 50); }
|
||||
|
||||
public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware_UnlockLevel", 100); }
|
||||
|
||||
public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur_UnlockLevel", 250); }
|
||||
public int getThickFurModifier() { return config.getInt("Skills.Taming.ThickFur_Modifier", 2); }
|
||||
|
||||
public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof_UnlockLevel", 500); }
|
||||
public int getShockProofModifier() { return config.getInt("Skills.Taming.ShockProof_Modifier", 6); }
|
||||
|
||||
public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws_UnlockLevel", 750); }
|
||||
public int getSharpenedClawsBonus() { return config.getInt("Skills.Taming.SharpenedClaws_Bonus", 2); }
|
||||
|
||||
/* UNARMED */
|
||||
public double getDisarmChanceMax() { return config.getDouble("Skills.Unarmed.Disarm_ChanceMax", 33.0D); }
|
||||
public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm_MaxBonusLevel", 1000); }
|
||||
|
||||
public double getDeflectChanceMax() { return config.getDouble("Skills.Unarmed.Deflect_ChanceMax", 50.0D); }
|
||||
public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); }
|
||||
|
||||
public double getIronGripChanceMax() { return config.getDouble("Skills.Unarmed.IronGrip_ChanceMax", 100.0D); }
|
||||
public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); }
|
||||
|
||||
public int getIronArmMaxBonus() { return config.getInt("Skills.Unarmed.IronArm_BonusMax", 8); }
|
||||
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); }
|
||||
|
||||
/* WOODCUTTING */
|
||||
public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); }
|
||||
|
||||
public double getWoodcuttingDoubleDropChance() { return config.getDouble("Skills.Woodcutting.DoubleDrops_ChanceMax", 100.0D); }
|
||||
public int getWoodcuttingDoubleDropMaxLevel() { return config.getInt("Skills.Woodcutting.DoubleDrops_MaxBonusLevel", 1000); }
|
||||
|
||||
/* SPOUT STUFF*/
|
||||
public int getSpoutNotificationTier1() { return config.getInt("Spout.Notifications.Tier1", 200); }
|
||||
public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); }
|
||||
public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); }
|
||||
public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); }
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class Config extends ConfigLoader {
|
||||
private static Config instance;
|
||||
public double xpGainMultiplier = 1;
|
||||
|
||||
private Config() {
|
||||
super("config.yml");
|
||||
xpGainMultiplier = getExperienceGainsGlobalMultiplier();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@@ -33,69 +36,90 @@ public class Config extends ConfigLoader {
|
||||
/* General Settings */
|
||||
public String getLocale() { return config.getString("General.Locale", "en_us"); }
|
||||
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
|
||||
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
|
||||
public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
|
||||
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
|
||||
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
|
||||
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
||||
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
|
||||
public boolean getBackupsEnabled() { return config.getBoolean("General.Generate_Backups", true); }
|
||||
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
||||
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.p.Use_Display_Names", true); }
|
||||
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.a.Use_Display_Names", true); }
|
||||
|
||||
/* Database Purging */
|
||||
public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
|
||||
public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); }
|
||||
|
||||
/* mySQL */
|
||||
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
|
||||
public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
|
||||
public String getMySQLDatabaseName() { return config.getString("MySQL.Database.Name", "DatabaseName"); }
|
||||
public String getMySQLUserName() { return config.getString("MySQL.Database.User_Name", "UserName"); } //Really should be labeled under MySQL.User_Name instead...
|
||||
public String getMySQLDatabaseName() { return getStringIncludingInts(config, "MySQL.Database.Name"); }
|
||||
public String getMySQLUserName() { return getStringIncludingInts(config, "MySQL.Database.User_Name"); }
|
||||
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
|
||||
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
|
||||
|
||||
public String getMySQLUserPassword() {
|
||||
if (config.getString("MySQL.Database.User_Password", null) != null) {
|
||||
return config.getString("MySQL.Database.User_Password", null);
|
||||
if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) {
|
||||
return getStringIncludingInts(config, "MySQL.Database.User_Password");
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
|
||||
String str = cfg.getString(key);
|
||||
|
||||
if (str == null) {
|
||||
str = String.valueOf(cfg.getInt(key));
|
||||
}
|
||||
|
||||
if (str == "0") {
|
||||
str = "No value set for '" + key + "'";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/* Hardcore Mode */
|
||||
public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); }
|
||||
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75); }
|
||||
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism_Stat_Leech_Percentage", 5); }
|
||||
public void setHardcoreEnabled(boolean enabled) { config.set("Hardcore.Enabled", enabled); }
|
||||
|
||||
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75.0); }
|
||||
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss_Penalty_Percentage", value); }
|
||||
|
||||
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism_Stat_Leech_Percentage", 5.0); }
|
||||
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism_Stat_Leech_Percentage", value); }
|
||||
|
||||
public boolean getHardcoreVampirismEnabled() { return config.getBoolean("Hardcore.Vampirism", false); }
|
||||
public void setHardcoreVampirismEnabled(boolean enabled) { config.set("Hardcore.Vampirism", enabled); }
|
||||
|
||||
/* SMP Mods */
|
||||
public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
|
||||
public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
|
||||
public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
|
||||
|
||||
/* Commands */
|
||||
public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
|
||||
public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
|
||||
public boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); }
|
||||
public boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); }
|
||||
public boolean getCommandAddLevelsEnabled() { return config.getBoolean("Commands.addlevels.Enabled", true); }
|
||||
public boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); }
|
||||
public boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); }
|
||||
public boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); }
|
||||
public boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); }
|
||||
public boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); }
|
||||
public boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); }
|
||||
public boolean getCommandSkillResetEnabled() { return config.getBoolean("Commands.skillreset.Enabled", true); }
|
||||
public boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); }
|
||||
public boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); }
|
||||
public boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); }
|
||||
public boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); }
|
||||
public boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); }
|
||||
public boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); }
|
||||
public boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); }
|
||||
public boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); }
|
||||
public boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); }
|
||||
|
||||
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); }
|
||||
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
|
||||
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
|
||||
|
||||
/* Items */
|
||||
public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }
|
||||
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
|
||||
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
||||
|
||||
/* PARTY SETTINGS */
|
||||
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
|
||||
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }
|
||||
public boolean getExpShareEnabled() { return config.getBoolean("Party.Sharing.ExpShare_enabled", true); }
|
||||
public double getPartyShareBonusBase() { return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1); }
|
||||
public double getPartyShareBonusIncrease() { return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05); }
|
||||
public double getPartyShareBonusCap() { return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5); }
|
||||
public boolean getItemShareEnabled() { return config.getBoolean("Party.Sharing.ItemShare_enabled", true); }
|
||||
public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0); }
|
||||
|
||||
/* Party Teleport Settings */
|
||||
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); }
|
||||
public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
|
||||
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Confirm_Required", true); }
|
||||
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
|
||||
|
||||
/*
|
||||
* ABILITY SETTINGS
|
||||
*/
|
||||
@@ -105,30 +129,13 @@ public class Config extends ConfigLoader {
|
||||
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
||||
|
||||
public int getCooldown(AbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||
public int getMaxTicks(AbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||
|
||||
/* Durability Settings */
|
||||
public boolean getAbilitiesDamageTools() { return config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true); }
|
||||
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 2); }
|
||||
|
||||
/* Cooldowns */
|
||||
public int getAbilityCooldownGreenTerra() { return config.getInt("Abilities.Cooldowns.Green_Terra", 240); }
|
||||
public int getAbilityCooldownSuperBreaker() { return config.getInt("Abilities.Cooldowns.Super_Breaker", 240); }
|
||||
public int getAbilityCooldownGigaDrillBreaker() { return config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240); }
|
||||
public int getAbilityCooldownTreeFeller() { return config.getInt("Abilities.Cooldowns.Tree_Feller", 240); }
|
||||
public int getAbilityCooldownBerserk() { return config.getInt("Abilities.Cooldowns.Berserk", 240); }
|
||||
public int getAbilityCooldownSerratedStrikes() { return config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240); }
|
||||
public int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); }
|
||||
public int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); }
|
||||
|
||||
/* Max ticks */
|
||||
public int getAbilityMaxTicksGreenTerra() { return config.getInt("Abilities.Max_Seconds.Green_Terra", 0); }
|
||||
public int getAbilityMaxTicksSuperBreaker() { return config.getInt("Abilities.Max_Seconds.Super_Breaker", 0); }
|
||||
public int getAbilityMaxTicksGigaDrillBreaker() { return config.getInt("Abilities.Max_Seconds.Giga_Drill_Breaker", 0); }
|
||||
public int getAbilityMaxTicksTreeFeller() { return config.getInt("Abilities.Max_Seconds.Tree_Feller", 0); }
|
||||
public int getAbilityMaxTicksBerserk() { return config.getInt("Abilities.Max_Seconds.Berserk", 0); }
|
||||
public int getAbilityMaxTicksSerratedStrikes() { return config.getInt("Abilities.Max_Seconds.Serrated_Strikes", 0); }
|
||||
public int getAbilityMaxTicksSkullSplitter() { return config.getInt("Abilities.Max_Seconds.Skull_Splitter", 0); }
|
||||
public int getAbilityMaxTicksBlastMining() { return config.getInt("Abilities.Max_Seconds.Blast_Mining", 0); }
|
||||
|
||||
/* Thresholds */
|
||||
public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }
|
||||
|
||||
@@ -136,124 +143,46 @@ public class Config extends ConfigLoader {
|
||||
* SKILL SETTINGS
|
||||
*/
|
||||
|
||||
/* Tool Requirements */
|
||||
public boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); }
|
||||
public boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); }
|
||||
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
|
||||
public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
public boolean getDoubleDropsEnabled(SkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
|
||||
/* Excavation */
|
||||
public int getExcavationBaseXP() { return config.getInt("Experience.Excavation.Base", 40); }
|
||||
public boolean getDoubleDropsDisabled(SkillType skill) {
|
||||
String skillName = StringUtils.getCapitalized(skill.toString());
|
||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
|
||||
Set<String> keys = section.getKeys(false);
|
||||
boolean disabled = true;
|
||||
|
||||
for (String key : keys) {
|
||||
if (config.getBoolean("Double_Drops." + skillName + "." + key)) {
|
||||
disabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return disabled;
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
|
||||
/* Fishing */
|
||||
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Fishing.Drops_Enabled", true); }
|
||||
public int getFishingTierLevelsTier1() { return config.getInt("Fishing.Tier_Levels.Tier1", 0); }
|
||||
public int getFishingTierLevelsTier2() { return config.getInt("Fishing.Tier_Levels.Tier2", 200); }
|
||||
public int getFishingTierLevelsTier3() { return config.getInt("Fishing.Tier_Levels.Tier3", 400); }
|
||||
public int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); }
|
||||
public int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); }
|
||||
|
||||
/* Herbalism */
|
||||
public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); }
|
||||
public int getHerbalismXPWheat() { return config.getInt("Experience.Herbalism.Wheat", 50); }
|
||||
public int getHerbalismXPCactus() { return config.getInt("Experience.Herbalism.Cactus", 30); }
|
||||
public int getHerbalismXPPumpkin() { return config.getInt("Experience.Herbalism.Pumpkin", 20); }
|
||||
public int getHerbalismXPFlowers() { return config.getInt("Experience.Herbalism.Flowers", 100); }
|
||||
public int getHerbalismXPMushrooms() { return config.getInt("Experience.Herbalism.Mushrooms", 150); }
|
||||
public int getHerbalismXPMelon() { return config.getInt("Experience.Herbalism.Melon", 20); }
|
||||
public int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); }
|
||||
public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); }
|
||||
public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); }
|
||||
|
||||
public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); }
|
||||
public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); }
|
||||
public boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); }
|
||||
|
||||
public boolean getBrownMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Brown_Mushrooms", true); }
|
||||
public boolean getCactiDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cacti", true); }
|
||||
public boolean getWheatDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Wheat", true); }
|
||||
public boolean getMelonsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Melons", true); }
|
||||
public boolean getNetherWartsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Nether_Warts", true); }
|
||||
public boolean getPumpkinsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Pumpkins", true); }
|
||||
public boolean getRedMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Mushrooms", true); }
|
||||
public boolean getRedRosesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Roses", true); }
|
||||
public boolean getSugarCaneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Sugar_Cane", true); }
|
||||
public boolean getVinesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Vines", true); }
|
||||
public boolean getWaterLiliesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Water_Lilies", true); }
|
||||
public boolean getYellowFlowersDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Yellow_Flowers", true); }
|
||||
|
||||
public boolean herbalismDoubleDropsDisabled() {
|
||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Herbalism");
|
||||
Set<String> keys = section.getKeys(false);
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
|
||||
boolean disabled = true;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
|
||||
if (config.getBoolean("Double_Drops.Herbalism." + key)) {
|
||||
disabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return disabled;
|
||||
}
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
|
||||
/* Mining */
|
||||
public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); }
|
||||
public int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); }
|
||||
public int getMiningXPIronOre() { return config.getInt("Experience.Mining.Iron", 250); }
|
||||
public int getMiningXPRedstoneOre() { return config.getInt("Experience.Mining.Redstone", 150); }
|
||||
public int getMiningXPLapisOre() { return config.getInt("Experience.Mining.Lapis", 400); }
|
||||
public int getMiningXPObsidian() { return config.getInt("Experience.Mining.Obsidian", 150); }
|
||||
public int getMiningXPNetherrack() { return config.getInt("Experience.Mining.Netherrack", 30); }
|
||||
public int getMiningXPGlowstone() { return config.getInt("Experience.Mining.Glowstone", 30); }
|
||||
public int getMiningXPCoalOre() { return config.getInt("Experience.Mining.Coal", 100); }
|
||||
public int getMiningXPStone() { return config.getInt("Experience.Mining.Stone", 30); }
|
||||
public int getMiningXPSandstone() { return config.getInt("Experience.Mining.Sandstone", 30); }
|
||||
public int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); }
|
||||
public int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); }
|
||||
|
||||
public boolean getCoalDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Coal", true); }
|
||||
public boolean getDiamondDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Diamond", true); }
|
||||
public boolean getEndStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.End_Stone", true); }
|
||||
public boolean getGlowstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Glowstone", true); }
|
||||
public boolean getGoldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Gold", true); }
|
||||
public boolean getIronDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Iron", true); }
|
||||
public boolean getLapisDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Lapis", true); }
|
||||
public boolean getMossyCobblestoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Moss_Stone", true); }
|
||||
public boolean getNetherrackDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Netherrack", true); }
|
||||
public boolean getObsidianDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Obsidian", true); }
|
||||
public boolean getRedstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Redstone", true); }
|
||||
public boolean getSandstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Sandstone", true); }
|
||||
public boolean getStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Stone", true); }
|
||||
|
||||
public boolean miningDoubleDropsDisabled() {
|
||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Mining");
|
||||
Set<String> keys = section.getKeys(false);
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
|
||||
boolean disabled = true;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
|
||||
if (config.getBoolean("Double_Drops.Mining." + key)) {
|
||||
disabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
|
||||
|
||||
/* Repair */
|
||||
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
||||
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
|
||||
public boolean getSalvageEnabled() { return config.getBoolean("Skills.Repair.Salvage_enabled", true); }
|
||||
public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); }
|
||||
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage_UnlockLevel", 600); }
|
||||
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
|
||||
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
|
||||
|
||||
/* Unarmed */
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
|
||||
@@ -262,79 +191,38 @@ public class Config extends ConfigLoader {
|
||||
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
||||
|
||||
/* Woodcutting */
|
||||
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
|
||||
|
||||
public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
|
||||
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
|
||||
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
|
||||
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
|
||||
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
|
||||
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
|
||||
|
||||
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
|
||||
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
|
||||
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
|
||||
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
|
||||
|
||||
public boolean woodcuttingDoubleDropsDisabled() {
|
||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Woodcutting");
|
||||
Set<String> keys = section.getKeys(false);
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
|
||||
boolean disabled = true;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
|
||||
if (config.getBoolean("Double_Drops.Woodcutting." + key)) {
|
||||
disabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return disabled;
|
||||
}
|
||||
|
||||
/* Arcane Forging */
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); }
|
||||
public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); }
|
||||
public int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); }
|
||||
public int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); }
|
||||
public int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); }
|
||||
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); }
|
||||
public int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); }
|
||||
public int getArcaneForgingRankLevels1() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); }
|
||||
public int getArcaneForgingRankLevels2() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); }
|
||||
public int getArcaneForgingRankLevels3() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); }
|
||||
public int getArcaneForgingRankLevels4() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); }
|
||||
/* AFK Leveling */
|
||||
public boolean getAcrobaticsAFKDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
|
||||
public boolean getHerbalismAFKDisabled() { return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true); }
|
||||
|
||||
/* Level Caps */
|
||||
public int getLevelCapAcrobatics() { return config.getInt("Skills.Acrobatics.Level_Cap", 0); }
|
||||
public int getLevelCapArchery() { return config.getInt("Skills.Archery.Level_Cap", 0); }
|
||||
public int getLevelCapAxes() { return config.getInt("Skills.Axes.Level_Cap", 0); }
|
||||
public int getLevelCapExcavation() { return config.getInt("Skills.Excavation.Level_Cap", 0); }
|
||||
public int getLevelCapFishing() { return config.getInt("Skills.Fishing.Level_Cap", 0); }
|
||||
public int getLevelCapHerbalism() { return config.getInt("Skills.Herbalism.Level_Cap", 0); }
|
||||
public int getLevelCapMining() { return config.getInt("Skills.Mining.Level_Cap", 0); }
|
||||
public int getLevelCapRepair() { return config.getInt("Skills.Repair.Level_Cap", 0); }
|
||||
public int getLevelCapSwords() { return config.getInt("Skills.Swords.Level_Cap", 0); }
|
||||
public int getLevelCapTaming() { return config.getInt("Skills.Taming.Level_Cap", 0); }
|
||||
public int getLevelCapUnarmed() { return config.getInt("Skills.Unarmed.Level_Cap", 0); }
|
||||
public int getLevelCapWoodcutting() { return config.getInt("Skills.Woodcutting.Level_Cap", 0); }
|
||||
public int getPowerLevelCap() { return config.getInt("General.Power_Level_Cap", 0); }
|
||||
public int getPowerLevelCap() {
|
||||
int cap = config.getInt("General.Power_Level_Cap", 0);
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
public int getLevelCap(SkillType skill) {
|
||||
int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
/* PVP & PVE Settings */
|
||||
public boolean getAcrobaticsPVP() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVP", true); }
|
||||
public boolean getAcrobaticsPVE() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVE", true); }
|
||||
public boolean getArcheryPVP() { return config.getBoolean("Skills.Archery.Enabled_For_PVP", true); }
|
||||
public boolean getArcheryPVE() { return config.getBoolean("Skills.Archery.Enabled_For_PVE", true); }
|
||||
public boolean getAxesPVP() { return config.getBoolean("Skills.Axes.Enabled_For_PVP", true); }
|
||||
public boolean getAxesPVE() { return config.getBoolean("Skills.Axes.Enabled_For_PVE", true); }
|
||||
public boolean getSwordsPVP() { return config.getBoolean("Skills.Swords.Enabled_For_PVP", true); }
|
||||
public boolean getSwordsPVE() { return config.getBoolean("Skills.Swords.Enabled_For_PVE", true); }
|
||||
public boolean getTamingPVP() { return config.getBoolean("Skills.Taming.Enabled_For_PVP", true); }
|
||||
public boolean getTamingPVE() { return config.getBoolean("Skills.Taming.Enabled_For_PVE", true); }
|
||||
public boolean getUnarmedPVP() { return config.getBoolean("Skills.Unarmed.Enabled_For_PVP", true); }
|
||||
public boolean getUnarmedPVE() { return config.getBoolean("Skills.Unarmed.Enabled_For_PVE", true); }
|
||||
public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
|
||||
public boolean getPVEEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
@@ -343,38 +231,19 @@ public class Config extends ConfigLoader {
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); }
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
|
||||
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience.Gains.Multiplier.Global", 1.0); }
|
||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience.Gains.Multiplier.Global", value); }
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); }
|
||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
|
||||
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
|
||||
public double getCreeperXP() { return config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); }
|
||||
public double getSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); }
|
||||
public double getSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Spider", 3.0); }
|
||||
public double getGhastXP() { return config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0); }
|
||||
public double getSlimeXP() { return config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); }
|
||||
public double getZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); }
|
||||
public double getPigZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); }
|
||||
public double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0); }
|
||||
public double getCaveSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); }
|
||||
public double getSilverfishXP() { return config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); }
|
||||
public double getBlazeXP() { return config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); }
|
||||
public double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); }
|
||||
public double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); }
|
||||
public double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); }
|
||||
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
|
||||
|
||||
|
||||
/* XP Formula Multiplier */
|
||||
public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); }
|
||||
public double getFormulaMultiplierTaming() { return config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); }
|
||||
public double getFormulaMultiplierMining() { return config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); }
|
||||
public double getFormulaMultiplierRepair() { return config.getDouble("Experience.Formula.Multiplier.Repair", 1.0); }
|
||||
public double getFormulaMultiplierWoodcutting() { return config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); }
|
||||
public double getFormulaMultiplierUnarmed() { return config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0); }
|
||||
public double getFormulaMultiplierHerbalism() { return config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0); }
|
||||
public double getFormulaMultiplierExcavation() { return config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0); }
|
||||
public double getFormulaMultiplierArchery() { return config.getDouble("Experience.Formula.Multiplier.Archery", 1.0); }
|
||||
public double getFormulaMultiplierSwords() { return config.getDouble("Experience.Formula.Multiplier.Swords", 1.0); }
|
||||
public double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); }
|
||||
public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); }
|
||||
public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); }
|
||||
public double getForumulaMultiplier(SkillType skill) { return config.getDouble("Experience.Formula.Multiplier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.metrics.MetricsManager;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
protected static final mcMMO plugin = mcMMO.p;
|
||||
@@ -16,13 +24,13 @@ public abstract class ConfigLoader {
|
||||
protected File configFile;
|
||||
protected FileConfiguration config;
|
||||
|
||||
public ConfigLoader(String relativePath, String fileName){
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
public ConfigLoader(String fileName){
|
||||
public ConfigLoader(String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), fileName);
|
||||
loadFile();
|
||||
@@ -38,6 +46,98 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResource(fileName));
|
||||
|
||||
Set<String> configKeys = config.getKeys(true);
|
||||
Set<String> internalConfigKeys = internalConfig.getKeys(true);
|
||||
|
||||
boolean needSave = false;
|
||||
|
||||
Set<String> oldKeys = new HashSet<String>(configKeys);
|
||||
oldKeys.removeAll(internalConfigKeys);
|
||||
|
||||
Set<String> newKeys = new HashSet<String>(internalConfigKeys);
|
||||
newKeys.removeAll(configKeys);
|
||||
|
||||
// Don't need a re-save if we have old keys sticking around?
|
||||
// Would be less saving, but less... correct?
|
||||
if (!newKeys.isEmpty() || !oldKeys.isEmpty()) {
|
||||
needSave = true;
|
||||
}
|
||||
|
||||
for (String key : oldKeys) {
|
||||
plugin.debug("Removing unused key: " + key);
|
||||
config.set(key, null);
|
||||
}
|
||||
|
||||
for (String key : newKeys) {
|
||||
plugin.debug("Adding new key: " + key + " = " + internalConfig.get(key));
|
||||
config.set(key, internalConfig.get(key));
|
||||
}
|
||||
|
||||
if (needSave) {
|
||||
// Get Bukkit's version of an acceptable config with new keys, and no old keys
|
||||
String output = config.saveToString();
|
||||
|
||||
// Convert to the superior 4 space indentation
|
||||
output = output.replace(" ", " ");
|
||||
|
||||
// Rip out Bukkit's attempt to save comments at the top of the file
|
||||
while (output.indexOf('#') != -1) {
|
||||
output = output.substring(output.indexOf('\n', output.indexOf('#'))+1);
|
||||
}
|
||||
|
||||
// Read the internal config to get comments, then put them in the new one
|
||||
try {
|
||||
// Read internal
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource(fileName)));
|
||||
HashMap<String, String> comments = new HashMap<String, String>();
|
||||
String temp = "";
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains("#")) {
|
||||
temp += line + "\n";
|
||||
}
|
||||
else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if(!temp.isEmpty()) {
|
||||
comments.put(line, temp);
|
||||
temp = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dump to the new one
|
||||
for (String key : comments.keySet()) {
|
||||
if (output.indexOf(key) != -1) {
|
||||
output = output.substring(0, output.indexOf(key)) + comments.get(key) + output.substring(output.indexOf(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Save it
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(plugin.getDataFolder(), fileName)));
|
||||
writer.write(output);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (String key : configKeys) {
|
||||
if (!config.isConfigurationSection(key) && !config.get(key).equals(internalConfig.get(key))) {
|
||||
MetricsManager.customConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void loadKeys();
|
||||
@@ -59,7 +159,7 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().severe("Missing ressource file: '" + fileName + "' please notify the plugin authors");
|
||||
plugin.getLogger().severe("Missing resource file: '" + fileName + "' please notify the plugin authors");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ public class HiddenConfig {
|
||||
private static String fileName;
|
||||
private static YamlConfiguration config;
|
||||
private static boolean chunkletsEnabled;
|
||||
private static int conversionRate;
|
||||
private static boolean useEnchantmentBuffs;
|
||||
|
||||
public HiddenConfig(String fileName) {
|
||||
HiddenConfig.fileName = fileName;
|
||||
@@ -27,10 +29,20 @@ public class HiddenConfig {
|
||||
if (mcMMO.p.getResource(fileName) != null) {
|
||||
config = YamlConfiguration.loadConfiguration(mcMMO.p.getResource(fileName));
|
||||
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
||||
conversionRate = config.getInt("Options.ConversionRate", 1);
|
||||
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getChunkletsEnabled() {
|
||||
return chunkletsEnabled;
|
||||
}
|
||||
|
||||
public int getConversionRate() {
|
||||
return conversionRate;
|
||||
}
|
||||
|
||||
public boolean useEnchantmentBuffs() {
|
||||
return useEnchantmentBuffs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -11,12 +10,14 @@ import java.util.Set;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.Treasure;
|
||||
|
||||
public class TreasuresConfig extends ConfigLoader{
|
||||
public class TreasuresConfig extends ConfigLoader {
|
||||
private static TreasuresConfig instance;
|
||||
public List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
|
||||
@@ -25,11 +26,12 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
|
||||
public List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
|
||||
public List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
|
||||
public List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
|
||||
public List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
|
||||
public List<FishingTreasure> fishingRewardsTier5 = new ArrayList<FishingTreasure>();
|
||||
|
||||
public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>();
|
||||
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
|
||||
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
|
||||
|
||||
public List<FishingTreasure> fishingRewards = new ArrayList<FishingTreasure>();
|
||||
|
||||
private TreasuresConfig() {
|
||||
super("treasures.yml");
|
||||
@@ -49,10 +51,8 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
|
||||
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
|
||||
Set<String> treasureConfigSet = treasureSection.getKeys(false);
|
||||
Iterator<String> iterator = treasureConfigSet.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String treasureName = iterator.next();
|
||||
for (String treasureName : treasureConfigSet) {
|
||||
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
@@ -125,7 +125,7 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
* Drops From & Max Level
|
||||
*/
|
||||
|
||||
ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data);
|
||||
ItemStack item = (new MaterialData(id, (byte) data)).toItemStack(amount);
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
||||
@@ -138,10 +138,6 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
|
||||
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
|
||||
|
||||
if (maxLevel < 0) {
|
||||
reason.add("Invalid Max_Level: " + maxLevel);
|
||||
}
|
||||
|
||||
if (noErrorsInTreasure(reason)) {
|
||||
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
|
||||
treasures.put(treasureName, fTreasure);
|
||||
@@ -149,6 +145,7 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
}
|
||||
else {
|
||||
ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
HylianTreasure hTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) {
|
||||
eTreasure.setDropsFromDirt();
|
||||
@@ -178,23 +175,36 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
eTreasure.setDropsFromSoulSand();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Bushes", false)) {
|
||||
hTreasure.setDropsFromBushes();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Flowers", false)) {
|
||||
hTreasure.setDropsFromFlowers();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Pots", false)) {
|
||||
hTreasure.setDropsFromPots();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
reason.add("Excavation drops cannot also be fishing drops");
|
||||
}
|
||||
|
||||
if (noErrorsInTreasure(reason)) {
|
||||
if (noErrorsInTreasure(reason) && hTreasure.getDropsFrom() == (byte) 0x0) {
|
||||
treasures.put(treasureName, eTreasure);
|
||||
}
|
||||
else if (noErrorsInTreasure(reason) && eTreasure.getDropsFrom() == (byte) 0x0){
|
||||
treasures.put(treasureName, hTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
|
||||
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
|
||||
// Iterator<String> treasureIterator = treasures.keySet().iterator();
|
||||
Iterator<Entry<String,Treasure>> treasureIterator = treasures.entrySet().iterator();
|
||||
List<String> hylianTreasures = config.getStringList("Hylian_Luck.Treasure");
|
||||
|
||||
while (treasureIterator.hasNext()) {
|
||||
Entry<String,Treasure> nextEntry = treasureIterator.next();
|
||||
for (Entry<String,Treasure> nextEntry : treasures.entrySet()) {
|
||||
String treasureKey = nextEntry.getKey();
|
||||
Treasure treasure = nextEntry.getValue();
|
||||
|
||||
@@ -203,30 +213,26 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
continue;
|
||||
}
|
||||
|
||||
FishingTreasure fTreasure = (FishingTreasure) treasure;
|
||||
int dropLevel = fTreasure.getDropLevel();
|
||||
int maxLevel = fTreasure.getMaxLevel();
|
||||
|
||||
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) {
|
||||
fishingRewardsTier1.add(fTreasure);
|
||||
fishingRewards.add((FishingTreasure) treasure);
|
||||
}
|
||||
else if (treasure instanceof HylianTreasure) {
|
||||
if (!hylianTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
|
||||
fishingRewardsTier2.add(fTreasure);
|
||||
HylianTreasure hTreasure = (HylianTreasure) treasure;
|
||||
|
||||
if (hTreasure.getDropsFromBushes()) {
|
||||
hylianFromBushes.add(hTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier3() && maxLevel >= Config.getInstance().getFishingTierLevelsTier3()) {
|
||||
fishingRewardsTier3.add(fTreasure);
|
||||
if (hTreasure.getDropsFromFlowers()) {
|
||||
hylianFromFlowers.add(hTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier4() && maxLevel >= Config.getInstance().getFishingTierLevelsTier4()) {
|
||||
fishingRewardsTier4.add(fTreasure);
|
||||
if (hTreasure.getDropsFromPots()) {
|
||||
hylianFromPots.add(hTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier5() && maxLevel >= Config.getInstance().getFishingTierLevelsTier5()) {
|
||||
fishingRewardsTier5.add(fTreasure);
|
||||
}
|
||||
|
||||
}
|
||||
else if (treasure instanceof ExcavationTreasure) {
|
||||
if (!excavationTreasures.contains(treasureKey)) {
|
||||
@@ -270,11 +276,10 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
if (issues.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
}
|
||||
return false;
|
||||
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
610
src/main/java/com/gmail/nossr50/database/Database.java
Normal file
610
src/main/java/com/gmail/nossr50/database/Database.java
Normal file
@@ -0,0 +1,610 @@
|
||||
package com.gmail.nossr50.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.runnables.SQLReconnect;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.spout.SpoutTools;
|
||||
import com.gmail.nossr50.spout.huds.SpoutHud;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class Database {
|
||||
private static String connectionString;
|
||||
|
||||
private static String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
private static Connection connection = null;
|
||||
|
||||
// Scale waiting time by this much per failed attempt
|
||||
private static final double SCALING_FACTOR = 40;
|
||||
|
||||
// Minimum wait in nanoseconds (default 500ms)
|
||||
private static final long MIN_WAIT = 500L*1000000L;
|
||||
|
||||
// Maximum time to wait between reconnects (default 5 minutes)
|
||||
private static final long MAX_WAIT = 5L * 60L * 1000L * 1000000L;
|
||||
|
||||
// How long to wait when checking if connection is valid (default 3 seconds)
|
||||
private static final int VALID_TIMEOUT = 3;
|
||||
|
||||
// When next to try connecting to Database in nanoseconds
|
||||
private static long nextReconnectTimestamp = 0L;
|
||||
|
||||
// How many connection attemtps have failed
|
||||
private static int reconnectAttempt = 0;
|
||||
|
||||
private Database() {}
|
||||
|
||||
/**
|
||||
* Attempt to connect to the mySQL database.
|
||||
*/
|
||||
public static void connect() {
|
||||
Config configInstance = Config.getInstance();
|
||||
connectionString = "jdbc:mysql://" + configInstance.getMySQLServerName() + ":" + configInstance.getMySQLServerPort() + "/" + configInstance.getMySQLDatabaseName();
|
||||
|
||||
try {
|
||||
mcMMO.p.getLogger().info("Attempting connection to MySQL...");
|
||||
|
||||
// Force driver to load if not yet loaded
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
Properties connectionProperties = new Properties();
|
||||
connectionProperties.put("user", configInstance.getMySQLUserName());
|
||||
connectionProperties.put("password", configInstance.getMySQLUserPassword());
|
||||
connectionProperties.put("autoReconnect", "false");
|
||||
connectionProperties.put("maxReconnects", "0");
|
||||
connection = DriverManager.getConnection(connectionString, connectionProperties);
|
||||
|
||||
mcMMO.p.getLogger().info("Connection to MySQL was a success!");
|
||||
} catch (SQLException ex) {
|
||||
connection = null;
|
||||
if (reconnectAttempt == 0 || reconnectAttempt >= 11) {
|
||||
mcMMO.p.getLogger().info("Connection to MySQL failed!");
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
connection = null;
|
||||
if (reconnectAttempt == 0 || reconnectAttempt >= 11) {
|
||||
mcMMO.p.getLogger().info("MySQL database driver not found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to create the database structure.
|
||||
*/
|
||||
public static void createStructure() {
|
||||
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` ("
|
||||
+ "`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`lastlogin` int(32) unsigned NOT NULL,"
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`hudtype` varchar(50) NOT NULL DEFAULT 'STANDARD',"
|
||||
+ "PRIMARY KEY (`user_id`),"
|
||||
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
|
||||
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`),"
|
||||
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
|
||||
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`),"
|
||||
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
|
||||
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`),"
|
||||
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
|
||||
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
|
||||
checkDatabaseStructure(DatabaseUpdate.FISHING);
|
||||
checkDatabaseStructure(DatabaseUpdate.BLAST_MINING);
|
||||
checkDatabaseStructure(DatabaseUpdate.CASCADE_DELETE);
|
||||
checkDatabaseStructure(DatabaseUpdate.INDEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check database structure for missing values.
|
||||
*
|
||||
* @param update Type of data to check updates for
|
||||
*/
|
||||
private static void checkDatabaseStructure(DatabaseUpdate update) {
|
||||
String sql = null;
|
||||
ResultSet resultSet = null;
|
||||
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
|
||||
|
||||
switch (update) {
|
||||
case BLAST_MINING:
|
||||
sql = "SELECT * FROM `" + tablePrefix + "cooldowns` ORDER BY `" + tablePrefix + "cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
|
||||
break;
|
||||
|
||||
case CASCADE_DELETE:
|
||||
write("ALTER TABLE `" + tablePrefix + "huds` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
|
||||
write("ALTER TABLE `" + tablePrefix + "experience` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
|
||||
write("ALTER TABLE `" + tablePrefix + "cooldowns` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
|
||||
write("ALTER TABLE `" + tablePrefix + "skills` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
|
||||
break;
|
||||
|
||||
case FISHING:
|
||||
sql = "SELECT * FROM `" + tablePrefix + "experience` ORDER BY `" + tablePrefix + "experience`.`fishing` ASC LIMIT 0 , 30";
|
||||
break;
|
||||
|
||||
case INDEX:
|
||||
if (read("SHOW INDEX FROM " + tablePrefix + "skills").size() != 13 && checkConnected()) {
|
||||
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
|
||||
write("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_taming` (`taming`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_mining` (`mining`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_woodcutting` (`woodcutting`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_repair` (`repair`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_unarmed` (`unarmed`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_herbalism` (`herbalism`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_excavation` (`excavation`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_archery` (`archery`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_swords` (`swords`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_axes` (`axes`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_acrobatics` (`acrobatics`) USING BTREE, "
|
||||
+ "ADD INDEX `idx_fishing` (`fishing`) USING BTREE;");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
if (!checkConnected()) return;
|
||||
statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
while (resultSet.next()) {
|
||||
ArrayList<String> column = new ArrayList<String>();
|
||||
|
||||
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
|
||||
column.add(resultSet.getString(i));
|
||||
}
|
||||
|
||||
rows.put(resultSet.getRow(), column);
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
switch (update) {
|
||||
case BLAST_MINING:
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Blast Mining...");
|
||||
write("ALTER TABLE `"+tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
|
||||
break;
|
||||
|
||||
case FISHING:
|
||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
|
||||
write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException e) {
|
||||
// Ignore the error, we're leaving
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
// Ignore the error, we're leaving
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to write the SQL query.
|
||||
*
|
||||
* @param sql Query to write.
|
||||
* @return true if the query was successfully written, false otherwise.
|
||||
*/
|
||||
public static boolean write(String sql) {
|
||||
if (checkConnected()) {
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = connection.prepareStatement(sql);
|
||||
statement.executeUpdate();
|
||||
return true;
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
return false;
|
||||
} finally {
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
printErrors(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows affected by either a DELETE or UPDATE query
|
||||
*
|
||||
* @param sql SQL query to execute
|
||||
* @return the number of rows affected
|
||||
*/
|
||||
public static int update(String sql) {
|
||||
int ret = 0;
|
||||
if (checkConnected()) {
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = connection.prepareStatement(sql);
|
||||
ret = statement.executeUpdate();
|
||||
return ret;
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
return 0;
|
||||
} finally {
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
printErrors(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Integer. Only return first row / first field.
|
||||
*
|
||||
* @param sql SQL query to execute
|
||||
* @return the value in the first row / first field
|
||||
*/
|
||||
public static int getInt(String sql) {
|
||||
ResultSet resultSet;
|
||||
int result = 0;
|
||||
|
||||
if (checkConnected()) {
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
result = resultSet.getInt(1);
|
||||
}
|
||||
else {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check connection status and re-establish if dead or stale.
|
||||
*
|
||||
* If the very first immediate attempt fails, further attempts
|
||||
* will be made in progressively larger intervals up to MAX_WAIT
|
||||
* intervals.
|
||||
*
|
||||
* This allows for MySQL to time out idle connections as needed by
|
||||
* server operator, without affecting McMMO, while still providing
|
||||
* protection against a database outage taking down Bukkit's tick
|
||||
* processing loop due to attemping a database connection each
|
||||
* time McMMO needs the database.
|
||||
*
|
||||
* @return the boolean value for whether or not we are connected
|
||||
*/
|
||||
public static boolean checkConnected() {
|
||||
boolean isClosed = true;
|
||||
boolean isValid = false;
|
||||
boolean exists = (connection != null);
|
||||
|
||||
// If we're waiting for server to recover then leave early
|
||||
if (nextReconnectTimestamp > 0 && nextReconnectTimestamp > System.nanoTime()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
try {
|
||||
isClosed = connection.isClosed();
|
||||
} catch (SQLException e) {
|
||||
isClosed = true;
|
||||
e.printStackTrace();
|
||||
printErrors(e);
|
||||
}
|
||||
|
||||
if (!isClosed) {
|
||||
try {
|
||||
isValid = connection.isValid(VALID_TIMEOUT);
|
||||
} catch (SQLException e) {
|
||||
// Don't print stack trace because it's valid to lose idle connections
|
||||
// to the server and have to restart them.
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Leave if all ok
|
||||
if (exists && !isClosed && isValid) {
|
||||
// Housekeeping
|
||||
nextReconnectTimestamp = 0;
|
||||
reconnectAttempt = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cleanup after ourselves for GC and MySQL's sake
|
||||
if (exists && !isClosed) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException ex) {
|
||||
// This is a housekeeping exercise, ignore errors
|
||||
}
|
||||
}
|
||||
|
||||
// Try to connect again
|
||||
connect();
|
||||
|
||||
// Leave if connection is good
|
||||
try {
|
||||
if (connection != null && !connection.isClosed()) {
|
||||
// Schedule a database save if we really had an outage
|
||||
if (reconnectAttempt > 1) {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new SQLReconnect(), 5);
|
||||
}
|
||||
nextReconnectTimestamp = 0;
|
||||
reconnectAttempt = 0;
|
||||
return true;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// Failed to check isClosed, so presume connection is bad and attempt later
|
||||
e.printStackTrace();
|
||||
printErrors(e);
|
||||
}
|
||||
|
||||
reconnectAttempt++;
|
||||
|
||||
nextReconnectTimestamp = (long)(System.nanoTime() + Math.min(MAX_WAIT, (reconnectAttempt*SCALING_FACTOR*MIN_WAIT)));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read SQL query.
|
||||
*
|
||||
* @param sql SQL query to read
|
||||
* @return the rows in this SQL query
|
||||
*/
|
||||
public static HashMap<Integer, ArrayList<String>> read(String sql) {
|
||||
ResultSet resultSet;
|
||||
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
|
||||
|
||||
if (checkConnected()) {
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
while (resultSet.next()) {
|
||||
ArrayList<String> column = new ArrayList<String>();
|
||||
|
||||
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
|
||||
column.add(resultSet.getString(i));
|
||||
}
|
||||
|
||||
rows.put(resultSet.getRow(), column);
|
||||
}
|
||||
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> readSQLRank(String playerName) {
|
||||
ResultSet resultSet;
|
||||
Map<String, Integer> skills = new HashMap<String, Integer>();
|
||||
|
||||
if (checkConnected()) {
|
||||
try {
|
||||
for (SkillType skillType: SkillType.values()) {
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " > (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "')";
|
||||
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
resultSet.next();
|
||||
|
||||
int rank = resultSet.getInt("rank");
|
||||
|
||||
sql = "SELECT user, " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " = (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "') ORDER BY user";
|
||||
|
||||
statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
while (resultSet.next()) {
|
||||
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
|
||||
skills.put(skillType.name(), rank + resultSet.getRow());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
statement.close();
|
||||
}
|
||||
|
||||
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > 0 AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "')";
|
||||
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
resultSet.next();
|
||||
|
||||
int rank = resultSet.getInt("rank");
|
||||
|
||||
sql = "SELECT user, taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > 0 AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing = (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "') ORDER BY user";
|
||||
|
||||
statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
while (resultSet.next()) {
|
||||
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
|
||||
skills.put("ALL", rank + resultSet.getRow());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return skills;
|
||||
}
|
||||
|
||||
public static void purgePowerlessSQL() {
|
||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
||||
HashMap<Integer, ArrayList<String>> usernames = read("SELECT u.user FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE s.user_id = u.id AND (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0");
|
||||
write("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.id IN (SELECT * FROM (SELECT u.id FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE s.user_id = u.id AND (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0) AS p)");
|
||||
|
||||
int purgedUsers = 0;
|
||||
for (int i = 1; i <= usernames.size(); i++) {
|
||||
String playerName = usernames.get(i).get(0);
|
||||
|
||||
if (playerName == null || Bukkit.getOfflinePlayer(playerName).isOnline()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profileCleanup(playerName);
|
||||
purgedUsers++;
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
|
||||
}
|
||||
|
||||
public static void purgeOldSQL() {
|
||||
mcMMO.p.getLogger().info("Purging old users...");
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long purgeTime = 2630000000L * Config.getInstance().getOldUsersCutoff();
|
||||
HashMap<Integer, ArrayList<String>> usernames = read("SELECT user FROM " + tablePrefix + "users WHERE ((" + currentTime + " - lastlogin*1000) > " + purgeTime + ")");
|
||||
write("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.id IN (SELECT * FROM (SELECT id FROM " + tablePrefix + "users WHERE ((" + currentTime + " - lastlogin*1000) > " + purgeTime + ")) AS p)");
|
||||
|
||||
int purgedUsers = 0;
|
||||
for (int i = 1; i <= usernames.size(); i++) {
|
||||
String playerName = usernames.get(i).get(0);
|
||||
|
||||
if (playerName == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
profileCleanup(playerName);
|
||||
purgedUsers++;
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
|
||||
}
|
||||
|
||||
private static void printErrors(SQLException ex) {
|
||||
mcMMO.p.getLogger().severe("SQLException: " + ex.getMessage());
|
||||
mcMMO.p.getLogger().severe("SQLState: " + ex.getSQLState());
|
||||
mcMMO.p.getLogger().severe("VendorError: " + ex.getErrorCode());
|
||||
}
|
||||
|
||||
public static void profileCleanup(String playerName) {
|
||||
McMMOPlayer mcmmoPlayer = Users.getPlayer(playerName);
|
||||
|
||||
if (mcmmoPlayer != null) {
|
||||
Player player = mcmmoPlayer.getPlayer();
|
||||
SpoutHud spoutHud = mcmmoPlayer.getProfile().getSpoutHud();
|
||||
|
||||
if (spoutHud != null) {
|
||||
spoutHud.removeWidgets();
|
||||
}
|
||||
|
||||
Users.remove(playerName);
|
||||
|
||||
if (player.isOnline()) {
|
||||
Users.addUser(player);
|
||||
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutTools.reloadSpoutPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.gmail.nossr50.database;
|
||||
|
||||
public enum DatabaseUpdate {
|
||||
FISHING,
|
||||
BLAST_MINING,
|
||||
CASCADE_DELETE,
|
||||
INDEX;
|
||||
}
|
||||
401
src/main/java/com/gmail/nossr50/database/Leaderboard.java
Normal file
401
src/main/java/com/gmail/nossr50/database/Leaderboard.java
Normal file
@@ -0,0 +1,401 @@
|
||||
package com.gmail.nossr50.database;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public final class Leaderboard {
|
||||
private static HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||
private static List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
||||
private static long lastUpdate = 0;
|
||||
|
||||
private Leaderboard() {}
|
||||
|
||||
/**
|
||||
* Update the leader boards.
|
||||
*/
|
||||
public static void updateLeaderboards() {
|
||||
if(System.currentTimeMillis() < lastUpdate + 600000) {
|
||||
return; //Only update FFS leaderboards every 10 minutes.. this puts a lot of strain on the server (depending on the size of the database) and should not be done frequently
|
||||
}
|
||||
|
||||
lastUpdate = System.currentTimeMillis(); //Log when the last update was run
|
||||
|
||||
//Initialize lists
|
||||
List<PlayerStat> mining, woodcutting, herbalism, excavation, acrobatics, repair, swords, axes, archery, unarmed, taming, fishing;
|
||||
|
||||
mining = new ArrayList<PlayerStat>();
|
||||
woodcutting = new ArrayList<PlayerStat>();
|
||||
herbalism = new ArrayList<PlayerStat>();
|
||||
excavation = new ArrayList<PlayerStat>();
|
||||
acrobatics = new ArrayList<PlayerStat>();
|
||||
repair = new ArrayList<PlayerStat>();
|
||||
swords = new ArrayList<PlayerStat>();
|
||||
axes = new ArrayList<PlayerStat>();
|
||||
archery = new ArrayList<PlayerStat>();
|
||||
unarmed = new ArrayList<PlayerStat>();
|
||||
taming = new ArrayList<PlayerStat>();
|
||||
fishing = new ArrayList<PlayerStat>();
|
||||
powerLevels = new ArrayList<PlayerStat>();
|
||||
|
||||
//Read from the FlatFile database and fill our arrays with information
|
||||
try {
|
||||
FileReader file = new FileReader(mcMMO.getUsersFilePath());
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
ArrayList<String> players = new ArrayList<String>();
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] character = line.split(":");
|
||||
|
||||
String p = character[0];
|
||||
int powerLevel = 0;
|
||||
|
||||
//Prevent the same player from being added multiple times (I'd like to note that this shouldn't happen...)
|
||||
if (players.contains(p)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
players.add(p);
|
||||
|
||||
if (character.length > 1 && StringUtils.isInt(character[1])) {
|
||||
mining.add(new PlayerStat(p, Integer.parseInt(character[1])));
|
||||
powerLevel += Integer.parseInt(character[1]);
|
||||
}
|
||||
|
||||
if (character.length > 5 && StringUtils.isInt(character[5])) {
|
||||
woodcutting.add(new PlayerStat(p, Integer.parseInt(character[5])));
|
||||
powerLevel += Integer.parseInt(character[5]);
|
||||
}
|
||||
|
||||
if (character.length > 7 && StringUtils.isInt(character[7])) {
|
||||
repair.add(new PlayerStat(p, Integer.parseInt(character[7])));
|
||||
powerLevel += Integer.parseInt(character[7]);
|
||||
}
|
||||
|
||||
if (character.length > 8 && StringUtils.isInt(character[8])) {
|
||||
unarmed.add(new PlayerStat(p, Integer.parseInt(character[8])));
|
||||
powerLevel += Integer.parseInt(character[8]);
|
||||
}
|
||||
|
||||
if (character.length > 9 && StringUtils.isInt(character[9])) {
|
||||
herbalism.add(new PlayerStat(p, Integer.parseInt(character[9])));
|
||||
powerLevel += Integer.parseInt(character[9]);
|
||||
}
|
||||
|
||||
if (character.length > 10 && StringUtils.isInt(character[10])) {
|
||||
excavation.add(new PlayerStat(p, Integer.parseInt(character[10])));
|
||||
powerLevel += Integer.parseInt(character[10]);
|
||||
}
|
||||
|
||||
if (character.length > 11 && StringUtils.isInt(character[11])) {
|
||||
archery.add(new PlayerStat(p, Integer.parseInt(character[11])));
|
||||
powerLevel += Integer.parseInt(character[11]);
|
||||
}
|
||||
|
||||
if (character.length > 12 && StringUtils.isInt(character[12])) {
|
||||
swords.add(new PlayerStat(p, Integer.parseInt(character[12])));
|
||||
powerLevel += Integer.parseInt(character[12]);
|
||||
}
|
||||
|
||||
if (character.length > 13 && StringUtils.isInt(character[13])) {
|
||||
axes.add(new PlayerStat(p, Integer.parseInt(character[13])));
|
||||
powerLevel += Integer.parseInt(character[13]);
|
||||
}
|
||||
|
||||
if (character.length > 14 && StringUtils.isInt(character[14])) {
|
||||
acrobatics.add(new PlayerStat(p, Integer.parseInt(character[14])));
|
||||
powerLevel += Integer.parseInt(character[14]);
|
||||
}
|
||||
|
||||
if (character.length > 24 && StringUtils.isInt(character[24])) {
|
||||
taming.add(new PlayerStat(p, Integer.parseInt(character[24])));
|
||||
powerLevel += Integer.parseInt(character[24]);
|
||||
}
|
||||
|
||||
if (character.length > 34 && StringUtils.isInt(character[34])) {
|
||||
fishing.add(new PlayerStat(p, Integer.parseInt(character[34])));
|
||||
powerLevel += Integer.parseInt(character[34]);
|
||||
}
|
||||
|
||||
powerLevels.add(new PlayerStat(p, powerLevel));
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe(("Exception while reading " + mcMMO.getUsersFilePath() + " (Are you sure you formatted it correctly?)" + e.toString()));
|
||||
}
|
||||
|
||||
SkillComparator c = new SkillComparator();
|
||||
Collections.sort(mining, c);
|
||||
Collections.sort(woodcutting, c);
|
||||
Collections.sort(repair, c);
|
||||
Collections.sort(unarmed, c);
|
||||
Collections.sort(herbalism, c);
|
||||
Collections.sort(excavation, c);
|
||||
Collections.sort(archery, c);
|
||||
Collections.sort(swords, c);
|
||||
Collections.sort(axes, c);
|
||||
Collections.sort(acrobatics, c);
|
||||
Collections.sort(taming, c);
|
||||
Collections.sort(fishing, c);
|
||||
Collections.sort(powerLevels, c);
|
||||
|
||||
playerStatHash.put(SkillType.MINING, mining);
|
||||
playerStatHash.put(SkillType.WOODCUTTING, woodcutting);
|
||||
playerStatHash.put(SkillType.REPAIR, repair);
|
||||
playerStatHash.put(SkillType.UNARMED, unarmed);
|
||||
playerStatHash.put(SkillType.HERBALISM, herbalism);
|
||||
playerStatHash.put(SkillType.EXCAVATION, excavation);
|
||||
playerStatHash.put(SkillType.ARCHERY, archery);
|
||||
playerStatHash.put(SkillType.SWORDS, swords);
|
||||
playerStatHash.put(SkillType.AXES, axes);
|
||||
playerStatHash.put(SkillType.ACROBATICS, acrobatics);
|
||||
playerStatHash.put(SkillType.TAMING, taming);
|
||||
playerStatHash.put(SkillType.FISHING, fishing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skillType Skill to retrieve info on.
|
||||
* @param pageNumber Which page in the leaderboards to retrieve
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
public static String[] retrieveInfo(String skillType, int pageNumber) {
|
||||
String[] info = new String[10];
|
||||
List<PlayerStat> statsList;
|
||||
|
||||
if (skillType.equalsIgnoreCase("all")) {
|
||||
statsList = powerLevels;
|
||||
}
|
||||
else {
|
||||
statsList = playerStatHash.get(SkillType.getSkill(skillType));
|
||||
}
|
||||
|
||||
int destination;
|
||||
|
||||
// How many lines to skip through
|
||||
if (pageNumber == 1) {
|
||||
destination = 0;
|
||||
}
|
||||
else {
|
||||
destination = (pageNumber * 10) - 9;
|
||||
}
|
||||
|
||||
int currentPos = 0;
|
||||
|
||||
for (PlayerStat ps : statsList) {
|
||||
if (currentPos == 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (destination > 1) {
|
||||
destination--;
|
||||
continue;
|
||||
}
|
||||
|
||||
info[currentPos] = ps.name + ":" + ps.statVal;
|
||||
currentPos++;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public static int[] getPlayerRank(String playerName) {
|
||||
int currentPos = 1;
|
||||
|
||||
if (powerLevels != null) {
|
||||
for (PlayerStat stat : powerLevels) {
|
||||
if (stat.name.equalsIgnoreCase(playerName)) {
|
||||
return new int[] {currentPos, stat.statVal};
|
||||
}
|
||||
|
||||
currentPos++;
|
||||
continue;
|
||||
}
|
||||
return new int[] {0, 0};
|
||||
}
|
||||
|
||||
return new int[] {0, 0};
|
||||
}
|
||||
|
||||
public static int[] getPlayerRank(String playerName, SkillType skillType) {
|
||||
int currentPos = 1;
|
||||
List<PlayerStat> statsList = playerStatHash.get(skillType);
|
||||
|
||||
if (statsList != null) {
|
||||
for (PlayerStat stat : statsList) {
|
||||
if (stat.name.equalsIgnoreCase(playerName)) {
|
||||
return new int[] {currentPos, stat.statVal};
|
||||
}
|
||||
|
||||
currentPos++;
|
||||
continue;
|
||||
}
|
||||
return new int[] {0, 0};
|
||||
}
|
||||
|
||||
return new int[] {0, 0};
|
||||
}
|
||||
|
||||
private static class SkillComparator implements Comparator<PlayerStat> {
|
||||
@Override
|
||||
public int compare(PlayerStat o1, PlayerStat o2) {
|
||||
return (o2.statVal - o1.statVal);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean removeFlatFileUser(String playerName) {
|
||||
boolean worked = false;
|
||||
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
String usersFilePath = mcMMO.getUsersFilePath();
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(usersFilePath);
|
||||
in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
|
||||
if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
mcMMO.p.getLogger().info("User found, removing...");
|
||||
worked = true;
|
||||
continue; //Skip the player
|
||||
}
|
||||
}
|
||||
|
||||
out = new FileWriter(usersFilePath); //Write out the new file
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return worked;
|
||||
}
|
||||
|
||||
|
||||
public static void purgePowerlessFlatfile() {
|
||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
||||
|
||||
int purgedUsers = 0;
|
||||
for (PlayerStat stat : powerLevels) {
|
||||
if (stat.statVal == 0 && removeFlatFileUser(stat.name) && !Bukkit.getOfflinePlayer(stat.name).isOnline()) {
|
||||
purgedUsers++;
|
||||
}
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
|
||||
}
|
||||
|
||||
public static void purgeOldFlatfile() {
|
||||
mcMMO.p.getLogger().info("Purging old users...");
|
||||
int purgedUsers = removeOldFlatfileUsers();
|
||||
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
|
||||
}
|
||||
|
||||
private static int removeOldFlatfileUsers() {
|
||||
int removedPlayers = 0;
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long purgeTime = 2630000000L * Config.getInstance().getOldUsersCutoff();
|
||||
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
String usersFilePath = mcMMO.getUsersFilePath();
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(usersFilePath);
|
||||
in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
|
||||
String[] splitLine = line.split(":");
|
||||
|
||||
if (splitLine.length > 37) {
|
||||
if (currentTime - (StringUtils.getLong(line.split(":")[37]) * 1000) <= purgeTime) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
mcMMO.p.getLogger().info("User found, removing...");
|
||||
removedPlayers++;
|
||||
continue; //Skip the player
|
||||
}
|
||||
}
|
||||
else {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
out = new FileWriter(usersFilePath); //Write out the new file
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return removedPlayers;
|
||||
}
|
||||
|
||||
}
|
||||
11
src/main/java/com/gmail/nossr50/database/PlayerStat.java
Normal file
11
src/main/java/com/gmail/nossr50/database/PlayerStat.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.gmail.nossr50.database;
|
||||
|
||||
public class PlayerStat {
|
||||
public String name;
|
||||
public int statVal = 0;
|
||||
|
||||
public PlayerStat(String name, int value) {
|
||||
this.name = name;
|
||||
this.statVal = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.gmail.nossr50.database.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.database.Leaderboard;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class McpurgeCommand implements CommandExecutor{
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
Database.purgePowerlessSQL();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
Database.purgeOldSQL();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Leaderboard.purgePowerlessFlatfile();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
Leaderboard.purgeOldFlatfile();
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success"));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gmail.nossr50.database.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.database.Leaderboard;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class McremoveCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
/* MySQL */
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
|
||||
if (Database.update("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.user = '" + args[0] + "'") != 0) {
|
||||
Database.profileCleanup(args[0]);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", args[0]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Leaderboard.removeFlatFileUser(args[0])) {
|
||||
Database.profileCleanup(args[0]);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", args[0]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gmail.nossr50.database.commands;
|
||||
|
||||
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.config.Config;
|
||||
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class MmoupdateCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
|
||||
Users.clearAll();
|
||||
convertToMySQL();
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(player);
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Finish"));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert FlatFile data to MySQL data.
|
||||
*/
|
||||
private void convertToMySQL() {
|
||||
if (!Config.getInstance().getUseMySQL()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().getScheduler().runTaskLaterAsynchronously(mcMMO.p, new SQLConversionTask(), 1);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,27 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
package com.gmail.nossr50.database.runnables;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.util.Database;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class SQLConversionTask implements Runnable {
|
||||
private final mcMMO plugin;
|
||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
|
||||
public SQLConversionTask(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Database database = mcMMO.getPlayerDatabase();
|
||||
String location = mcMMO.getUsersFile();
|
||||
String location = mcMMO.getUsersFilePath();
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
String playerName = null;
|
||||
String party = null;
|
||||
//String party = null;
|
||||
String mining = null;
|
||||
String woodcutting = null;
|
||||
String repair = null;
|
||||
@@ -68,10 +63,13 @@ public class SQLConversionTask implements Runnable {
|
||||
if (character.length > 1) {
|
||||
mining = character[1];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Looks like we still have party as the 4th string in the array but we don't use it anymore
|
||||
if (character.length > 3) {
|
||||
party = character[3];
|
||||
}
|
||||
*/
|
||||
|
||||
if (character.length > 4) {
|
||||
miningXP = character[4];
|
||||
@@ -166,7 +164,7 @@ public class SQLConversionTask implements Runnable {
|
||||
}
|
||||
|
||||
//Check to see if the user is in the DB
|
||||
id = database.getInt("SELECT id FROM "
|
||||
id = Database.getInt("SELECT id FROM "
|
||||
+ tablePrefix
|
||||
+ "users WHERE user = '" + playerName + "'");
|
||||
|
||||
@@ -174,112 +172,114 @@ public class SQLConversionTask implements Runnable {
|
||||
theCount++;
|
||||
|
||||
//Update the skill values
|
||||
database.write("UPDATE "
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
database.write("UPDATE "
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "skills SET "
|
||||
+ " taming = taming+" + Misc.getInt(taming)
|
||||
+ ", mining = mining+" + Misc.getInt(mining)
|
||||
+ ", repair = repair+" + Misc.getInt(repair)
|
||||
+ ", woodcutting = woodcutting+" + Misc.getInt(woodcutting)
|
||||
+ ", unarmed = unarmed+" + Misc.getInt(unarmed)
|
||||
+ ", herbalism = herbalism+" + Misc.getInt(herbalism)
|
||||
+ ", excavation = excavation+" + Misc.getInt(excavation)
|
||||
+ ", archery = archery+" + Misc.getInt(archery)
|
||||
+ ", swords = swords+" + Misc.getInt(swords)
|
||||
+ ", axes = axes+" + Misc.getInt(axes)
|
||||
+ ", acrobatics = acrobatics+" + Misc.getInt(acrobatics)
|
||||
+ ", fishing = fishing+" + Misc.getInt(fishing)
|
||||
+ " taming = taming+" + StringUtils.getInt(taming)
|
||||
+ ", mining = mining+" + StringUtils.getInt(mining)
|
||||
+ ", repair = repair+" + StringUtils.getInt(repair)
|
||||
+ ", woodcutting = woodcutting+" + StringUtils.getInt(woodcutting)
|
||||
+ ", unarmed = unarmed+" + StringUtils.getInt(unarmed)
|
||||
+ ", herbalism = herbalism+" + StringUtils.getInt(herbalism)
|
||||
+ ", excavation = excavation+" + StringUtils.getInt(excavation)
|
||||
+ ", archery = archery+" + StringUtils.getInt(archery)
|
||||
+ ", swords = swords+" + StringUtils.getInt(swords)
|
||||
+ ", axes = axes+" + StringUtils.getInt(axes)
|
||||
+ ", acrobatics = acrobatics+" + StringUtils.getInt(acrobatics)
|
||||
+ ", fishing = fishing+" + StringUtils.getInt(fishing)
|
||||
+ " WHERE user_id = " + id);
|
||||
database.write("UPDATE "
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "experience SET "
|
||||
+ " taming = " + Misc.getInt(tamingXP)
|
||||
+ ", mining = " + Misc.getInt(miningXP)
|
||||
+ ", repair = " + Misc.getInt(repairXP)
|
||||
+ ", woodcutting = " + Misc.getInt(woodCuttingXP)
|
||||
+ ", unarmed = " + Misc.getInt(unarmedXP)
|
||||
+ ", herbalism = " + Misc.getInt(herbalismXP)
|
||||
+ ", excavation = " + Misc.getInt(excavationXP)
|
||||
+ ", archery = " + Misc.getInt(archeryXP)
|
||||
+ ", swords = " + Misc.getInt(swordsXP)
|
||||
+ ", axes = " + Misc.getInt(axesXP)
|
||||
+ ", acrobatics = " + Misc.getInt(acrobaticsXP)
|
||||
+ ", fishing = " + Misc.getInt(fishingXP)
|
||||
+ " taming = " + StringUtils.getInt(tamingXP)
|
||||
+ ", mining = " + StringUtils.getInt(miningXP)
|
||||
+ ", repair = " + StringUtils.getInt(repairXP)
|
||||
+ ", woodcutting = " + StringUtils.getInt(woodCuttingXP)
|
||||
+ ", unarmed = " + StringUtils.getInt(unarmedXP)
|
||||
+ ", herbalism = " + StringUtils.getInt(herbalismXP)
|
||||
+ ", excavation = " + StringUtils.getInt(excavationXP)
|
||||
+ ", archery = " + StringUtils.getInt(archeryXP)
|
||||
+ ", swords = " + StringUtils.getInt(swordsXP)
|
||||
+ ", axes = " + StringUtils.getInt(axesXP)
|
||||
+ ", acrobatics = " + StringUtils.getInt(acrobaticsXP)
|
||||
+ ", fishing = " + StringUtils.getInt(fishingXP)
|
||||
+ " WHERE user_id = " + id);
|
||||
}
|
||||
else {
|
||||
theCount++;
|
||||
|
||||
//Create the user in the DB
|
||||
database.write("INSERT INTO "
|
||||
Database.write("INSERT INTO "
|
||||
+ tablePrefix
|
||||
+ "users (user, lastlogin) VALUES ('"
|
||||
+ playerName + "',"
|
||||
+ System.currentTimeMillis() / 1000 + ")");
|
||||
id = database.getInt("SELECT id FROM "
|
||||
+ tablePrefix
|
||||
+ "users WHERE user = '"
|
||||
+ playerName + "'");
|
||||
database.write("INSERT INTO "
|
||||
+ System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR + ")");
|
||||
id = Database.getInt("SELECT id FROM "
|
||||
+ tablePrefix
|
||||
+ "users WHERE user = '"
|
||||
+ playerName + "'");
|
||||
Database.write("INSERT INTO "
|
||||
+ tablePrefix
|
||||
+ "skills (user_id) VALUES (" + id + ")");
|
||||
database.write("INSERT INTO "
|
||||
Database.write("INSERT INTO "
|
||||
+ tablePrefix
|
||||
+ "experience (user_id) VALUES (" + id
|
||||
+ ")");
|
||||
//Update the skill values
|
||||
database.write("UPDATE "
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
database.write("UPDATE "
|
||||
/*
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET party = '" + party
|
||||
+ "' WHERE id = " + id);
|
||||
database.write("UPDATE "
|
||||
*/
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "skills SET "
|
||||
+ " taming = taming+" + Misc.getInt(taming)
|
||||
+ ", mining = mining+" + Misc.getInt(mining)
|
||||
+ ", repair = repair+" + Misc.getInt(repair)
|
||||
+ ", woodcutting = woodcutting+" + Misc.getInt(woodcutting)
|
||||
+ ", unarmed = unarmed+" + Misc.getInt(unarmed)
|
||||
+ ", herbalism = herbalism+" + Misc.getInt(herbalism)
|
||||
+ ", excavation = excavation+" + Misc.getInt(excavation)
|
||||
+ ", archery = archery+" + Misc.getInt(archery)
|
||||
+ ", swords = swords+" + Misc.getInt(swords)
|
||||
+ ", axes = axes+" + Misc.getInt(axes)
|
||||
+ ", acrobatics = acrobatics+" + Misc.getInt(acrobatics)
|
||||
+ ", fishing = fishing+" + Misc.getInt(fishing)
|
||||
+ " taming = taming+" + StringUtils.getInt(taming)
|
||||
+ ", mining = mining+" + StringUtils.getInt(mining)
|
||||
+ ", repair = repair+" + StringUtils.getInt(repair)
|
||||
+ ", woodcutting = woodcutting+" + StringUtils.getInt(woodcutting)
|
||||
+ ", unarmed = unarmed+" + StringUtils.getInt(unarmed)
|
||||
+ ", herbalism = herbalism+" + StringUtils.getInt(herbalism)
|
||||
+ ", excavation = excavation+" + StringUtils.getInt(excavation)
|
||||
+ ", archery = archery+" + StringUtils.getInt(archery)
|
||||
+ ", swords = swords+" + StringUtils.getInt(swords)
|
||||
+ ", axes = axes+" + StringUtils.getInt(axes)
|
||||
+ ", acrobatics = acrobatics+" + StringUtils.getInt(acrobatics)
|
||||
+ ", fishing = fishing+" + StringUtils.getInt(fishing)
|
||||
+ " WHERE user_id = " + id);
|
||||
database.write("UPDATE "
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "experience SET "
|
||||
+ " taming = " + Misc.getInt(tamingXP)
|
||||
+ ", mining = " + Misc.getInt(miningXP)
|
||||
+ ", repair = " + Misc.getInt(repairXP)
|
||||
+ ", woodcutting = " + Misc.getInt(woodCuttingXP)
|
||||
+ ", unarmed = " + Misc.getInt(unarmedXP)
|
||||
+ ", herbalism = " + Misc.getInt(herbalismXP)
|
||||
+ ", excavation = " + Misc.getInt(excavationXP)
|
||||
+ ", archery = " + Misc.getInt(archeryXP)
|
||||
+ ", swords = " + Misc.getInt(swordsXP)
|
||||
+ ", axes = " + Misc.getInt(axesXP)
|
||||
+ ", acrobatics = " + Misc.getInt(acrobaticsXP)
|
||||
+ ", fishing = " + Misc.getInt(fishingXP)
|
||||
+ " taming = " + StringUtils.getInt(tamingXP)
|
||||
+ ", mining = " + StringUtils.getInt(miningXP)
|
||||
+ ", repair = " + StringUtils.getInt(repairXP)
|
||||
+ ", woodcutting = " + StringUtils.getInt(woodCuttingXP)
|
||||
+ ", unarmed = " + StringUtils.getInt(unarmedXP)
|
||||
+ ", herbalism = " + StringUtils.getInt(herbalismXP)
|
||||
+ ", excavation = " + StringUtils.getInt(excavationXP)
|
||||
+ ", archery = " + StringUtils.getInt(archeryXP)
|
||||
+ ", swords = " + StringUtils.getInt(swordsXP)
|
||||
+ ", axes = " + StringUtils.getInt(axesXP)
|
||||
+ ", acrobatics = " + StringUtils.getInt(acrobaticsXP)
|
||||
+ ", fishing = " + StringUtils.getInt(fishingXP)
|
||||
+ " WHERE user_id = " + id);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[mcMMO] MySQL Updated from users file, " + theCount + " items added/updated to MySQL DB"); //TODO: Locale
|
||||
mcMMO.p.getLogger().info("[mcMMO] MySQL Updated from users file, " + theCount + " items added/updated to MySQL DB");
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
plugin.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.gmail.nossr50.database.runnables;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SQLReconnect implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Database.checkConnected()) {
|
||||
Users.saveAll(); //Save all profiles
|
||||
Users.clearAll(); //Clear the profiles
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(player); //Add in new profiles, forcing them to 'load' again from MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gmail.nossr50.database.runnables;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.database.Leaderboard;
|
||||
|
||||
public class UserPurgeTask implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
Database.purgePowerlessSQL();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
Database.purgeOldSQL();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Leaderboard.purgePowerlessFlatfile();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
Leaderboard.purgeOldFlatfile();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public enum DatabaseUpdate {
|
||||
FISHING,
|
||||
BLAST_MINING;
|
||||
}
|
||||
@@ -6,26 +6,36 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.mods.ModChecks;
|
||||
import com.gmail.nossr50.mods.datatypes.CustomTool;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.spout.huds.SpoutHud;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModChecks;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McMMOPlayer {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
|
||||
private Party party;
|
||||
private Party invite;
|
||||
private Player ptpRequest;
|
||||
private boolean ptpEnabled = true;
|
||||
private boolean ptpConfirmRequired = Config.getInstance().getPTPCommandConfirmRequired();
|
||||
private long ptpTimeout;
|
||||
private boolean partyChatMode;
|
||||
private boolean adminChatMode;
|
||||
|
||||
public McMMOPlayer (Player player) {
|
||||
String playerName = player.getName();
|
||||
this.player = player;
|
||||
this.profile = new PlayerProfile(playerName, true);
|
||||
this.party = PartyManager.getInstance().getPlayerParty(playerName);
|
||||
this.party = PartyManager.getPlayerParty(playerName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +47,11 @@ public class McMMOPlayer {
|
||||
int powerLevel = 0;
|
||||
|
||||
for (SkillType type : SkillType.values()) {
|
||||
if (type.getPermissions(player)) {
|
||||
if (type.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(player, type)) {
|
||||
powerLevel += profile.getSkillLevel(type);
|
||||
}
|
||||
}
|
||||
@@ -46,133 +60,90 @@ public class McMMOPlayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the party XP modifier.
|
||||
* Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party
|
||||
*
|
||||
* @param skillType Type of skill to check
|
||||
* @return the party bonus multiplier
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
private double calculatePartyXPModifier(SkillType skillType) {
|
||||
double bonusModifier = 0.0;
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
if (party.getLeader().equals(member.getName())) {
|
||||
if (Misc.isNear(player.getLocation(), member.getLocation(), 25.0)) {
|
||||
PlayerProfile partyLeader = Users.getProfile(member);
|
||||
int leaderSkill = partyLeader.getSkillLevel(skillType);
|
||||
int playerSkill = profile.getSkillLevel(skillType);
|
||||
|
||||
if (leaderSkill >= playerSkill) {
|
||||
int difference = leaderSkill - playerSkill;
|
||||
bonusModifier = (difference * 0.75) / 100.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void beginXpGain(SkillType skillType, int xp) {
|
||||
if (xp == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
return bonusModifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, doesn't calculate for XP Rate
|
||||
*
|
||||
* @param skillType The skill to add XP to
|
||||
* @param newValue The amount of XP to add
|
||||
*/
|
||||
public void addXPOverride(SkillType skillType, int xp) {
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
for (SkillType type : SkillType.values()) {
|
||||
if (type.equals(SkillType.ALL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, type, xp));
|
||||
profile.setSkillXPLevel(type, profile.getSkillXpLevel(type) + xp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
|
||||
profile.setSkillXPLevel(skillType, profile.getSkillXpLevel(skillType) + xp);
|
||||
|
||||
SpoutHud spoutHud = profile.getSpoutHud();
|
||||
|
||||
if (spoutHud != null) {
|
||||
spoutHud.setLastGained(skillType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, this ignores skill modifiers.
|
||||
*
|
||||
* @param skillType The skill to add XP to
|
||||
* @param newValue The amount of XP to add
|
||||
*/
|
||||
public void addXPOverrideBonus(SkillType skillType, int xp) {
|
||||
int modifiedXp = (int)Math.floor(xp * Config.getInstance().xpGainMultiplier);
|
||||
addXPOverride(skillType, modifiedXp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, this is affected by skill modifiers and XP Rate and Permissions
|
||||
*
|
||||
* @param skillType The skill to add XP to
|
||||
* @param newvalue The amount of XP to add
|
||||
*/
|
||||
public void addXP(SkillType skillType, int newValue) {
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE)) {
|
||||
|
||||
// Return if the experience has been shared
|
||||
if (party != null && ShareHandler.handleXpShare(xp, this, skillType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
double bonusModifier = 0;
|
||||
beginUnsharedXpGain(skillType, xp);
|
||||
}
|
||||
|
||||
if (inParty()) {
|
||||
bonusModifier = calculatePartyXPModifier(skillType);
|
||||
/**
|
||||
* Begins an experience gain. The amount will be affected by skill modifiers, global rate and perks
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginUnsharedXpGain(SkillType skillType, int xp) {
|
||||
xp = modifyXpGain(skillType, xp);
|
||||
|
||||
applyXpGain(skillType, xp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies an experience gain
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void applyXpGain(SkillType skillType, int xp) {
|
||||
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skillType, xp);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int xp = (int)Math.floor((newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier);
|
||||
|
||||
if (bonusModifier > 0) {
|
||||
if (bonusModifier >= 2) {
|
||||
bonusModifier = 2;
|
||||
}
|
||||
|
||||
double trueBonus = bonusModifier * xp;
|
||||
xp += trueBonus;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getToolModsEnabled()) {
|
||||
ItemStack item = player.getItemInHand();
|
||||
CustomTool tool = ModChecks.getToolFromItemStack(item);
|
||||
|
||||
if (tool != null) {
|
||||
xp = (int) (xp * tool.getXpMultiplier());
|
||||
}
|
||||
}
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.xp.quadruple")) {
|
||||
xp = xp * 4;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.triple")) {
|
||||
xp = xp * 3;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
|
||||
xp = (int) (xp * 2.5);
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.double")) {
|
||||
xp = xp * 2;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.50percentboost")) {
|
||||
xp = (int) (xp * 1.5);
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
|
||||
profile.setSkillXPLevel(skillType, profile.getSkillXpLevel(skillType) + xp);
|
||||
profile.setSkillXpLevel(skillType, profile.getSkillXpLevel(skillType) + event.getXpGained());
|
||||
|
||||
SpoutHud spoutHud = profile.getSpoutHud();
|
||||
|
||||
if (spoutHud != null) {
|
||||
spoutHud.setLastGained(skillType);
|
||||
}
|
||||
|
||||
SkillTools.xpCheckSkill(skillType, player, profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies an experience gain using skill modifiers, global rate and perks
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @return Modified experience
|
||||
*/
|
||||
private int modifyXpGain(SkillType skillType, int xp) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
xp = (int) (xp / skillType.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
|
||||
if (Config.getInstance().getToolModsEnabled()) {
|
||||
ItemStack item = player.getItemInHand();
|
||||
CustomTool tool = ModChecks.getToolFromItemStack(item);
|
||||
|
||||
if (tool != null) {
|
||||
xp *= tool.getXpMultiplier();
|
||||
}
|
||||
}
|
||||
|
||||
xp = PerksUtils.handleXpPerks(player, xp);
|
||||
return xp;
|
||||
}
|
||||
|
||||
// Players & Profiles
|
||||
@@ -191,11 +162,11 @@ public class McMMOPlayer {
|
||||
|
||||
// Party Stuff
|
||||
|
||||
public void setInvite(Party invite) {
|
||||
public void setPartyInvite(Party invite) {
|
||||
this.invite = invite;
|
||||
}
|
||||
|
||||
public Party getInvite() {
|
||||
public Party getPartyInvite() {
|
||||
return invite;
|
||||
}
|
||||
|
||||
@@ -203,9 +174,8 @@ public class McMMOPlayer {
|
||||
if (invite != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setParty(Party party) {
|
||||
@@ -220,16 +190,79 @@ public class McMMOPlayer {
|
||||
if (party != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeParty() {
|
||||
party = null;
|
||||
}
|
||||
|
||||
public void removeInvite() {
|
||||
public void removePartyInvite() {
|
||||
invite = null;
|
||||
}
|
||||
|
||||
public boolean getPtpEnabled() {
|
||||
return ptpEnabled;
|
||||
}
|
||||
|
||||
public void togglePtpUse() {
|
||||
ptpEnabled = !ptpEnabled;
|
||||
}
|
||||
|
||||
public Player getPtpRequest() {
|
||||
return ptpRequest;
|
||||
}
|
||||
|
||||
public void setPtpRequest(Player ptpRequest) {
|
||||
this.ptpRequest = ptpRequest;
|
||||
}
|
||||
|
||||
public boolean hasPtpRequest() {
|
||||
return (ptpRequest != null) ? true : false;
|
||||
}
|
||||
|
||||
public void removePtpRequest() {
|
||||
ptpRequest = null;
|
||||
}
|
||||
|
||||
public boolean getPtpConfirmRequired() {
|
||||
return ptpConfirmRequired;
|
||||
}
|
||||
|
||||
public void togglePtpConfirmRequired() {
|
||||
ptpConfirmRequired = !ptpConfirmRequired;
|
||||
}
|
||||
|
||||
public long getPtpTimeout() {
|
||||
return ptpTimeout;
|
||||
}
|
||||
|
||||
public void actualizePtpTimeout() {
|
||||
ptpTimeout = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
public boolean getAdminChatMode() {
|
||||
return adminChatMode;
|
||||
}
|
||||
|
||||
public void setAdminChat(boolean enabled) {
|
||||
adminChatMode = enabled;
|
||||
}
|
||||
|
||||
public void toggleAdminChat() {
|
||||
adminChatMode = !adminChatMode;
|
||||
}
|
||||
|
||||
public boolean getPartyChatMode() {
|
||||
return partyChatMode;
|
||||
}
|
||||
|
||||
public void setPartyChat(boolean enabled) {
|
||||
partyChatMode = enabled;
|
||||
}
|
||||
|
||||
public void togglePartyChat() {
|
||||
partyChatMode = !partyChatMode;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public class PlayerStat {
|
||||
public String name;
|
||||
public int statVal = 0;
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public enum SkillType {
|
||||
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
|
||||
ALL, //This one is just for convenience
|
||||
ARCHERY(Config.getInstance().getLevelCapArchery(), Config.getInstance().getFormulaMultiplierArchery()),
|
||||
AXES(AbilityType.SKULL_SPLIITER, Config.getInstance().getLevelCapAxes(), ToolType.AXE, Config.getInstance().getFormulaMultiplierAxes()),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getInstance().getLevelCapExcavation(), ToolType.SHOVEL, Config.getInstance().getFormulaMultiplierExcavation()),
|
||||
FISHING(Config.getInstance().getLevelCapFishing(), Config.getInstance().getFormulaMultiplierFishing()),
|
||||
HERBALISM(AbilityType.GREEN_TERRA, Config.getInstance().getLevelCapHerbalism(), ToolType.HOE, Config.getInstance().getFormulaMultiplierHerbalism()),
|
||||
MINING(AbilityType.SUPER_BREAKER, Config.getInstance().getLevelCapMining(), ToolType.PICKAXE, Config.getInstance().getFormulaMultiplierMining()),
|
||||
REPAIR(Config.getInstance().getLevelCapRepair(), Config.getInstance().getFormulaMultiplierRepair()),
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, Config.getInstance().getLevelCapSwords(), ToolType.SWORD, Config.getInstance().getFormulaMultiplierSwords()),
|
||||
TAMING(Config.getInstance().getLevelCapTaming(), Config.getInstance().getFormulaMultiplierTaming()),
|
||||
UNARMED(AbilityType.BERSERK, Config.getInstance().getLevelCapUnarmed(), ToolType.FISTS, Config.getInstance().getFormulaMultiplierUnarmed()),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, Config.getInstance().getLevelCapWoodcutting(), ToolType.AXE, Config.getInstance().getFormulaMultiplierWoodcutting());
|
||||
|
||||
private AbilityType ability;
|
||||
private int maxLevel;
|
||||
private ToolType tool;
|
||||
private double xpModifier;
|
||||
|
||||
private SkillType() {
|
||||
this.ability = null;
|
||||
this.maxLevel = 0;
|
||||
this.tool = null;
|
||||
this.xpModifier = 0;
|
||||
}
|
||||
|
||||
private SkillType(AbilityType ability, int maxLevel, ToolType tool, double xpModifier) {
|
||||
this.ability = ability;
|
||||
this.maxLevel = maxLevel;
|
||||
this.tool = tool;
|
||||
this.xpModifier = xpModifier;
|
||||
}
|
||||
|
||||
private SkillType(int maxLevel, double xpModifier) {
|
||||
this(null, maxLevel, null, xpModifier);
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max level of this skill.
|
||||
*
|
||||
* @return the max level of this skill
|
||||
*/
|
||||
public int getMaxLevel() {
|
||||
if (maxLevel > 0) {
|
||||
return maxLevel;
|
||||
}
|
||||
else {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public ToolType getTool() {
|
||||
return tool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base permissions associated with this skill.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case ACROBATICS:
|
||||
return Permissions.getInstance().acrobatics(player);
|
||||
|
||||
case ARCHERY:
|
||||
return Permissions.getInstance().archery(player);
|
||||
|
||||
case AXES:
|
||||
return Permissions.getInstance().axes(player);
|
||||
|
||||
case EXCAVATION:
|
||||
return Permissions.getInstance().excavation(player);
|
||||
|
||||
case FISHING:
|
||||
return Permissions.getInstance().fishing(player);
|
||||
|
||||
case HERBALISM:
|
||||
return Permissions.getInstance().herbalism(player);
|
||||
|
||||
case MINING:
|
||||
return Permissions.getInstance().mining(player);
|
||||
|
||||
case REPAIR:
|
||||
return Permissions.getInstance().repair(player);
|
||||
|
||||
case SWORDS:
|
||||
return Permissions.getInstance().swords(player);
|
||||
|
||||
case TAMING:
|
||||
return Permissions.getInstance().taming(player);
|
||||
|
||||
case UNARMED:
|
||||
return Permissions.getInstance().unarmed(player);
|
||||
|
||||
case WOODCUTTING:
|
||||
return Permissions.getInstance().woodcutting(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public double getXpModifier() {
|
||||
return xpModifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the skill level for this skill.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return
|
||||
*/
|
||||
public int getSkillLevel(Player player) {
|
||||
return Users.getProfile(player).getSkillLevel(this);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Tree {
|
||||
|
||||
private TreeNode root = null;
|
||||
|
||||
/**
|
||||
* Add a node to this tree.
|
||||
*
|
||||
* @param p Player name
|
||||
* @param in Stat value
|
||||
*/
|
||||
public void add(String p, int in) {
|
||||
if (root == null) {
|
||||
root = new TreeNode(p, in);
|
||||
}
|
||||
else {
|
||||
root.add(p, in);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an array of PlayerStats from the Tree.
|
||||
*
|
||||
* @return the player stats of this tree, in order
|
||||
*/
|
||||
public PlayerStat[] inOrder() {
|
||||
if (root != null) {
|
||||
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||
return order.toArray(new PlayerStat[order.size()]);
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
* Throw some dummy info in case the users file is empty.
|
||||
* It's not a good fix but its better than rewriting the whole system.
|
||||
*/
|
||||
ArrayList<PlayerStat> x = new ArrayList<PlayerStat>();
|
||||
PlayerStat y = new PlayerStat();
|
||||
|
||||
y.name = "$mcMMO_DummyInfo";
|
||||
y.statVal = 0;
|
||||
x.add(y);
|
||||
|
||||
return x.toArray(new PlayerStat[x.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TreeNode {
|
||||
TreeNode left = null;
|
||||
TreeNode right = null;
|
||||
PlayerStat ps = new PlayerStat();
|
||||
|
||||
public TreeNode(String p, int in) {
|
||||
ps.statVal = in;
|
||||
ps.name = p;
|
||||
}
|
||||
|
||||
public void add (String p, int in) {
|
||||
if (in >= ps.statVal) {
|
||||
if (left == null) {
|
||||
left = new TreeNode(p, in);
|
||||
}
|
||||
else {
|
||||
left.add(p, in);
|
||||
}
|
||||
}
|
||||
else if(in < ps.statVal) {
|
||||
if (right == null) {
|
||||
right = new TreeNode(p, in);
|
||||
}
|
||||
else {
|
||||
right.add(p, in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<PlayerStat> inOrder(ArrayList<PlayerStat> a) {
|
||||
//if left node is not null than assign arrayList(a) to left.inOrder()
|
||||
//GOES THROUGH THE ENTIRE LEFT BRANCH AND GRABS THE GREATEST NUMBER
|
||||
|
||||
if (left != null) {
|
||||
a = left.inOrder(a);
|
||||
}
|
||||
|
||||
a.add(ps);
|
||||
|
||||
if (right != null) {
|
||||
a = right.inOrder(a);
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.gmail.nossr50.datatypes.treasure;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ExcavationTreasure extends Treasure {
|
||||
|
||||
// dirt | grass | sand | gravel | clay | mycel | soulsand
|
||||
// 00000001 - dirt 1
|
||||
// 00000010 - grass 2
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.gmail.nossr50.datatypes.treasure;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class HylianTreasure extends Treasure {
|
||||
// bushes | flowers | pots
|
||||
// 00000001 - bushes 1
|
||||
// 00000010 - flowers 2
|
||||
// 00000100 - pots 4
|
||||
private byte dropsFrom = 0x0;
|
||||
|
||||
public HylianTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
|
||||
super(drop, xp, dropChance, dropLevel);
|
||||
}
|
||||
|
||||
// Raw getters and setters
|
||||
public byte getDropsFrom() {
|
||||
return dropsFrom;
|
||||
}
|
||||
|
||||
public void setDropsFrom(byte dropsFrom) {
|
||||
this.dropsFrom = dropsFrom;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean getDropsFromBushes() {
|
||||
return getDropFromMask(1);
|
||||
}
|
||||
|
||||
public boolean getDropsFromFlowers() {
|
||||
return getDropFromMask(2);
|
||||
}
|
||||
|
||||
public boolean getDropsFromPots() {
|
||||
return getDropFromMask(4);
|
||||
}
|
||||
|
||||
private boolean getDropFromMask(int mask) {
|
||||
return ((dropsFrom & mask) > 0) ? true : false;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setDropsFromBushes() {
|
||||
setDropFromMask(1);
|
||||
}
|
||||
|
||||
public void setDropsFromFlowers() {
|
||||
setDropFromMask(2);
|
||||
}
|
||||
|
||||
public void setDropsFromPots() {
|
||||
setDropFromMask(4);
|
||||
}
|
||||
|
||||
private void setDropFromMask(int mask) {
|
||||
dropsFrom |= mask;
|
||||
}
|
||||
|
||||
// Un-setters
|
||||
public void unsetDropsFromBushes() {
|
||||
unsetDropFromMask(1);
|
||||
}
|
||||
|
||||
public void unsetDropsFromFlowers() {
|
||||
unsetDropFromMask(2);
|
||||
}
|
||||
|
||||
public void unsetDropsFromPots() {
|
||||
unsetDropFromMask(4);
|
||||
}
|
||||
|
||||
private void unsetDropFromMask(int mask) {
|
||||
dropsFrom &= ~mask;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.gmail.nossr50.events.chat;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Called when a chat is sent to the admin chat channel
|
||||
*/
|
||||
public class McMMOAdminChatEvent extends McMMOChatEvent{
|
||||
|
||||
public McMMOAdminChatEvent(String sender, String message) {
|
||||
super(sender, message);
|
||||
public class McMMOAdminChatEvent extends McMMOChatEvent {
|
||||
public McMMOAdminChatEvent(Plugin plugin, String sender, String displayName, String message) {
|
||||
super(plugin, sender, displayName, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,29 @@ package com.gmail.nossr50.events.chat;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class McMMOChatEvent extends Event implements Cancellable{
|
||||
public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private Plugin plugin;
|
||||
private String sender;
|
||||
private String displayName;
|
||||
private String message;
|
||||
|
||||
public McMMOChatEvent(String sender, String message) {
|
||||
protected McMMOChatEvent(Plugin plugin, String sender, String displayName, String message) {
|
||||
this.plugin = plugin;
|
||||
this.sender = sender;
|
||||
this.displayName = displayName;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The plugin responsible for this event, note this can be null
|
||||
*/
|
||||
public Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String name of the player who sent the chat, or "Console"
|
||||
*/
|
||||
@@ -21,6 +33,13 @@ public class McMMOChatEvent extends Event implements Cancellable{
|
||||
return sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String display name of the player who sent the chat, or "Console"
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String message that will be sent
|
||||
*/
|
||||
@@ -28,6 +47,13 @@ public class McMMOChatEvent extends Event implements Cancellable{
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayName String display name of the player who sent the chat
|
||||
*/
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message String message to be sent in chat
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.gmail.nossr50.events.chat;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Called when a chat is sent to a party channel
|
||||
*/
|
||||
public class McMMOPartyChatEvent extends McMMOChatEvent{
|
||||
public class McMMOPartyChatEvent extends McMMOChatEvent {
|
||||
private String party;
|
||||
|
||||
public McMMOPartyChatEvent(String sender, String party, String message) {
|
||||
super(sender, message);
|
||||
public McMMOPartyChatEvent(Plugin plugin, String sender, String displayName, String party, String message) {
|
||||
super(plugin, sender, displayName, message);
|
||||
this.party = party;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
/**
|
||||
* Generic event for mcMMO experience events.
|
||||
*/
|
||||
public class McMMOPlayerExperienceEvent extends PlayerEvent {
|
||||
public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
protected SkillType skill;
|
||||
protected int skillLevel;
|
||||
|
||||
public McMMOPlayerExperienceEvent(Player player, SkillType skill) {
|
||||
protected McMMOPlayerExperienceEvent(Player player, SkillType skill) {
|
||||
super(player);
|
||||
this.skill = skill;
|
||||
this.skillLevel = skill.getSkillLevel(player);
|
||||
this.skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(skill);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,4 +47,15 @@ public class McMMOPlayerExperienceEvent extends PlayerEvent {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
|
||||
/**
|
||||
* Called when a user levels up in a skill
|
||||
@@ -12,7 +12,12 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerExperienceEvent {
|
||||
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill) {
|
||||
super(player, skill);
|
||||
this.levelsGained = 1; // Always 1 for now as we call in the loop where the levelups are calculated, could change later!
|
||||
this.levelsGained = 1;
|
||||
}
|
||||
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, int levelsGained) {
|
||||
super(player, skill);
|
||||
this.levelsGained = levelsGained;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
|
||||
/**
|
||||
* Called when a player gains XP in a skill
|
||||
@@ -21,4 +21,11 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
public int getXpGained() {
|
||||
return xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained int amount of experience gained in this event
|
||||
*/
|
||||
public void setXpGained(int xpGained) {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
* Called when mcMMO breaks a block due to a special ability.
|
||||
*/
|
||||
public class FakeBlockBreakEvent extends BlockBreakEvent {
|
||||
|
||||
public FakeBlockBreakEvent(Block theBlock, Player player) {
|
||||
super(theBlock, player);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
* Called when mcMMO damages a block due to a special ability.
|
||||
*/
|
||||
public class FakeBlockDamageEvent extends BlockDamageEvent {
|
||||
|
||||
public FakeBlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) {
|
||||
super(player, block, itemInHand, instaBreak);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
* Called when mcMMO applies damage from an entity due to special abilities.
|
||||
*/
|
||||
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
||||
|
||||
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage) {
|
||||
super(damager, damagee, cause, damage);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user