mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 17:53:00 +01:00
Compare commits
1495 Commits
1.3.03
...
1.4.00-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
3934392219 | ||
|
|
ed6f48b5fe | ||
|
|
729e4a6eac | ||
|
|
9a39dead4f | ||
|
|
cb1eabc3fa | ||
|
|
b30002948c | ||
|
|
d528f11082 | ||
|
|
42a1fdf2df | ||
|
|
394ddd4e51 | ||
|
|
8c7d95f9ea | ||
|
|
422550abfd | ||
|
|
ca9ce1ba1b | ||
|
|
ac1c420cb5 | ||
|
|
05a9e85529 | ||
|
|
ca6ed76e8f | ||
|
|
3d04da39e3 | ||
|
|
127908f104 | ||
|
|
686bcd5308 | ||
|
|
07c66378c0 | ||
|
|
4e7107c8a8 | ||
|
|
3c2d658b37 | ||
|
|
f0b2cc1bab | ||
|
|
d038cbf357 | ||
|
|
c3ea632cb9 | ||
|
|
a31d50924d | ||
|
|
c567e2714a | ||
|
|
a2e342b4fc | ||
|
|
4469637f27 | ||
|
|
f4ecbe7f65 | ||
|
|
dbaab4efe1 | ||
|
|
8c178869b7 | ||
|
|
3c7bcb990e | ||
|
|
f7a5678814 | ||
|
|
646bb32965 | ||
|
|
dce7d8fdd3 | ||
|
|
6dd17312f4 | ||
|
|
9c64f40ea1 | ||
|
|
da6b461408 | ||
|
|
77dce75108 | ||
|
|
37308917d1 | ||
|
|
21d2229572 | ||
|
|
7d372af51e | ||
|
|
a3e0753076 | ||
|
|
a728d1f9c8 | ||
|
|
b893e86f3c | ||
|
|
63cf6e9b3a | ||
|
|
67738d811e | ||
|
|
4d77f6d04d | ||
|
|
3702495038 | ||
|
|
ede08ce5ac | ||
|
|
5571e0bc0c | ||
|
|
73bb73c8ca | ||
|
|
54011fdeb7 | ||
|
|
5b8811bd09 | ||
|
|
c460eec0ab | ||
|
|
bc6233541a | ||
|
|
18aef9d526 | ||
|
|
ccc6fd30f8 | ||
|
|
1ba498c443 | ||
|
|
64f31f2b5a | ||
|
|
b94085c5f4 | ||
|
|
62b90ad552 | ||
|
|
d6d1e0ffed | ||
|
|
ccd103cd88 | ||
|
|
0606f16a11 | ||
|
|
c9e3ea005b | ||
|
|
f009f5803f | ||
|
|
3f8268d848 | ||
|
|
cefec723d0 | ||
|
|
124aa72fd9 | ||
|
|
dbc7277ba9 | ||
|
|
24d8769b5b | ||
|
|
4aecb9756e | ||
|
|
51ca29ab9f | ||
|
|
c6e5264b7b | ||
|
|
73203ce869 | ||
|
|
b80a29ca04 | ||
|
|
5ee440d9a5 | ||
|
|
cda3675dc5 | ||
|
|
caf9c07ba3 | ||
|
|
96e70aa4d2 | ||
|
|
9f1b77a007 | ||
|
|
946b5bb006 | ||
|
|
bebcc40987 | ||
|
|
d6d7f5099f | ||
|
|
bdcc2f644b | ||
|
|
c3ba54a0ce | ||
|
|
1443e2f6b8 | ||
|
|
7799acec05 | ||
|
|
1bbc1f28aa | ||
|
|
8257fd8e7c | ||
|
|
bc58aff362 | ||
|
|
1073954550 | ||
|
|
c3d7a4e3de | ||
|
|
92ae92c116 | ||
|
|
3c10be6d1a | ||
|
|
f18a9bdcc7 | ||
|
|
87f59cd3eb | ||
|
|
819b6fcacb | ||
|
|
246961887e | ||
|
|
54e21333a3 | ||
|
|
c45beec59d | ||
|
|
c88ada489a | ||
|
|
189f23f407 | ||
|
|
9789143c6d | ||
|
|
f4dd7ff483 | ||
|
|
50e05c6320 | ||
|
|
9ba5360bfc | ||
|
|
565ef693ce | ||
|
|
0c1a8eff85 | ||
|
|
32e9de6e9a | ||
|
|
533955a9c7 | ||
|
|
2faa0356a5 | ||
|
|
ee2a5c199a | ||
|
|
bdcc522897 | ||
|
|
71b20bdeaa | ||
|
|
0e85b4776a | ||
|
|
24d2c1bc7a | ||
|
|
1610e932c6 | ||
|
|
31d7bb2332 | ||
|
|
3d9c03c0c8 | ||
|
|
dd94343d92 | ||
|
|
4b93dede33 | ||
|
|
61205989cc | ||
|
|
2559ea61d8 | ||
|
|
eae665c1c5 | ||
|
|
d73521e0a0 | ||
|
|
e8deb0384a | ||
|
|
881f2c023e | ||
|
|
5057a8a7a3 | ||
|
|
b8e9269488 | ||
|
|
76afd5a7ca | ||
|
|
dc48d467f5 | ||
|
|
0b0390620e | ||
|
|
24eb34c182 | ||
|
|
1a5bd1b6a2 | ||
|
|
ab7b6ce460 | ||
|
|
c4cd677021 | ||
|
|
6b84d39dda | ||
|
|
e61342177d | ||
|
|
d51fa92b46 | ||
|
|
3e20dc7de6 | ||
|
|
dce1d7ba39 | ||
|
|
adffea1d52 | ||
|
|
20b73dcc84 | ||
|
|
b331fa353b | ||
|
|
9fe14609af | ||
|
|
f6973b8907 | ||
|
|
8738036f6f | ||
|
|
fce02dc0e5 | ||
|
|
2bef0e833f | ||
|
|
9040a2a2e3 | ||
|
|
4407ed0a6f | ||
|
|
09721518b0 | ||
|
|
8ad6337dde | ||
|
|
271740d2ac | ||
|
|
48dd537257 | ||
|
|
77b4aaa50d | ||
|
|
1014316581 | ||
|
|
739cd83155 | ||
|
|
df08bc4da0 | ||
|
|
55e832d4f6 | ||
|
|
032472dcb3 | ||
|
|
68bf93d1ac | ||
|
|
ba133f94fc | ||
|
|
064c16f4d7 | ||
|
|
5a394ee744 | ||
|
|
3bc2f5dc55 | ||
|
|
6f63818e5f | ||
|
|
a5d7bee939 | ||
|
|
9d396162f1 | ||
|
|
4a0d9a96ab | ||
|
|
9f65e5a9ab | ||
|
|
c71f4e438b | ||
|
|
14d13eb4c7 | ||
|
|
29c629eb22 | ||
|
|
050b794b42 | ||
|
|
89b5f8c275 | ||
|
|
f589197321 | ||
|
|
09575a68f0 | ||
|
|
c1b838e356 | ||
|
|
8ed2696315 | ||
|
|
ab138bdba2 | ||
|
|
5ba9fb78fd | ||
|
|
2d47447375 | ||
|
|
d9eaede4c2 | ||
|
|
c6db11a10b | ||
|
|
2225e542ad | ||
|
|
975e13d45f | ||
|
|
534a165c45 | ||
|
|
5cff6ed67b | ||
|
|
3448733834 | ||
|
|
c382c95d24 | ||
|
|
0034226fa7 | ||
|
|
5f067a6bb5 | ||
|
|
6ab1996440 | ||
|
|
5bff6d63f2 | ||
|
|
5fe227b874 | ||
|
|
cbaf2f8370 | ||
|
|
393ac886e2 | ||
|
|
c9082083d1 | ||
|
|
5d0d89e74d | ||
|
|
e9c3583fd8 | ||
|
|
81eadc1418 | ||
|
|
dfff0efc0b | ||
|
|
3732db2226 | ||
|
|
e9ccdcfbbe | ||
|
|
01345a5dc4 | ||
|
|
90c8e57ed7 | ||
|
|
d644b4c331 | ||
|
|
2f15c71412 | ||
|
|
0a44a74f59 | ||
|
|
f876fe8d25 | ||
|
|
290032646f | ||
|
|
e5d2ed4bb2 | ||
|
|
e9ea0e0389 | ||
|
|
35565bb021 | ||
|
|
56aff1d191 | ||
|
|
b8be1d1866 | ||
|
|
1d7d2cd52e | ||
|
|
71446a12af | ||
|
|
ca6cafaebd | ||
|
|
c97be335ee | ||
|
|
fd1227b87e | ||
|
|
7ef72c501e | ||
|
|
f7ee96aa99 | ||
|
|
b84478898d | ||
|
|
6afe0e8a34 | ||
|
|
6e4f4b5c8d | ||
|
|
f86fe4a138 | ||
|
|
63c663b8c1 | ||
|
|
a1296596fa | ||
|
|
1cca4de9e5 | ||
|
|
7ada587df3 | ||
|
|
1e58c32a5f | ||
|
|
2a27048174 | ||
|
|
2b291954cf | ||
|
|
8f8bfc62ca | ||
|
|
38d4d448a9 | ||
|
|
d5d11ca4bd | ||
|
|
e3e400f376 | ||
|
|
6637758ad0 | ||
|
|
41e9bd3cb5 | ||
|
|
c2d1909379 | ||
|
|
77688f297f | ||
|
|
714f665cc7 | ||
|
|
ec138d5741 | ||
|
|
560e5aa19a | ||
|
|
ad162f3366 | ||
|
|
5d07830339 | ||
|
|
b310d25ee3 | ||
|
|
443ccbd807 | ||
|
|
8cdecf80c7 | ||
|
|
a16d5435de | ||
|
|
ec02422226 | ||
|
|
cc5d438550 | ||
|
|
806d116501 | ||
|
|
066c9d9fec | ||
|
|
5b3b9fbc30 | ||
|
|
d15e189b7c | ||
|
|
1bd9974f89 | ||
|
|
90296d87df | ||
|
|
75b287771a | ||
|
|
5765504796 | ||
|
|
dda8c0c9e0 | ||
|
|
ce9d668602 | ||
|
|
39c2c5f25f | ||
|
|
12a7d794b4 | ||
|
|
ff8b0300ae | ||
|
|
f882df4cb7 | ||
|
|
e1300005cb | ||
|
|
e599ab9214 | ||
|
|
92acf62884 | ||
|
|
c2fb57fce9 | ||
|
|
3699d26e5d | ||
|
|
6eb0159ea1 | ||
|
|
433913c77a | ||
|
|
d955feef61 | ||
|
|
5377b9b618 | ||
|
|
5c9371c575 | ||
|
|
23d916f191 | ||
|
|
35d4914518 | ||
|
|
eb2ec71d2b | ||
|
|
dc50758dc9 | ||
|
|
9775d71c28 | ||
|
|
c40e4ee9ee | ||
|
|
2b469c385c | ||
|
|
a104fe45aa | ||
|
|
257df25a67 | ||
|
|
2a977557c2 | ||
|
|
d0e9f03311 | ||
|
|
97ca699170 | ||
|
|
702537e8fd | ||
|
|
83a3488d0d | ||
|
|
450e938092 | ||
|
|
b88e076f27 | ||
|
|
0fe90df01e | ||
|
|
66ad909908 | ||
|
|
77d74717d2 | ||
|
|
63f683982f | ||
|
|
9525ce8299 | ||
|
|
d7b8ec1274 | ||
|
|
96cd16faf7 | ||
|
|
9ddc7501fe | ||
|
|
301c496fb2 | ||
|
|
3eb265c5f7 | ||
|
|
049338e83b | ||
|
|
a336e9f460 | ||
|
|
0294cf8c4a | ||
|
|
c5183309ae | ||
|
|
0a15cb1e13 | ||
|
|
9546cc42b2 | ||
|
|
ac01262655 | ||
|
|
6ea962c1fa | ||
|
|
9e35283273 | ||
|
|
9c8e1d9c9f | ||
|
|
7d324b3fd4 | ||
|
|
badc5738ff | ||
|
|
8feaf4410f | ||
|
|
4e224d761e | ||
|
|
e775abdc5a | ||
|
|
60754c9380 | ||
|
|
c890ff5605 | ||
|
|
9f9c0059a5 | ||
|
|
4eabd417b9 | ||
|
|
c218de9567 | ||
|
|
4b5ca5ecf4 | ||
|
|
edbf46a751 | ||
|
|
c9c90bb86a | ||
|
|
437a608d2b | ||
|
|
b638eef1c6 | ||
|
|
b7cec8a0c4 | ||
|
|
28578bd6b0 | ||
|
|
160004fa7e | ||
|
|
f4332761f9 | ||
|
|
a4d1a18850 | ||
|
|
c3e1e55e9c | ||
|
|
e20bcd19b9 | ||
|
|
1fbf213ada | ||
|
|
c2d2359a8c | ||
|
|
586a2a065e | ||
|
|
adf43b7e35 | ||
|
|
45a4cddeef | ||
|
|
69f62551c7 | ||
|
|
f1bdf502be | ||
|
|
e89b3795f8 | ||
|
|
20b169e8eb | ||
|
|
1480ee2779 | ||
|
|
41c9741b72 | ||
|
|
f9e5096ceb | ||
|
|
a9b2a4940e | ||
|
|
f66c6ab8fc | ||
|
|
73902d5f92 | ||
|
|
0bb5f9f297 | ||
|
|
16ad8502d2 | ||
|
|
ad68e6057e | ||
|
|
54b4faeeff | ||
|
|
a7f69545f2 | ||
|
|
93ea558ec3 | ||
|
|
d0cdc208e3 | ||
|
|
0d7c483bd5 | ||
|
|
3f211c6277 | ||
|
|
79e93edfef | ||
|
|
44e8efda36 | ||
|
|
9726ac6f12 | ||
|
|
898d8c6449 | ||
|
|
01006ed76d | ||
|
|
2936823d03 | ||
|
|
7d05d53f9e | ||
|
|
f3074461ed | ||
|
|
146f832919 | ||
|
|
a622707608 | ||
|
|
6da43b15c8 | ||
|
|
d0bb7b075e | ||
|
|
c1ecd74644 | ||
|
|
a1aada0777 | ||
|
|
c55a8eeccd | ||
|
|
73cc8adcab | ||
|
|
7bb05f7f26 | ||
|
|
7f0803c3f6 | ||
|
|
1185ea4f96 | ||
|
|
43db51a664 | ||
|
|
d35cdc91f8 | ||
|
|
8d643277c0 | ||
|
|
5be1858b45 | ||
|
|
13d6e16630 | ||
|
|
dcb1cbbdb7 | ||
|
|
f7f077be3e | ||
|
|
3d79416520 | ||
|
|
c559e70270 | ||
|
|
efcc15d89d | ||
|
|
d17fe6bb7a | ||
|
|
01235ff398 | ||
|
|
3d6e490505 | ||
|
|
bd3491d210 | ||
|
|
d139146e0b | ||
|
|
b36da06fad | ||
|
|
d20c5e1773 | ||
|
|
0afc0d59a4 | ||
|
|
26481c547a | ||
|
|
45fe8c182b | ||
|
|
c25ddd0dbc | ||
|
|
efc9a10fdf | ||
|
|
a8eb9dfedf | ||
|
|
87cf5cb932 | ||
|
|
e1ca2c0b98 | ||
|
|
a9295751c8 | ||
|
|
2a46a5c00a | ||
|
|
d3b7af3c5f | ||
|
|
db59f24873 | ||
|
|
5645bf7982 | ||
|
|
6cbf87b52c | ||
|
|
bc642deebd | ||
|
|
e84a9643f8 | ||
|
|
e9af0ebdc5 | ||
|
|
29ee8a035b | ||
|
|
81ac4e8d01 | ||
|
|
ecc68d373f | ||
|
|
3032572f18 | ||
|
|
bcee6abb65 | ||
|
|
7e0b8ddf50 | ||
|
|
91dcb508b3 | ||
|
|
d549e2722d | ||
|
|
3bb29c8308 | ||
|
|
0121228d88 | ||
|
|
cbafa7110a | ||
|
|
06791beabd | ||
|
|
68b9857409 | ||
|
|
112a0df8c2 | ||
|
|
73717278ff | ||
|
|
5fa79926db | ||
|
|
06f97ac2f1 | ||
|
|
c2b4961b8d | ||
|
|
9b3838b912 | ||
|
|
946ea19371 | ||
|
|
419e011d0b | ||
|
|
b0157c9bd2 | ||
|
|
37d146e8fa | ||
|
|
063d982750 | ||
|
|
fbfeaa0f95 | ||
|
|
9b11b02658 | ||
|
|
3e435c419a | ||
|
|
1b37ba8daa | ||
|
|
b529219a0e | ||
|
|
d9b3eff18f | ||
|
|
cb5ada6ec9 | ||
|
|
baf7ffd441 | ||
|
|
2b4ca80a95 | ||
|
|
b5963936fd | ||
|
|
354ed9ede0 | ||
|
|
7ad9b8ff3e | ||
|
|
6dc522a044 | ||
|
|
3e91bc8c1e | ||
|
|
3218c544dc | ||
|
|
1ae11da036 | ||
|
|
84e36d758e | ||
|
|
06ede80435 | ||
|
|
dbc57060ee | ||
|
|
798bd46d0a | ||
|
|
c95f388d8d | ||
|
|
a9024ebc6b | ||
|
|
33bc2d8a6b | ||
|
|
cc60f2f308 | ||
|
|
edaa51593b | ||
|
|
e2265dd6f7 | ||
|
|
e1cf89c3bf | ||
|
|
8cd1541893 | ||
|
|
9d510815b4 | ||
|
|
44d22d93da | ||
|
|
f7405a82e6 | ||
|
|
04f3e44c3a | ||
|
|
6cc207a10c | ||
|
|
6b5e615a23 | ||
|
|
46268a7cf3 | ||
|
|
3682fbf531 | ||
|
|
0928b54d90 | ||
|
|
5a10339adc | ||
|
|
7c412cbec8 | ||
|
|
d235ca8ed8 | ||
|
|
97511be64a | ||
|
|
3bd5aaa251 | ||
|
|
ae2d9d8387 | ||
|
|
33c9694d26 | ||
|
|
dbede7f81a | ||
|
|
c8ad2bb454 | ||
|
|
18c52a5e23 | ||
|
|
ca1954ff80 | ||
|
|
5a3574734c | ||
|
|
5c6d10b2db | ||
|
|
7e96ced4c4 | ||
|
|
8da259cabc | ||
|
|
f978d739bb | ||
|
|
7b2d50e93e | ||
|
|
8bec50663f | ||
|
|
f4f5063efe | ||
|
|
11782ac34d | ||
|
|
bfec3fff36 | ||
|
|
d8c0a56577 | ||
|
|
ff1326a44f | ||
|
|
1fa4fccbcc | ||
|
|
323b41fd58 | ||
|
|
3d2b881b0e | ||
|
|
def41af469 | ||
|
|
4750aba763 | ||
|
|
5a9249dee1 | ||
|
|
064fc0a8e2 | ||
|
|
67de70432c | ||
|
|
facd71bd71 | ||
|
|
96e6270520 | ||
|
|
51c45e86ce | ||
|
|
445214f0b5 | ||
|
|
859d4f5372 | ||
|
|
0541280b20 | ||
|
|
ec7ced9fd3 | ||
|
|
4840b435f5 | ||
|
|
3acee3a686 | ||
|
|
d849a249c2 | ||
|
|
38656eca72 | ||
|
|
9b438d0caa | ||
|
|
f30debd1b3 | ||
|
|
d32b32842a | ||
|
|
2fad8f2ad7 | ||
|
|
7d17bd7dd1 | ||
|
|
357eded2c3 | ||
|
|
f7532cf5b4 | ||
|
|
bd7203dd9c | ||
|
|
9e98351923 | ||
|
|
b46997bc1a | ||
|
|
477d698eac | ||
|
|
96ab3d1c7e | ||
|
|
0dd41ab18a | ||
|
|
47b7780c96 | ||
|
|
ac35f002f1 | ||
|
|
8dec24693c | ||
|
|
e3803702c5 | ||
|
|
b9c8fed01f | ||
|
|
e97fec802c | ||
|
|
0234b0f6ce | ||
|
|
4fa3708c2f | ||
|
|
bede658d94 | ||
|
|
6f85e4506b | ||
|
|
9d21aa36de | ||
|
|
3c02286a08 | ||
|
|
6f2a2fd9e6 | ||
|
|
22169c64db | ||
|
|
b8e128e0a9 | ||
|
|
2729b37b76 | ||
|
|
0a5b0eb6d5 | ||
|
|
295b7a0701 | ||
|
|
fea3bd6aa4 | ||
|
|
05724ae64f | ||
|
|
8d7afe4f46 | ||
|
|
77c716bd6c | ||
|
|
f6c5aa9f84 | ||
|
|
945e5ca11c | ||
|
|
2f58e593e5 | ||
|
|
32fad08ef5 | ||
|
|
9606dd3501 | ||
|
|
f09b055872 | ||
|
|
4433da1e4a | ||
|
|
e3f02d02a2 | ||
|
|
a4ff2c7701 | ||
|
|
de510129bc | ||
|
|
ed171e5761 | ||
|
|
747d8a6031 | ||
|
|
36a5039c12 | ||
|
|
ac075c5bae | ||
|
|
e650c2f534 | ||
|
|
48b3998443 | ||
|
|
ef17da48c7 | ||
|
|
c97fff320b | ||
|
|
255954dd56 | ||
|
|
3c748bca39 | ||
|
|
c18b3e9114 | ||
|
|
66b4388e64 | ||
|
|
116adb1167 | ||
|
|
3db83db5d2 | ||
|
|
efc63b5230 | ||
|
|
c45cd56c78 | ||
|
|
f94a617d94 | ||
|
|
153ecf4d13 | ||
|
|
825bc87ca3 | ||
|
|
d1b652b013 | ||
|
|
46d7212d1b | ||
|
|
ea350c30c8 | ||
|
|
45871aa1c8 | ||
|
|
d3dedca4a8 | ||
|
|
1177263c8f | ||
|
|
a82b63e88b | ||
|
|
2f66c93bfd | ||
|
|
6991fa4907 | ||
|
|
b86d76fcd4 | ||
|
|
4f1ee03fe8 | ||
|
|
e3267f2e0c | ||
|
|
c265aad6d7 | ||
|
|
b512fe2003 | ||
|
|
46648e2547 | ||
|
|
54e945bf14 | ||
|
|
7c01fced68 | ||
|
|
64871b4c37 | ||
|
|
e3e2def809 | ||
|
|
ea7d1ce0e2 | ||
|
|
f5ddf1bc0e | ||
|
|
f6a6316b7a | ||
|
|
35f62d4e45 | ||
|
|
77efbe39a9 | ||
|
|
fcdf538368 | ||
|
|
248f24d4b9 | ||
|
|
32422646e4 | ||
|
|
a90e4e9c8d | ||
|
|
74188415dd | ||
|
|
11a4fdfcd5 | ||
|
|
7a119facdf | ||
|
|
4e6cc5ffa0 | ||
|
|
5a37e3e275 | ||
|
|
1edc32c6b0 | ||
|
|
a01a5a737b | ||
|
|
0c22064a94 | ||
|
|
9ef68d226a | ||
|
|
bf361f6824 | ||
|
|
74ee210514 | ||
|
|
2b7f21fee4 | ||
|
|
6ad32e487f | ||
|
|
97fd3eaf64 | ||
|
|
d9b4647cf5 | ||
|
|
03e0c02640 | ||
|
|
398f8c4318 | ||
|
|
1c7709a18b | ||
|
|
06c3a588bf | ||
|
|
80526c0e06 | ||
|
|
86528334d1 | ||
|
|
1cc4f7eaaa | ||
|
|
af2a05d0b5 | ||
|
|
701daadff5 | ||
|
|
7442d1c4a5 | ||
|
|
f247545fc4 | ||
|
|
e8817ec9ea | ||
|
|
44d2466422 | ||
|
|
eb7a0143da | ||
|
|
069e656cde | ||
|
|
f1aa3f5c68 | ||
|
|
acc3d7610b | ||
|
|
b2565bedd3 | ||
|
|
80c36ca846 | ||
|
|
00e5e75092 | ||
|
|
c8b30b6714 | ||
|
|
2c4418e6e6 | ||
|
|
d0e7e1bbb5 | ||
|
|
70ce762b5a | ||
|
|
e879153df7 | ||
|
|
c9db9566cb | ||
|
|
a1283bfc0f | ||
|
|
378de09ccd | ||
|
|
20febbc3bc | ||
|
|
3b0ba43e94 | ||
|
|
c189a6b489 | ||
|
|
2082c479f1 | ||
|
|
b70e868b5c | ||
|
|
24a50346db | ||
|
|
b84a03082e | ||
|
|
e40e10da61 | ||
|
|
6a858dace7 | ||
|
|
b0fbaa71bf | ||
|
|
18a2b686c1 | ||
|
|
a2f23bd056 | ||
|
|
bb5a9826bc | ||
|
|
9904eb0b0d | ||
|
|
f89f215813 | ||
|
|
d01bd487f7 | ||
|
|
3be31dbf90 | ||
|
|
bb1bce879f | ||
|
|
dd6082c8a1 | ||
|
|
be6d208b8b | ||
|
|
f547523c3e | ||
|
|
7de19f8087 | ||
|
|
dfdf8b881e | ||
|
|
da6755f703 | ||
|
|
602bde7bc5 | ||
|
|
e9d1297c17 | ||
|
|
8bbee7fe06 | ||
|
|
8b4c86c8ba | ||
|
|
6c1ee24101 | ||
|
|
26ed6aa840 | ||
|
|
ef3802f7c2 | ||
|
|
3c9e38d7ad | ||
|
|
2e4aeca0df | ||
|
|
fd6bf931fc | ||
|
|
751b795417 | ||
|
|
8b07b189d4 | ||
|
|
6c6fb117ea | ||
|
|
6fffe10c32 | ||
|
|
a2d5b97467 | ||
|
|
1cda446063 | ||
|
|
a5af583a29 | ||
|
|
4d4638feea | ||
|
|
ef3d76fb9f | ||
|
|
5e12979f09 | ||
|
|
cd64b60ece | ||
|
|
13951e5806 | ||
|
|
6cfc8c7a52 | ||
|
|
fd6610f966 | ||
|
|
aaa63a7f5d | ||
|
|
f786c4db50 | ||
|
|
87a0c0b0b6 | ||
|
|
8cfae368c3 | ||
|
|
f19b8a88d5 | ||
|
|
ac384c5d95 | ||
|
|
83c326fb39 | ||
|
|
be31d03733 | ||
|
|
0fcba5f1ee | ||
|
|
d1041c30db | ||
|
|
1642c61b7f | ||
|
|
2ff5f2eb46 | ||
|
|
af4ba976d9 | ||
|
|
3fc5a167a4 | ||
|
|
933449f16b | ||
|
|
dd170ec7ef | ||
|
|
2d3b01ba34 | ||
|
|
6a8737547f | ||
|
|
ae8997b4f3 | ||
|
|
65e3384a96 | ||
|
|
945fb5ed55 | ||
|
|
ca2949dcaf | ||
|
|
7b22c6232d | ||
|
|
3ec5894249 | ||
|
|
77462888ff | ||
|
|
0ee05687d9 | ||
|
|
d8dbce7cc9 | ||
|
|
adea5a5674 | ||
|
|
443b4a193c | ||
|
|
46c31e1abb | ||
|
|
46cdfe992f | ||
|
|
752cc88270 | ||
|
|
d1f13ddec0 |
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
|
||||
|
||||
378
Changelog.txt
378
Changelog.txt
@@ -6,7 +6,379 @@ Key:
|
||||
= Fix
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
|
||||
Version 1.4.00-dev
|
||||
+ Added new Child Skill - Smelting!
|
||||
+ 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 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
|
||||
+ Added vanilla XP boost for Fishing - includes permissions, config options, etc
|
||||
= Fixed /addlevels 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 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 a bug where party join messages weren't displayed
|
||||
= Fixed a bug where Disarm and Deflect had wrong values
|
||||
= Fixed Magic Hunter (Fishing ability) favoring certain enchants
|
||||
! 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 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
|
||||
- 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.
|
||||
|
||||
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
|
||||
! 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 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
|
||||
+ Added 50% & 150% XP boost perks
|
||||
+ Added "lucky" perk for donors
|
||||
= Fixed /inspect not working on offline players
|
||||
= Fixed custom blocks, tools and armors not loading properly
|
||||
= Fixed duplication bug with sticky pistons
|
||||
= Fixed "GenericLabel belonging to mcMMO..." message
|
||||
= 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 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
|
||||
= Fixed ArrayIndexOutOfBounds error caused when trying to use /xplock after logging in but before gaining XP
|
||||
= Fixed custom tools not properly respecting the Ability_Enabled flag.
|
||||
= Fixed "lower tool" messages still being displayed even when ability messages are disabled.
|
||||
= Fixed custom blocks not dropping the proper item with Super Breaker when Silk Touch is used
|
||||
= 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
|
||||
|
||||
Version 1.3.09
|
||||
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
|
||||
+ Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP)
|
||||
+ Added reduced cooldown permission nodes as special perks (1/4, 1/3, 1/2 cooldown)
|
||||
+ Added increased activation time permissions nodes as special perks (+4, +8, and +12 seconds)
|
||||
+ Added API for plugins to add custom tools directly via Spout - repair / abilities do not work ATM
|
||||
+ Added offline party members to the list displayed by /party
|
||||
+ Added possibility to kick offline members from parties
|
||||
= Fixed bug that would cause a NPE for players that had no parties
|
||||
= Fixed Vampirism not notifying the correct amount of stolen levels
|
||||
= Fixed bug with Acrobatics not saving you from deadly falls
|
||||
= Fixed /mcremove being applied only after a reload
|
||||
= Fixed Archery PVE disablement not working properly
|
||||
= Fixed possible NPE when a projectile is shot by a dispenser or doesn't have any shooter
|
||||
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)
|
||||
= Fixed tiny memory leak concerning Archery
|
||||
= Fixed bug where you could receive Archery XP from Potions
|
||||
= Fixed bug where Chunklets for the < 64 y coordinates would not be properly loaded
|
||||
= Fixed exploit with block duplication via piston pushing
|
||||
= Fixed bug with falling sand/gravel not being tracked
|
||||
= Fixed bug with Tree Feller not working with custom axes
|
||||
= Fixed bug with locale strings when trying to teleport to a non-existent player
|
||||
= Fixed bug with Tree Feller changing durability before checking for axe splintering
|
||||
= Fixed bug with Repair Mastery permission due to typo
|
||||
= Fixed bug with repairing items that use metadata
|
||||
= Fixed bug with Chunklets not being reloaded on /reload
|
||||
= Fixed possible NPE when falling with no item in hand
|
||||
! API methods can now only be used in a static way
|
||||
! Arrows shot from a bow having the Infinity enchantment can no longer be retrieved
|
||||
! Arrows that aren't shot by an entity are now able to be dodged (currently only from dispensers)
|
||||
! Changed Spout settings to be in their own config file (spout.yml)
|
||||
! Changed file format for parties (parties.yml), previous files are no longer used
|
||||
! Changed mcMMO to inform on corrupt Chunklets and make new ones
|
||||
|
||||
Version 1.3.08
|
||||
+ Added more notifications about Vampirism and Hardcore mode on player death
|
||||
+ Added information about Hardcore mode when joining a server running Hardcore mode
|
||||
+ Added new hidden.yml inside the jar for very sensitive config options for advanced users
|
||||
+ Added option to disable Chunklets for servers which do not have doubledrops and do not care about xp farming
|
||||
+ Added new "Max_Seconds" setting in config.yml to limit the max time of abilities
|
||||
+ Added new repair configs to allow customization of the repair skill
|
||||
+ Added message to inform users about hardcore mode on login
|
||||
= Fixed exploit where you could gain tons of Acrobatics XP from spamming Ender Pearls
|
||||
= Fixed normal pistons marking a block as user-placed on retract if it wasn't a sticky piston (thanks turt2live!)
|
||||
= Fixed handling of the Unbreaking enchantment so that tools are actually damaged as they should now
|
||||
= Fixed hurting pet cats with serrated strikes
|
||||
! Changed Hardcore Vampirism to require the victim to have at least half the skill level of the killer in order for vampirism to proc (this is to avoid exploitation)
|
||||
! Changed Hardcore Vampirism to steal a minimum of 1 skill level from a player no matter the percentage
|
||||
! Changed Hardcore & Vampirism to not be executed if percentages were set to zero or below
|
||||
! Changed Vampirism to actually remove stats from the victim
|
||||
! Changed Vampirism to inform the victim of their stat loss
|
||||
! Changed Mining to allow Silk Touch to work again since the dupe exploit has been fixed.
|
||||
! Changed Metrics to also report if the server uses plugin profiling
|
||||
- Removed level and item settings from Repair skill in config.yml
|
||||
|
||||
Version 1.3.07
|
||||
+ Added ability to gain XP from custom blocks. Enable custom blocks in the config file, then enter the data in the blocks.yml file.
|
||||
+ Added ability to gain XP with custom tools. Enable custom tools in the config file, then enter the data in the tools.yml file.
|
||||
+ Added ability to repair custom tools. Enable custom tools in the config file, then enter the data in the tools.yml file.
|
||||
+ Added ability to repair custom armor. Enable custom armor in the config file, then enter the data in the armor.yml file.
|
||||
+ Added functionality which makes a new folder in all world files "mcmmo_data" to store player placed block information in
|
||||
+ Added new configurable Hardcore mode functionality to mcMMO
|
||||
+ Added new configurable Vampirism PVP stat leech for Hardcore mode
|
||||
+ Added new bypass permission node for the negative penalties of Hardcore mode 'mcmmo.bypass.hardcoremode'
|
||||
+ Added configurable level curve multiplier which allows for tweaking the steepness of the XP needed to level formula
|
||||
+ Added a permission node for Archery bonus damage
|
||||
+ Added a permission node for Greater Impact ability
|
||||
+ Added permission nodes for Treasure & Magic Hunter for Fishing
|
||||
+ Added a permission node for Farmer's Diet
|
||||
+ Added config options for enabling/disabling specific double drops
|
||||
+ Added automatic zip backup of flatfile database & config files
|
||||
+ Added config options to enable/disable specific skills for PVP & PVE
|
||||
= Fixed bug where Tree Feller was looking at the wrong blocks for determining how much to take down.
|
||||
= Fixed bug where Green Terra consumed seeds even on Mossy Stone Brick
|
||||
= Fixed bug where the client didn't reflect the Stone Brick to Mossy Stone Brick change
|
||||
= Fixed bug where an arrow could bounce off entities on daze proc
|
||||
= Fixed bug where a player could gain Acrobatics experience while riding a cart
|
||||
= Fixed /party not working properly with 2 arguments
|
||||
= Fixed /party not showing properly the member list
|
||||
= Fixed /ability not checking the right permission
|
||||
= Fixed rare NPE on /party command
|
||||
= Fixed Arrow Retrieval dropping only one arrow
|
||||
= Fixed /p and /a incompatibilities with bChatManager
|
||||
= Fixed Iron Grip working reversely
|
||||
= Fixed NPE when user clicked the HUD button with Spout
|
||||
= Fixed bug where the permission node for Impact didn't work
|
||||
= Fixed some bypass nodes defaulting true for Ops
|
||||
= Fixed bug with trying to use Chimera Wing while standing on a half-block
|
||||
= Fixed duplication bug when a placed block was mined after a server restart
|
||||
= Fixed exploit where shooting yourself with an arrow gave Archery XP
|
||||
! Changed the mcMMO motd to link to the new website rather than the wiki
|
||||
! Changed bleeding ticks damage to 1 from 2
|
||||
! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch
|
||||
! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick
|
||||
! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server
|
||||
! Changed the permission node for Blast Mining detonation to mcmmo.ability.blastmining.detonate (was mcmmo.skills.blastmining) for the sake of consistency
|
||||
! Changed skill commands to only display what you have permissions for
|
||||
! Changed mcMMO to use a new storage system for player placed blocks
|
||||
- Removed some unused permission nodes
|
||||
- Removed a few config options in favor of permissions nodes (Hunger Bonus, Armor/Tool Repair, Instant Wheat Regrowth)
|
||||
- Removed level requirement for repairing string tools from the config file
|
||||
|
||||
Version 1.3.06
|
||||
+ Added Iron Golem XP for aggressive golems
|
||||
+ Added permissions check to skill functions
|
||||
+ Added API functions for obtaining offline profiles & profiles via player names
|
||||
+ Added API functions for admin & party chat
|
||||
+ Added Iron Grip skill to Unarmed which gives players an chance to keep from being disarmed.
|
||||
+ Added some new languages to the locale files.
|
||||
= Fixed Green Thumb consuming 2 seeds instead of 1
|
||||
= Fixed exploit where you could teleport to yourself with PTP to prevent things like fall damage
|
||||
= 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 bug with repairing wooden tools
|
||||
= Fixed bug with Nether Wart not awarding XP
|
||||
= Fixed bug with fishing treasures when treasures list is empty
|
||||
= Fixed bug with only getting one level when there was enough XP for multiple levels.
|
||||
= Fixed bugs with the way /mctop displayed
|
||||
= Fixed issues with custom characters & locale files.
|
||||
= Fixed double explosion for Blast Mining
|
||||
= Fixed Blast Mining not giving triple drops when it should
|
||||
! Changed Bleeding to now stack to a finite number on Monsters and will wear off eventually
|
||||
! 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 /mcremove to no longer kick players when they are removed from database
|
||||
! 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 /mcrefresh to work from console
|
||||
! 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
|
||||
|
||||
Version 1.3.05
|
||||
+ Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%)
|
||||
+ Added ExperienceAPI and PartyAPI classes for developer use
|
||||
+ Added ability to cap overall power level
|
||||
+ Added showing powerlevel below a persons name if you run Spout (optional)
|
||||
= Fixed errors when Spout would disable itself after start-up
|
||||
= Fixed XP bar not updating when XP was gained
|
||||
= Fixed bug with repairing wooden tools
|
||||
= Fixed bug where spawned wolves only had 8 health.
|
||||
= Fixed bug where rare Treasures from Excavation were dropping too often
|
||||
= Fixed bug where Skull Splitter & Serrated Strikes could be used without permissions.
|
||||
= Fixed bug where API functions were set to static
|
||||
= Fixed bug where mmoedit threw errors when modifying an offline user
|
||||
= Fixed dupe exploit with Blast Mining
|
||||
! Changed Tree Feller to account for ability durability loss but not leaves.
|
||||
! Changed bypass node for Arcane Forging to not default to true for OPs
|
||||
- Removed Ignition from Archery
|
||||
- Removed McMMOPlayerRepairEvent - was basically a duplicate of McMMOPlayerRepairCheck but couldn't be cancelled.
|
||||
|
||||
Version 1.3.04
|
||||
+ Added McMMOPlayerRepairEvent for API usage - fires after completion of a repair.
|
||||
+ Added McMMOPlayerRepairCheckEvent for API usage - fires before repair process begins, can be cancelled.
|
||||
+ Added ability to get skill level from McMMOPlayerExperience events
|
||||
+ Added McMMOPartyTeleportEvent for API usage - fires before a successful teleportation would occur.
|
||||
+ Added McMMOPartyChangeEvent for API usage - fires whenever a player joins or leaves a party
|
||||
= Fixed Shake ability dropping bonemeal instead of ink for squids.
|
||||
= Fixed Green Terra & Super Breaker awarding 4x drops at high levels.
|
||||
= Fixed summoned ocelots never changing skins.
|
||||
= Fixed bug with Disarm not working
|
||||
= Fixed some API functions not being visible
|
||||
= Fixed bug where /ptp worked on dead party members
|
||||
! Changed MySQL to reload all player information on reconnection
|
||||
! Changed event package structure - be sure to update these if you're using the API in your plugin
|
||||
|
||||
Version 1.3.03
|
||||
+ Added Ocelots to Taming XP tables
|
||||
+ Added ability to summon Ocelots with Call of the Wild
|
||||
@@ -20,7 +392,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
|
||||
@@ -36,7 +408,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,6 +1,9 @@
|
||||
== mcMMO
|
||||
**The RPG lovers mod**
|
||||
|
||||
=== 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.
|
||||
|
||||
@@ -17,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.
|
||||
|
||||
73
extras/repair.chain.yml
Normal file
73
extras/repair.chain.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Any file named repair.*.yml in the mcmmmo folder will be loaded as a repair config
|
||||
# All repair configs have a main section titled "Repairables"
|
||||
# Afterwards, all sub-items are considered a Repairable to be loaded
|
||||
# The bare minimum of a Repairable is that it have an ItemId, a RepairMaterialId, and a MaximumDurability
|
||||
#
|
||||
# ItemId: This is the id of the item to be repairable.
|
||||
## This is required to be set.
|
||||
#
|
||||
# ItemType: This is the type of item to be repaired, this is only important to permissions.
|
||||
## Valid values are ARMOR, TOOL, and OTHER.
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# MaterialType: This is the type of the material of the item to be repaired, this is only important for permissions.
|
||||
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# RepairMaterialId: This is the id of the item used to repair this repairable.
|
||||
## This is required to be set.
|
||||
#
|
||||
# RepairMaterialMetadata: This is the metadata of the item used to repair this repairable.
|
||||
## A value of -1 means to ignore all metadata when repairing.
|
||||
## This defaults to -1
|
||||
#
|
||||
# MaximumDurability: This is the maximum durability of the item.
|
||||
## This is required to be set.
|
||||
#
|
||||
# MinimumLevel: This is the minimum repair level needed to repair this item.
|
||||
## Valid values are > 0
|
||||
## This defaults to 0
|
||||
#
|
||||
# MinimumQuantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses.
|
||||
## This is typically the number of the repair material needed to create a new item, for example for a sword it is 2, for an axe it is 3
|
||||
## This defaults to 2
|
||||
#
|
||||
# XpMultiplier: This is the amount to multiply the xp bonus by.
|
||||
## This defaults to 1
|
||||
#
|
||||
#
|
||||
# The following is an example of a repair.*.yml config which adds the ability to repair Chainmail armor using fire.
|
||||
#
|
||||
#
|
||||
###
|
||||
Repairables:
|
||||
ChainHelmet:
|
||||
ItemId: 302
|
||||
ItemType: ARMOR
|
||||
RepairMaterialId: 51
|
||||
MaximumDurability: 165
|
||||
MinimumQuantity: 5
|
||||
XpMultiplier: 2
|
||||
ChainChest:
|
||||
ItemId: 303
|
||||
ItemType: ARMOR
|
||||
RepairMaterialId: 51
|
||||
MaximumDurability: 240
|
||||
MinimumQuantity: 8
|
||||
XpMultiplier: 2
|
||||
ChainLegs:
|
||||
ItemId: 304
|
||||
ItemType: ARMOR
|
||||
RepairMaterialId: 51
|
||||
MaximumDurability: 225
|
||||
MinimumQuantity: 7
|
||||
XpMultiplier: 2
|
||||
ChainBoots:
|
||||
ItemId: 305
|
||||
ItemType: ARMOR
|
||||
RepairMaterialId: 51
|
||||
RepairMaterialMetadata: -1
|
||||
MaximumDurability: 195
|
||||
MinimumQuantity: 4
|
||||
XpMultiplier: 2
|
||||
45
pom.xml
Normal file → Executable file
45
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.03</version>
|
||||
<version>1.4.00-beta1</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>
|
||||
@@ -54,12 +54,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>
|
||||
@@ -92,6 +92,13 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>2.2</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -109,8 +116,8 @@
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</snapshots>
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.spout.org/content/groups/public/</url>
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.spout.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
@@ -123,12 +130,24 @@
|
||||
</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>
|
||||
</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>
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
|
||||
public class BlockChecks {
|
||||
|
||||
/**
|
||||
* Checks to see if a block type awards XP.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block type awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(Material material) {
|
||||
switch (material) {
|
||||
case BROWN_MUSHROOM:
|
||||
case CACTUS:
|
||||
case CLAY:
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case DIRT:
|
||||
case ENDER_STONE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GLOWSTONE:
|
||||
case GOLD_ORE:
|
||||
case GRASS:
|
||||
case GRAVEL:
|
||||
case IRON_ORE:
|
||||
case JACK_O_LANTERN:
|
||||
case LAPIS_ORE:
|
||||
case LOG:
|
||||
case MELON_BLOCK:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case MYCEL:
|
||||
case NETHERRACK:
|
||||
case OBSIDIAN:
|
||||
case PUMPKIN:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case REDSTONE_ORE:
|
||||
case SAND:
|
||||
case SANDSTONE:
|
||||
case SOUL_SAND:
|
||||
case STONE:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
case WATER_LILY:
|
||||
case YELLOW_FLOWER:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block should allow for the activation of abilities.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block should allow ability activation, false otherwise
|
||||
*/
|
||||
public static boolean abilityBlockCheck(Material material) {
|
||||
switch (material) {
|
||||
case BED_BLOCK:
|
||||
case BREWING_STAND:
|
||||
case BOOKSHELF:
|
||||
case BURNING_FURNACE:
|
||||
case CAKE_BLOCK:
|
||||
case CHEST:
|
||||
case DISPENSER:
|
||||
case ENCHANTMENT_TABLE:
|
||||
case FENCE_GATE:
|
||||
case FURNACE:
|
||||
case IRON_DOOR_BLOCK:
|
||||
case JUKEBOX:
|
||||
case LEVER:
|
||||
case NOTE_BLOCK:
|
||||
case STONE_BUTTON:
|
||||
case TRAP_DOOR:
|
||||
case WALL_SIGN:
|
||||
case WOODEN_DOOR:
|
||||
case WORKBENCH:
|
||||
return false;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Material.getMaterial(LoadProperties.anvilID).equals(material)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block type is an ore.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the Block is an ore, false otherwise
|
||||
*/
|
||||
public static boolean isOre(Material material) {
|
||||
switch (material) {
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GOLD_ORE:
|
||||
case IRON_ORE:
|
||||
case LAPIS_ORE:
|
||||
case REDSTONE_ORE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,468 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.runnables.GainXp;
|
||||
import com.gmail.nossr50.runnables.mcBleedTimer;
|
||||
import com.gmail.nossr50.skills.Acrobatics;
|
||||
import com.gmail.nossr50.skills.Archery;
|
||||
import com.gmail.nossr50.skills.Axes;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.Swords;
|
||||
import com.gmail.nossr50.skills.Taming;
|
||||
import com.gmail.nossr50.skills.Unarmed;
|
||||
|
||||
public class Combat {
|
||||
|
||||
/**
|
||||
* Apply combat modifiers and process and XP gain.
|
||||
*
|
||||
* @param event The event to run the combat checks on.
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void combatChecks(EntityDamageByEntityEvent event, mcMMO plugin) {
|
||||
if (event.getDamage() == 0 || event.getEntity().isDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity damager = event.getDamager();
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
EntityType damagerType = damager.getType();
|
||||
EntityType targetType = target.getType();
|
||||
|
||||
switch (damagerType) {
|
||||
case PLAYER:
|
||||
Player attacker = (Player) event.getDamager();
|
||||
ItemStack itemInHand = attacker.getItemInHand();
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
combatAbilityChecks(attacker);
|
||||
|
||||
if (ItemChecks.isSword(itemInHand) && mcPermissions.getInstance().swords(attacker)) {
|
||||
if (!mcBleedTimer.contains(target) && mcPermissions.getInstance().swordsBleed(attacker)) {
|
||||
Swords.bleedCheck(attacker, target, plugin);
|
||||
}
|
||||
|
||||
if (PPa.getSerratedStrikesMode()) {
|
||||
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.SWORDS);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.SWORDS, plugin);
|
||||
}
|
||||
else if (ItemChecks.isAxe(itemInHand) && mcPermissions.getInstance().axes(attacker)) {
|
||||
if (mcPermissions.getInstance().axeBonus(attacker)) {
|
||||
Axes.axesBonus(attacker, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().criticalHit(attacker)) {
|
||||
Axes.axeCriticalCheck(attacker, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().impact(attacker)) {
|
||||
Axes.impact(attacker, target, event);
|
||||
}
|
||||
|
||||
if (PPa.getSkullSplitterMode()) {
|
||||
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.AXES);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.AXES, plugin);
|
||||
}
|
||||
else if (itemInHand.getType().equals(Material.AIR) && mcPermissions.getInstance().unarmed(attacker)) {
|
||||
if (mcPermissions.getInstance().unarmedBonus(attacker)) {
|
||||
Unarmed.unarmedBonus(PPa, event);
|
||||
}
|
||||
|
||||
if (PPa.getBerserkMode() && mcPermissions.getInstance().berserk(attacker)) {
|
||||
event.setDamage((int) (event.getDamage() * 1.5));
|
||||
}
|
||||
|
||||
if (targetType.equals(EntityType.PLAYER) && mcPermissions.getInstance().disarm(attacker)) {
|
||||
Unarmed.disarmProcCheck(PPa, (Player) target);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);
|
||||
}
|
||||
else if (itemInHand.getType().equals(Material.BONE) && mcPermissions.getInstance().beastLore(attacker)) {
|
||||
Taming.beastLore(event, target, attacker);
|
||||
}
|
||||
break;
|
||||
|
||||
case WOLF:
|
||||
Wolf wolf = (Wolf) damager;
|
||||
|
||||
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
||||
Player master = (Player) wolf.getOwner();
|
||||
PlayerProfile PPo = Users.getProfile(master);
|
||||
|
||||
if (mcPermissions.getInstance().taming(master)) {
|
||||
if (mcPermissions.getInstance().fastFoodService(master)) {
|
||||
Taming.fastFoodService(PPo, wolf, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().sharpenedclaws(master)) {
|
||||
Taming.sharpenedClaws(PPo, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().gore(master)) {
|
||||
Taming.gore(PPo, event, master, plugin);
|
||||
}
|
||||
|
||||
startGainXp(master, PPo, target, SkillType.TAMING, plugin);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ARROW:
|
||||
archeryCheck((EntityDamageByEntityEvent) event, plugin);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetType.equals(EntityType.PLAYER)) {
|
||||
Swords.counterAttackChecks(event);
|
||||
Acrobatics.dodgeChecks(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process combat abilities based on weapon preparation modes.
|
||||
*
|
||||
* @param attacker The player attacking
|
||||
*/
|
||||
public static void combatAbilityChecks(Player attacker) {
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
if (PPa.getAxePreparationMode()) {
|
||||
Skills.abilityCheck(attacker, SkillType.AXES);
|
||||
}
|
||||
else if (PPa.getSwordsPreparationMode()) {
|
||||
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
||||
}
|
||||
else if (PPa.getFistsPreparationMode()) {
|
||||
Skills.abilityCheck(attacker, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process archery abilities.
|
||||
*
|
||||
* @param event The event to run the archery checks on.
|
||||
* @param pluginx mcMMO plugin instance
|
||||
*/
|
||||
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx) {
|
||||
Arrow arrow = (Arrow) event.getDamager();
|
||||
LivingEntity shooter = arrow.getShooter();
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getType().equals(Material.AIR)) {
|
||||
Unarmed.deflectCheck(defender, event);
|
||||
}
|
||||
}
|
||||
|
||||
if (shooter instanceof Player) {
|
||||
Player attacker = (Player) shooter;
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (mcPermissions.getInstance().archery(attacker) && damage > 0) {
|
||||
if (mcPermissions.getInstance().trackArrows(attacker)) {
|
||||
Archery.trackArrows(pluginx, target, PPa);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().ignition(attacker)) {
|
||||
Archery.ignitionCheck(target, attacker);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx);
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if (PPa.inParty() && PPd.inParty() && Party.getInstance().inSameParty(defender, attacker)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Archery.dazeCheck(defender, attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason CUSTOM
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg) {
|
||||
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason cause
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param cause DamageCause to pass to damage event
|
||||
*/
|
||||
private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
|
||||
if (LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
}
|
||||
else {
|
||||
target.damage(dmg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param attacker Player to pass to event as damager
|
||||
*/
|
||||
private static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
||||
if (LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
}
|
||||
else {
|
||||
target.damage(dmg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Area-of-Effect ability actions.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param target The defending entity
|
||||
* @param damage The initial damage amount
|
||||
* @param plugin mcMMO plugin instance
|
||||
* @param type The type of skill being used
|
||||
*/
|
||||
private static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, mcMMO plugin, SkillType type) {
|
||||
int numberOfTargets = m.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
|
||||
int damageAmount = 0;
|
||||
|
||||
if (type.equals(SkillType.AXES)) {
|
||||
damageAmount = damage / 2;
|
||||
}
|
||||
else if (type.equals(SkillType.SWORDS)) {
|
||||
damageAmount = damage / 4;
|
||||
}
|
||||
|
||||
if (damageAmount < 1) {
|
||||
damageAmount = 1;
|
||||
}
|
||||
|
||||
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
|
||||
EntityType entityType = entity.getType();
|
||||
|
||||
if (entityType.equals(EntityType.WOLF)) {
|
||||
Wolf wolf = (Wolf) entity;
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
Player owner = (Player) tamer;
|
||||
|
||||
if (owner.equals(attacker) || Party.getInstance().inSameParty(attacker, owner)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity && numberOfTargets >= 1) {
|
||||
if (entityType.equals(EntityType.PLAYER)) {
|
||||
Player defender = (Player) entity;
|
||||
PlayerProfile PP = Users.getProfile(defender);
|
||||
|
||||
//Reasons why the target shouldn't be hit
|
||||
if (PP.getGodMode()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defender.getName().equals(attacker.getName())) { //Is this even possible?
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Party.getInstance().inSameParty(attacker, defender)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defender.isDead()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Apply effect to players only if PVP is enabled
|
||||
if (target.getWorld().getPVP()) {
|
||||
String message = "";
|
||||
|
||||
if (type.equals(SkillType.AXES)) {
|
||||
message = mcLocale.getString("Axes.HitByCleave");
|
||||
}
|
||||
else if (type.equals(SkillType.SWORDS)) {
|
||||
message = mcLocale.getString("Swords.HitBySerratedStrikes");
|
||||
}
|
||||
|
||||
dealDamage(defender, damageAmount, attacker);
|
||||
defender.sendMessage(message);
|
||||
|
||||
if (type.equals(SkillType.SWORDS)) {
|
||||
PP.addBleedTicks(5);
|
||||
}
|
||||
|
||||
numberOfTargets--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
|
||||
if (type.equals(SkillType.SWORDS)) {
|
||||
mcBleedTimer.add(livingEntity);
|
||||
}
|
||||
|
||||
dealDamage(livingEntity, damageAmount, attacker);
|
||||
numberOfTargets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the task that gives combat XP.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param PP The player's PlayerProfile
|
||||
* @param target The defending entity
|
||||
* @param skillType The skill being used
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void startGainXp(Player attacker, PlayerProfile PP, LivingEntity target, SkillType skillType, mcMMO pluginx) {
|
||||
double baseXP = 0;
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (!LoadProperties.pvpxp) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player defender = (Player) target;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if (System.currentTimeMillis() >= (PPd.getRespawnATS() * 1000) + 5000 && ((PPd.getLastLogin() + 5) * 1000) < System.currentTimeMillis() && defender.getHealth() >= 1) {
|
||||
baseXP = 20 * LoadProperties.pvpxprewardmodifier;
|
||||
}
|
||||
}
|
||||
else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
|
||||
if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) {
|
||||
baseXP = LoadProperties.animalXP;
|
||||
}
|
||||
else {
|
||||
EntityType type = target.getType();
|
||||
|
||||
switch (type) {
|
||||
case BLAZE:
|
||||
baseXP = LoadProperties.blazeXP;
|
||||
break;
|
||||
|
||||
case CAVE_SPIDER:
|
||||
baseXP = LoadProperties.cavespiderXP;
|
||||
break;
|
||||
|
||||
case CREEPER:
|
||||
baseXP = LoadProperties.creeperXP;
|
||||
break;
|
||||
|
||||
case ENDER_DRAGON:
|
||||
baseXP = LoadProperties.enderdragonXP;
|
||||
break;
|
||||
|
||||
case ENDERMAN:
|
||||
baseXP = LoadProperties.endermanXP;
|
||||
break;
|
||||
|
||||
case GHAST:
|
||||
baseXP = LoadProperties.ghastXP;
|
||||
break;
|
||||
|
||||
case MAGMA_CUBE:
|
||||
baseXP = LoadProperties.magmacubeXP;
|
||||
break;
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
baseXP = LoadProperties.pigzombieXP;
|
||||
break;
|
||||
|
||||
case SILVERFISH:
|
||||
baseXP = LoadProperties.silverfishXP;
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
baseXP = LoadProperties.skeletonXP;
|
||||
break;
|
||||
|
||||
case SLIME:
|
||||
baseXP = LoadProperties.slimeXP;
|
||||
break;
|
||||
|
||||
case SPIDER:
|
||||
baseXP = LoadProperties.spiderXP;
|
||||
break;
|
||||
|
||||
case ZOMBIE:
|
||||
baseXP = LoadProperties.zombieXP;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
baseXP *= 10;
|
||||
}
|
||||
|
||||
if (baseXP != 0) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(pluginx, new GainXp(attacker, PP, skillType, baseXP, target), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.DatabaseUpdate;
|
||||
|
||||
public class Database {
|
||||
|
||||
private String connectionString = "jdbc:mysql://" + LoadProperties.MySQLserverName + ":" + LoadProperties.MySQLport + "/" + LoadProperties.MySQLdbName + "?user=" + LoadProperties.MySQLuserName + "&password=" + LoadProperties.MySQLdbPass;
|
||||
private Connection conn = null;
|
||||
private mcMMO plugin = null;
|
||||
private long reconnectTimestamp = 0;
|
||||
|
||||
public Database(mcMMO instance) {
|
||||
plugin = instance;
|
||||
connect(); //Connect to MySQL
|
||||
|
||||
// Load the driver instance
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
DriverManager.getConnection(connectionString);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
Bukkit.getLogger().warning(e.getLocalizedMessage());
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
Bukkit.getLogger().warning(ex.getLocalizedMessage());
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to connect to the mySQL database.
|
||||
*/
|
||||
public void connect() {
|
||||
try {
|
||||
System.out.println("[mcMMO] Attempting connection to MySQL...");
|
||||
Properties conProperties = new Properties();
|
||||
conProperties.put("autoReconnect", "false");
|
||||
conProperties.put("maxReconnects", "0");
|
||||
conn = DriverManager.getConnection(connectionString, conProperties);
|
||||
System.out.println("[mcMMO] Connection to MySQL was a success!");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
System.out.println("[mcMMO] Connection to MySQL failed!");
|
||||
ex.printStackTrace();
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to create the database structure.
|
||||
*/
|
||||
public void createStructure() {
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`hudtype` varchar(50) NOT NULL DEFAULT '',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`lastlogin` int(32) unsigned NOT NULL,"
|
||||
+ "`party` varchar(100) NOT NULL DEFAULT '',"
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "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`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "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`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "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`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
|
||||
checkDatabaseStructure(DatabaseUpdate.FISHING);
|
||||
checkDatabaseStructure(DatabaseUpdate.BLAST_MINING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check database structure for missing values.
|
||||
*
|
||||
* @param update Type of data to check updates for
|
||||
*/
|
||||
public void checkDatabaseStructure(DatabaseUpdate update) {
|
||||
String sql = null;
|
||||
ResultSet rs = null;
|
||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||
|
||||
switch (update) {
|
||||
case BLAST_MINING:
|
||||
sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"cooldowns` ORDER BY `"+LoadProperties.MySQLtablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
|
||||
break;
|
||||
case FISHING:
|
||||
sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> Col = new ArrayList<String>();
|
||||
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
|
||||
Col.add(rs.getString(i));
|
||||
}
|
||||
Rows.put(rs.getRow(), Col);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
if (update.equals(DatabaseUpdate.BLAST_MINING)) {
|
||||
System.out.println("Updating mcMMO MySQL tables for Blast Mining...");
|
||||
write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
else if (update.equals(DatabaseUpdate.FISHING)) {
|
||||
System.out.println("Updating mcMMO MySQL tables for Fishing...");
|
||||
write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to write the SQL query.
|
||||
*
|
||||
* @param sql Query to write.
|
||||
* @return true if the query was successfully written, false otherwise.
|
||||
*/
|
||||
public boolean write(String sql) {
|
||||
if (isConnected()) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt.executeUpdate();
|
||||
return true;
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
attemptReconnect();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Integer getInt(String sql) {
|
||||
ResultSet rs = null;
|
||||
Integer result = 0;
|
||||
|
||||
if (isConnected()) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
if (rs.next()) {
|
||||
result = rs.getInt(1);
|
||||
}
|
||||
else {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
attemptReconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get connection status
|
||||
*
|
||||
* @return the boolean value for whether or not we are connected
|
||||
*/
|
||||
public boolean isConnected() {
|
||||
if(conn == null)
|
||||
return false;
|
||||
|
||||
try {
|
||||
return conn.isValid(3);
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a Sync Delayed Task with the Bukkit Scheduler to attempt reconnection after a minute has elapsed
|
||||
* This will check for a connection being present or not to prevent unneeded reconnection attempts
|
||||
*/
|
||||
public void attemptReconnect() {
|
||||
if(reconnectTimestamp+60000 < System.currentTimeMillis()) //Only reconnect if another attempt hasn't been made recently
|
||||
{
|
||||
System.out.println("[mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds...");
|
||||
reconnectTimestamp = System.currentTimeMillis();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
if (!isConnected()) {
|
||||
connect();
|
||||
}
|
||||
}
|
||||
}, 20*60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read SQL query.
|
||||
*
|
||||
* @param sql SQL query to read
|
||||
* @return the rows in this SQL query
|
||||
*/
|
||||
public HashMap<Integer, ArrayList<String>> read(String sql) {
|
||||
ResultSet rs = null;
|
||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||
|
||||
if (isConnected()) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> Col = new ArrayList<String>();
|
||||
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
|
||||
Col.add(rs.getString(i));
|
||||
}
|
||||
Rows.put(rs.getRow(), Col);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
attemptReconnect();
|
||||
}
|
||||
return Rows;
|
||||
}
|
||||
|
||||
private static void printErrors(SQLException ex) {
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("VendorError: " + ex.getErrorCode());
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class Item {
|
||||
|
||||
/**
|
||||
* Check for item usage.
|
||||
*
|
||||
* @param player Player whose item usage to check
|
||||
*/
|
||||
public static void itemchecks(Player player) {
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
|
||||
if (LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId) {
|
||||
chimaerawing(player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void chimaerawing(Player player) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack is = player.getItemInHand();
|
||||
Block block = player.getLocation().getBlock();
|
||||
int amount = is.getAmount();
|
||||
|
||||
if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == LoadProperties.chimaeraId) {
|
||||
if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= LoadProperties.feathersConsumedByChimaeraWing) {
|
||||
player.setItemInHand(new ItemStack(LoadProperties.chimaeraId, amount - LoadProperties.feathersConsumedByChimaeraWing));
|
||||
|
||||
for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
||||
if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail"));
|
||||
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK)) {
|
||||
player.teleport(player.getBedSpawnLocation());
|
||||
}
|
||||
else {
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
}
|
||||
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass"));
|
||||
}
|
||||
else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing) {
|
||||
player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)}));
|
||||
}
|
||||
else if (is.getAmount() <= LoadProperties.feathersConsumedByChimaeraWing) {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.chimaeraId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.datatypes.Tree;
|
||||
|
||||
public class Leaderboard {
|
||||
static String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
|
||||
/**
|
||||
* Create the leaderboards.
|
||||
*/
|
||||
public static void makeLeaderboards() {
|
||||
//Make Trees
|
||||
Tree Mining = new Tree();
|
||||
Tree WoodCutting = new Tree();
|
||||
Tree Herbalism = new Tree();
|
||||
Tree Excavation = new Tree();
|
||||
Tree Acrobatics = new Tree();
|
||||
Tree Repair = new Tree();
|
||||
Tree Swords = new Tree();
|
||||
Tree Axes = new Tree();
|
||||
Tree Archery = new Tree();
|
||||
Tree Unarmed = new Tree();
|
||||
Tree Taming = new Tree();
|
||||
Tree Fishing = new Tree();
|
||||
Tree PowerLevel = new Tree();
|
||||
|
||||
//Add Data To Trees
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
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
|
||||
if (players.contains(p)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
players.add(p);
|
||||
}
|
||||
|
||||
if (character.length > 1 && m.isInt(character[1])) {
|
||||
Mining.add(p, Integer.valueOf(character[1]));
|
||||
powerLevel += Integer.valueOf(character[1]);
|
||||
}
|
||||
|
||||
if (character.length > 5 && m.isInt(character[5])) {
|
||||
WoodCutting.add(p, Integer.valueOf(character[5]));
|
||||
powerLevel += Integer.valueOf(character[5]);
|
||||
}
|
||||
|
||||
if (character.length > 7 && m.isInt(character[7])) {
|
||||
Repair.add(p, Integer.valueOf(character[7]));
|
||||
powerLevel += Integer.valueOf(character[7]);
|
||||
}
|
||||
|
||||
if (character.length > 8 && m.isInt(character[8])) {
|
||||
Unarmed.add(p, Integer.valueOf(character[8]));
|
||||
powerLevel += Integer.valueOf(character[8]);
|
||||
}
|
||||
|
||||
if (character.length > 9 && m.isInt(character[9])) {
|
||||
Herbalism.add(p, Integer.valueOf(character[9]));
|
||||
powerLevel += Integer.valueOf(character[9]);
|
||||
}
|
||||
|
||||
if (character.length > 10 && m.isInt(character[10])) {
|
||||
Excavation.add(p, Integer.valueOf(character[10]));
|
||||
powerLevel += Integer.valueOf(character[10]);
|
||||
}
|
||||
|
||||
if (character.length > 11 && m.isInt(character[11])) {
|
||||
Archery.add(p, Integer.valueOf(character[11]));
|
||||
powerLevel += Integer.valueOf(character[11]);
|
||||
}
|
||||
|
||||
if (character.length > 12 && m.isInt(character[12])) {
|
||||
Swords.add(p, Integer.valueOf(character[12]));
|
||||
powerLevel += Integer.valueOf(character[12]);
|
||||
}
|
||||
|
||||
if (character.length > 13 && m.isInt(character[13])) {
|
||||
Axes.add(p, Integer.valueOf(character[13]));
|
||||
powerLevel += Integer.valueOf(character[13]);
|
||||
}
|
||||
|
||||
if (character.length > 14 && m.isInt(character[14])) {
|
||||
Acrobatics.add(p, Integer.valueOf(character[14]));
|
||||
powerLevel += Integer.valueOf(character[14]);
|
||||
}
|
||||
|
||||
if (character.length > 24 && m.isInt(character[24])) {
|
||||
Taming.add(p, Integer.valueOf(character[24]));
|
||||
powerLevel += Integer.valueOf(character[24]);
|
||||
}
|
||||
|
||||
if (character.length > 34 && m.isInt(character[34])) {
|
||||
Fishing.add(p, Integer.valueOf(character[34]));
|
||||
powerLevel += Integer.valueOf(character[34]);
|
||||
}
|
||||
|
||||
PowerLevel.add(p, powerLevel);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe(("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString()));
|
||||
}
|
||||
|
||||
//Write the leader board files
|
||||
leaderWrite(Mining.inOrder(), SkillType.MINING);
|
||||
leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING);
|
||||
leaderWrite(Repair.inOrder(), SkillType.REPAIR);
|
||||
leaderWrite(Unarmed.inOrder(), SkillType.UNARMED);
|
||||
leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM);
|
||||
leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION);
|
||||
leaderWrite(Archery.inOrder(), SkillType.ARCHERY);
|
||||
leaderWrite(Swords.inOrder(), SkillType.SWORDS);
|
||||
leaderWrite(Axes.inOrder(), SkillType.AXES);
|
||||
leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS);
|
||||
leaderWrite(Taming.inOrder(), SkillType.TAMING);
|
||||
leaderWrite(Fishing.inOrder(), SkillType.FISHING);
|
||||
leaderWrite(PowerLevel.inOrder(), SkillType.ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to the leaderboards.
|
||||
*
|
||||
* @param ps Stats to write to the leaderboard
|
||||
* @param skillType Skill type to write the leaderboard of
|
||||
*/
|
||||
private static void leaderWrite(PlayerStat[] ps, SkillType skillType) {
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo";
|
||||
File theDir = new File(theLocation);
|
||||
|
||||
//CHECK IF THE FILE EXISTS
|
||||
if (!theDir.exists()) {
|
||||
FileWriter writer = null;
|
||||
|
||||
try {
|
||||
writer = new FileWriter(theLocation);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe(("Exception while creating " + theLocation + e.toString()));
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
Bukkit.getLogger().severe("Exception while closing writer for " + theLocation + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
|
||||
for (PlayerStat p : ps) {
|
||||
if (p.name.equals("$mcMMO_DummyInfo")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p.statVal == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
writer.append(p.name + ":" + p.statVal);
|
||||
writer.append("\r\n");
|
||||
}
|
||||
|
||||
in.close();
|
||||
FileWriter out = new FileWriter(theLocation);
|
||||
out.write(writer.toString());
|
||||
out.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skillName Skill to retrieve info on.
|
||||
* @param pagenumber Which page in the leaderboards to retrieve
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
public static String[] retrieveInfo(String skillName, int pagenumber) {
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
int destination = (pagenumber - 1) * 10; //How many lines to skip through
|
||||
int x = 0; //how many lines we've gone through
|
||||
int y = 0; //going through the lines
|
||||
String line = "";
|
||||
String[] info = new String[10]; //what to return
|
||||
|
||||
while ((line = in.readLine()) != null && y < 10) {
|
||||
x++;
|
||||
|
||||
if (x >= destination && y < 10) {
|
||||
info[y] = line.toString();
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
return info;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while reading " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
|
||||
return null; //Shouldn't get here
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the leaderboards.
|
||||
*
|
||||
* @param ps Stats to update the leaderboard with.
|
||||
* @param skillType Skill whose leaderboard is being updated.
|
||||
*/
|
||||
public static void updateLeaderboard(PlayerStat ps, SkillType skillType) {
|
||||
if (LoadProperties.useMySQL) {
|
||||
return;
|
||||
}
|
||||
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo";
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = "";
|
||||
Boolean inserted = false;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
//Insert the player into the line before it finds a smaller one
|
||||
if (Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) {
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||
inserted = true;
|
||||
}
|
||||
|
||||
//Write anything that isn't the player already in the file so we remove the duplicate
|
||||
if (!line.split(":")[0].equalsIgnoreCase(ps.name)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
if(!inserted) {
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||
}
|
||||
|
||||
in.close();
|
||||
|
||||
//Write the new file
|
||||
FileWriter out = new FileWriter(theLocation);
|
||||
out.write(writer.toString());
|
||||
out.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,541 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Metrics {
|
||||
|
||||
/**
|
||||
* The current revision number
|
||||
*/
|
||||
private final static int REVISION = 5;
|
||||
|
||||
/**
|
||||
* The base url of the metrics domain
|
||||
*/
|
||||
private static final String BASE_URL = "http://metrics.griefcraft.com";
|
||||
|
||||
/**
|
||||
* The url used to report a server's status
|
||||
*/
|
||||
private static final String REPORT_URL = "/report/%s";
|
||||
|
||||
/**
|
||||
* The file where guid and opt out is stored in
|
||||
*/
|
||||
private static final String CONFIG_FILE = "plugins/PluginMetrics/config.yml";
|
||||
|
||||
/**
|
||||
* The separator to use for custom data. This MUST NOT change unless you are hosting your own
|
||||
* version of metrics and want to change it.
|
||||
*/
|
||||
private static final String CUSTOM_DATA_SEPARATOR = "~~";
|
||||
|
||||
/**
|
||||
* Interval of time to ping (in minutes)
|
||||
*/
|
||||
private final static int PING_INTERVAL = 10;
|
||||
|
||||
/**
|
||||
* A map of all of the graphs for each plugin
|
||||
*/
|
||||
private Map<Plugin, Set<Graph>> graphs = Collections.synchronizedMap(new HashMap<Plugin, Set<Graph>>());
|
||||
|
||||
/**
|
||||
* A convenient map of the default Graph objects (used by addCustomData mainly)
|
||||
*/
|
||||
private Map<Plugin, Graph> defaultGraphs = Collections.synchronizedMap(new HashMap<Plugin, Graph>());
|
||||
|
||||
/**
|
||||
* The plugin configuration file
|
||||
*/
|
||||
private final YamlConfiguration configuration;
|
||||
|
||||
/**
|
||||
* Unique server id
|
||||
*/
|
||||
private String guid;
|
||||
|
||||
public Metrics() throws IOException {
|
||||
// load the config
|
||||
File file = new File(CONFIG_FILE);
|
||||
configuration = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
// add some defaults
|
||||
configuration.addDefault("opt-out", false);
|
||||
configuration.addDefault("guid", UUID.randomUUID().toString());
|
||||
|
||||
// Do we need to create the file?
|
||||
if (configuration.get("guid", null) == null) {
|
||||
configuration.options().header("http://metrics.griefcraft.com").copyDefaults(true);
|
||||
configuration.save(file);
|
||||
}
|
||||
|
||||
// Load the guid then
|
||||
guid = configuration.getString("guid");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct and create a Graph that can be used to separate specific plotters to their own graphs
|
||||
* on the metrics website. Plotters can be added to the graph object returned.
|
||||
*
|
||||
* @param plugin
|
||||
* @param type
|
||||
* @param name
|
||||
* @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
|
||||
*/
|
||||
public Graph createGraph(Plugin plugin, Graph.Type type, String name) {
|
||||
if (plugin == null || type == null || name == null) {
|
||||
throw new IllegalArgumentException("All arguments must not be null");
|
||||
}
|
||||
|
||||
// Construct the graph object
|
||||
Graph graph = new Graph(type, name);
|
||||
|
||||
// Get the graphs for the plugin
|
||||
Set<Graph> graphs = getOrCreateGraphs(plugin);
|
||||
|
||||
// Now we can add our graph
|
||||
graphs.add(graph);
|
||||
|
||||
// and return back
|
||||
return graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom data plotter for a given plugin
|
||||
*
|
||||
* @param plugin
|
||||
* @param plotter
|
||||
*/
|
||||
public void addCustomData(Plugin plugin, Plotter plotter) {
|
||||
// The default graph for the plugin
|
||||
Graph graph = getOrCreateDefaultGraph(plugin);
|
||||
|
||||
// Add the plotter to the graph o/
|
||||
graph.addPlotter(plotter);
|
||||
|
||||
// Ensure the default graph is included in the submitted graphs
|
||||
getOrCreateGraphs(plugin).add(graph);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin measuring a plugin
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public void beginMeasuringPlugin(final Plugin plugin) {
|
||||
// Did we opt out?
|
||||
if (configuration.getBoolean("opt-out", false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Begin hitting the server with glorious data
|
||||
plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
|
||||
private boolean firstPost = true;
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
// We use the inverse of firstPost because if it is the first time we are posting,
|
||||
// it is not a interval ping, so it evaluates to FALSE
|
||||
// Each time thereafter it will evaluate to TRUE, i.e PING!
|
||||
postPlugin(plugin, !firstPost);
|
||||
|
||||
// After the first post we set firstPost to false
|
||||
// Each post thereafter will be a ping
|
||||
firstPost = false;
|
||||
} catch (IOException e) {
|
||||
System.out.println("[Metrics] " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 0, PING_INTERVAL * 1200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method that posts a plugin to the metrics website
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
private void postPlugin(Plugin plugin, boolean isPing) throws IOException {
|
||||
// The plugin's description file containg all of the plugin data such as name, version, author, etc
|
||||
PluginDescriptionFile description = plugin.getDescription();
|
||||
|
||||
// The author string, created with description.getAuthors()
|
||||
// Authors are separated by a comma
|
||||
String authors = "";
|
||||
|
||||
// Add each author to the string
|
||||
for (String author : description.getAuthors()) {
|
||||
authors += author + ", ";
|
||||
}
|
||||
|
||||
// If there were any authors at all, we need to remove the last 2 characters
|
||||
// the last 2 characters are the last comma and space
|
||||
if (!authors.isEmpty()) {
|
||||
authors = authors.substring(0, authors.length() - 2);
|
||||
}
|
||||
|
||||
// Construct the post data
|
||||
String data = encode("guid") + '=' + encode(guid)
|
||||
+ encodeDataPair("authors", authors)
|
||||
+ encodeDataPair("version", description.getVersion())
|
||||
+ encodeDataPair("server", Bukkit.getVersion())
|
||||
+ encodeDataPair("players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length))
|
||||
+ encodeDataPair("revision", String.valueOf(REVISION));
|
||||
|
||||
// If we're pinging, append it
|
||||
if (isPing) {
|
||||
data += encodeDataPair("ping", "true");
|
||||
}
|
||||
|
||||
// Add any custom data available for the plugin
|
||||
Set<Graph> graphs = getOrCreateGraphs(plugin);
|
||||
|
||||
// Acquire a lock on the graphs, which lets us make the assumption we also lock everything
|
||||
// inside of the graph (e.g plotters)
|
||||
synchronized(graphs) {
|
||||
Iterator<Graph> iter = graphs.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
Graph graph = iter.next();
|
||||
|
||||
// Because we have a lock on the graphs set already, it is reasonable to assume
|
||||
// that our lock transcends down to the individual plotters in the graphs also.
|
||||
// Because our methods are private, no one but us can reasonably access this list
|
||||
// without reflection so this is a safe assumption without adding more code.
|
||||
for (Plotter plotter : graph.getPlotters()) {
|
||||
// The key name to send to the metrics server
|
||||
// The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top
|
||||
// Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME
|
||||
String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName());
|
||||
|
||||
// The value to send, which for the foreseeable future is just the string
|
||||
// value of plotter.getValue()
|
||||
String value = Integer.toString(plotter.getValue());
|
||||
|
||||
// Add it to the http post data :)
|
||||
data += encodeDataPair(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create the url
|
||||
URL url = new URL(BASE_URL + String.format(REPORT_URL, plugin.getDescription().getName()));
|
||||
|
||||
// Connect to the website
|
||||
URLConnection connection;
|
||||
|
||||
// Mineshafter creates a socks proxy, so we can safely bypass it
|
||||
// It does not reroute POST requests so we need to go around it
|
||||
if (isMineshafterPresent()) {
|
||||
connection = url.openConnection(Proxy.NO_PROXY);
|
||||
} else {
|
||||
connection = url.openConnection();
|
||||
}
|
||||
|
||||
connection.setDoOutput(true);
|
||||
|
||||
// Write the data
|
||||
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
|
||||
writer.write(data);
|
||||
writer.flush();
|
||||
|
||||
// Now read the response
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String response = reader.readLine();
|
||||
|
||||
// close resources
|
||||
writer.close();
|
||||
reader.close();
|
||||
|
||||
if (response.startsWith("ERR")) {
|
||||
throw new IOException(response); //Throw the exception
|
||||
} else {
|
||||
// Is this the first update this hour?
|
||||
if (response.contains("OK This is your first update this hour")) {
|
||||
synchronized (graphs) {
|
||||
Iterator<Graph> iter = graphs.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
Graph graph = iter.next();
|
||||
|
||||
for (Plotter plotter : graph.getPlotters()) {
|
||||
plotter.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create the Set of graphs for a specific plugin
|
||||
*
|
||||
* @param plugin
|
||||
* @return
|
||||
*/
|
||||
private Set<Graph> getOrCreateGraphs(Plugin plugin) {
|
||||
Set<Graph> theGraphs = graphs.get(plugin);
|
||||
|
||||
// Create the Set if it does not already exist
|
||||
if (theGraphs == null) {
|
||||
theGraphs = Collections.synchronizedSet(new HashSet<Graph>());
|
||||
graphs.put(plugin, theGraphs);
|
||||
}
|
||||
|
||||
return theGraphs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default graph for a plugin and if it does not exist, create one
|
||||
*
|
||||
* @param plugin
|
||||
* @return
|
||||
*/
|
||||
private Graph getOrCreateDefaultGraph(Plugin plugin) {
|
||||
Graph graph = defaultGraphs.get(plugin);
|
||||
|
||||
// Not yet created :(
|
||||
if (graph == null) {
|
||||
graph = new Graph(Graph.Type.Line, "Default");
|
||||
defaultGraphs.put(plugin, graph);
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isMineshafterPresent() {
|
||||
try {
|
||||
Class.forName("mineshafter.MineServer");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first
|
||||
* key/value pair MUST be included manually, e.g:
|
||||
* <p>
|
||||
* String httpData = encode("guid") + "=" + encode("1234") + encodeDataPair("authors") + "..";
|
||||
* </p>
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private static String encodeDataPair(String key, String value) throws UnsupportedEncodingException {
|
||||
return "&" + encode(key) + "=" + encode(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode text as UTF-8
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private static String encode(String text) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(text, "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a custom graph on the website
|
||||
*/
|
||||
public static class Graph {
|
||||
|
||||
/**
|
||||
* The graph's type that will be visible on the website
|
||||
*/
|
||||
public static enum Type {
|
||||
|
||||
/**
|
||||
* A simple line graph which also includes a scrollable timeline viewer to view
|
||||
* as little or as much of the data as possible.
|
||||
*/
|
||||
Line,
|
||||
|
||||
/**
|
||||
* An area graph. This is the same as a line graph except the area under the curve is shaded
|
||||
*/
|
||||
Area,
|
||||
|
||||
/**
|
||||
* A column graph, which is a graph where the data is represented by columns on the vertical axis,
|
||||
* i.e they go up and down.
|
||||
*/
|
||||
Column,
|
||||
|
||||
/**
|
||||
* A pie graph. The graph is generated by taking the data for the last hour and summing it
|
||||
* together. Then the percentage for each plotter is calculated via round( (plot / total) * 100, 2 )
|
||||
*/
|
||||
Pie
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* What the graph should be plotted as
|
||||
*/
|
||||
private final Type type;
|
||||
|
||||
/**
|
||||
* The graph's name, alphanumeric and spaces only :)
|
||||
* If it does not comply to the above when submitted, it is rejected
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The set of plotters that are contained within this graph
|
||||
*/
|
||||
private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
|
||||
|
||||
private Graph(Type type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the graph's name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a plotter to the graph, which will be used to plot entries
|
||||
*
|
||||
* @param plotter
|
||||
*/
|
||||
public void addPlotter(Plotter plotter) {
|
||||
plotters.add(plotter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a plotter from the graph
|
||||
*
|
||||
* @param plotter
|
||||
*/
|
||||
public void removePlotter(Plotter plotter) {
|
||||
plotters.remove(plotter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
* @return
|
||||
*/
|
||||
public Set<Plotter> getPlotters() {
|
||||
return Collections.unmodifiableSet(plotters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (type.hashCode() * 17) ^ name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof Graph)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Graph graph = (Graph) object;
|
||||
return graph.type == type && graph.name.equals(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to collect custom data for a plugin
|
||||
*/
|
||||
public static abstract class Plotter {
|
||||
|
||||
/**
|
||||
* The plot's name
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Construct a plotter with the default plot name
|
||||
*/
|
||||
public Plotter() {
|
||||
this("Default");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a plotter with a specific plot name
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public Plotter(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value for the plotted point
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract int getValue();
|
||||
|
||||
/**
|
||||
* Get the column name for the plotted point
|
||||
*
|
||||
* @return the plotted point's column name
|
||||
*/
|
||||
public String getColumnName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the website graphs have been updated
|
||||
*/
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getColumnName().hashCode() + getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof Plotter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Plotter plotter = (Plotter) object;
|
||||
return plotter.name.equals(name) && plotter.getValue() == getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class Users {
|
||||
private static volatile Users instance;
|
||||
|
||||
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
String directory = "plugins/mcMMO/FlatFileStuff/";
|
||||
String directoryb = "plugins/mcMMO/FlatFileStuff/Leaderboards/";
|
||||
|
||||
public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>();
|
||||
|
||||
/**
|
||||
* Load users.
|
||||
*/
|
||||
public void loadUsers() {
|
||||
new File(directory).mkdir();
|
||||
new File(directoryb).mkdir();
|
||||
File theDir = new File(location);
|
||||
|
||||
if (!theDir.exists()) {
|
||||
try {
|
||||
FileWriter writer = new FileWriter(theDir);
|
||||
writer.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new user.
|
||||
*
|
||||
* @param player The player to create a user record for
|
||||
*/
|
||||
public static void addUser(Player player) {
|
||||
if (!players.containsKey(player.getName().toLowerCase())) {
|
||||
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all users.
|
||||
*/
|
||||
public static void clearUsers() {
|
||||
players.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all PlayerProfiles.
|
||||
*
|
||||
* @return a HashMap containing the PlayerProfile of everyone in the database
|
||||
*/
|
||||
public static HashMap<String, PlayerProfile> getProfiles() {
|
||||
return players;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a user from the database.
|
||||
*
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public static void removeUser(Player player) {
|
||||
|
||||
//Only remove PlayerProfile if user is offline and we have it in memory
|
||||
if (!player.isOnline() && players.containsKey(player.getName().toLowerCase())) {
|
||||
players.get(player.getName().toLowerCase()).save();
|
||||
players.remove(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a user from the DB by name.
|
||||
*
|
||||
* @param playerName The name of the player to remove
|
||||
*/
|
||||
public static void removeUserByName(String playerName) {
|
||||
players.remove(playerName.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the profile of an online player.
|
||||
*
|
||||
* @param player The player whose profile to retrieve
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static PlayerProfile getProfile(Player player) {
|
||||
if(players.get(player.getName().toLowerCase()) != null) {
|
||||
return players.get(player.getName().toLowerCase());
|
||||
}
|
||||
else {
|
||||
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
|
||||
return players.get(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the profile of an online player.
|
||||
*
|
||||
* @param player The player whose profile to retrieve
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static PlayerProfile getProfile(String playerName) {
|
||||
if(players.get(playerName.toLowerCase()) != null) {
|
||||
return players.get(playerName.toLowerCase());
|
||||
}
|
||||
else {
|
||||
players.put(playerName.toLowerCase(), new PlayerProfile(playerName));
|
||||
return players.get(playerName.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the profile of an offline player.
|
||||
*
|
||||
* @param playerName Name of the player whose profile to retrieve
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static PlayerProfile getOfflineProfile(String playerName) {
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of this class.
|
||||
*
|
||||
* @return an instance of this class
|
||||
*/
|
||||
public static Users getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Users();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
48
src/main/java/com/gmail/nossr50/api/AbilityAPI.java
Normal file
48
src/main/java/com/gmail/nossr50/api/AbilityAPI.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.BERSERK);
|
||||
}
|
||||
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
}
|
||||
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SKULL_SPLIITER);
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||
}
|
||||
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
if (Users.getProfile(player).getAbilityMode(ability)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
97
src/main/java/com/gmail/nossr50/api/ChatAPI.java
Normal file
97
src/main/java/com/gmail/nossr50/api/ChatAPI.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
|
||||
public final class ChatAPI {
|
||||
private ChatAPI() {}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @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) {
|
||||
sendPartyChat(null, party, sender, sender, 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
|
||||
* @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) {
|
||||
sendAdminChat(null, sender, sender, message);
|
||||
}
|
||||
}
|
||||
176
src/main/java/com/gmail/nossr50/api/ExperienceAPI.java
Normal file
176
src/main/java/com/gmail/nossr50/api/ExperienceAPI.java
Normal file
@@ -0,0 +1,176 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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() {}
|
||||
|
||||
/**
|
||||
* Check the XP of a player. This should be called after giving XP to process level-ups.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @param skillType The skill to check
|
||||
*/
|
||||
private static void checkXP(Player player, SkillType skillType) {
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
SkillTools.xpCheckAll(player, Users.getProfile(player));
|
||||
}
|
||||
else {
|
||||
SkillTools.xpCheckSkill(skillType, player, Users.getProfile(player));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, doesn't calculate for XP Rate or other modifiers.
|
||||
* </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 addRawXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getPlayer(player).addXpOverride(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate but not skill modifiers.
|
||||
* </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 addMultipliedXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getPlayer(player).addXpOverrideBonus(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds XP to the player, calculates for XP Rate and skill modifiers.
|
||||
* </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, SkillType skillType, int XP) {
|
||||
Users.getPlayer(player).addXp(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public static int getXP(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillXpLevel(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
|
||||
*/
|
||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getXpToLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param notify True if this should fire a level up notification, false otherwise.
|
||||
*/
|
||||
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
|
||||
Users.getProfile(player).addLevels(skillType, levels);
|
||||
|
||||
if (notify) {
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public static int getLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the power level of a player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to get the power level for
|
||||
* @return the power level of the player
|
||||
*/
|
||||
public static int getPowerLevel(Player player) {
|
||||
return Users.getPlayer(player).getPowerLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, SkillType skillType, int skillLevel) {
|
||||
Users.getProfile(player).modifySkill(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
|
||||
*/
|
||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
||||
Users.getProfile(player).setSkillXpLevel(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
|
||||
*/
|
||||
public static void removeXP(Player player, SkillType skillType, int xp) {
|
||||
Users.getProfile(player).removeXp(skillType, xp);
|
||||
}
|
||||
}
|
||||
153
src/main/java/com/gmail/nossr50/api/PartyAPI.java
Normal file
153
src/main/java/com/gmail/nossr50/api/PartyAPI.java
Normal file
@@ -0,0 +1,153 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class PartyAPI {
|
||||
private PartyAPI() {}
|
||||
|
||||
/**
|
||||
* Get the name of the party a player is in.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check the party name of
|
||||
* @return the name of the player's party
|
||||
*/
|
||||
public static String getPartyName(Player player) {
|
||||
return Users.getProfile(player).getParty().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player is in a party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
return Users.getProfile(player).inParty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two players are in the same party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playera The first player to check
|
||||
* @param playerb The second player to check
|
||||
* @return true if the two players are in the same party, false otherwise
|
||||
*/
|
||||
public static boolean inSameParty(Player playera, Player playerb) {
|
||||
return PartyManager.inSameParty(playera, playerb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all current parties.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public static List<Party> getParties() {
|
||||
return PartyManager.getParties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a player to a party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
*/
|
||||
public static void addToParty(Player player, String partyName) {
|
||||
Party party = PartyManager.getParty(partyName);
|
||||
String playerName = player.getName();
|
||||
|
||||
if (party == null) {
|
||||
party = new Party();
|
||||
party.setName(partyName);
|
||||
party.setLeader(playerName);
|
||||
}
|
||||
|
||||
PartyManager.addToParty(playerName, Users.getProfile(player), party);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a player from a party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public static void removeFromParty(Player player) {
|
||||
PartyManager.removeFromParty(player.getName(), Users.getProfile(player).getParty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the leader of a party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The party name
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
return PartyManager.getPartyLeader(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the leader of a party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The name of the party to set the leader of
|
||||
* @param player The player to set as leader
|
||||
*/
|
||||
public static void setPartyLeader(String partyName, String player) {
|
||||
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
|
||||
*/
|
||||
public static List<String> getAllMembers(Player player) {
|
||||
return PartyManager.getAllMembers(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all online players in this party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The party to check
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(String partyName) {
|
||||
return PartyManager.getOnlineMembers(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all online players in this player's party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return all online players in the player's party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(Player player) {
|
||||
return PartyManager.getOnlineMembers(player);
|
||||
}
|
||||
}
|
||||
53
src/main/java/com/gmail/nossr50/api/SpoutToolsAPI.java
Normal file
53
src/main/java/com/gmail/nossr50/api/SpoutToolsAPI.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.skills.utilities.ToolType;
|
||||
|
||||
public final class 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>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param spoutTool The tool to add
|
||||
* @param type The type of tool to add
|
||||
*/
|
||||
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
|
||||
switch (type) {
|
||||
case AXE:
|
||||
spoutAxes.add(spoutTool);
|
||||
break;
|
||||
|
||||
case HOE:
|
||||
spoutHoes.add(spoutTool);
|
||||
break;
|
||||
|
||||
case PICKAXE:
|
||||
spoutPickaxes.add(spoutTool);
|
||||
break;
|
||||
|
||||
case SHOVEL:
|
||||
spoutShovels.add(spoutTool);
|
||||
break;
|
||||
|
||||
case SWORD:
|
||||
spoutSwords.add(spoutTool);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
67
src/main/java/com/gmail/nossr50/chat/ChatManager.java
Normal file
67
src/main/java/com/gmail/nossr50/chat/ChatManager.java
Normal file
@@ -0,0 +1,67 @@
|
||||
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;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
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();
|
||||
|
||||
for (Player otherPlayer : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
if (Permissions.adminChat(otherPlayer) || otherPlayer.isOp()) {
|
||||
otherPlayer.sendMessage(LocaleLoader.getString("Commands.AdminChat.Prefix", new Object[] {displayName}) + adminMessage);
|
||||
}
|
||||
}
|
||||
|
||||
displayName = ChatColor.stripColor(displayName);
|
||||
mcMMO.p.getLogger().info("[A]<" + displayName + "> " + adminMessage);
|
||||
}
|
||||
|
||||
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", new Object[] {displayName}) + partyMessage);
|
||||
}
|
||||
|
||||
displayName = ChatColor.stripColor(displayName);
|
||||
mcMMO.p.getLogger().info("[P](" + partyName + ")" + "<" + displayName + "> " + partyMessage);
|
||||
}
|
||||
}
|
||||
73
src/main/java/com/gmail/nossr50/chat/commands/ACommand.java
Normal file
73
src/main/java/com/gmail/nossr50/chat/commands/ACommand.java
Normal file
@@ -0,0 +1,73 @@
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
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 ACommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"a", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"});
|
||||
|
||||
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:
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(args[0]);
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
builder.append(" ");
|
||||
builder.append(args[i]);
|
||||
}
|
||||
|
||||
String message = builder.toString();
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
ChatManager.handleAdminChat(mcMMO.p, player.getName(), player.getDisplayName(), message);
|
||||
}
|
||||
else {
|
||||
String ssender = LocaleLoader.getString("Commands.Chat.Console");
|
||||
ChatManager.handleAdminChat(mcMMO.p, ssender, ssender, message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
108
src/main/java/com/gmail/nossr50/chat/commands/PCommand.java
Normal file
108
src/main/java/com/gmail/nossr50/chat/commands/PCommand.java
Normal file
@@ -0,0 +1,108 @@
|
||||
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.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
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;
|
||||
|
||||
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 = LocaleLoader.getString("Commands.Usage.2", new Object[] {"p", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(args[0]);
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
builder.append(" ");
|
||||
builder.append(args[i]);
|
||||
}
|
||||
|
||||
String message = builder.toString();
|
||||
ChatManager.handlePartyChat(plugin, party, player.getName(), player.getDisplayName(), message);
|
||||
}
|
||||
else {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
Party party = PartyManager.getParty(args[0]);
|
||||
|
||||
if (party == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(args[1]);
|
||||
|
||||
for (int i = 2; i < args.length; i++) {
|
||||
builder.append(" ");
|
||||
builder.append(args[i]);
|
||||
}
|
||||
|
||||
String ssender = LocaleLoader.getString("Commands.Chat.Console");
|
||||
String message = builder.toString();
|
||||
|
||||
ChatManager.handlePartyChat(plugin, party, ssender, ssender, message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
151
src/main/java/com/gmail/nossr50/commands/CommandHelper.java
Normal file
151
src/main/java/com/gmail/nossr50/commands/CommandHelper.java
Normal file
@@ -0,0 +1,151 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
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.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public final class CommandHelper {
|
||||
private 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.hasPermission(player, permission)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean noCommandPermissions(Player player, String permission) {
|
||||
if (!Permissions.hasPermission(player, permission)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean noConsoleUsage(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.NoConsole"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasGatheringSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
|
||||
if (Permissions.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.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.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.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.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) }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasCombatSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
|
||||
if (Permissions.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.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.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.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.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) }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasMiscSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
|
||||
if (Permissions.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.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) }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void printMiscSkills(Player player, PlayerProfile profile) {
|
||||
printMiscSkills(player, profile, player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
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.commands.admin.AddlevelsCommand;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
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.SkillType;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingCommand;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public final class CommandRegistrationHelper {
|
||||
private CommandRegistrationHelper() {};
|
||||
|
||||
private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
|
||||
|
||||
public static void registerSkillCommands() {
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
if (skill != SkillType.ALL) {
|
||||
String commandName = skill.toString().toLowerCase();
|
||||
String localizedName = LocaleLoader.getString(Misc.getCapitalized(commandName) + ".SkillName").toLowerCase();
|
||||
|
||||
List<String> aliasList = new ArrayList<String>();
|
||||
aliasList.add(localizedName);
|
||||
|
||||
PluginCommand command;
|
||||
|
||||
// Make us play nice with Essentials
|
||||
if (skill == SkillType.REPAIR && mcMMO.p.getServer().getPluginManager().isPluginEnabled("Essentials")) {
|
||||
command = mcMMO.p.getCommand("mcrepair");
|
||||
}
|
||||
else {
|
||||
command = mcMMO.p.getCommand(commandName);
|
||||
}
|
||||
|
||||
command.setAliases(aliasList);
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.Skill", new Object[] { Misc.getCapitalized(localizedName) }));
|
||||
command.setPermission("mcmmo.skills." + commandName);
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
|
||||
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");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.3", new Object[] {"addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">" }));
|
||||
command.setExecutor(new AddlevelsCommand());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
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.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
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;
|
||||
SkillType skill;
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (sender instanceof Player) {
|
||||
if (!SkillTools.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[1])) {
|
||||
levels = Integer.valueOf(args[1]);
|
||||
skill = SkillTools.getSkillType(args[0]);
|
||||
profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", new Object[] {levels}));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", new Object[] {levels, Misc.getCapitalized(skill.toString())}));
|
||||
}
|
||||
|
||||
profile.addLevels(skill, levels);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
case 3:
|
||||
if (!Permissions.hasPermission(sender, "mcmmo.commands.addlevels.others")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Misc.isInt(args[2])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
levels = Integer.valueOf(args[2]);
|
||||
skill = SkillTools.getSkillType(args[1]);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
profile.addLevels(skill, levels);
|
||||
profile.save(); // Since this is a temporary profile, we save it here.
|
||||
}
|
||||
else {
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
profile.addLevels(skill, levels);
|
||||
|
||||
// Check if the player is online before we try to send them a message.
|
||||
if (player.isOnline()) {
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", new Object[] {levels}));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", new Object[] {levels, Misc.getCapitalized(skill.toString())}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", new Object[] {args[0]}));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", new Object[] {Misc.getCapitalized(skill.toString()), args[0]}));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
127
src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java
Normal file
127
src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java
Normal file
@@ -0,0 +1,127 @@
|
||||
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.mcMMO;
|
||||
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.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;
|
||||
|
||||
//TODO: Any way we can make this work for offline use?
|
||||
public class AddxpCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player modifiedPlayer;
|
||||
int xp;
|
||||
SkillType skill;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.3", new Object[] {"addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">" });
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.addxp")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
if (!SkillTools.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 = SkillTools.getSkillType(args[0]);
|
||||
|
||||
PlayerProfile profile = Users.getProfile(modifiedPlayer);
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(modifiedPlayer);
|
||||
mcMMOPlayer.addXpOverride(skill, xp);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
modifiedPlayer.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", new Object[] {xp}));
|
||||
}
|
||||
else {
|
||||
modifiedPlayer.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", new Object[] {xp, Misc.getCapitalized(skill.toString())}));
|
||||
}
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
SkillTools.xpCheckAll(modifiedPlayer, profile);
|
||||
}
|
||||
else {
|
||||
SkillTools.xpCheckSkill(skill, modifiedPlayer, profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.addxp.others")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
modifiedPlayer = mcMMO.p.getServer().getPlayer(args[0]);
|
||||
String playerName = modifiedPlayer.getName();
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(modifiedPlayer);
|
||||
PlayerProfile profile = Users.getProfile(modifiedPlayer);
|
||||
|
||||
// TODO: Not sure if we actually need a null check here
|
||||
if (profile == null || !profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Misc.isInt(args[2])) {
|
||||
xp = Integer.valueOf(args[2]);
|
||||
skill = SkillTools.getSkillType(args[1]);
|
||||
|
||||
mcMMOPlayer.addXpOverride(skill, xp);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", new Object[] {playerName}));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", new Object[] {Misc.getCapitalized(skill.toString()), playerName}));
|
||||
}
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
modifiedPlayer.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", new Object[] {xp}));
|
||||
SkillTools.xpCheckAll(modifiedPlayer, profile);
|
||||
}
|
||||
else {
|
||||
modifiedPlayer.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", new Object[] {xp, Misc.getCapitalized(skill.toString())}));
|
||||
SkillTools.xpCheckSkill(skill, modifiedPlayer, profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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.commands.CommandHelper;
|
||||
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 (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Permissions.mcgodCommand(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
profile = Users.getProfile((Player) sender);
|
||||
|
||||
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.hasPermission(sender, "mcmmo.commands.mcgod.others")) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
else {
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
// Check if the player is online before we try to send them a message.
|
||||
if (player.isOnline()) {
|
||||
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,73 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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 {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
OfflinePlayer player;
|
||||
PlayerProfile profile;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"});
|
||||
|
||||
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 = mcMMO.p.getServer().getOfflinePlayer(args[0]);
|
||||
profile = Users.getProfile(player);
|
||||
String playerName = player.getName();
|
||||
|
||||
if (profile == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", new Object[] {playerName}));
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
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.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.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 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 = LocaleLoader.getString("Commands.Usage.3", new Object[] {"mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">" });
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoedit")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
if (!SkillTools.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 = SkillTools.getSkillType(args[0]);
|
||||
profile = Users.getProfile(player);
|
||||
|
||||
if (skill.equals(SkillType.ALL)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", new Object[] { newValue }));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", new Object[] { Misc.getCapitalized(skill.toString()), newValue }));
|
||||
}
|
||||
|
||||
profile.modifySkill(skill, newValue);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoedit.others")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Misc.isInt(args[2])) {
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillTools.getSkillType(args[1]);
|
||||
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
newValue = Integer.valueOf(args[2]);
|
||||
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
if (mcmmoPlayer != null) {
|
||||
profile = mcmmoPlayer.getProfile();
|
||||
|
||||
if (profile == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.modifySkill(skill, newValue);
|
||||
if (skill == SkillType.ALL) {
|
||||
mcmmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", new Object[] { newValue }));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", new Object[] { args[0] }));
|
||||
}
|
||||
else {
|
||||
skillName = Misc.getCapitalized(skill.toString());
|
||||
|
||||
mcmmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", new Object[] { skillName, newValue }));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", new Object[] { skillName, args[0] }));
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
if (skill == SkillType.ALL) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", new Object[] { args[0] }));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", new Object[] { Misc.getCapitalized(skill.toString()), args[0] }));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
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.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SkillResetCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
OfflinePlayer modifiedPlayer;
|
||||
PlayerProfile profile;
|
||||
SkillType skill;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.3", new Object[] {"skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"});
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (sender instanceof Player) {
|
||||
if (!SkillTools.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillTools.getSkillType(args[0]);
|
||||
|
||||
if (CommandHelper.noCommandPermissions((Player) sender, "mcmmo.commands.skillreset." + skill.toString().toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
modifiedPlayer = (Player) sender;
|
||||
profile = Users.getProfile(modifiedPlayer);
|
||||
profile.modifySkill(skill, 0);
|
||||
|
||||
if (skill == SkillType.ALL) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", new Object[] { Misc.getCapitalized(skill.toString()) }));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
modifiedPlayer = mcMMO.p.getServer().getOfflinePlayer(args[0]);
|
||||
profile = Users.getProfile(modifiedPlayer);
|
||||
|
||||
// TODO:Not sure if we actually need a null check here
|
||||
if (profile == null || !profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SkillTools.isSkill(args[1])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillTools.getSkillType(args[1]);
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.skillreset.others." + skill.toString().toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.modifySkill(skill, 0);
|
||||
|
||||
if (modifiedPlayer.isOnline()) {
|
||||
if (skill == SkillType.ALL) {
|
||||
((Player)modifiedPlayer).sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
}
|
||||
else {
|
||||
((Player)modifiedPlayer).sendMessage(LocaleLoader.getString("Commands.Reset.Single", new Object[] { Misc.getCapitalized(skill.toString()) }));
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", new Object[] { Misc.getCapitalized(skill.toString()), args[0] }));
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
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.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 static double originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
|
||||
|
||||
@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.commands.xprate")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean xpEventEnabled = mcMMO.p.isXPEventEnabled();
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("reset")) {
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.reset")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (xpEventEnabled) {
|
||||
for (Player x : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
x.sendMessage(LocaleLoader.getString("Commands.xprate.over"));
|
||||
}
|
||||
|
||||
mcMMO.p.setXPEventEnabled(!xpEventEnabled);
|
||||
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
|
||||
}
|
||||
else {
|
||||
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
|
||||
}
|
||||
}
|
||||
else if (Misc.isInt(args[0])) {
|
||||
sender.sendMessage(usage3);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage2);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (Misc.isInt(args[0])) {
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.set")) {
|
||||
return true;
|
||||
}
|
||||
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
|
||||
mcMMO.p.setXPEventEnabled(Boolean.valueOf(args[1]));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage3);
|
||||
}
|
||||
|
||||
int newRate = Misc.getInt(args[0]);
|
||||
Config.getInstance().setExperienceGainsGlobalMultiplier(newRate);
|
||||
|
||||
if (xpEventEnabled) {
|
||||
for (Player x : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.0"));
|
||||
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.1", new Object[] {newRate}));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", new Object[] {newRate}));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage1);
|
||||
sender.sendMessage(usage2);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage1);
|
||||
sender.sendMessage(usage2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +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.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class AddlevelsCommand implements CommandExecutor{
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AddlevelsCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
|
||||
sender.sendMessage("This command requires permissions.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if (args.length < 2) {
|
||||
System.out.println("Usage is /addlevels playername skillname levels");
|
||||
return true;
|
||||
} else if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
int levels = Integer.valueOf(args[2]);
|
||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).addLevels(Skills.getSkillType(args[1]), levels);
|
||||
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
|
||||
}
|
||||
} else {
|
||||
System.out.println("Usage is /addlevels playername skillname levels");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /addlevels playername skillname levels");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
int levels = Integer.valueOf(args[2]);
|
||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).addLevels(Skills.getSkillType(args[1]), levels);
|
||||
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
|
||||
int levels = Integer.valueOf(args[1]);
|
||||
PP.addLevels(Skills.getSkillType(args[0]), levels);
|
||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /addlevels playername skillname newvalue");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +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.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class AddxpCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public AddxpCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
|
||||
sender.sendMessage("This command requires permissions.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if (args.length < 2) {
|
||||
// No console aliasing yet
|
||||
// System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp");
|
||||
System.out.println("Usage is /addxp playername skillname xp");
|
||||
return true;
|
||||
} else if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
int newvalue = Integer.valueOf(args[2]);
|
||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).addXPOverrideNoBonus(Skills.getSkillType(args[1]), newvalue);
|
||||
plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!");
|
||||
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
|
||||
Skills.XpCheckAll(plugin.getServer().getPlayer(args[0]));
|
||||
}
|
||||
} else {
|
||||
// No console aliasing yet
|
||||
// System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp");
|
||||
System.out.println("Usage is /addxp playername skillname xp");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
int newvalue = Integer.valueOf(args[2]);
|
||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).addXP(Skills.getSkillType(args[1]), newvalue, plugin.getServer().getPlayer(args[0]));
|
||||
plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!");
|
||||
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
|
||||
Skills.XpCheckAll(plugin.getServer().getPlayer(args[0]));
|
||||
}
|
||||
} else if (args.length == 2 && m.isInt(args[1]) && Skills.isSkill(args[0])) {
|
||||
int newvalue = Integer.valueOf(args[1]);
|
||||
Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue, player);
|
||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,126 +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.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class InspectCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public InspectCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !mcPermissions.getInstance().inspect(player)) {
|
||||
sender.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
sender.sendMessage(ChatColor.RED + "Proper usage is /inspect <playername>");
|
||||
return true;
|
||||
}
|
||||
|
||||
// if split[1] is an online player
|
||||
if (plugin.getServer().getPlayer(args[0]) != null)
|
||||
{
|
||||
Player target = plugin.getServer().getPlayer(args[0]);
|
||||
PlayerProfile PPt = Users.getProfile(target);
|
||||
|
||||
//If they are not an Op they have to be close
|
||||
if(sender instanceof Player && !player.isOp() && !m.isNear(player.getLocation(), target.getLocation(), 5))
|
||||
{
|
||||
sender.sendMessage("You are too far away to inspect that player!");
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for " + ChatColor.YELLOW + target.getName());
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-");
|
||||
if (mcPermissions.getInstance().excavation(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION)));
|
||||
if (mcPermissions.getInstance().fishing(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING)));
|
||||
if (mcPermissions.getInstance().herbalism(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM)));
|
||||
if (mcPermissions.getInstance().mining(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING)));
|
||||
if (mcPermissions.getInstance().woodcutting(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-");
|
||||
if (mcPermissions.getInstance().axes(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES)));
|
||||
if (mcPermissions.getInstance().archery(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY)));
|
||||
if (mcPermissions.getInstance().swords(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS)));
|
||||
if (mcPermissions.getInstance().taming(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING)));
|
||||
if (mcPermissions.getInstance().unarmed(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED)));
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-");
|
||||
if (mcPermissions.getInstance().acrobatics(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS)));
|
||||
if (mcPermissions.getInstance().repair(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
|
||||
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(target, PPt)));
|
||||
} else {
|
||||
if(sender instanceof Player && !player.isOp())
|
||||
{
|
||||
sender.sendMessage("That player is offline, inspecting offline players is limited to Ops!");
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile PPt = Users.getOfflineProfile(args[0]);
|
||||
|
||||
if(!PPt.isLoaded())
|
||||
{
|
||||
sender.sendMessage("Player does not exist in the database!");
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for Offline Player " + ChatColor.YELLOW + args[0]);
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-");
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-");
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED)));
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-");
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS)));
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +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.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class McstatsCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
|
||||
|
||||
ChatColor header = ChatColor.GOLD;
|
||||
|
||||
if (Skills.hasGatheringSkills(player)) {
|
||||
player.sendMessage(header + "-=GATHERING SKILLS=-");
|
||||
if (mcPermissions.getInstance().excavation(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION)));
|
||||
if (mcPermissions.getInstance().fishing(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING)));
|
||||
if (mcPermissions.getInstance().herbalism(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM)));
|
||||
if (mcPermissions.getInstance().mining(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING)));
|
||||
if (mcPermissions.getInstance().woodcutting(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
}
|
||||
if (Skills.hasCombatSkills(player)) {
|
||||
player.sendMessage(header + "-=COMBAT SKILLS=-");
|
||||
if (mcPermissions.getInstance().axes(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES)));
|
||||
if (mcPermissions.getInstance().archery(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY)));
|
||||
if (mcPermissions.getInstance().swords(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS)));
|
||||
if (mcPermissions.getInstance().taming(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING)));
|
||||
if (mcPermissions.getInstance().unarmed(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED)));
|
||||
}
|
||||
|
||||
if (Skills.hasMiscSkills(player)) {
|
||||
player.sendMessage(header + "-=MISC SKILLS=-");
|
||||
if (mcPermissions.getInstance().acrobatics(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS)));
|
||||
if (mcPermissions.getInstance().repair(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(player, PP)));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,118 +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.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class MmoeditCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
|
||||
sender.sendMessage("This command requires permissions.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||
return true;
|
||||
} else if (args.length == 3)
|
||||
{
|
||||
PlayerProfile PPt = null;
|
||||
|
||||
if(Users.players.containsKey(args[0].toLowerCase())) {
|
||||
PPt = Users.players.get(args[0].toLowerCase());
|
||||
}
|
||||
|
||||
if(PPt == null)
|
||||
Users.getOfflineProfile(args[0]); //Only grab offline profile if the above failed
|
||||
|
||||
if(!PPt.isLoaded())
|
||||
{
|
||||
sender.sendMessage("Player does not exist in the database!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
|
||||
{
|
||||
int newvalue = Integer.valueOf(args[2]);
|
||||
Users.getOfflineProfile(args[0]).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||
System.out.println(args[1] + " has been modified for " + args[0] + ".");
|
||||
}
|
||||
} else
|
||||
{
|
||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcPermissions.getInstance().mmoedit(player))
|
||||
{
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 3)
|
||||
{
|
||||
PlayerProfile PPt = null;
|
||||
|
||||
if(Users.players.containsKey(args[0].toLowerCase())) {
|
||||
PPt = Users.players.get(args[0].toLowerCase());
|
||||
}
|
||||
|
||||
if(PPt == null)
|
||||
Users.getOfflineProfile(args[0]); //Only grab offline profile if the above failed
|
||||
|
||||
if(!PPt.isLoaded())
|
||||
{
|
||||
sender.sendMessage("Player does not exist in the database!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
|
||||
{
|
||||
int newvalue = Integer.valueOf(args[2]);
|
||||
PPt.modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||
player.sendMessage(ChatColor.RED + args[1] + " has been modified for "+args[0]);
|
||||
}
|
||||
} else if (args.length == 2)
|
||||
{
|
||||
if (m.isInt(args[1]) && Skills.isSkill(args[0]))
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int newvalue = Integer.valueOf(args[1]);
|
||||
PP.modifyskill(Skills.getSkillType(args[0]), newvalue);
|
||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||
}
|
||||
} else
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.runnables.SQLConversionTask;
|
||||
|
||||
public class MmoupdateCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!mcPermissions.getInstance().admin(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
player.sendMessage(ChatColor.GRAY + "Starting conversion...");
|
||||
Users.clearUsers();
|
||||
convertToMySQL();
|
||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(x);
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN + "Conversion finished!");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert FlatFile data to MySQL data.
|
||||
*/
|
||||
private void convertToMySQL() {
|
||||
if (!LoadProperties.useMySQL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package com.gmail.nossr50.commands.general;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class XprateCommand implements CommandExecutor {
|
||||
private static int oldrate = LoadProperties.xpGainMultiplier;
|
||||
|
||||
public static boolean xpevent = false;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if(args.length <= 0)
|
||||
{
|
||||
System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {"xprate"}));
|
||||
System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {"xprate"}));
|
||||
}
|
||||
|
||||
if(args.length == 1 && args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
if(xpevent)
|
||||
{
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
|
||||
xpevent = !xpevent;
|
||||
LoadProperties.xpGainMultiplier = oldrate;
|
||||
} else
|
||||
{
|
||||
LoadProperties.xpGainMultiplier = oldrate;
|
||||
}
|
||||
}
|
||||
|
||||
if(args.length >= 1 && m.isInt(args[0]))
|
||||
{
|
||||
oldrate = LoadProperties.xpGainMultiplier;
|
||||
|
||||
if(args.length >= 2 && (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")))
|
||||
{
|
||||
if(args[1].equalsIgnoreCase("true"))
|
||||
xpevent = true;
|
||||
else
|
||||
xpevent = false;
|
||||
} else
|
||||
{
|
||||
System.out.println(mcLocale.getString("Commands.xprate.proper3"));
|
||||
return true;
|
||||
}
|
||||
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
|
||||
if(xpevent = true)
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!");
|
||||
x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!");
|
||||
}
|
||||
|
||||
System.out.println("The XP RATE was modified to "+LoadProperties.xpGainMultiplier);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(!mcPermissions.getInstance().admin(player))
|
||||
{
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if(args.length <= 0)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {"xprate"}));
|
||||
player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {"xprate"}));
|
||||
}
|
||||
if(args.length == 1 && args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
if(xpevent)
|
||||
{
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
|
||||
xpevent = !xpevent;
|
||||
LoadProperties.xpGainMultiplier = oldrate;
|
||||
} else
|
||||
{
|
||||
LoadProperties.xpGainMultiplier = oldrate;
|
||||
}
|
||||
}
|
||||
if(args.length >= 1 && m.isInt(args[0]))
|
||||
{
|
||||
oldrate = LoadProperties.xpGainMultiplier;
|
||||
|
||||
if(args.length >= 2 && (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")))
|
||||
{
|
||||
if(args[1].equalsIgnoreCase("true"))
|
||||
xpevent = true;
|
||||
else
|
||||
xpevent = false;
|
||||
} else
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Commands.xprate.proper3"));
|
||||
return true;
|
||||
}
|
||||
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
|
||||
if(xpevent = true)
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.started"));
|
||||
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mcAbility(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getAbilityUse()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
|
||||
PP.toggleAbilityUse();
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
|
||||
PP.toggleAbilityUse();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,63 +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.mcPermissions;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class MccCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---");
|
||||
|
||||
if (mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(mcLocale.getString("m.mccPartyCommands"));
|
||||
player.sendMessage("/party " + mcLocale.getString("m.mccParty"));
|
||||
player.sendMessage("/party q " + mcLocale.getString("m.mccPartyQ"));
|
||||
|
||||
if (mcPermissions.getInstance().partyChat(player))
|
||||
player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle"));
|
||||
|
||||
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyInvite"));
|
||||
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyAccept"));
|
||||
|
||||
if (mcPermissions.getInstance().partyTeleport(player))
|
||||
player.sendMessage("/ptp " + mcLocale.getString("m.mccPartyTeleport"));
|
||||
}
|
||||
player.sendMessage(mcLocale.getString("m.mccOtherCommands"));
|
||||
player.sendMessage("/mcstats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats"));
|
||||
player.sendMessage("/mctop <skillname> <page> " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards"));
|
||||
|
||||
if (mcPermissions.getInstance().mcAbility(player))
|
||||
player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility"));
|
||||
|
||||
if (mcPermissions.getInstance().adminChat(player))
|
||||
player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle"));
|
||||
|
||||
if (mcPermissions.getInstance().inspect(player))
|
||||
player.sendMessage("/inspect " + mcLocale.getString("m.mccInspect"));
|
||||
|
||||
if (mcPermissions.getInstance().mmoedit(player))
|
||||
player.sendMessage("/mmoedit" + mcLocale.getString("m.mccMmoedit"));
|
||||
|
||||
if (mcPermissions.getInstance().mcgod(player))
|
||||
player.sendMessage("/mcgod" + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod"));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.mccSkillInfo"));
|
||||
player.sendMessage("/mcmmo " + mcLocale.getString("m.mccModDescription"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McgodCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().mcgod(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().mcgod(player)) {
|
||||
if (PP.getGodMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
|
||||
PP.toggleGodMode();
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled"));
|
||||
PP.toggleGodMode();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +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 org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
String description = mcLocale.getString("mcMMO.Description", new Object[] { "mcc" });
|
||||
String[] mcSplit = description.split(",");
|
||||
|
||||
for (String x : mcSplit) {
|
||||
player.sendMessage(x);
|
||||
}
|
||||
|
||||
if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
SpoutPlayer sPlayer = (SpoutPlayer) player;
|
||||
if (LoadProperties.donateMessage)
|
||||
sPlayer.sendMessage(ChatColor.YELLOW + "[mcMMO]"+ChatColor.GOLD+" Donate! Paypal "+ChatColor.GREEN+"theno1yeti@gmail.com");
|
||||
} else {
|
||||
if (LoadProperties.donateMessage)
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO]"+ChatColor.GOLD+" Donate! Paypal "+ChatColor.GREEN+"theno1yeti@gmail.com");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +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.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
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) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().mcrefresh(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
|
||||
player.sendMessage("You have refreshed " + args[0] + "'s cooldowns!");
|
||||
player = plugin.getServer().getPlayer(args[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* PREP MODES
|
||||
*/
|
||||
PP = Users.getProfile(player);
|
||||
PP.setRecentlyHurt((long) 0);
|
||||
PP.setHoePreparationMode(false);
|
||||
PP.setAxePreparationMode(false);
|
||||
PP.setFistsPreparationMode(false);
|
||||
PP.setSwordsPreparationMode(false);
|
||||
PP.setPickaxePreparationMode(false);
|
||||
|
||||
|
||||
//RESET COOLDOWNS
|
||||
PP.resetCooldowns();
|
||||
PP.setGreenTerraMode(false);
|
||||
PP.setGigaDrillBreakerMode(false);
|
||||
PP.setSerratedStrikesMode(false);
|
||||
PP.setSuperBreakerMode(false);
|
||||
PP.setTreeFellerMode(false);
|
||||
PP.setBerserkMode(false);
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McremoveCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mcremove(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length == 0)
|
||||
{
|
||||
sender.sendMessage("Correct usage is /mcremove [Player Name]");
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = args[0]; //Player that we are going to remove
|
||||
|
||||
//If the server is using MySQL
|
||||
if(LoadProperties.useMySQL)
|
||||
{
|
||||
int userId = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
|
||||
//Remove user from tables
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"users WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"users.id="+userId);
|
||||
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"cooldowns WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"cooldowns.user_id="+userId);
|
||||
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"huds WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"huds.user_id="+userId);
|
||||
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"skills WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"skills.user_id="+userId);
|
||||
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"experience WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"experience.user_id="+userId);
|
||||
|
||||
sender.sendMessage("User "+playerName+" removed from MySQL DB!");
|
||||
} else {
|
||||
//FlatFile removal
|
||||
//TODO: Properly remove users from FlatFile, it's going to be a huge bitch with how our FlatFile system works. Let's adopt SQLite support.
|
||||
if(Bukkit.getServer().getPlayer(playerName) != null)
|
||||
{
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
|
||||
if(targetPlayer.isOnline())
|
||||
{
|
||||
Users.getProfile(targetPlayer).resetAllData();
|
||||
sender.sendMessage("User "+playerName+" removed from FlatFile DB!");
|
||||
} else {
|
||||
sender.sendMessage("[mcMMO] This command is not fully functional for FlatFile yet, the player needs to be online.");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("[mcMMO] This command is not fully functional for FlatFile yet, the player needs to be online.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Force PlayerProfile stuff to update
|
||||
if(Bukkit.getServer().getPlayer(playerName) != null)
|
||||
{
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
|
||||
if(targetPlayer.isOnline())
|
||||
{
|
||||
targetPlayer.kickPlayer("[mcMMO] Stats have been reset! Rejoin!");
|
||||
Users.removeUserByName(playerName);
|
||||
} else {
|
||||
Users.removeUser(targetPlayer);
|
||||
}
|
||||
} else {
|
||||
Users.removeUserByName(playerName);
|
||||
}
|
||||
|
||||
sender.sendMessage("[mcMMO] mcremove operation completed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,186 +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.Leaderboard;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class MctopCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (LoadProperties.useMySQL == false) {
|
||||
/*
|
||||
* POWER LEVEL INFO RETRIEVAL
|
||||
*/
|
||||
if (args.length == 0) {
|
||||
int p = 1;
|
||||
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
int n = 1 * p; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
String digit = String.valueOf(n);
|
||||
if (n < 10)
|
||||
digit = "0" + String.valueOf(n);
|
||||
String[] splitx = x.split(":");
|
||||
// Format: 1. Playername - skill value
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args.length >= 1 && m.isInt(args[0])) {
|
||||
int p = 1;
|
||||
// Grab page value if specified
|
||||
if (args.length >= 1) {
|
||||
if (m.isInt(args[0])) {
|
||||
p = Integer.valueOf(args[0]);
|
||||
}
|
||||
}
|
||||
int pt = p;
|
||||
if (p > 1) {
|
||||
pt -= 1;
|
||||
pt += (pt * 10);
|
||||
pt = 10;
|
||||
}
|
||||
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
int n = 1 * pt; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
String digit = String.valueOf(n);
|
||||
if (n < 10)
|
||||
digit = "0" + String.valueOf(n);
|
||||
String[] splitx = x.split(":");
|
||||
// Format: 1. Playername - skill value
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* SKILL SPECIFIED INFO RETRIEVAL
|
||||
*/
|
||||
if (args.length >= 1 && Skills.isSkill(args[0])) {
|
||||
int p = 1;
|
||||
// Grab page value if specified
|
||||
if (args.length >= 2) {
|
||||
if (m.isInt(args[1])) {
|
||||
p = Integer.valueOf(args[1]);
|
||||
}
|
||||
}
|
||||
int pt = p;
|
||||
if (p > 1) {
|
||||
pt -= 1;
|
||||
pt += (pt * 10);
|
||||
pt = 10;
|
||||
}
|
||||
String firstLetter = args[0].substring(0, 1); // Get first letter
|
||||
String remainder = args[0].substring(1); // Get remainder of word.
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
|
||||
String[] info = Leaderboard.retrieveInfo(args[0].toUpperCase(), p);
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
|
||||
int n = 1 * pt; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
String digit = String.valueOf(n);
|
||||
if (n < 10)
|
||||
digit = "0" + String.valueOf(n);
|
||||
String[] splitx = x.split(":");
|
||||
// Format: 1. Playername - skill value
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* MYSQL LEADERBOARDS
|
||||
*/
|
||||
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
|
||||
if (args.length >= 1 && Skills.isSkill(args[0])) {
|
||||
/*
|
||||
* Create a nice consistent capitalized leaderboard name
|
||||
*/
|
||||
String lowercase = args[0].toLowerCase(); // For the query
|
||||
String firstLetter = args[0].substring(0, 1); // Get first letter
|
||||
String remainder = args[0].substring(1); // Get remainder of word.
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
|
||||
if (args.length >= 2 && m.isInt(args[1])) {
|
||||
int n = 1; // For the page number
|
||||
int n2 = Integer.valueOf(args[1]);
|
||||
if (n2 > 1) {
|
||||
// Figure out the 'page' here
|
||||
n = 10;
|
||||
n = n * (n2 - 1);
|
||||
}
|
||||
// If a page number is specified
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
|
||||
|
||||
for (int i = n; i <= n + 10; i++) {
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "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));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// If no page number is specified
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
|
||||
for (int i = 1; i <= 10; i++) { // i<=userslist.size()
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "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));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args.length >= 0) {
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
if (args.length >= 1 && m.isInt(args[0])) {
|
||||
int n = 1; // For the page number
|
||||
int n2 = Integer.valueOf(args[0]);
|
||||
if (n2 > 1) {
|
||||
// Figure out the 'page' here
|
||||
n = 10;
|
||||
n = n * (n2 - 1);
|
||||
}
|
||||
// If a page number is specified
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
|
||||
for (int i = n; i <= n + 10; i++) {
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "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));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "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));
|
||||
// System.out.println(username.get(1).get(0));
|
||||
// System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class ACommand implements CommandExecutor {
|
||||
|
||||
public ACommand() {}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
// Console message?
|
||||
if (!(sender instanceof Player) && args.length >= 1) {
|
||||
String aMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
|
||||
|
||||
Bukkit.getLogger().info("[A]<*Console*> " + aMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not a toggle, a message
|
||||
|
||||
if (args.length >= 1) {
|
||||
String aMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
|
||||
Bukkit.getLogger().info("[A]<" + name + "> " + aMessage);
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getPartyChatMode())
|
||||
PP.togglePartyChat();
|
||||
|
||||
PP.toggleAdminChat();
|
||||
|
||||
if (PP.getAdminChatMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class AcceptCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PP.hasPartyInvite()) {
|
||||
Party Pinstance = Party.getInstance();
|
||||
|
||||
if (PP.inParty()) {
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
}
|
||||
PP.acceptInvite();
|
||||
Pinstance.addToParty(player, PP, PP.getParty(), true);
|
||||
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +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.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
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) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party Pinstance = Party.getInstance();
|
||||
|
||||
if (!PP.inParty()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.NotInParty"));
|
||||
return true;
|
||||
}
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /invite <playername>");
|
||||
return true;
|
||||
}
|
||||
if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
|
||||
if (Pinstance.canInvite(player, PP)) {
|
||||
Player target = plugin.getServer().getPlayer(args[0]);
|
||||
PlayerProfile PPt = Users.getProfile(target);
|
||||
PPt.modifyInvite(PP.getParty());
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.InviteSuccess"));
|
||||
// target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName());
|
||||
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] { PPt.getInvite(), player.getName() }));
|
||||
// target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+LoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
|
||||
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { "/accept" }));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.Locked"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class PCommand implements CommandExecutor {
|
||||
public PCommand() {}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
// Console message?
|
||||
if (!(sender instanceof Player)) {
|
||||
if (args.length < 2)
|
||||
return true;
|
||||
String pMessage = args[1];
|
||||
for (int i = 2; i <= args.length - 1; i++) {
|
||||
pMessage = pMessage + " " + args[i];
|
||||
}
|
||||
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
|
||||
|
||||
Bukkit.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
if (Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) {
|
||||
herp.sendMessage(pPrefix + pMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not a toggle, a message
|
||||
|
||||
if (args.length >= 1) {
|
||||
if(!PP.inParty()) {
|
||||
player.sendMessage("You're not in a party."); //TODO: Use mcLocale
|
||||
return true;
|
||||
}
|
||||
|
||||
String pMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
pMessage = pMessage + " " + args[i];
|
||||
}
|
||||
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") ";
|
||||
Bukkit.getLogger().info("[P](" + PP.getParty() + ")<" + name + "> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
if (Party.getInstance().inSameParty(herp, player))
|
||||
herp.sendMessage(pPrefix + pMessage);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PP.getAdminChatMode())
|
||||
PP.toggleAdminChat();
|
||||
|
||||
PP.togglePartyChat();
|
||||
|
||||
if (PP.getPartyChatMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOn"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOff"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,225 +0,0 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class PartyCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party Pinstance = Party.getInstance();
|
||||
|
||||
if (PP.inParty() && (!Pinstance.isParty(PP.getParty()) || !Pinstance.isInParty(player, PP))) {
|
||||
Pinstance.addToParty(player, PP, PP.getParty(), false);
|
||||
}
|
||||
|
||||
if (args.length == 0 && !PP.inParty()) {
|
||||
player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { "/party "}));
|
||||
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party "}));
|
||||
player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { "/party " }));
|
||||
return true;
|
||||
} else if (args.length == 0 && PP.inParty()) {
|
||||
String tempList = "";
|
||||
int x = 0;
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
|
||||
if (p != null && x + 1 >= Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) {
|
||||
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
|
||||
tempList += ChatColor.GOLD + p.getName();
|
||||
x++;
|
||||
} else {
|
||||
tempList += ChatColor.WHITE + p.getName();
|
||||
x++;
|
||||
}
|
||||
}
|
||||
if (p != null && x < Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) {
|
||||
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
|
||||
tempList += ChatColor.GOLD + p.getName() + ", ";
|
||||
x++;
|
||||
} else {
|
||||
tempList += ChatColor.WHITE + p.getName() + ", ";
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.YouAreInParty", new Object[] { PP.getParty() }));
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyMembers") + " (" + tempList + ChatColor.GREEN + ")");
|
||||
|
||||
//Master Apprentice Stuff
|
||||
//Show the player all their bonuses when they type /party
|
||||
|
||||
/*
|
||||
for(Player a : Party.getInstance().getPartyMembers(player))
|
||||
{
|
||||
if(Party.getInstance().isPartyLeader(a.getName(), PP.getParty()) && !a.getName().equals(player.getName()))
|
||||
{
|
||||
PlayerProfile LP = Users.getProfile(a);
|
||||
for(SkillType type : SkillType.values())
|
||||
{
|
||||
//Skip this one
|
||||
if(type == SkillType.ALL)
|
||||
continue;
|
||||
|
||||
if(LP.getSkillLevel(type) > PP.getSkillLevel(type))
|
||||
{
|
||||
//Tell them what their skill bonus is for this skill
|
||||
int leaderLevel = LP.getSkillLevel(type);
|
||||
int difference = leaderLevel - PP.getSkillLevel(type);
|
||||
|
||||
double bonusModifier = (difference*0.75D)/100D;
|
||||
double trueBonus = bonusModifier * 100;
|
||||
player.sendMessage("You get "+trueBonus+"% more XP from "+type.toString());
|
||||
//double percent = (trueBonus/100)*100;
|
||||
} else
|
||||
{
|
||||
//Tell them they have no bonus.. or not
|
||||
}
|
||||
}
|
||||
} else if(Party.getInstance().isPartyLeader(a.getName(), PP.getParty()) && a.getName().equals(player.getName()))
|
||||
{
|
||||
//Tell them they are providing bonuses
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
} else if (args.length == 1) {
|
||||
if (args[0].equals("q") && PP.inParty()) {
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("?")) {
|
||||
player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { "/party " }));
|
||||
} else if (args[0].equalsIgnoreCase("lock")) {
|
||||
if (PP.inParty()) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
Pinstance.lockParty(PP.getParty());
|
||||
player.sendMessage(mcLocale.getString("Party.Locked"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.NotOwner"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.InvalidName"));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("unlock")) {
|
||||
if (PP.inParty()) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
Pinstance.unlockParty(PP.getParty());
|
||||
player.sendMessage(mcLocale.getString("Party.Unlocked"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.NotOwner"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.InvalidName"));
|
||||
}
|
||||
// Party debugging command.
|
||||
// } else if (args[0].equalsIgnoreCase("dump")) {
|
||||
// Pinstance.dump(player);
|
||||
} else {
|
||||
if (PP.inParty()) {
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
}
|
||||
Pinstance.addToParty(player, PP, args[0], false);
|
||||
return true;
|
||||
}
|
||||
} else if (args.length == 2 && PP.inParty()) {
|
||||
if (args[0].equalsIgnoreCase("password")) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
if (Pinstance.isPartyLocked(PP.getParty())) {
|
||||
Pinstance.setPartyPassword(PP.getParty(), args[1]);
|
||||
player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] { args[1] }));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.IsntLocked"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.NotOwner"));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("kick")) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
if (Pinstance.isPartyLocked(PP.getParty())) {
|
||||
Player tPlayer = null;
|
||||
if (Bukkit.getServer().getPlayer(args[1]) != null)
|
||||
tPlayer = Bukkit.getServer().getPlayer(args[1]);
|
||||
if (tPlayer == null) {
|
||||
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
|
||||
}
|
||||
if (!Pinstance.inSameParty(player, tPlayer)) {
|
||||
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { tPlayer.getName() }));
|
||||
} else {
|
||||
// Not an admin
|
||||
if (!mcPermissions.getInstance().admin(player)) {
|
||||
// Can't kick an admin
|
||||
if (mcPermissions.getInstance().admin(tPlayer)) {
|
||||
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { tPlayer.getName() }));
|
||||
}
|
||||
}
|
||||
PlayerProfile tPP = Users.getProfile(tPlayer);
|
||||
|
||||
Pinstance.removeFromParty(tPlayer, tPP);
|
||||
|
||||
tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.IsntLocked"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.NotOwner"));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("owner")) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
Player tPlayer = null;
|
||||
if (Bukkit.getServer().getPlayer(args[1]) != null)
|
||||
tPlayer = Bukkit.getServer().getPlayer(args[1]);
|
||||
if (tPlayer == null) {
|
||||
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] }));
|
||||
}
|
||||
if (!Pinstance.inSameParty(player, tPlayer)) {
|
||||
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { tPlayer.getName() }));
|
||||
} else {
|
||||
Pinstance.setPartyLeader(PP.getParty(), tPlayer.getName());
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.NotOwner"));
|
||||
}
|
||||
} else {
|
||||
Pinstance.removeFromParty(player, PP);
|
||||
Pinstance.addToParty(player, PP, args[0], false, args[1]);
|
||||
}
|
||||
} else if (args.length == 2 && !PP.inParty()) {
|
||||
Pinstance.addToParty(player, PP, args[0], false, args[1]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,75 +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.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
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) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().partyTeleport(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!Party.getInstance().isParty(PP.getParty()))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED+"You are not in a party!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(PP.getRecentlyHurt()+(LoadProperties.ptpCommandCooldown*1000) > System.currentTimeMillis())
|
||||
{
|
||||
player.sendMessage(ChatColor.RED+"You've been hurt in the last " + LoadProperties.ptpCommandCooldown + " seconds and cannnot teleport.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.getServer().getPlayer(args[0]) == null) {
|
||||
player.sendMessage("That is not a valid player");
|
||||
}
|
||||
|
||||
if (plugin.getServer().getPlayer(args[0]) != null) {
|
||||
Player target = plugin.getServer().getPlayer(args[0]);
|
||||
PlayerProfile PPt = Users.getProfile(target);
|
||||
if (PP.getParty().equals(PPt.getParty())) {
|
||||
player.teleport(target);
|
||||
player.sendMessage(ChatColor.GREEN + "You have teleported to " + target.getName());
|
||||
target.sendMessage(ChatColor.GREEN + player.getName() + " has teleported to you.");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "That player is in a different party than you.");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
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) {
|
||||
String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"inspect", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"});
|
||||
|
||||
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 && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.inspectFar((Player) sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile profile = mcmmoPlayer.getProfile();
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", new Object[] { target.getName() }));
|
||||
CommandHelper.printGatheringSkills(target, profile, sender);
|
||||
CommandHelper.printCombatSkills(target, profile, sender);
|
||||
CommandHelper.printMiscSkills(target, profile, sender);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { mcmmoPlayer.getPowerLevel() }));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !Permissions.inspectOffline((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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
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 McabilityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"mcability", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"});
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcability")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
case 1:
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcability.others")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer modifiedPlayer = mcMMO.p.getServer().getOfflinePlayer(args[0]);
|
||||
profile = Users.getProfile(modifiedPlayer);
|
||||
|
||||
// TODO:Not sure if we actually need a null check here
|
||||
if (profile == null || !profile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getAbilityUse()) {
|
||||
((Player) modifiedPlayer).sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||
}
|
||||
else {
|
||||
((Player) modifiedPlayer).sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||
}
|
||||
|
||||
profile.toggleAbilityUse();
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
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.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(LocaleLoader.getString("Commands.mcc.Header"));
|
||||
|
||||
if (Permissions.party(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
|
||||
player.sendMessage("/party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
|
||||
player.sendMessage("/party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
|
||||
player.sendMessage("/party quit " + LocaleLoader.getString("Commands.Party.Quit"));
|
||||
|
||||
if (Permissions.partyChat(player)) {
|
||||
player.sendMessage("/p " + LocaleLoader.getString("Commands.Party.Toggle"));
|
||||
}
|
||||
|
||||
player.sendMessage("/party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
|
||||
player.sendMessage("/party accept " + LocaleLoader.getString("Commands.Party.Accept"));
|
||||
|
||||
if (Permissions.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 (Permissions.skillReset(player)) {
|
||||
player.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
|
||||
}
|
||||
|
||||
if (Permissions.mcAbility(player)) {
|
||||
player.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
|
||||
}
|
||||
|
||||
if (Permissions.adminChat(player)) {
|
||||
player.sendMessage("/a " + LocaleLoader.getString("Commands.AdminToggle"));
|
||||
}
|
||||
|
||||
if (Permissions.inspect(player)) {
|
||||
player.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
|
||||
}
|
||||
|
||||
if (Permissions.mmoedit(player)) {
|
||||
player.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
|
||||
}
|
||||
|
||||
if (Permissions.mcgod(player)) {
|
||||
player.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
|
||||
player.sendMessage("/mcmmo " + LocaleLoader.getString("Commands.ModDescription"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
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.util.Anniversary;
|
||||
|
||||
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(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", new Object[] {mcMMO.p.getDescription().getVersion()}));
|
||||
|
||||
Anniversary.anniversaryCheck(sender);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
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.Leaderboard;
|
||||
|
||||
public class McrankCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
//TODO: Better input handling, add usage string
|
||||
|
||||
if (!Config.getInstance().getUseMySQL()) {
|
||||
Leaderboard.updateLeaderboards(); //Make sure the information is up to date
|
||||
}
|
||||
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
String playerName;
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
playerName = player.getName();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
playerName = args[0];
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
sqlDisplay(sender, playerName);
|
||||
}
|
||||
else {
|
||||
flatfileDisplay(sender, playerName);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void flatfileDisplay(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", new Object[] {playerName}));
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
int[] rankInts = Leaderboard.getPlayerRank(playerName, skillType);
|
||||
if (skillType.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
continue; // We want the overall ranking to be at the bottom
|
||||
}
|
||||
|
||||
if (rankInts[1] == 0) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", new Object[] {SkillTools.localizeSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked")} )); //Don't bother showing ranking for players without skills
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", new Object[] {SkillTools.localizeSkillName(skillType), String.valueOf(rankInts[0])} ));
|
||||
}
|
||||
}
|
||||
|
||||
//Show the powerlevel ranking
|
||||
int[] rankInts = Leaderboard.getPlayerRank(playerName, SkillType.ALL);
|
||||
|
||||
if (rankInts[1] == 0) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Overalll", new Object[] {LocaleLoader.getString("Commands.mcrank.Unranked")} )); //Don't bother showing ranking for players without skills
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Overall", new Object[] {String.valueOf(rankInts[0])} ));
|
||||
}
|
||||
}
|
||||
|
||||
private void sqlDisplay(CommandSender sender, String playerName) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("mcMMO"), new McRankAsync(playerName, sender));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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.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;
|
||||
}
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcstats")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile profile = Users.getPlayer(player).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 > 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
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.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
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.Leaderboard;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class MctopCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = LocaleLoader.getString("Commands.Usage.2", new Object[] {"mctop", "[" + LocaleLoader.getString("Commands.Usage.Skill") + "]", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"});
|
||||
|
||||
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 (SkillTools.isSkill(args[0])) {
|
||||
flatfileDisplay(1, args[0].toUpperCase(), sender);
|
||||
}
|
||||
else if (SkillTools.isLocalizedSkill(args[0])) {
|
||||
flatfileDisplay(1, SkillTools.translateLocalizedSkill(args[0]).toUpperCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (Misc.isInt(args[1])) {
|
||||
if (SkillTools.isSkill(args[0])) {
|
||||
flatfileDisplay(Integer.valueOf(args[1]), args[0].toUpperCase(), sender);
|
||||
}
|
||||
else if (SkillTools.isLocalizedSkill(args[0])) {
|
||||
flatfileDisplay(Integer.valueOf(args[1]), SkillTools.translateLocalizedSkill(args[0]).toUpperCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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 (SkillTools.isSkill(args[0])) {
|
||||
sqlDisplay(1, args[0].toLowerCase(), sender);
|
||||
}
|
||||
else if (SkillTools.isLocalizedSkill(args[0])) {
|
||||
sqlDisplay(1, SkillTools.translateLocalizedSkill(args[0]).toLowerCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (Misc.isInt(args[1])) {
|
||||
if (SkillTools.isSkill(args[0])) {
|
||||
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
|
||||
}
|
||||
else if (SkillTools.isLocalizedSkill(args[0])) {
|
||||
sqlDisplay(Integer.valueOf(args[1]), SkillTools.translateLocalizedSkill(args[0]).toLowerCase(), sender);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void flatfileDisplay(int page, String skill, CommandSender sender) {
|
||||
Leaderboard.updateLeaderboards(); //Make sure we have the latest information
|
||||
SkillType skillType = SkillType.getSkill(skill);
|
||||
String[] info = Leaderboard.retrieveInfo(skillType, page);
|
||||
|
||||
if (skill.equalsIgnoreCase("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++;
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
}
|
||||
|
||||
private void sqlDisplay(int page, String query, CommandSender sender) {
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
HashMap<Integer, ArrayList<String>> userslist = Database.read("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT "+((page * 10) - 10)+",10");
|
||||
|
||||
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) }));
|
||||
}
|
||||
int place = (page * 10) - 9;
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
if(userslist.get(i) == null) {
|
||||
break;
|
||||
}
|
||||
sender.sendMessage(String.valueOf(place) + ". " + ChatColor.GREEN + userslist.get(i).get(1) + " - " + ChatColor.WHITE + userslist.get(i).get(0));
|
||||
place++;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class AcrobaticsCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
String dodgepercentage;
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.ACROBATICS);
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2);
|
||||
|
||||
if (PP.getSkillLevel(SkillType.ACROBATICS) <= 800)
|
||||
dodgepercentage = String.valueOf((skillvalue / 4000 * 100));
|
||||
else
|
||||
dodgepercentage = "20";
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAcrobatics") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAcrobatics") }));
|
||||
|
||||
if (mcPermissions.getInstance().acrobatics(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics1_0"), mcLocale.getString("m.EffectsAcrobatics1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics2_0"), mcLocale.getString("m.EffectsAcrobatics2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics3_0"), mcLocale.getString("m.EffectsAcrobatics3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.AcrobaticsRollChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.AcrobaticsGracefulRollChance", new Object[] { gracepercentage }));
|
||||
player.sendMessage(mcLocale.getString("m.AcrobaticsDodgeChance", new Object[] { dodgepercentage }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class ArcheryCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.ARCHERY);
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
|
||||
int ignition = 20;
|
||||
if (PP.getSkillLevel(SkillType.ARCHERY) >= 200)
|
||||
ignition += 20;
|
||||
if (PP.getSkillLevel(SkillType.ARCHERY) >= 400)
|
||||
ignition += 20;
|
||||
if (PP.getSkillLevel(SkillType.ARCHERY) >= 600)
|
||||
ignition += 20;
|
||||
if (PP.getSkillLevel(SkillType.ARCHERY) >= 800)
|
||||
ignition += 20;
|
||||
if (PP.getSkillLevel(SkillType.ARCHERY) >= 1000)
|
||||
ignition += 20;
|
||||
|
||||
String percentagedaze;
|
||||
if (PP.getSkillLevel(SkillType.ARCHERY) < 1000)
|
||||
percentagedaze = String.valueOf((skillvalue / 2000) * 100);
|
||||
else
|
||||
percentagedaze = "50";
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillArchery") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainArchery") }));
|
||||
|
||||
if (mcPermissions.getInstance().archery(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery4_0"), mcLocale.getString("m.EffectsArchery4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcheryDazeChance", new Object[] { percentagedaze }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] { (ignition / 20) }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class AxesCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
String percentage;
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.AXES);
|
||||
if (PP.getSkillLevel(SkillType.AXES) < 750)
|
||||
percentage = String.valueOf((skillvalue / 2000) * 100);
|
||||
else
|
||||
percentage = "37.5";
|
||||
|
||||
int bonusDmg = Users.getProfile(player).getSkillLevel(SkillType.AXES)/50;
|
||||
if(bonusDmg > 4)
|
||||
bonusDmg = 4;
|
||||
|
||||
int ticks = 2;
|
||||
short durDmg = 5;
|
||||
durDmg+=Users.getProfile(player).getSkillLevel(SkillType.AXES)/30;
|
||||
int x = PP.getSkillLevel(SkillType.AXES);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAxes") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAxes") }));
|
||||
|
||||
if (mcPermissions.getInstance().axes(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes1_0"), mcLocale.getString("m.EffectsAxes1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes2_0"), mcLocale.getString("m.EffectsAxes2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes3_0"), mcLocale.getString("m.EffectsAxes3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes4_0"), mcLocale.getString("m.EffectsAxes4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes5_0"), mcLocale.getString("m.EffectsAxes5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.AxesCritChance", new Object[] { percentage }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1", new Object[] {bonusDmg}) }));
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes2_0"), mcLocale.getString("m.AbilBonusAxes2_1", new Object[] {durDmg}) }));
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes3_0"), mcLocale.getString("m.AbilBonusAxes3_1", new Object[] {2}) }));
|
||||
player.sendMessage(mcLocale.getString("m.AxesSkullLength", new Object[] { ticks }));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class ExcavationCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
int ticks = 2;
|
||||
int x = PP.getSkillLevel(SkillType.EXCAVATION);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
player.sendMessage("");
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillExcavation") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainExcavation") }));
|
||||
|
||||
if (mcPermissions.getInstance().excavation(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.ExcavationGigaDrillBreakerLength", new Object[] { ticks }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Fishing;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class FishingCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillFishing") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainFishing") }));
|
||||
|
||||
if (mcPermissions.getInstance().fishing(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing1_0"), mcLocale.getString("m.EffectsFishing1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing2_0"), mcLocale.getString("m.EffectsFishing2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing3_0"), mcLocale.getString("m.EffectsFishing3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.FishingRank", new Object[] { Fishing.getFishingLootTier(PP) }));
|
||||
player.sendMessage(mcLocale.getString("m.FishingMagicInfo"));
|
||||
|
||||
if (PP.getSkillLevel(SkillType.FISHING) < 150)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockFishing1") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.ShakeInfo", new Object[] { Fishing.getFishingLootTier(PP) }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.FISHING, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class HerbalismCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
int bonus = 0;
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 200)
|
||||
bonus++;
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 400)
|
||||
bonus++;
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600)
|
||||
bonus++;
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 800)
|
||||
bonus++;
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 1000)
|
||||
bonus++;
|
||||
|
||||
int ticks = 2;
|
||||
int x = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.HERBALISM);
|
||||
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
String gpercentage = String.valueOf((skillvalue / 1500) * 100);
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillHerbalism") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainHerbalism") }));
|
||||
|
||||
if (mcPermissions.getInstance().herbalism(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism3_0"), mcLocale.getString("m.EffectsHerbalism3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism4_0"), mcLocale.getString("m.EffectsHerbalism4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism5_0"), mcLocale.getString("m.EffectsHerbalism5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.HerbalismGreenTerraLength", new Object[] { ticks }));
|
||||
player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbChance", new Object[] { gpercentage }));
|
||||
player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbStage", new Object[] { bonus }));
|
||||
player.sendMessage(mcLocale.getString("m.HerbalismFoodPlus", new Object[] { bonus } ));
|
||||
player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] { percentage }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class MiningCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.MINING);
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
int ticks = 2;
|
||||
int x = PP.getSkillLevel(SkillType.MINING);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
int rank = 0;
|
||||
int damage = 0;
|
||||
int radius = 0;
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 125 && PP.getSkillLevel(SkillType.MINING) < 250)
|
||||
rank = 1;
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 250 && PP.getSkillLevel(SkillType.MINING) < 375){
|
||||
rank = 2;
|
||||
radius = 1;
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 375 && PP.getSkillLevel(SkillType.MINING) < 500){
|
||||
rank = 3;
|
||||
radius = 1;
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 500 && PP.getSkillLevel(SkillType.MINING) < 625){
|
||||
rank = 4;
|
||||
damage = 25;
|
||||
radius = 2;
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 625 && PP.getSkillLevel(SkillType.MINING) < 750){
|
||||
rank = 5;
|
||||
damage = 25;
|
||||
radius = 2;
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 750 && PP.getSkillLevel(SkillType.MINING) < 875){
|
||||
rank = 6;
|
||||
damage = 50;
|
||||
radius = 3;
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 875 && PP.getSkillLevel(SkillType.MINING) < 1000){
|
||||
rank = 7;
|
||||
damage = 50;
|
||||
radius = 3;
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.MINING) >= 1000){
|
||||
rank = 8;
|
||||
damage = 100;
|
||||
radius = 4;
|
||||
}
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillMining") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainMining") }));
|
||||
|
||||
if (mcPermissions.getInstance().mining(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining1_0"), mcLocale.getString("m.EffectsMining1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining2_0"), mcLocale.getString("m.EffectsMining2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining3_0"), mcLocale.getString("m.EffectsMining3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining4_0"), mcLocale.getString("m.EffectsMining4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining5_0"), mcLocale.getString("m.EffectsMining5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.MiningDoubleDropChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.MiningSuperBreakerLength", new Object[] { ticks }));
|
||||
if (PP.getSkillLevel(SkillType.MINING) < 125)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockMining1") }));
|
||||
else{
|
||||
switch (rank){
|
||||
case 1:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining1") }));
|
||||
break;
|
||||
case 2:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining2") }));
|
||||
break;
|
||||
case 3:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining3") }));
|
||||
break;
|
||||
case 4:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining4") }));
|
||||
break;
|
||||
case 5:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining5") }));
|
||||
break;
|
||||
case 6:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining6") }));
|
||||
break;
|
||||
case 7:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining7") }));
|
||||
break;
|
||||
case 8:
|
||||
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining8") }));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (PP.getSkillLevel(SkillType.MINING) < 250)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockMining2") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.MiningBiggerBombs", new Object[] { radius }));
|
||||
if (PP.getSkillLevel(SkillType.MINING) < 500)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockMining3") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.MiningDemolitionsExpertDamageDecrease", new Object[] { damage }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.MINING, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Repair;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class RepairCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.REPAIR);
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
String repairmastery = String.valueOf((skillvalue / 500) * 100);
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillRepair") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainRepair") }));
|
||||
|
||||
if (mcPermissions.getInstance().repair(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair1_0"), mcLocale.getString("m.EffectsRepair1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair2_0"), mcLocale.getString("m.EffectsRepair2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair3_0"), mcLocale.getString("m.EffectsRepair3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair4_0", new Object[] { LoadProperties.repairdiamondlevel }), mcLocale.getString("m.EffectsRepair4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair5_0"), mcLocale.getString("m.EffectsRepair5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] { repairmastery }));
|
||||
player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] { Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR)) }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] { Repair.getEnchantChance(Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR))) }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] { Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR))) }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.REPAIR, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class SwordsCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
int bleedrank = 2;
|
||||
String percentage, counterattackpercentage;
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.SWORDS);
|
||||
if (PP.getSkillLevel(SkillType.SWORDS) < 750)
|
||||
percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
else
|
||||
percentage = "75";
|
||||
|
||||
if (skillvalue >= 750)
|
||||
bleedrank += 1;
|
||||
|
||||
if (PP.getSkillLevel(SkillType.SWORDS) <= 600)
|
||||
counterattackpercentage = String.valueOf((skillvalue / 2000) * 100);
|
||||
else
|
||||
counterattackpercentage = "30";
|
||||
|
||||
int ticks = 2;
|
||||
int x = PP.getSkillLevel(SkillType.SWORDS);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillSwords") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainSwords") }));
|
||||
|
||||
if (mcPermissions.getInstance().swords(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords3_0"), mcLocale.getString("m.EffectsSwords3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords5_0"), mcLocale.getString("m.EffectsSwords5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.SwordsCounterAttChance", new Object[] { counterattackpercentage }));
|
||||
player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] { bleedrank }));
|
||||
player.sendMessage(mcLocale.getString("m.SwordsTickNote"));
|
||||
player.sendMessage(mcLocale.getString("m.SwordsBleedChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] { ticks }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class TamingCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.TAMING);
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillTaming") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainTaming") }));
|
||||
|
||||
if (mcPermissions.getInstance().taming(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming1_0"), mcLocale.getString("m.EffectsTaming1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming2_0"), mcLocale.getString("m.EffectsTaming2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming3_0"), mcLocale.getString("m.EffectsTaming3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming4_0"), mcLocale.getString("m.EffectsTaming4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming7_0"), mcLocale.getString("m.EffectsTaming7_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming8_0"), mcLocale.getString("m.EffectsTaming8_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTaming7_2", new Object[] { LoadProperties.bonesConsumedByCOTW }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
|
||||
if (PP.getSkillLevel(SkillType.TAMING) < 100)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming1") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming1_0"), mcLocale.getString("m.AbilBonusTaming1_1") }));
|
||||
|
||||
if (PP.getSkillLevel(SkillType.TAMING) < 250)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming2") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming2_0"), mcLocale.getString("m.AbilBonusTaming2_1") }));
|
||||
|
||||
if (PP.getSkillLevel(SkillType.TAMING) < 500)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming3") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming3_0"), mcLocale.getString("m.AbilBonusTaming3_1") }));
|
||||
|
||||
if (PP.getSkillLevel(SkillType.TAMING) < 750)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming4") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming4_0"), mcLocale.getString("m.AbilBonusTaming4_1") }));
|
||||
if (PP.getSkillLevel(SkillType.TAMING) < 50)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming5") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming5_0"), mcLocale.getString("m.AbilBonusTaming5_1") }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.TamingGoreChance", new Object[] { percentage }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.TAMING, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class UnarmedCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
String percentage, arrowpercentage;
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.UNARMED);
|
||||
|
||||
if (PP.getSkillLevel(SkillType.UNARMED) < 1000)
|
||||
percentage = String.valueOf((skillvalue / 3000) * 100);
|
||||
else
|
||||
percentage = "33.3";
|
||||
|
||||
if (PP.getSkillLevel(SkillType.UNARMED) < 1000)
|
||||
arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
|
||||
else
|
||||
arrowpercentage = "50";
|
||||
|
||||
int ticks = 2;
|
||||
int x = PP.getSkillLevel(SkillType.UNARMED);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
int bonus = 3 + (PP.getSkillLevel(SkillType.UNARMED)/50);
|
||||
|
||||
if(bonus > 8)
|
||||
bonus = 8;
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillUnarmed") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainUnarmed") }));
|
||||
|
||||
if (mcPermissions.getInstance().unarmed(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed1_0"), mcLocale.getString("m.EffectsUnarmed1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed2_0"), mcLocale.getString("m.EffectsUnarmed2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed3_0"), mcLocale.getString("m.EffectsUnarmed3_1") }));
|
||||
//player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed4_0"), mcLocale.getString("m.EffectsUnarmed4_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed5_0"), mcLocale.getString("m.EffectsUnarmed5_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.UnarmedArrowDeflectChance", new Object[] { arrowpercentage }));
|
||||
player.sendMessage(mcLocale.getString("m.UnarmedDisarmChance", new Object[] { percentage }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1", new Object[] {bonus}) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] { ticks }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.UNARMED, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.util.Page;
|
||||
|
||||
public class WoodcuttingCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
float skillvalue = (float) PP.getSkillLevel(SkillType.WOODCUTTING);
|
||||
int ticks = 2;
|
||||
int x = PP.getSkillLevel(SkillType.WOODCUTTING);
|
||||
while (x >= 50) {
|
||||
x -= 50;
|
||||
ticks++;
|
||||
}
|
||||
String percentage = String.valueOf((skillvalue / 1000) * 100);
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillWoodCutting") }));
|
||||
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainWoodCutting") }));
|
||||
|
||||
if (mcPermissions.getInstance().woodcutting(player))
|
||||
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting1_0"), mcLocale.getString("m.EffectsWoodCutting1_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting2_0"), mcLocale.getString("m.EffectsWoodCutting2_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting3_0"), mcLocale.getString("m.EffectsWoodCutting3_1") }));
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
|
||||
if (PP.getSkillLevel(SkillType.WOODCUTTING) < 100)
|
||||
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockWoodCutting1") }));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusWoodCutting1_0"), mcLocale.getString("m.AbilBonusWoodCutting1_1") }));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.WoodCuttingDoubleDropChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.WoodCuttingTreeFellerLength", new Object[] { ticks }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.WOODCUTTING, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.gmail.nossr50.commands.spout;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.HUDType;
|
||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class MchudCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!LoadProperties.spoutEnabled) {
|
||||
sender.sendMessage("This command is not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(args.length >= 1)
|
||||
{
|
||||
for(HUDType x : HUDType.values())
|
||||
{
|
||||
if(x.toString().toLowerCase().equals(args[0].toLowerCase()))
|
||||
{
|
||||
if(SpoutStuff.playerHUDs.containsKey(player))
|
||||
{
|
||||
SpoutStuff.playerHUDs.get(player).resetHUD();
|
||||
SpoutStuff.playerHUDs.remove(player);
|
||||
PP.setHUDType(x);
|
||||
SpoutStuff.playerHUDs.put(player, new HUDmmo(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -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.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class XplockCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!LoadProperties.spoutEnabled || !LoadProperties.xpbar || !LoadProperties.xplockEnable) {
|
||||
sender.sendMessage("This command is not enabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
|
||||
if (PP.getXpBarLocked()) {
|
||||
PP.setSkillLock(Skills.getSkillType(args[0]));
|
||||
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
|
||||
} else {
|
||||
PP.setSkillLock(Skills.getSkillType(args[0]));
|
||||
PP.toggleXpBarLocked();
|
||||
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
|
||||
}
|
||||
SpoutStuff.updateXpBar(player);
|
||||
} else if (args.length < 1) {
|
||||
if (PP.getXpBarLocked()) {
|
||||
PP.toggleXpBarLocked();
|
||||
player.sendMessage(mcLocale.getString("Commands.xplock.unlocked"));
|
||||
} else if (PP.getLastGained() != null) {
|
||||
PP.toggleXpBarLocked();
|
||||
PP.setSkillLock(PP.getLastGained());
|
||||
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
|
||||
}
|
||||
} else if (args.length >= 1 && !Skills.isSkill(args[0])) {
|
||||
player.sendMessage("Commands.xplock.invalid");
|
||||
} else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
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 getHylianLucksMaxLevel() { 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); }
|
||||
}
|
||||
415
src/main/java/com/gmail/nossr50/config/Config.java
Normal file
415
src/main/java/com/gmail/nossr50/config/Config.java
Normal file
@@ -0,0 +1,415 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class Config extends ConfigLoader {
|
||||
private static Config instance;
|
||||
|
||||
private Config() {
|
||||
super("config.yml");
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
public static Config getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Config();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
|
||||
/*
|
||||
* GENERAL SETTINGS
|
||||
*/
|
||||
|
||||
/* 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 getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
|
||||
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 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 (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) {
|
||||
return getStringIncludingInts(config, "MySQL.Database.User_Password");
|
||||
}
|
||||
|
||||
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 == null)
|
||||
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 boolean getHardcoreVampirismEnabled() { return config.getBoolean("Hardcore.Vampirism", false); }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/*
|
||||
* ABILITY SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); }
|
||||
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/*
|
||||
* 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); }
|
||||
|
||||
/* Excavation */
|
||||
public int getExcavationClayXP() { return config.getInt("Experience.Excavation.Clay", 40); }
|
||||
public int getExcavationDirtXP() { return config.getInt("Experience.Excavation.Dirt", 40); }
|
||||
public int getExcavationGrassXP() { return config.getInt("Experience.Excavation.Grass", 40); }
|
||||
public int getExcavationGravelXP() { return config.getInt("Experience.Excavation.Gravel", 40); }
|
||||
public int getExcavationMycelXP() { return config.getInt("Experience.Excavation.Mycel", 40); }
|
||||
public int getExcavationSandXP() { return config.getInt("Experience.Excavation.Sand", 40); }
|
||||
public int getExcavationSoulSandXP() { return config.getInt("Experience.Excavation.SoulSand", 40); }
|
||||
|
||||
/* Fishing */
|
||||
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
|
||||
/* 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 int getHerbalismXPCocoa() { return config.getInt("Experience.Herbalism.Cocoa", 30); }
|
||||
public int getHerbalismXPCarrot() { return config.getInt("Experience.Herbalism.Carrot", 50); }
|
||||
public int getHerbalismXPPotato() { return config.getInt("Experience.Herbalism.Potato", 50); }
|
||||
|
||||
public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); }
|
||||
public boolean getHerbalismGreenThumbCobbleWallToMossyWall() { return config.getBoolean("Skills.Herbalism.Green_Thumb.CobbleWall_To_MossyWall", 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 getCocoaDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cocoa", true); }
|
||||
public boolean getCarrotDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Carrot", true); }
|
||||
public boolean getPotatoDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Potato", true); }
|
||||
|
||||
public boolean herbalismDoubleDropsDisabled() {
|
||||
return doubleDropsDisabled("Herbalism");
|
||||
}
|
||||
|
||||
/* 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 int getMiningXPEmeraldOre() { return config.getInt("Experience.Mining.Emerald", 1000); }
|
||||
|
||||
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 getEmeraldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Emerald", true); }
|
||||
|
||||
public boolean miningDoubleDropsDisabled() {
|
||||
return doubleDropsDisabled("Mining");
|
||||
}
|
||||
|
||||
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); }
|
||||
|
||||
/* Smelting */
|
||||
public int getSmeltingXPCoal() { return config.getInt("Experience.Smelting.Coal", 10); }
|
||||
public int getSmeltingXPRedstone() { return config.getInt("Experience.Smelting.Redstone", 15); }
|
||||
public int getSmeltingXPIron() { return config.getInt("Experience.Smelting.Iron", 25); }
|
||||
public int getSmeltingXPGold() { return config.getInt("Experience.Smelting.Gold", 35); }
|
||||
public int getSmeltingXPDiamond() { return config.getInt("Experience.Smelting.Diamond", 75); }
|
||||
public int getSmeltingXPLapis() { return config.getInt("Experience.Smelting.Lapis", 40); }
|
||||
public int getSmeltingXPEmerald() { return config.getInt("Experience.Smelting.Emerald", 100); }
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
|
||||
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
|
||||
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
|
||||
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
||||
|
||||
/* Woodcutting */
|
||||
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 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() {
|
||||
return doubleDropsDisabled("Woodcutting");
|
||||
}
|
||||
|
||||
/* 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); }
|
||||
|
||||
/* Dogde Lightning */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
|
||||
/* Level Caps */
|
||||
public int getLevelCapAcrobatics() {
|
||||
return getLevelCap("Skills.Acrobatics.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapArchery() {
|
||||
return getLevelCap("Skills.Archery.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapAxes() {
|
||||
return getLevelCap("Skills.Axes.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapExcavation() {
|
||||
return getLevelCap("Skills.Excavation.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapFishing() {
|
||||
return getLevelCap("Skills.Fishing.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapHerbalism() {
|
||||
return getLevelCap("Skills.Herbalism.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapMining() {
|
||||
return getLevelCap("Skills.Mining.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapRepair() {
|
||||
return getLevelCap("Skills.Repair.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapSmelting() {
|
||||
return getLevelCap("Skills.Smelting.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapSwords() {
|
||||
return getLevelCap("Skills.Swords.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapTaming() {
|
||||
return getLevelCap("Skills.Taming.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapUnarmed() {
|
||||
return getLevelCap("Skills.Unarmed.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapWoodcutting() {
|
||||
return getLevelCap("Skills.Woodcutting.Level_Cap");
|
||||
}
|
||||
|
||||
public int getPowerLevelCap() {
|
||||
return getLevelCap("General.Power_Level_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); }
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* 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 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 getGiantXP() { return config.getDouble("Experience.Combat.Multiplier.Giant", 4.0); }
|
||||
public double getWitherXP() { return config.getDouble("Experience.Combat.Multiplier.Wither", 7.0); }
|
||||
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
|
||||
public double getWitchXP() { return config.getDouble("Experience.Combat.Multiplier.Witch", 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); }
|
||||
|
||||
private boolean doubleDropsDisabled(String skillName) {
|
||||
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;
|
||||
}
|
||||
|
||||
private int getLevelCap(String configString) {
|
||||
int cap = config.getInt(configString, 0);
|
||||
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
|
||||
}
|
||||
|
||||
/* Party Settings */
|
||||
public boolean getExpShareEnabled() { return config.getBoolean("Party.Sharing.ExpShare_enabled", true); }
|
||||
public double getPartyShareBonus() { return config.getDouble("Party.Sharing.ExpShare_bonus", 1.1); }
|
||||
public boolean getItemShareEnabled() { return config.getBoolean("Party.Sharing.ItemShare_enabled", true); }
|
||||
public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0); }
|
||||
}
|
||||
@@ -1,55 +1,79 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
protected static final mcMMO plugin = mcMMO.p;
|
||||
protected String fileName;
|
||||
protected File configFile;
|
||||
protected FileConfiguration config;
|
||||
|
||||
protected static File configFile;
|
||||
protected static File dataFolder;
|
||||
protected final mcMMO plugin;
|
||||
protected static FileConfiguration config;
|
||||
|
||||
public ConfigLoader(mcMMO plugin, String fileName){
|
||||
this.plugin = plugin;
|
||||
dataFolder = plugin.getDataFolder();
|
||||
configFile = new File(dataFolder, File.separator + fileName);
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load this config file.
|
||||
*/
|
||||
protected abstract void load();
|
||||
public ConfigLoader(String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save this config file.
|
||||
*/
|
||||
private static void saveConfig() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
protected void loadFile() {
|
||||
if (!configFile.exists()) {
|
||||
plugin.getLogger().info("Creating mcMMO " + fileName + " File...");
|
||||
createFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
else {
|
||||
plugin.getLogger().info("Loading mcMMO " + fileName + " File...");
|
||||
}
|
||||
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the defaults to this config file.
|
||||
*/
|
||||
protected void addDefaults() {
|
||||
|
||||
// Load from included config.yml
|
||||
config.options().copyDefaults(true);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the keys from this config file.
|
||||
*/
|
||||
protected abstract void loadKeys();
|
||||
|
||||
protected void createFile() {
|
||||
if (configFile.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
configFile.getParentFile().mkdirs();
|
||||
|
||||
InputStream inputStream = plugin.getResource(fileName);
|
||||
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
copyStreamToFile(inputStream, configFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().severe("Missing ressource file: '" + fileName + "' please notify the plugin authors");
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyStreamToFile(InputStream inputStream, File file) throws Exception {
|
||||
OutputStream outputStream = new FileOutputStream(file);
|
||||
|
||||
int read = 0;
|
||||
byte[] bytes = new byte[1024];
|
||||
|
||||
while ((read = inputStream.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, read);
|
||||
}
|
||||
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
42
src/main/java/com/gmail/nossr50/config/HiddenConfig.java
Normal file
42
src/main/java/com/gmail/nossr50/config/HiddenConfig.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class HiddenConfig {
|
||||
private static HiddenConfig instance;
|
||||
private static String fileName;
|
||||
private static YamlConfiguration config;
|
||||
private static boolean chunkletsEnabled;
|
||||
private static int conversionRate;
|
||||
|
||||
public HiddenConfig(String fileName) {
|
||||
HiddenConfig.fileName = fileName;
|
||||
load();
|
||||
}
|
||||
|
||||
public static HiddenConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new HiddenConfig("hidden.yml");
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getChunkletsEnabled() {
|
||||
return chunkletsEnabled;
|
||||
}
|
||||
|
||||
public int getConversionRate() {
|
||||
return conversionRate;
|
||||
}
|
||||
}
|
||||
@@ -1,479 +0,0 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.HUDType;
|
||||
|
||||
public class LoadProperties extends ConfigLoader{
|
||||
|
||||
/*
|
||||
* GENERAL SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public static String locale;
|
||||
public static Boolean enableMotd, statsTracking, eventCallback;
|
||||
public static int saveInterval;
|
||||
|
||||
/* mySQL */
|
||||
public static Boolean useMySQL;
|
||||
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass;
|
||||
public static int MySQLport;
|
||||
|
||||
/* Commands */
|
||||
public static Boolean xplockEnable, xprateEnable, mccEnable, mcmmoEnable,
|
||||
partyEnable, inviteEnable, acceptEnable, inspectEnable,
|
||||
mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable,
|
||||
mcremoveEnable, mcgodEnable, mcabilityEnable, mctopEnable,
|
||||
addlevelsEnable, mcrefreshEnable, aEnable, pEnable;
|
||||
public static Boolean aDisplayNames, pDisplayNames;
|
||||
public static int ptpCommandCooldown;
|
||||
public static Boolean donateMessage;
|
||||
|
||||
/* Tool Level Requirements */
|
||||
public static Boolean perLevelTools;
|
||||
public static int sAxe, sHoe, sShovel, sSword, sPickaxe;
|
||||
public static int iAxe, iHoe, iShovel, iSword, iPickaxe;
|
||||
public static int gAxe, gHoe, gShovel, gSword, gPickaxe;
|
||||
public static int dAxe, dHoe, dShovel, dSword, dPickaxe;
|
||||
|
||||
/* Items */
|
||||
public static Boolean chimaeraWingEnable;
|
||||
public static int chimaeraId, feathersConsumedByChimaeraWing;
|
||||
|
||||
/*
|
||||
* ABILITY SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities;
|
||||
|
||||
/* Durability Settings */
|
||||
public static Boolean toolsLoseDurabilityFromAbilities;
|
||||
public static int abilityDurabilityLoss;
|
||||
|
||||
/* Cooldowns */
|
||||
public static int superBreakerCooldown, blastMiningCooldown, greenTerraCooldown,
|
||||
gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown,
|
||||
serratedStrikeCooldown, skullSplitterCooldown;
|
||||
|
||||
/* Thresholds */
|
||||
public static int treeFellerThreshold;
|
||||
|
||||
/*
|
||||
* SKILL SETTINGS
|
||||
*/
|
||||
|
||||
/* Tool Requirements */
|
||||
public static Boolean miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe;
|
||||
|
||||
/* Excavation */
|
||||
public static int mbase;
|
||||
|
||||
/* Fishing */
|
||||
public static Boolean fishingDrops;
|
||||
public static int fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5;
|
||||
public static int mfishing;
|
||||
|
||||
/* Herbalism */
|
||||
public static Boolean herbalismHungerBonus, wheatRegrowth;
|
||||
public static int mmelon, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mvines, mlilypad, mnetherwart;
|
||||
public static Boolean enableCobbleToMossy, enableSmoothToMossy, enableDirtToGrass;
|
||||
|
||||
/* Mining */
|
||||
public static int msandstone, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, mendstone, mmossstone;
|
||||
public static int detonatorID;
|
||||
|
||||
/* Repair */
|
||||
public static Boolean repairArmor, repairTools;
|
||||
public static Boolean anvilmessages;
|
||||
public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather;
|
||||
public static int anvilID;
|
||||
public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel;
|
||||
|
||||
/* Taming */
|
||||
public static int mtameWolf, mtameOcelot;
|
||||
public static int bonesConsumedByCOTW, fishConsumedByCOTW;
|
||||
|
||||
/* Woodcutting */
|
||||
public static int moak, mbirch, mspruce, mjungle;
|
||||
|
||||
/* Arcane Forging */
|
||||
public static Boolean mayDowngradeEnchants, mayLoseEnchants;
|
||||
public static int arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4;
|
||||
public static int downgradeRank1, downgradeRank2, downgradeRank3, downgradeRank4;
|
||||
public static int keepEnchantsRank1, keepEnchantsRank2, keepEnchantsRank3, keepEnchantsRank4;
|
||||
|
||||
/* Level Caps */
|
||||
public static int levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
|
||||
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
|
||||
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting;
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public static Boolean xpGainsMobSpawners, pvpxp;
|
||||
public static int xpGainMultiplier;
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public static double pvpxprewardmodifier;
|
||||
public static double animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP,
|
||||
zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP,
|
||||
blazeXP, magmacubeXP, enderdragonXP;
|
||||
|
||||
/* XP Formula Multiplier */
|
||||
public static double tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
|
||||
fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
|
||||
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
||||
|
||||
/*
|
||||
* SPOUT SETTINGS
|
||||
*/
|
||||
|
||||
public static Boolean spoutEnabled;
|
||||
|
||||
/* Spout Party HUD */
|
||||
public static Boolean showDisplayName, showFaces, partybar;
|
||||
|
||||
/* Spout XP Bar */
|
||||
public static Boolean xpbar, xpicon;
|
||||
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y;
|
||||
|
||||
/* Spout HUD Colors */
|
||||
public static double xpbackground_r, xpbackground_g, xpbackground_b;
|
||||
public static double xpborder_r, xpborder_g, xpborder_b;
|
||||
public static double fishing_r, fishing_g, fishing_b;
|
||||
public static double acrobatics_r, acrobatics_g, acrobatics_b;
|
||||
public static double archery_r, archery_g, archery_b;
|
||||
public static double axes_r, axes_g, axes_b;
|
||||
public static double excavation_r, excavation_g, excavation_b;
|
||||
public static double herbalism_r, herbalism_g, herbalism_b;
|
||||
public static double mining_r, mining_g, mining_b;
|
||||
public static double repair_r, repair_g, repair_b;
|
||||
public static double swords_r, swords_g, swords_b;
|
||||
public static double taming_r, taming_g, taming_b;
|
||||
public static double unarmed_r, unarmed_g, unarmed_b;
|
||||
public static double woodcutting_r, woodcutting_g, woodcutting_b;
|
||||
|
||||
/*
|
||||
* CONFIG LOADING
|
||||
*/
|
||||
|
||||
public static HUDType defaulthud;
|
||||
|
||||
public LoadProperties(mcMMO plugin) {
|
||||
super(plugin, "config.yml");
|
||||
config = plugin.getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
// If it doesn't exist, copy it from the .jar
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveDefaultConfig();
|
||||
}
|
||||
|
||||
addDefaults();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
plugin.getLogger().info("Loading mcMMO config.yml File...");
|
||||
|
||||
// Setup default HUD
|
||||
String temp = config.getString("Spout.HUD.Default", "STANDARD");
|
||||
for (HUDType x : HUDType.values()) {
|
||||
if (x.toString().equalsIgnoreCase(temp)) {
|
||||
defaulthud = x;
|
||||
}
|
||||
}
|
||||
|
||||
enableAbilityMessages = config.getBoolean("Abilities.Messages", true);
|
||||
enableAbilities = config.getBoolean("Abilities.Enabled", true);
|
||||
|
||||
donateMessage = config.getBoolean("Commands.mcmmo.Donate_Message", true);
|
||||
xpGainsMobSpawners = config.getBoolean("Experience.Gains.Mobspawners.Enabled", false);
|
||||
|
||||
bonesConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10);
|
||||
fishConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10);
|
||||
|
||||
xpbar = config.getBoolean("Spout.XP.Bar.Enabled", true);
|
||||
xpicon = config.getBoolean("Spout.XP.Icon.Enabled", true);
|
||||
xpbar_x = config.getInt("Spout.XP.Bar.X_POS", 95);
|
||||
xpbar_y = config.getInt("Spout.XP.Bar.Y_POS", 6);
|
||||
xpicon_x = config.getInt("Spout.XP.Icon.X_POS", 78);
|
||||
xpicon_y = config.getInt("Spout.XP.Icon.Y_POS", 2);
|
||||
|
||||
showFaces = config.getBoolean("Spout.Party.HUD.Show_Faces", true);
|
||||
showDisplayName = config.getBoolean("Spout.Party.HUD.Show_Display_Name", false);
|
||||
partybar = config.getBoolean("Spout.Party.HUD.Enabled", true);
|
||||
|
||||
acrobatics_r = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
||||
acrobatics_g = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
|
||||
acrobatics_b = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
|
||||
archery_r = config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
|
||||
archery_g = config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
|
||||
archery_b = config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
|
||||
axes_r = config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
|
||||
axes_g = config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
|
||||
axes_b = config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
|
||||
excavation_r = config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
|
||||
excavation_g = config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
|
||||
excavation_b = config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
|
||||
herbalism_r = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
|
||||
herbalism_g = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
|
||||
herbalism_b = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
|
||||
mining_r = config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
|
||||
mining_g = config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
|
||||
mining_b = config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
|
||||
repair_r = config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
|
||||
repair_g = config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
|
||||
repair_b = config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
|
||||
swords_r = config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
|
||||
swords_g = config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
|
||||
swords_b = config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
|
||||
taming_r = config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
|
||||
taming_g = config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
|
||||
taming_b = config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
|
||||
unarmed_r = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
|
||||
unarmed_g = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
|
||||
unarmed_b = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
|
||||
woodcutting_r = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
|
||||
woodcutting_g = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
|
||||
woodcutting_b = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
|
||||
fishing_r = config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3);
|
||||
fishing_g = config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3);
|
||||
fishing_b = config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75);
|
||||
|
||||
xpborder_r = config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
|
||||
xpborder_g = config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
|
||||
xpborder_b = config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
|
||||
xpbackground_r = config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
|
||||
xpbackground_g = config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
|
||||
xpbackground_b = config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
|
||||
|
||||
mbase = config.getInt("Experience.Excavation.Base", 40);
|
||||
|
||||
msugar = config.getInt("Experience.Herbalism.Sugar_Cane", 30);
|
||||
mwheat = config.getInt("Experience.Herbalism.Wheat", 50);
|
||||
mcactus = config.getInt("Experience.Herbalism.Cactus", 30);
|
||||
mpumpkin = config.getInt("Experience.Herbalism.Pumpkin", 20);
|
||||
mflower = config.getInt("Experience.Herbalism.Flowers", 100);
|
||||
mmushroom = config.getInt("Experience.Herbalism.Mushrooms", 150);
|
||||
mmelon = config.getInt("Experience.Herbalism.Melon", 20);
|
||||
mnetherwart = config.getInt("Experience.Herbalism.Nether_Wart", 50);
|
||||
mlilypad = config.getInt("Experience.Herbalism.Lily_Pads", 100);
|
||||
mvines = config.getInt("Experience.Herbalism.Vines", 10);
|
||||
herbalismHungerBonus = config.getBoolean("Skills.Herbalism.Hunger_Bonus", true);
|
||||
wheatRegrowth = config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true);
|
||||
|
||||
moak = config.getInt("Experience.Woodcutting.Oak", 70);
|
||||
mbirch = config.getInt("Experience.Woodcutting.Birch", 90);
|
||||
mspruce = config.getInt("Experience.Woodcutting.Spruce", 80);
|
||||
mjungle = config.getInt("Experience.Woodcutting.Jungle", 100);
|
||||
|
||||
mgold = config.getInt("Experience.Mining.Gold", 250);
|
||||
mdiamond = config.getInt("Experience.Mining.Diamond", 750);
|
||||
miron = config.getInt("Experience.Mining.Iron", 250);
|
||||
mredstone = config.getInt("Experience.Mining.Redstone", 150);
|
||||
mlapis = config.getInt("Experience.Mining.Lapis", 400);
|
||||
mobsidian = config.getInt("Experience.Mining.Obsidian", 150);
|
||||
mnetherrack = config.getInt("Experience.Mining.Netherrack", 30);
|
||||
mglowstone = config.getInt("Experience.Mining.Glowstone", 30);
|
||||
mcoal = config.getInt("Experience.Mining.Coal", 100);
|
||||
mstone = config.getInt("Experience.Mining.Stone", 30);
|
||||
msandstone = config.getInt("Experience.Mining.Sandstone", 30);
|
||||
mendstone = config.getInt("Experience.Mining.End_Stone", 150);
|
||||
mmossstone = config.getInt("Experience.Mining.Moss_Stone", 30);
|
||||
|
||||
mtameWolf = config.getInt("Experience.Taming.Animal_Taming.Wolf", 250);
|
||||
mtameOcelot = config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500);
|
||||
|
||||
mfishing = config.getInt("Experience.Fishing.Base", 800);
|
||||
|
||||
enableOnlyActivateWhenSneaking = config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
|
||||
|
||||
greenTerraCooldown = config.getInt("Abilities.Cooldowns.Green_Terra", 240);
|
||||
superBreakerCooldown = config.getInt("Abilities.Cooldowns.Super_Breaker", 240);
|
||||
gigaDrillBreakerCooldown = config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240);
|
||||
treeFellerThreshold = config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500);
|
||||
treeFellerCooldown = config.getInt("Abilities.Cooldowns.Tree_Feller", 240);
|
||||
berserkCooldown = config.getInt("Abilities.Cooldowns.Berserk", 240);
|
||||
serratedStrikeCooldown = config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240);
|
||||
skullSplitterCooldown = config.getInt("Abilities.Cooldowns.Skull_Splitter", 240);
|
||||
blastMiningCooldown = config.getInt("Abilities.Cooldowns.Blast_Mining", 60);
|
||||
|
||||
MySQLserverName = config.getString("MySQL.Server.Address", "localhost");
|
||||
|
||||
if (config.getString("MySQL.Database.User_Password", null) != null) {
|
||||
MySQLdbPass = config.getString("MySQL.Database.User_Password", null);
|
||||
}
|
||||
else {
|
||||
MySQLdbPass = "";
|
||||
}
|
||||
|
||||
MySQLdbName = config.getString("MySQL.Database.Name", "DatabaseName");
|
||||
MySQLuserName = config.getString("MySQL.Database.User_Name", "UserName");
|
||||
MySQLtablePrefix = config.getString("MySQL.Database.TablePrefix", "mcmmo_");
|
||||
MySQLport = config.getInt("MySQL.Server.Port", 3306);
|
||||
useMySQL = config.getBoolean("MySQL.Enabled", false);
|
||||
|
||||
locale = config.getString("General.Locale", "en_us");
|
||||
enableMotd = config.getBoolean("General.MOTD_Enabled", true);
|
||||
saveInterval = config.getInt("General.Save_Interval", 10);
|
||||
statsTracking = config.getBoolean("General.Stats_Tracking", true);
|
||||
eventCallback = config.getBoolean("General.Event_Callback", true);
|
||||
perLevelTools = config.getBoolean("General.Per_Level_Tools", false);
|
||||
|
||||
enableCobbleToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
|
||||
enableSmoothToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
|
||||
enableDirtToGrass = config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
|
||||
|
||||
xpGainMultiplier = config.getInt("Experience.Gains.Multiplier.Global", 1);
|
||||
toolsLoseDurabilityFromAbilities = config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
|
||||
abilityDurabilityLoss = config.getInt("Abilities.Tools.Durability_Loss", 2);
|
||||
|
||||
feathersConsumedByChimaeraWing = config.getInt("Items.Chimaera_Wing.Feather_Cost", 10);
|
||||
chimaeraId = config.getInt("Items.Chimaera_Wing.Item_ID", 288);
|
||||
chimaeraWingEnable = config.getBoolean("Items.Chimaera_Wing.Enabled", true);
|
||||
dAxe = config.getInt("Items.Diamond.Axe", 750);
|
||||
dHoe = config.getInt("Items.Diamond.Hoe", 750);
|
||||
dShovel = config.getInt("Items.Diamond.Shovel", 750);
|
||||
dSword = config.getInt("Items.Diamond.Sword", 750);
|
||||
dPickaxe = config.getInt("Items.Diamond.Pickaxe", 750);
|
||||
gAxe = config.getInt("Items.Gold.Axe", 500);
|
||||
gHoe = config.getInt("Items.Gold.Hoe", 500);
|
||||
gShovel = config.getInt("Items.Gold.Shovel", 500);
|
||||
gSword = config.getInt("Items.Gold.Sword", 500);
|
||||
gPickaxe = config.getInt("Items.Gold.Pickaxe", 500);
|
||||
iAxe = config.getInt("Items.Iron.Axe", 250);
|
||||
iHoe = config.getInt("Items.Iron.Hoe", 250);
|
||||
iShovel = config.getInt("Items.Iron.Shovel", 250);
|
||||
iSword = config.getInt("Items.Iron.Sword", 250);
|
||||
iPickaxe = config.getInt("Items.Iron.Pickaxe", 250);
|
||||
sAxe = config.getInt("Items.Stone.Axe", 0);
|
||||
sHoe = config.getInt("Items.Stone.Hoe", 0);
|
||||
sShovel = config.getInt("Items.Stone.Shovel", 0);
|
||||
sSword = config.getInt("Items.Stone.Sword", 0);
|
||||
sPickaxe = config.getInt("Items.Stone.Pickaxe", 0);
|
||||
|
||||
pvpxp = config.getBoolean("Experience.PVP.Rewards", true);
|
||||
pvpxprewardmodifier = config.getDouble("Experience.Gains.Multiplier.PVP", 1.0);
|
||||
|
||||
miningrequirespickaxe = config.getBoolean("Skills.Mining.Requires_Pickaxe", true);
|
||||
excavationRequiresShovel = config.getBoolean("Skills.Excavation.Requires_Shovel", true);
|
||||
woodcuttingrequiresaxe = config.getBoolean("Skills.Woodcutting.Requires_Axe", true);
|
||||
repairArmor = config.getBoolean("Skills.Repair.Can_Repair_Armor", true);
|
||||
repairTools = config.getBoolean("Skills.Repair.Can_Repair_Tools", true);
|
||||
repairdiamondlevel = config.getInt("Skills.Repair.Diamond.Level_Required", 50);
|
||||
repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0);
|
||||
repairGoldLevel = config.getInt("Skills.Repair.Gold.Level_Required", 0);
|
||||
repairStoneLevel = config.getInt("Skills.Repair.Stone.Level_Required", 0);
|
||||
|
||||
tamingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Taming", 1.0);
|
||||
miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0);
|
||||
repairxpmodifier = config.getDouble("Experience.Formula.Multiplier.Repair", 1.0);
|
||||
woodcuttingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
|
||||
unarmedxpmodifier = config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
|
||||
herbalismxpmodifier = config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
|
||||
excavationxpmodifier = config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0);
|
||||
archeryxpmodifier = config.getDouble("Experience.Formula.Multiplier.Archery", 1.0);
|
||||
swordsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Swords", 1.0);
|
||||
axesxpmodifier = config.getDouble("Experience.Formula.Multiplier.Axes", 1.0);
|
||||
acrobaticsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
|
||||
fishingxpmodifier = config.getDouble("Experience.Forumla.Multiplier.Fishing", 1.0);
|
||||
|
||||
anvilmessages = config.getBoolean("Skills.Repair.Anvil_Messages", true);
|
||||
anvilID = config.getInt("Skills.Repair.Anvil_ID", 42);
|
||||
|
||||
rGold = config.getInt("Skills.Repair.Gold.ID", 266);
|
||||
rStone = config.getInt("Skills.Repair.Stone.ID", 4);
|
||||
rWood = config.getInt("Skills.Repair.Wood.ID", 5);
|
||||
rDiamond = config.getInt("Skills.Repair.Diamond.ID", 264);
|
||||
rIron = config.getInt("Skills.Repair.Iron.ID", 265);
|
||||
rString = config.getInt("Skills.Repair.String.ID", 287);
|
||||
rLeather = config.getInt("Skills.Repair.Leather.ID", 334);
|
||||
|
||||
levelCapAcrobatics = config.getInt("Skills.Acrobatics.Level_Cap", 0);
|
||||
levelCapArchery = config.getInt("Skills.Archery.Level_Cap", 0);
|
||||
levelCapAxes = config.getInt("Skills.Axes.Level_Cap", 0);
|
||||
levelCapExcavation = config.getInt("Skills.Excavation.Level_Cap", 0);
|
||||
levelCapFishing = config.getInt("Skills.Fishing.Level_Cap", 0);
|
||||
levelCapHerbalism = config.getInt("Skills.Herbalism.Level_Cap", 0);
|
||||
levelCapMining = config.getInt("Skills.Mining.Level_Cap", 0);
|
||||
levelCapRepair = config.getInt("Skills.Repair.Level_Cap", 0);
|
||||
levelCapSwords = config.getInt("Skills.Swords.Level_Cap", 0);
|
||||
levelCapTaming = config.getInt("Skills.Taming.Level_Cap", 0);
|
||||
levelCapUnarmed = config.getInt("Skills.Unarmed.Level_Cap", 0);
|
||||
levelCapWoodcutting = config.getInt("Skills.Woodcutting.Level_Cap", 0);
|
||||
|
||||
mayDowngradeEnchants = config.getBoolean("Arcane_Forging.Downgrades.Enabled", true);
|
||||
downgradeRank1 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
|
||||
downgradeRank2 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50);
|
||||
downgradeRank3 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25);
|
||||
downgradeRank4 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15);
|
||||
mayLoseEnchants = config.getBoolean("Arcane_Forging.May_Lose_Enchants", true);
|
||||
keepEnchantsRank1 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10);
|
||||
keepEnchantsRank2 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20);
|
||||
keepEnchantsRank3 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30);
|
||||
keepEnchantsRank4 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40);
|
||||
arcaneRank1 = config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100);
|
||||
arcaneRank2 = config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250);
|
||||
arcaneRank3 = config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500);
|
||||
arcaneRank4 = config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750);
|
||||
|
||||
fishingDrops = config.getBoolean("Fishing.Drops_Enabled", true);
|
||||
fishingTier1 = config.getInt("Fishing.Tier_Levels.Tier1", 0);
|
||||
fishingTier2 = config.getInt("Fishing.Tier_Levels.Tier2", 200);
|
||||
fishingTier3 = config.getInt("Fishing.Tier_Levels.Tier3", 400);
|
||||
fishingTier4 = config.getInt("Fishing.Tier_Levels.Tier4", 600);
|
||||
fishingTier5 = config.getInt("Fishing.Tier_Levels.Tier5", 800);
|
||||
|
||||
xplockEnable = config.getBoolean("Commands.xplock.Enabled", true);
|
||||
xprateEnable = config.getBoolean("Commands.xprate.Enabled", true);
|
||||
mctopEnable = config.getBoolean("Commands.mctop.Enabled", true);
|
||||
addxpEnable = config.getBoolean("Commands.addxp.Enabled", true);
|
||||
addlevelsEnable = config.getBoolean("Commands.addlevels.Enabled", true);
|
||||
mcabilityEnable = config.getBoolean("Commands.mcability.Enabled", true);
|
||||
mcrefreshEnable = config.getBoolean("Commands.mcrefresh.Enabled", true);
|
||||
mcmmoEnable = config.getBoolean("Commands.mcmmo.Enabled", true);
|
||||
mccEnable = config.getBoolean("Commands.mcc.Enabled", true);
|
||||
mcgodEnable = config.getBoolean("Commands.mcgod.Enabled", true);
|
||||
mcstatsEnable = config.getBoolean("Commands.mcstats.Enabled", true);
|
||||
mmoeditEnable = config.getBoolean("Commands.mmoedit.Enabled", true);
|
||||
mcremoveEnable = config.getBoolean("Commands.mcremove.Enable", true);
|
||||
ptpEnable = config.getBoolean("Commands.ptp.Enabled", true);
|
||||
partyEnable = config.getBoolean("Commands.party.Enabled", true);
|
||||
inspectEnable = config.getBoolean("Commands.inspect.Enabled", true);
|
||||
inviteEnable = config.getBoolean("Commands.invite.Enabled", true);
|
||||
acceptEnable = config.getBoolean("Commands.accept.Enabled", true);
|
||||
aEnable = config.getBoolean("Commands.a.Enabled", true);
|
||||
pEnable = config.getBoolean("Commands.p.Enabled", true);
|
||||
|
||||
aDisplayNames = config.getBoolean("Commands.a.Display_Names", true);
|
||||
pDisplayNames = config.getBoolean("Commands.p.Display_Names", true);
|
||||
|
||||
ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30);
|
||||
|
||||
animalXP = config.getDouble("Experience.Combat.Multiplier.Animals", 1.0);
|
||||
creeperXP = config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0);
|
||||
skeletonXP = config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0);
|
||||
spiderXP = config.getDouble("Experience.Combat.Multiplier.Spider", 3.0);
|
||||
ghastXP = config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0);
|
||||
slimeXP = config.getDouble("Experience.Combat.Multiplier.Slime", 2.0);
|
||||
zombieXP = config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0);
|
||||
pigzombieXP = config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0);
|
||||
endermanXP = config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0);
|
||||
cavespiderXP = config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0);
|
||||
silverfishXP = config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0);
|
||||
blazeXP = config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0);
|
||||
magmacubeXP = config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0);
|
||||
enderdragonXP = config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0);
|
||||
|
||||
detonatorID = config.getInt("Skills.Mining.Detonator_ID", 259);
|
||||
}
|
||||
}
|
||||
@@ -2,65 +2,57 @@ 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;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
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 LoadTreasures 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>();
|
||||
public List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
|
||||
|
||||
public static List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
|
||||
public static 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 LoadTreasures(mcMMO plugin) {
|
||||
super(plugin, "treasures.yml");
|
||||
config = plugin.getTreasuresConfig();
|
||||
public List<FishingTreasure> fishingRewards = new ArrayList<FishingTreasure>();
|
||||
|
||||
private TreasuresConfig() {
|
||||
super("treasures.yml");
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
// If it doesn't exist, copy it from the .jar
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveTreasuresConfig();
|
||||
public static TreasuresConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new TreasuresConfig();
|
||||
}
|
||||
|
||||
addDefaults();
|
||||
loadKeys();
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
plugin.getLogger().info("Loading mcMMO treasures.yml File...");
|
||||
|
||||
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>();
|
||||
@@ -86,7 +78,7 @@ public class LoadTreasures extends ConfigLoader{
|
||||
int data = config.getInt("Treasures." + treasureName + ".Data");
|
||||
|
||||
if (Material.getMaterial(id) == null) {
|
||||
reason.add("Invlid id: " + id);
|
||||
reason.add("Invalid id: " + id);
|
||||
}
|
||||
|
||||
if (amount < 1) {
|
||||
@@ -133,7 +125,7 @@ public class LoadTreasures 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) {
|
||||
@@ -146,10 +138,6 @@ public class LoadTreasures 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);
|
||||
@@ -157,6 +145,7 @@ public class LoadTreasures 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();
|
||||
@@ -186,53 +175,64 @@ public class LoadTreasures 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();
|
||||
List<String> hylianTreasures = config.getStringList("Hylian_Luck.Treasure");
|
||||
|
||||
while (treasureIterator.hasNext()) {
|
||||
String treasureKey = treasureIterator.next();
|
||||
Treasure treasure = treasures.get(treasureKey);
|
||||
for (Entry<String,Treasure> nextEntry : treasures.entrySet()) {
|
||||
String treasureKey = nextEntry.getKey();
|
||||
Treasure treasure = nextEntry.getValue();
|
||||
|
||||
if (treasure instanceof FishingTreasure) {
|
||||
if (!fishingTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FishingTreasure fTreasure = (FishingTreasure) treasure;
|
||||
int dropLevel = fTreasure.getDropLevel();
|
||||
int maxLevel = fTreasure.getMaxLevel();
|
||||
|
||||
if(dropLevel <= LoadProperties.fishingTier1 && maxLevel >= LoadProperties.fishingTier1) {
|
||||
fishingRewardsTier1.add(fTreasure);
|
||||
fishingRewards.add((FishingTreasure) treasure);
|
||||
}
|
||||
else if (treasure instanceof HylianTreasure) {
|
||||
if (!hylianTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(dropLevel <= LoadProperties.fishingTier2 && maxLevel >= LoadProperties.fishingTier2) {
|
||||
fishingRewardsTier2.add(fTreasure);
|
||||
HylianTreasure hTreasure = (HylianTreasure) treasure;
|
||||
|
||||
if (hTreasure.getDropsFromBushes()) {
|
||||
hylianFromBushes.add(hTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= LoadProperties.fishingTier3 && maxLevel >= LoadProperties.fishingTier3) {
|
||||
fishingRewardsTier3.add(fTreasure);
|
||||
if (hTreasure.getDropsFromFlowers()) {
|
||||
hylianFromFlowers.add(hTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= LoadProperties.fishingTier4 && maxLevel >= LoadProperties.fishingTier4) {
|
||||
fishingRewardsTier4.add(fTreasure);
|
||||
if (hTreasure.getDropsFromPots()) {
|
||||
hylianFromPots.add(hTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= LoadProperties.fishingTier5 && maxLevel >= LoadProperties.fishingTier5) {
|
||||
fishingRewardsTier5.add(fTreasure);
|
||||
}
|
||||
|
||||
}
|
||||
else if (treasure instanceof ExcavationTreasure) {
|
||||
if (!excavationTreasures.contains(treasureKey)) {
|
||||
@@ -276,11 +276,10 @@ public class LoadTreasures extends ConfigLoader{
|
||||
if (issues.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
for (String issue : issues) {
|
||||
Bukkit.getLogger().warning(issue);
|
||||
}
|
||||
return false;
|
||||
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
587
src/main/java/com/gmail/nossr50/database/Database.java
Normal file
587
src/main/java/com/gmail/nossr50/database/Database.java
Normal file
@@ -0,0 +1,587 @@
|
||||
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;");
|
||||
|
||||
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) {
|
||||
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;
|
||||
if (skillType != SkillType.ALL) {
|
||||
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 + "')";
|
||||
}
|
||||
else {
|
||||
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");
|
||||
if (skillType != SkillType.ALL) {
|
||||
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";
|
||||
}
|
||||
else {
|
||||
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(skillType.name(), 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) {
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("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;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
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.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class McpurgeCommand implements CommandExecutor{
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcremove")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
Database.purgePowerlessSQL();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
Database.purgeOldSQL();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//TODO: Make this work for Flatfile data.
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.gmail.nossr50.database.commands;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class McremoveCommand implements CommandExecutor {
|
||||
@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 = LocaleLoader.getString("Commands.Usage.1", new Object[] {"mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"});
|
||||
String success;
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcremove")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
playerName = args[0];
|
||||
success = LocaleLoader.getString("Commands.mcremove.Success", new Object[] {playerName});
|
||||
break;
|
||||
|
||||
default:
|
||||
sender.sendMessage(usage);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* MySQL */
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
int affected = 0;
|
||||
affected = Database.update("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.user = '" + playerName + "'");
|
||||
|
||||
if (affected > 0) {
|
||||
sender.sendMessage(success);
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (removeFlatFileUser(playerName)) {
|
||||
sender.sendMessage(success);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
}
|
||||
}
|
||||
|
||||
Database.profileCleanup(playerName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private 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 {
|
||||
System.out.println("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;
|
||||
}
|
||||
}
|
||||
@@ -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.commands.CommandHelper;
|
||||
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) {
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoupdate")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
|
||||
Users.clearAll();
|
||||
convertToMySQL();
|
||||
|
||||
for (Player x : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(x);
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Finish"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert FlatFile data to MySQL data.
|
||||
*/
|
||||
private void convertToMySQL() {
|
||||
if (!Config.getInstance().getUseMySQL()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().getScheduler().runTaskLaterAsynchronously(mcMMO.p, new SQLConversionTask(), 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
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.database.Database;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class SQLConversionTask implements Runnable {
|
||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String location = mcMMO.getUsersFilePath();
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
String playerName = null;
|
||||
String party = null;
|
||||
String mining = null;
|
||||
String woodcutting = null;
|
||||
String repair = null;
|
||||
String unarmed = null;
|
||||
String herbalism = null;
|
||||
String excavation = null;
|
||||
String archery = null;
|
||||
String swords = null;
|
||||
String axes = null;
|
||||
String acrobatics = null;
|
||||
String taming = null;
|
||||
String fishing = null;
|
||||
String miningXP = null;
|
||||
String woodCuttingXP = null;
|
||||
String repairXP = null;
|
||||
String unarmedXP = null;
|
||||
String herbalismXP = null;
|
||||
String excavationXP = null;
|
||||
String archeryXP = null;
|
||||
String swordsXP = null;
|
||||
String axesXP = null;
|
||||
String acrobaticsXP = null;
|
||||
String tamingXP = null;
|
||||
String fishingXP = null;
|
||||
int id = 0;
|
||||
int theCount = 0;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
//Find if the line contains the player we want.
|
||||
String[] character = line.split(":");
|
||||
playerName = character[0];
|
||||
|
||||
//Check for things we don't want put in the DB
|
||||
if (playerName == null || playerName.equals("null") || playerName.equals("#Storage place for user information")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (character.length > 1) {
|
||||
mining = character[1];
|
||||
}
|
||||
|
||||
if (character.length > 3) {
|
||||
party = character[3];
|
||||
}
|
||||
|
||||
if (character.length > 4) {
|
||||
miningXP = character[4];
|
||||
}
|
||||
|
||||
if (character.length > 5) {
|
||||
woodcutting = character[5];
|
||||
}
|
||||
|
||||
if (character.length > 6) {
|
||||
woodCuttingXP = character[6];
|
||||
}
|
||||
|
||||
if (character.length > 7) {
|
||||
repair = character[7];
|
||||
}
|
||||
|
||||
if (character.length > 8) {
|
||||
unarmed = character[8];
|
||||
}
|
||||
|
||||
if (character.length > 9) {
|
||||
herbalism = character[9];
|
||||
}
|
||||
|
||||
if (character.length > 10) {
|
||||
excavation = character[10];
|
||||
}
|
||||
|
||||
if (character.length > 11) {
|
||||
archery = character[11];
|
||||
}
|
||||
|
||||
if (character.length > 12) {
|
||||
swords = character[12];
|
||||
}
|
||||
|
||||
if (character.length > 13) {
|
||||
axes = character[13];
|
||||
}
|
||||
|
||||
if (character.length > 14) {
|
||||
acrobatics = character[14];
|
||||
}
|
||||
|
||||
if (character.length > 15) {
|
||||
repairXP = character[15];
|
||||
}
|
||||
|
||||
if (character.length > 16) {
|
||||
unarmedXP = character[16];
|
||||
}
|
||||
|
||||
if (character.length > 17) {
|
||||
herbalismXP = character[17];
|
||||
}
|
||||
|
||||
if (character.length > 18) {
|
||||
excavationXP = character[18];
|
||||
}
|
||||
|
||||
if (character.length > 19) {
|
||||
archeryXP = character[19];
|
||||
}
|
||||
|
||||
if (character.length > 20) {
|
||||
swordsXP = character[20];
|
||||
}
|
||||
|
||||
if (character.length > 21) {
|
||||
axesXP = character[21];
|
||||
}
|
||||
|
||||
if (character.length > 22) {
|
||||
acrobaticsXP = character[22];
|
||||
}
|
||||
|
||||
if (character.length > 24) {
|
||||
taming = character[24];
|
||||
}
|
||||
|
||||
if (character.length > 25) {
|
||||
tamingXP = character[25];
|
||||
}
|
||||
|
||||
if (character.length > 34) {
|
||||
fishing = character[34];
|
||||
}
|
||||
|
||||
if (character.length > 35) {
|
||||
fishingXP = character[35];
|
||||
}
|
||||
|
||||
//Check to see if the user is in the DB
|
||||
id = Database.getInt("SELECT id FROM "
|
||||
+ tablePrefix
|
||||
+ "users WHERE user = '" + playerName + "'");
|
||||
|
||||
if (id > 0) {
|
||||
theCount++;
|
||||
|
||||
//Update the skill values
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
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)
|
||||
+ " WHERE user_id = " + id);
|
||||
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)
|
||||
+ " WHERE user_id = " + id);
|
||||
}
|
||||
else {
|
||||
theCount++;
|
||||
|
||||
//Create the user in the DB
|
||||
Database.write("INSERT INTO "
|
||||
+ tablePrefix
|
||||
+ "users (user, lastlogin) VALUES ('"
|
||||
+ playerName + "',"
|
||||
+ 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 "
|
||||
+ tablePrefix
|
||||
+ "experience (user_id) VALUES (" + id
|
||||
+ ")");
|
||||
//Update the skill values
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET party = '" + party
|
||||
+ "' WHERE id = " + id);
|
||||
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)
|
||||
+ " WHERE user_id = " + id);
|
||||
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)
|
||||
+ " WHERE user_id = " + id);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[mcMMO] MySQL Updated from users file, " + theCount + " items added/updated to MySQL DB");
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
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,20 @@
|
||||
package com.gmail.nossr50.database.runnables;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
|
||||
public class UserPurgeTask implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
Database.purgePowerlessSQL();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
Database.purgeOldSQL();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//TODO: Make this work for Flatfile data.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Excavation;
|
||||
import com.gmail.nossr50.skills.Herbalism;
|
||||
import com.gmail.nossr50.skills.Mining;
|
||||
|
||||
public enum AbilityType {
|
||||
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"),
|
||||
SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"),
|
||||
GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"),
|
||||
GREEN_TERRA(LoadProperties.greenTerraCooldown, mcLocale.getString("Skills.GreenTerraOn"), mcLocale.getString("Skills.GreenTerraOff"), "Skills.GreenTerraPlayer", mcLocale.getString("Skills.YourGreenTerra"), mcLocale.getString("Skills.GreenTerraPlayerOff")),
|
||||
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
|
||||
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
|
||||
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
|
||||
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
|
||||
LEAF_BLOWER(0, null, null, null, null, null);
|
||||
|
||||
private int cooldown;
|
||||
private String abilityOn;
|
||||
private String abilityOff;
|
||||
private String abilityPlayer;
|
||||
private String abilityRefresh;
|
||||
private String abilityPlayerOff;
|
||||
|
||||
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.cooldown = cooldown;
|
||||
this.abilityOn = abilityOn;
|
||||
this.abilityOff = abilityOff;
|
||||
this.abilityPlayer = abilityPlayer;
|
||||
this.abilityRefresh = abilityRefresh;
|
||||
this.abilityPlayerOff = abilityPlayerOff;
|
||||
}
|
||||
|
||||
public int getCooldown() {
|
||||
return this.cooldown;
|
||||
}
|
||||
|
||||
public String getAbilityOn() {
|
||||
return this.abilityOn;
|
||||
}
|
||||
|
||||
public String getAbilityOff() {
|
||||
return this.abilityOff;
|
||||
}
|
||||
|
||||
public String getAbilityPlayer(Player player) {
|
||||
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
|
||||
}
|
||||
|
||||
public String getAbilityPlayerOff(Player player) {
|
||||
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
|
||||
}
|
||||
|
||||
public String getAbilityRefresh() {
|
||||
return this.abilityRefresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mode of this ability.
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @return true if the ability is enabled, false otherwise
|
||||
*/
|
||||
public boolean getMode(PlayerProfile PP) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return PP.getBerserkMode();
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return PP.getSuperBreakerMode();
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return PP.getGigaDrillBreakerMode();
|
||||
|
||||
case GREEN_TERRA:
|
||||
return PP.getGreenTerraMode();
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
return PP.getSkullSplitterMode();
|
||||
|
||||
case TREE_FELLER:
|
||||
return PP.getTreeFellerMode();
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return PP.getSerratedStrikesMode();
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mode of this ability.
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @param bool Mode to set the ability to
|
||||
*/
|
||||
public void setMode(PlayerProfile PP, boolean bool) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
PP.setBerserkMode(bool);
|
||||
break;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
PP.setSuperBreakerMode(bool);
|
||||
break;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
PP.setGigaDrillBreakerMode(bool);
|
||||
break;
|
||||
|
||||
case GREEN_TERRA:
|
||||
PP.setGreenTerraMode(bool);
|
||||
break;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
PP.setSkullSplitterMode(bool);
|
||||
break;
|
||||
|
||||
case TREE_FELLER:
|
||||
PP.setTreeFellerMode(bool);
|
||||
break;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
PP.setSerratedStrikesMode(bool);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the informed state of this ability
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @return true if the ability is informed, false otherwise
|
||||
*/
|
||||
public boolean getInformed(PlayerProfile PP) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return PP.getBerserkInformed();
|
||||
|
||||
case BLAST_MINING:
|
||||
return PP.getBlastMiningInformed();
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return PP.getSuperBreakerInformed();
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return PP.getGigaDrillBreakerInformed();
|
||||
|
||||
case GREEN_TERRA:
|
||||
return PP.getGreenTerraInformed();
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
return PP.getSkullSplitterInformed();
|
||||
|
||||
case TREE_FELLER:
|
||||
return PP.getTreeFellerInformed();
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return PP.getSerratedStrikesInformed();
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the informed state of this ability.
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @param bool Informed state to set the ability to
|
||||
*/
|
||||
public void setInformed(PlayerProfile PP, boolean bool) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
PP.setBerserkInformed(bool);
|
||||
break;
|
||||
|
||||
case BLAST_MINING:
|
||||
PP.setBlastMiningInformed(bool);
|
||||
break;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
PP.setSuperBreakerInformed(bool);
|
||||
break;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
PP.setGigaDrillBreakerInformed(bool);
|
||||
break;
|
||||
|
||||
case GREEN_TERRA:
|
||||
PP.setGreenTerraInformed(bool);
|
||||
break;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
PP.setSkullSplitterInformed(bool);
|
||||
break;
|
||||
|
||||
case TREE_FELLER:
|
||||
PP.setTreeFellerInformed(bool);
|
||||
break;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
PP.setSerratedStrikesInformed(bool);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the permissions for this ability.
|
||||
*
|
||||
* @param player Player to check permissions for
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return mcPermissions.getInstance().berserk(player);
|
||||
|
||||
case BLAST_MINING:
|
||||
return mcPermissions.getInstance().blastMining(player);
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return mcPermissions.getInstance().gigaDrillBreaker(player);
|
||||
|
||||
case GREEN_TERRA:
|
||||
return mcPermissions.getInstance().greenTerra(player);
|
||||
|
||||
case LEAF_BLOWER:
|
||||
return mcPermissions.getInstance().leafBlower(player);
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return mcPermissions.getInstance().serratedStrikes(player);
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
return mcPermissions.getInstance().skullSplitter(player);
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return mcPermissions.getInstance().superBreaker(player);
|
||||
|
||||
case TREE_FELLER:
|
||||
return mcPermissions.getInstance().treeFeller(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block is affected by this ability.
|
||||
*
|
||||
* @param material The block type to check
|
||||
* @return true if the block is affected by this ability, false otherwise
|
||||
*/
|
||||
public boolean blockCheck(Material material) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return Excavation.canBeGigaDrillBroken(material);
|
||||
|
||||
case GREEN_TERRA:
|
||||
return Herbalism.makeMossy(material);
|
||||
|
||||
case LEAF_BLOWER:
|
||||
return material.equals(Material.LEAVES);
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return Mining.canBeSuperBroken(material);
|
||||
|
||||
case TREE_FELLER:
|
||||
return material.equals(Material.LOG);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public enum DatabaseUpdate {
|
||||
FISHING,
|
||||
BLAST_MINING;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public enum HUDType {
|
||||
DISABLED,
|
||||
STANDARD,
|
||||
SMALL,
|
||||
RETRO;
|
||||
}
|
||||
@@ -1,337 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.gui.Color;
|
||||
import org.getspout.spoutapi.gui.GenericGradient;
|
||||
import org.getspout.spoutapi.gui.GenericTexture;
|
||||
import org.getspout.spoutapi.gui.RenderPriority;
|
||||
import org.getspout.spoutapi.gui.Widget;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class HUDmmo
|
||||
{
|
||||
int center_x = 427/2;
|
||||
int center_y = 240/2;
|
||||
|
||||
String playerName = null;
|
||||
Widget xpbar = null;
|
||||
GenericGradient xpfill = null;
|
||||
GenericGradient xpbg = null;
|
||||
GenericGradient xpicon_bg = null;
|
||||
GenericGradient xpicon_border = null;
|
||||
GenericTexture xpicon = null;
|
||||
mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
|
||||
|
||||
public HUDmmo(Player player)
|
||||
{
|
||||
playerName = player.getName();
|
||||
initializeHUD(player);
|
||||
}
|
||||
|
||||
public void initializeHUD(Player player)
|
||||
{
|
||||
//PlayerProfile PP = Users.getProfile(player);
|
||||
HUDType type = Users.getProfile(player).getHUDType();
|
||||
|
||||
//if(LoadProperties.partybar && PP.getPartyHUD())
|
||||
//mmoHelper.initialize(SpoutManager.getPlayer(player), plugin); //PARTY HUD
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case RETRO:
|
||||
{
|
||||
initializeXpBarDisplayRetro(SpoutManager.getPlayer(player));
|
||||
break;
|
||||
}
|
||||
case STANDARD:
|
||||
{
|
||||
initializeXpBarDisplayStandard(SpoutManager.getPlayer(player));
|
||||
break;
|
||||
}
|
||||
case SMALL:
|
||||
{
|
||||
initializeXpBarDisplaySmall(SpoutManager.getPlayer(player));
|
||||
break;
|
||||
}
|
||||
case DISABLED:
|
||||
{
|
||||
//Do nothing.. :)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateXpBarDisplay(HUDType type, Player player)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case RETRO:
|
||||
{
|
||||
updateXpBarRetro(player, Users.getProfile(player));
|
||||
break;
|
||||
}
|
||||
case STANDARD:
|
||||
{
|
||||
updateXpBarStandard(player, Users.getProfile(player));
|
||||
break;
|
||||
}
|
||||
case SMALL:
|
||||
{
|
||||
updateXpBarStandard(player, Users.getProfile(player));
|
||||
break;
|
||||
}
|
||||
case DISABLED:
|
||||
{
|
||||
//Do nothing.. :)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void resetHUD()
|
||||
{
|
||||
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
|
||||
//PlayerProfile PP = Users.getProfile(sPlayer);
|
||||
if(sPlayer != null)
|
||||
{
|
||||
sPlayer.getMainScreen().removeWidgets(plugin);
|
||||
|
||||
//Reset the objects
|
||||
xpbar = null;
|
||||
xpfill = null;
|
||||
xpbg = null;
|
||||
xpicon = null;
|
||||
|
||||
//if(LoadProperties.partybar && PP.getPartyHUD())
|
||||
//mmoHelper.initialize(sPlayer, plugin);
|
||||
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer)
|
||||
{
|
||||
Color border = new Color((float)LoadProperties.xpborder_r, (float)LoadProperties.xpborder_g, (float)LoadProperties.xpborder_b, 1f);
|
||||
Color green = new Color(0, 1f, 0, 1f);
|
||||
Color background = new Color((float)LoadProperties.xpbackground_r, (float)LoadProperties.xpbackground_g, (float)LoadProperties.xpbackground_b, 1f);
|
||||
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
|
||||
|
||||
xpicon = new GenericTexture();
|
||||
xpbar = new GenericGradient();
|
||||
xpfill = new GenericGradient();
|
||||
xpbg = new GenericGradient();
|
||||
|
||||
xpicon_bg = new GenericGradient();
|
||||
xpicon_border = new GenericGradient();
|
||||
|
||||
xpicon_bg.setBottomColor(darkbg).setTopColor(darkbg).setWidth(4).setHeight(4).setPriority(RenderPriority.High).setX(142).setY(10).setDirty(true);
|
||||
xpicon_border.setBottomColor(border).setTopColor(border).setWidth(6).setHeight(6).setPriority(RenderPriority.Highest).setX(141).setY(9).setDirty(true);
|
||||
|
||||
xpicon.setWidth(6).setHeight(6).setX(141).setY(9).setPriority(RenderPriority.Normal).setDirty(true);
|
||||
xpicon.setUrl("Icon_r.png");
|
||||
|
||||
xpbar.setWidth(128).setHeight(4).setX(149).setY(10);
|
||||
((GenericGradient) xpbar).setBottomColor(border).setTopColor(border).setPriority(RenderPriority.Highest).setDirty(true);
|
||||
|
||||
xpfill.setWidth(0).setHeight(2).setX(150).setY(11);
|
||||
xpfill.setBottomColor(green).setTopColor(green).setPriority(RenderPriority.Lowest).setDirty(true);
|
||||
|
||||
xpbg.setWidth(126).setHeight(2).setX(150).setY(11);
|
||||
xpbg.setBottomColor(background).setTopColor(background).setPriority(RenderPriority.Low).setDirty(true);
|
||||
|
||||
if(LoadProperties.xpbar)
|
||||
{
|
||||
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbar);
|
||||
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpfill);
|
||||
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbg);
|
||||
if(LoadProperties.xpicon)
|
||||
{
|
||||
sPlayer.getMainScreen().attachWidget(plugin, (GenericTexture)xpicon);
|
||||
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_bg);
|
||||
}
|
||||
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_border);
|
||||
}
|
||||
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
|
||||
private void initializeXpBarDisplayStandard(SpoutPlayer sPlayer)
|
||||
{
|
||||
//Setup xp bar
|
||||
xpbar = new GenericTexture();
|
||||
|
||||
if(LoadProperties.xpbar && LoadProperties.xpicon)
|
||||
{
|
||||
xpicon = new GenericTexture();
|
||||
|
||||
xpicon.setUrl("Icon.png");
|
||||
|
||||
xpicon.setHeight(16).setWidth(32).setX(LoadProperties.xpicon_x).setY(LoadProperties.xpicon_y);
|
||||
|
||||
xpicon.setDirty(true);
|
||||
|
||||
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
|
||||
}
|
||||
|
||||
if(LoadProperties.xpbar)
|
||||
{
|
||||
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
|
||||
xpbar.setX(LoadProperties.xpbar_x).setY(LoadProperties.xpbar_y).setHeight(8).setWidth(256);
|
||||
|
||||
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
|
||||
}
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
|
||||
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer)
|
||||
{
|
||||
//Setup xp bar
|
||||
xpbar = new GenericTexture();
|
||||
|
||||
if(LoadProperties.xpbar && LoadProperties.xpicon)
|
||||
{
|
||||
xpicon = new GenericTexture();
|
||||
|
||||
xpicon.setUrl("Icon.png");
|
||||
|
||||
xpicon.setHeight(8).setWidth(16).setX(center_x-(8+64)).setY(LoadProperties.xpicon_y+2);
|
||||
|
||||
xpicon.setDirty(true);
|
||||
|
||||
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
|
||||
}
|
||||
|
||||
if(LoadProperties.xpbar)
|
||||
{
|
||||
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
|
||||
xpbar.setX(center_x-64).setY(LoadProperties.xpbar_y).setHeight(4).setWidth(128);
|
||||
|
||||
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
|
||||
}
|
||||
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
|
||||
private void updateXpBarStandard(Player player, PlayerProfile PP)
|
||||
{
|
||||
if(!LoadProperties.xpbar)
|
||||
return;
|
||||
|
||||
SkillType theType = null;
|
||||
|
||||
if(PP.getXpBarLocked())
|
||||
theType=PP.getSkillLock();
|
||||
else
|
||||
theType=PP.getLastGained();
|
||||
|
||||
if(theType == null)
|
||||
return;
|
||||
|
||||
((GenericTexture) xpicon).setUrl(m.getCapitalized(theType.toString())+".png");
|
||||
xpicon.setDirty(true);
|
||||
|
||||
((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
|
||||
xpbar.setDirty(true);
|
||||
|
||||
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
|
||||
}
|
||||
|
||||
private void updateXpBarRetro(Player player, PlayerProfile PP)
|
||||
{
|
||||
if(!LoadProperties.xpbar)
|
||||
return;
|
||||
SkillType theType = null;
|
||||
|
||||
if(PP.getXpBarLocked() && PP.getSkillLock() != null)
|
||||
theType=PP.getSkillLock();
|
||||
else
|
||||
theType=PP.getLastGained();
|
||||
|
||||
if(theType == null)
|
||||
return;
|
||||
|
||||
Color color = getRetroColor(theType);
|
||||
|
||||
if(xpicon != null && theType != null)
|
||||
xpicon.setUrl(m.getCapitalized(theType.toString())+"_r.png");
|
||||
|
||||
if(theType != null)
|
||||
xpfill.setBottomColor(color).setTopColor(color).setWidth(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true);
|
||||
else
|
||||
System.out.println("theType was null!");
|
||||
|
||||
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
|
||||
}
|
||||
|
||||
private static Color getRetroColor(SkillType type) {
|
||||
switch (type) {
|
||||
case ACROBATICS:
|
||||
return new Color((float) LoadProperties.acrobatics_r, (float) LoadProperties.acrobatics_g, (float) LoadProperties.acrobatics_b, 1f);
|
||||
case ARCHERY:
|
||||
return new Color((float) LoadProperties.archery_r, (float)LoadProperties.archery_g, (float)LoadProperties.archery_b, 1f);
|
||||
case AXES:
|
||||
return new Color((float) LoadProperties.axes_r, (float)LoadProperties.axes_g, (float)LoadProperties.axes_b, 1f);
|
||||
case EXCAVATION:
|
||||
return new Color((float)LoadProperties.excavation_r, (float)LoadProperties.excavation_g, (float)LoadProperties.excavation_b, 1f);
|
||||
case HERBALISM:
|
||||
return new Color((float)LoadProperties.herbalism_r, (float)LoadProperties.herbalism_g, (float)LoadProperties.herbalism_b, 1f);
|
||||
case MINING:
|
||||
return new Color((float)LoadProperties.mining_r, (float)LoadProperties.mining_g, (float)LoadProperties.mining_b, 1f);
|
||||
case REPAIR:
|
||||
return new Color((float)LoadProperties.repair_r, (float)LoadProperties.repair_g, (float)LoadProperties.repair_b, 1f);
|
||||
case SWORDS:
|
||||
return new Color((float)LoadProperties.swords_r, (float)LoadProperties.swords_g, (float)LoadProperties.swords_b, 1f);
|
||||
case TAMING:
|
||||
return new Color((float)LoadProperties.taming_r, (float)LoadProperties.taming_g, (float)LoadProperties.taming_b, 1f);
|
||||
case UNARMED:
|
||||
return new Color((float)LoadProperties.unarmed_r, (float)LoadProperties.unarmed_g, (float)LoadProperties.unarmed_b, 1f);
|
||||
case WOODCUTTING:
|
||||
return new Color((float)LoadProperties.woodcutting_r, (float)LoadProperties.woodcutting_g, (float)LoadProperties.woodcutting_b, 1f);
|
||||
case FISHING:
|
||||
return new Color((float)LoadProperties.fishing_r, (float)LoadProperties.fishing_g, (float)LoadProperties.fishing_b, 1f);
|
||||
default:
|
||||
return new Color(0.3f, 0.3f, 0.75f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getUrlBar(Integer number) {
|
||||
char[] num = number.toString().toCharArray();
|
||||
|
||||
switch (num.length) {
|
||||
case 1:
|
||||
return "xpbar_inc00"+number+".png";
|
||||
|
||||
case 2:
|
||||
return "xpbar_inc0"+number+".png";
|
||||
|
||||
default:
|
||||
return "xpbar_inc"+number+".png";
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer getXpInc(int skillxp, int xptolevel, HUDType hud) {
|
||||
double percentage = (double) skillxp / xptolevel;
|
||||
double inc;
|
||||
|
||||
switch (hud) {
|
||||
case RETRO:
|
||||
inc = 0.0079365079365079;
|
||||
break;
|
||||
|
||||
case STANDARD:
|
||||
inc = 0.0039370078740157;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (int) (percentage / inc);
|
||||
}
|
||||
}
|
||||
212
src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java
Normal file
212
src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java
Normal file
@@ -0,0 +1,212 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
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.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.Permissions;
|
||||
|
||||
public class McMMOPlayer {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
private Party party;
|
||||
private Party invite;
|
||||
|
||||
public McMMOPlayer (Player player) {
|
||||
String playerName = player.getName();
|
||||
this.player = player;
|
||||
this.profile = new PlayerProfile(playerName, true);
|
||||
this.party = PartyManager.getPlayerParty(playerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the power level of this player.
|
||||
*
|
||||
* @return the power level of the player
|
||||
*/
|
||||
public int getPowerLevel() {
|
||||
int powerLevel = 0;
|
||||
|
||||
for (SkillType type : SkillType.values()) {
|
||||
if (type.isChildSkill()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type.getPermissions(player)) {
|
||||
powerLevel += profile.getSkillLevel(type);
|
||||
}
|
||||
}
|
||||
|
||||
return powerLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Xp to the player, doesn't calculate for Xp Rate
|
||||
*
|
||||
* @param skillType The skill to add Xp to
|
||||
* @param xp 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) || type.isChildSkill()) {
|
||||
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 xp The amount of Xp to add
|
||||
*/
|
||||
public void addXpOverrideBonus(SkillType skillType, int xp) {
|
||||
int modifiedXp = (int) Math.floor(xp * Config.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
addXpOverride(skillType, modifiedXp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds experience to the player, this is affected by skill modifiers, rate and permissions
|
||||
*
|
||||
* @param skillType The skill to add Xp to
|
||||
* @param xp The amount of Xp to add
|
||||
*/
|
||||
public void addXp(SkillType skillType, int xp) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (party != null && !ShareHandler.isRunning()) {
|
||||
// Return if the Xp has been shared
|
||||
if (ShareHandler.handleEqualXpShare(xp, this, skillType)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Misc.getPowerLevelCap() < getPowerLevel() + 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 = (int) (xp * tool.getXpMultiplier());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: find a better way to do this, if possible
|
||||
if (Permissions.xpQuadruple(player)) {
|
||||
xp *= 4;
|
||||
}
|
||||
else if (Permissions.xpTriple(player)) {
|
||||
xp *= 3;
|
||||
}
|
||||
else if (Permissions.xpDoubleAndOneHalf(player)) {
|
||||
xp *= 2.5;
|
||||
}
|
||||
else if (Permissions.xpDouble(player)) {
|
||||
xp *= 2;
|
||||
}
|
||||
else if (Permissions.xpOneAndOneHalf(player)) {
|
||||
xp *= 1.5;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
SkillTools.xpCheckSkill(skillType, player, profile);
|
||||
}
|
||||
|
||||
// Players & Profiles
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public PlayerProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
// Party Stuff
|
||||
|
||||
public void setInvite(Party invite) {
|
||||
this.invite = invite;
|
||||
}
|
||||
|
||||
public Party getInvite() {
|
||||
return invite;
|
||||
}
|
||||
|
||||
public boolean hasPartyInvite() {
|
||||
if (invite != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setParty(Party party) {
|
||||
this.party = party;
|
||||
}
|
||||
|
||||
public Party getParty() {
|
||||
return party;
|
||||
}
|
||||
|
||||
public boolean inParty() {
|
||||
if (party != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeParty() {
|
||||
party = null;
|
||||
}
|
||||
|
||||
public void removeInvite() {
|
||||
invite = null;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,4 +3,9 @@ package com.gmail.nossr50.datatypes;
|
||||
public class PlayerStat {
|
||||
public String name;
|
||||
public int statVal = 0;
|
||||
|
||||
public PlayerStat(String name, int value) {
|
||||
this.name = name;
|
||||
this.statVal = value;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
|
||||
public enum SkillType
|
||||
{
|
||||
ACROBATICS(LoadProperties.levelCapAcrobatics),
|
||||
ALL, //This one is just for convenience
|
||||
ARCHERY(LoadProperties.levelCapArchery),
|
||||
AXES(AbilityType.SKULL_SPLIITER, LoadProperties.levelCapAxes, ToolType.AXE),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, LoadProperties.levelCapExcavation, ToolType.SHOVEL),
|
||||
FISHING(LoadProperties.levelCapFishing),
|
||||
HERBALISM(AbilityType.GREEN_TERRA, LoadProperties.levelCapHerbalism, ToolType.HOE),
|
||||
MINING(AbilityType.SUPER_BREAKER, LoadProperties.levelCapMining, ToolType.PICKAXE),
|
||||
REPAIR(LoadProperties.levelCapRepair),
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, LoadProperties.levelCapSwords, ToolType.SWORD),
|
||||
TAMING(LoadProperties.levelCapTaming),
|
||||
UNARMED(AbilityType.BERSERK, LoadProperties.levelCapUnarmed, ToolType.FISTS),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, LoadProperties.levelCapWoodcutting, ToolType.AXE);
|
||||
|
||||
private AbilityType ability;
|
||||
private int maxLevel;
|
||||
private ToolType tool;
|
||||
|
||||
private SkillType()
|
||||
{
|
||||
this.ability = null;
|
||||
this.maxLevel = 0;
|
||||
this.tool = null;
|
||||
}
|
||||
|
||||
private SkillType(AbilityType ability, int maxLevel, ToolType tool)
|
||||
{
|
||||
this.ability = ability;
|
||||
this.maxLevel = maxLevel;
|
||||
this.tool = tool;
|
||||
}
|
||||
|
||||
private SkillType(int maxLevel)
|
||||
{
|
||||
this(null, maxLevel, null);
|
||||
}
|
||||
|
||||
public AbilityType getAbility()
|
||||
{
|
||||
return this.ability;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
if(maxLevel > 0)
|
||||
return maxLevel;
|
||||
else
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public ToolType getTool()
|
||||
{
|
||||
return this.tool;
|
||||
}
|
||||
|
||||
public boolean getPermissions(Player player)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case ACROBATICS:
|
||||
return mcPermissions.getInstance().acrobatics(player);
|
||||
case ARCHERY:
|
||||
return mcPermissions.getInstance().archery(player);
|
||||
case AXES:
|
||||
return mcPermissions.getInstance().axes(player);
|
||||
case EXCAVATION:
|
||||
return mcPermissions.getInstance().excavation(player);
|
||||
case FISHING:
|
||||
return mcPermissions.getInstance().fishing(player);
|
||||
case HERBALISM:
|
||||
return mcPermissions.getInstance().herbalism(player);
|
||||
case MINING:
|
||||
return mcPermissions.getInstance().mining(player);
|
||||
case REPAIR:
|
||||
return mcPermissions.getInstance().repair(player);
|
||||
case SWORDS:
|
||||
return mcPermissions.getInstance().swords(player);
|
||||
case TAMING:
|
||||
return mcPermissions.getInstance().taming(player);
|
||||
case UNARMED:
|
||||
return mcPermissions.getInstance().unarmed(player);
|
||||
case WOODCUTTING:
|
||||
return mcPermissions.getInstance().woodcutting(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public enum ToolType
|
||||
{
|
||||
AXE(mcLocale.getString("Skills.LowerAxe"), mcLocale.getString("Skills.ReadyAxe")),
|
||||
FISTS(mcLocale.getString("Skills.LowerFists"), mcLocale.getString("Skills.ReadyFists")),
|
||||
HOE(mcLocale.getString("Skills.LowerHoe"), mcLocale.getString("Skills.ReadyHoe")),
|
||||
PICKAXE(mcLocale.getString("Skills.LowerPickAxe"), mcLocale.getString("Skills.ReadyPickAxe")),
|
||||
SHOVEL(mcLocale.getString("Skills.LowerShovel"), mcLocale.getString("Skills.ReadyShovel")),
|
||||
SWORD(mcLocale.getString("Skills.LowerSword"), mcLocale.getString("Skills.ReadySword"));
|
||||
|
||||
private String lowerTool;
|
||||
private String raiseTool;
|
||||
|
||||
private ToolType(String lowerTool, String raiseTool)
|
||||
{
|
||||
this.lowerTool = lowerTool;
|
||||
this.raiseTool = raiseTool;
|
||||
}
|
||||
|
||||
public String getLowerTool()
|
||||
{
|
||||
return this.lowerTool;
|
||||
}
|
||||
|
||||
public String getRaiseTool()
|
||||
{
|
||||
return this.raiseTool;
|
||||
}
|
||||
|
||||
public boolean getToolMode(PlayerProfile PP)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case AXE:
|
||||
return PP.getAxePreparationMode();
|
||||
case FISTS:
|
||||
return PP.getFistsPreparationMode();
|
||||
case HOE:
|
||||
return PP.getHoePreparationMode();
|
||||
case PICKAXE:
|
||||
return PP.getPickaxePreparationMode();
|
||||
case SHOVEL:
|
||||
return PP.getShovelPreparationMode();
|
||||
case SWORD:
|
||||
return PP.getSwordsPreparationMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setToolMode(PlayerProfile PP, boolean bool)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case AXE:
|
||||
PP.setAxePreparationMode(bool);
|
||||
break;
|
||||
case FISTS:
|
||||
PP.setFistsPreparationMode(bool);
|
||||
break;
|
||||
case HOE:
|
||||
PP.setHoePreparationMode(bool);
|
||||
break;
|
||||
case PICKAXE:
|
||||
PP.setPickaxePreparationMode(bool);
|
||||
break;
|
||||
case SHOVEL:
|
||||
PP.setShovelPreparationMode(bool);
|
||||
break;
|
||||
case SWORD:
|
||||
PP.setSwordsPreparationMode(bool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public long getToolATS(PlayerProfile PP)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case AXE:
|
||||
return PP.getAxePreparationATS();
|
||||
case FISTS:
|
||||
return PP.getFistsPreparationATS();
|
||||
case HOE:
|
||||
return PP.getHoePreparationATS();
|
||||
case PICKAXE:
|
||||
return PP.getPickaxePreparationATS();
|
||||
case SHOVEL:
|
||||
return PP.getShovelPreparationATS();
|
||||
case SWORD:
|
||||
return PP.getSwordsPreparationATS();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setToolATS(PlayerProfile PP, long ats)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case AXE:
|
||||
PP.setAxePreparationATS(ats);
|
||||
break;
|
||||
case FISTS:
|
||||
PP.setFistsPreparationATS(ats);
|
||||
break;
|
||||
case HOE:
|
||||
PP.setHoePreparationATS(ats);
|
||||
break;
|
||||
case PICKAXE:
|
||||
PP.setPickaxePreparationATS(ats);
|
||||
break;
|
||||
case SHOVEL:
|
||||
PP.setShovelPreparationATS(ats);
|
||||
break;
|
||||
case SWORD:
|
||||
PP.setSwordsPreparationATS(ats);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inHand(ItemStack is)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case AXE:
|
||||
return ItemChecks.isAxe(is);
|
||||
case FISTS:
|
||||
return is.getType().equals(Material.AIR);
|
||||
case HOE:
|
||||
return ItemChecks.isHoe(is);
|
||||
case PICKAXE:
|
||||
return ItemChecks.isMiningPick(is);
|
||||
case SHOVEL:
|
||||
return ItemChecks.isShovel(is);
|
||||
case SWORD:
|
||||
return ItemChecks.isSword(is);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
|
||||
public class Tree {
|
||||
|
||||
private TreeNode root = null;
|
||||
|
||||
public Tree(){}
|
||||
|
||||
/**
|
||||
* 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,49 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
|
||||
public class TreeNode
|
||||
{
|
||||
TreeNode left = null
|
||||
, 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;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
public class ButtonEscape extends GenericButton
|
||||
{
|
||||
public ButtonEscape()
|
||||
{
|
||||
this.setText("EXIT");
|
||||
this.setWidth(60).setHeight(20);
|
||||
this.setDirty(true);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class ButtonHUDStyle extends GenericButton
|
||||
{
|
||||
public ButtonHUDStyle(PlayerProfile PP)
|
||||
{
|
||||
this.setText("HUD Type: "+PP.getHUDType().toString());
|
||||
this.setTooltip("Change your HUD style!");
|
||||
this.setWidth(120).setHeight(20);
|
||||
this.setDirty(true);
|
||||
}
|
||||
public void updateText(PlayerProfile PP)
|
||||
{
|
||||
this.setText("HUD Type: "+PP.getHUDType().toString());
|
||||
this.setDirty(true);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class ButtonPartyToggle extends GenericButton
|
||||
{
|
||||
public ButtonPartyToggle(PlayerProfile PP)
|
||||
{
|
||||
this.setText("Party HUD: "+PP.getPartyHUD());
|
||||
this.setTooltip("Toggle the Party HUD!");
|
||||
this.setWidth(120).setHeight(20);
|
||||
this.setDirty(true);
|
||||
}
|
||||
public void updateText(PlayerProfile PP)
|
||||
{
|
||||
this.setText("Party HUD: "+PP.getPartyHUD());
|
||||
this.setDirty(true);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes.popups;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.gui.GenericLabel;
|
||||
import org.getspout.spoutapi.gui.GenericPopup;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
|
||||
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
||||
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
|
||||
|
||||
public class PopupMMO extends GenericPopup
|
||||
{
|
||||
ButtonHUDStyle HUDButton = null;
|
||||
ButtonPartyToggle PartyButton = null;
|
||||
ButtonEscape EscapeButton = null;
|
||||
GenericLabel mcMMO_label = new GenericLabel();
|
||||
GenericLabel tip_escape = new GenericLabel();
|
||||
int center_x = 427/2;
|
||||
int center_y = 240/2;
|
||||
|
||||
public PopupMMO(Player player, PlayerProfile PP, mcMMO plugin)
|
||||
{
|
||||
//240, 427 are the bottom right
|
||||
mcMMO_label.setText(ChatColor.GOLD+"~mcMMO Menu~");
|
||||
mcMMO_label.setX(center_x-35).setY((center_y/2)-20).setDirty(true);
|
||||
|
||||
tip_escape.setText(ChatColor.GRAY+"Press ESCAPE to exit!");
|
||||
tip_escape.setX(mcMMO_label.getX()-15).setY(mcMMO_label.getY()+10).setDirty(true);
|
||||
|
||||
HUDButton = new ButtonHUDStyle(PP);
|
||||
HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true);
|
||||
|
||||
if(LoadProperties.partybar)
|
||||
{
|
||||
PartyButton = new ButtonPartyToggle(PP);
|
||||
PartyButton.setX(center_x-(PartyButton.getWidth()/2)).setY(center_y/2+PartyButton.getHeight()).setDirty(true);
|
||||
this.attachWidget(plugin, PartyButton);
|
||||
}
|
||||
|
||||
EscapeButton = new ButtonEscape();
|
||||
EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+(HUDButton.getHeight()*2)+5).setDirty(true);
|
||||
|
||||
this.attachWidget(plugin, HUDButton);
|
||||
this.attachWidget(plugin, mcMMO_label);
|
||||
this.attachWidget(plugin, tip_escape);
|
||||
this.attachWidget(plugin, EscapeButton);
|
||||
|
||||
this.setDirty(true);
|
||||
}
|
||||
|
||||
public void updateButtons(PlayerProfile PP)
|
||||
{
|
||||
HUDButton.updateText(PP);
|
||||
this.setDirty(true);
|
||||
}
|
||||
}
|
||||
@@ -3,125 +3,125 @@ 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
|
||||
// 00000100 - sand 4
|
||||
// 00001000 - gravel 8
|
||||
// 00010000 - clay 16
|
||||
// 00100000 - mycel 32
|
||||
// 01000000 - soulsand 64
|
||||
private byte dropsFrom = 0x0;
|
||||
// dirt | grass | sand | gravel | clay | mycel | soulsand
|
||||
// 00000001 - dirt 1
|
||||
// 00000010 - grass 2
|
||||
// 00000100 - sand 4
|
||||
// 00001000 - gravel 8
|
||||
// 00010000 - clay 16
|
||||
// 00100000 - mycel 32
|
||||
// 01000000 - soulsand 64
|
||||
private byte dropsFrom = 0x0;
|
||||
|
||||
public ExcavationTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
|
||||
super(drop, xp, dropChance, dropLevel);
|
||||
}
|
||||
public ExcavationTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
|
||||
super(drop, xp, dropChance, dropLevel);
|
||||
}
|
||||
|
||||
// Raw getters and setters
|
||||
public byte getDropsFrom() {
|
||||
return dropsFrom;
|
||||
}
|
||||
// Raw getters and setters
|
||||
public byte getDropsFrom() {
|
||||
return dropsFrom;
|
||||
}
|
||||
|
||||
public void setDropsFrom(byte dropsFrom) {
|
||||
this.dropsFrom = dropsFrom;
|
||||
}
|
||||
public void setDropsFrom(byte dropsFrom) {
|
||||
this.dropsFrom = dropsFrom;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean getDropsFromDirt() {
|
||||
return getDropFromMask(1);
|
||||
}
|
||||
// Getters
|
||||
public boolean getDropsFromDirt() {
|
||||
return getDropFromMask(1);
|
||||
}
|
||||
|
||||
public boolean getDropsFromGrass() {
|
||||
return getDropFromMask(2);
|
||||
}
|
||||
public boolean getDropsFromGrass() {
|
||||
return getDropFromMask(2);
|
||||
}
|
||||
|
||||
public boolean getDropsFromSand() {
|
||||
return getDropFromMask(4);
|
||||
}
|
||||
public boolean getDropsFromSand() {
|
||||
return getDropFromMask(4);
|
||||
}
|
||||
|
||||
public boolean getDropsFromGravel() {
|
||||
return getDropFromMask(8);
|
||||
}
|
||||
public boolean getDropsFromGravel() {
|
||||
return getDropFromMask(8);
|
||||
}
|
||||
|
||||
public boolean getDropsFromClay() {
|
||||
return getDropFromMask(16);
|
||||
}
|
||||
public boolean getDropsFromClay() {
|
||||
return getDropFromMask(16);
|
||||
}
|
||||
|
||||
public boolean getDropsFromMycel() {
|
||||
return getDropFromMask(32);
|
||||
}
|
||||
public boolean getDropsFromMycel() {
|
||||
return getDropFromMask(32);
|
||||
}
|
||||
|
||||
public boolean getDropsFromSoulSand() {
|
||||
return getDropFromMask(64);
|
||||
}
|
||||
public boolean getDropsFromSoulSand() {
|
||||
return getDropFromMask(64);
|
||||
}
|
||||
|
||||
private boolean getDropFromMask(int mask) {
|
||||
return ((dropsFrom & mask) > 0) ? true : false;
|
||||
}
|
||||
private boolean getDropFromMask(int mask) {
|
||||
return ((dropsFrom & mask) > 0) ? true : false;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setDropsFromDirt() {
|
||||
setDropFromMask(1);
|
||||
}
|
||||
// Setters
|
||||
public void setDropsFromDirt() {
|
||||
setDropFromMask(1);
|
||||
}
|
||||
|
||||
public void setDropsFromGrass() {
|
||||
setDropFromMask(2);
|
||||
}
|
||||
public void setDropsFromGrass() {
|
||||
setDropFromMask(2);
|
||||
}
|
||||
|
||||
public void setDropsFromSand() {
|
||||
setDropFromMask(4);
|
||||
}
|
||||
public void setDropsFromSand() {
|
||||
setDropFromMask(4);
|
||||
}
|
||||
|
||||
public void setDropsFromGravel() {
|
||||
setDropFromMask(8);
|
||||
}
|
||||
public void setDropsFromGravel() {
|
||||
setDropFromMask(8);
|
||||
}
|
||||
|
||||
public void setDropsFromClay() {
|
||||
setDropFromMask(16);
|
||||
}
|
||||
public void setDropsFromClay() {
|
||||
setDropFromMask(16);
|
||||
}
|
||||
|
||||
public void setDropsFromMycel() {
|
||||
setDropFromMask(32);
|
||||
}
|
||||
public void setDropsFromMycel() {
|
||||
setDropFromMask(32);
|
||||
}
|
||||
|
||||
public void setDropsFromSoulSand() {
|
||||
setDropFromMask(64);
|
||||
}
|
||||
public void setDropsFromSoulSand() {
|
||||
setDropFromMask(64);
|
||||
}
|
||||
|
||||
private void setDropFromMask(int mask) {
|
||||
dropsFrom |= mask;
|
||||
}
|
||||
private void setDropFromMask(int mask) {
|
||||
dropsFrom |= mask;
|
||||
}
|
||||
|
||||
// Un-setters
|
||||
public void unsetDropsFromDirt() {
|
||||
unsetDropFromMask(1);
|
||||
}
|
||||
// Un-setters
|
||||
public void unsetDropsFromDirt() {
|
||||
unsetDropFromMask(1);
|
||||
}
|
||||
|
||||
public void unsetDropsFromGrass() {
|
||||
unsetDropFromMask(2);
|
||||
}
|
||||
public void unsetDropsFromGrass() {
|
||||
unsetDropFromMask(2);
|
||||
}
|
||||
|
||||
public void unsetDropsFromSand() {
|
||||
unsetDropFromMask(4);
|
||||
}
|
||||
public void unsetDropsFromSand() {
|
||||
unsetDropFromMask(4);
|
||||
}
|
||||
|
||||
public void unsetDropsFromGravel() {
|
||||
unsetDropFromMask(8);
|
||||
}
|
||||
public void unsetDropsFromGravel() {
|
||||
unsetDropFromMask(8);
|
||||
}
|
||||
|
||||
public void unsetDropsFromClay() {
|
||||
unsetDropFromMask(16);
|
||||
}
|
||||
public void unsetDropsFromClay() {
|
||||
unsetDropFromMask(16);
|
||||
}
|
||||
|
||||
public void unsetDropsFromMycel() {
|
||||
unsetDropFromMask(32);
|
||||
}
|
||||
public void unsetDropsFromMycel() {
|
||||
unsetDropFromMask(32);
|
||||
}
|
||||
|
||||
public void unsetDropsFromSoulSand() {
|
||||
unsetDropFromMask(64);
|
||||
}
|
||||
public void unsetDropsFromSoulSand() {
|
||||
unsetDropFromMask(64);
|
||||
}
|
||||
|
||||
private void unsetDropFromMask(int mask) {
|
||||
dropsFrom &= ~mask;
|
||||
}
|
||||
private void unsetDropFromMask(int mask) {
|
||||
dropsFrom &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user