Compare commits
1130
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d6edc7b82 | ||
|
|
3f6c3047d8 | ||
|
|
e4fd23709f | ||
|
|
a255f55b6f | ||
|
|
e0e2a0f0c2 | ||
|
|
a4e84ad581 | ||
|
|
65cb3f7037 | ||
|
|
fc7509cca6 | ||
|
|
eebb4a4a6d | ||
|
|
698d1c7954 | ||
|
|
ed73fd059e | ||
|
|
87225b1c65 | ||
|
|
6362d9fb17 | ||
|
|
d5ba55716b | ||
|
|
4eca331430 | ||
|
|
b6574245b8 | ||
|
|
85d744d79f | ||
|
|
e536dff1a8 | ||
|
|
39287f55ef | ||
|
|
d5ebde53b9 | ||
|
|
913618101a | ||
|
|
a6eea018ac | ||
|
|
101ddae443 | ||
|
|
36cb515b86 | ||
|
|
4833111a2c | ||
|
|
a196bbd3e0 | ||
|
|
7d80f9d32c | ||
|
|
3ba1d26007 | ||
|
|
0e52316930 | ||
|
|
b84ed07371 | ||
|
|
efe5af460f | ||
|
|
418146e14c | ||
|
|
05c5cd8d66 | ||
|
|
e58de8d74d | ||
|
|
974afb4751 | ||
|
|
d819153690 | ||
|
|
7dbd29b838 | ||
|
|
560e3ab201 | ||
|
|
ffc4c600c5 | ||
|
|
44904eaef4 | ||
|
|
47a92deffd | ||
|
|
b4549c6791 | ||
|
|
2b97f7310f | ||
|
|
073091525b | ||
|
|
79b9c12319 | ||
|
|
01f745b027 | ||
|
|
9725bdfeeb | ||
|
|
cdf9767959 | ||
|
|
66e21da6b2 | ||
|
|
87b14d3944 | ||
|
|
7bbeb90320 | ||
|
|
cd895d03dc | ||
|
|
ee2a304148 | ||
|
|
06e9e33da4 | ||
|
|
7065ffaea2 | ||
|
|
1bc4e68ff9 | ||
|
|
4e53d13290 | ||
|
|
90344d36df | ||
|
|
f36a56e854 | ||
|
|
5d4bacc80e | ||
|
|
d88bf6e137 | ||
|
|
63f5d769d8 | ||
|
|
9a9bfc03b9 | ||
|
|
28112ef4d8 | ||
|
|
7e5a3238b8 | ||
|
|
3279a6a38d | ||
|
|
b64e48769d | ||
|
|
ff8002fc13 | ||
|
|
2af835f0c3 | ||
|
|
bf25b65f09 | ||
|
|
52eb3d820f | ||
|
|
d90210d70f | ||
|
|
ec254c2989 | ||
|
|
36549294b7 | ||
|
|
908fcb1e44 | ||
|
|
73cd26aea3 | ||
|
|
758d25812b | ||
|
|
fa0ef421c7 | ||
|
|
e936a6271f | ||
|
|
7362e543da | ||
|
|
8a46d70301 | ||
|
|
a168e5cb48 | ||
|
|
ae578f9491 | ||
|
|
e72122378d | ||
|
|
fd2ea3df09 | ||
|
|
e94e071c6e | ||
|
|
0e19236cdc | ||
|
|
1c12756acf | ||
|
|
bcfde80c07 | ||
|
|
8dc9e864eb | ||
|
|
fec820f4ba | ||
|
|
ff9ffad302 | ||
|
|
fc2cb6aeae | ||
|
|
d2776ef448 | ||
|
|
36ef41b710 | ||
|
|
9258ebd8c7 | ||
|
|
d528cbcafd | ||
|
|
760c193b0e | ||
|
|
7c6edcb081 | ||
|
|
009a94f74d | ||
|
|
bd6fb4e51c | ||
|
|
2fdef44744 | ||
|
|
5b991f44e2 | ||
|
|
871ba16b67 | ||
|
|
e90c50d170 | ||
|
|
d1be3bd0be | ||
|
|
4d40b3f7e4 | ||
|
|
20ba6f130a | ||
|
|
d8fff0ae15 | ||
|
|
3da1b7e8c4 | ||
|
|
79ae8754dc | ||
|
|
3fc3663d5d | ||
|
|
5d1d71baf2 | ||
|
|
71367d2d69 | ||
|
|
09d8790804 | ||
|
|
53f453b7ac | ||
|
|
9a255555a6 | ||
|
|
28d71f7bc1 | ||
|
|
bf5ab8d1b3 | ||
|
|
c05d866f2f | ||
|
|
9cf2c68fe8 | ||
|
|
15ae0ea54f | ||
|
|
1e711ac258 | ||
|
|
706338bb0c | ||
|
|
1c89b6458f | ||
|
|
7978193d88 | ||
|
|
9efbbe7a4b | ||
|
|
afaed87a67 | ||
|
|
f3addfbf4e | ||
|
|
19ad1db5fb | ||
|
|
16096acc34 | ||
|
|
1f907d93af | ||
|
|
aed0e178ea | ||
|
|
6694c02650 | ||
|
|
10ef838d3f | ||
|
|
5b25cf4f6c | ||
|
|
24596419e5 | ||
|
|
a403380375 | ||
|
|
a6ee8a55ca | ||
|
|
6fba6715ba | ||
|
|
6495b72a53 | ||
|
|
5dba9f156d | ||
|
|
a8590df9d4 | ||
|
|
1877479094 | ||
|
|
747cab75fd | ||
|
|
fe8118854e | ||
|
|
3377c1dbe5 | ||
|
|
3ec22fc578 | ||
|
|
17351e66c1 | ||
|
|
0166b8d139 | ||
|
|
2acca7f330 | ||
|
|
4ad6c53ba9 | ||
|
|
0117159159 | ||
|
|
ccf802e32f | ||
|
|
83f5a4a701 | ||
|
|
a034eaa555 | ||
|
|
3fb99bc156 | ||
|
|
9d34e5d75c | ||
|
|
27c2f7b9e9 | ||
|
|
697fee8c4c | ||
|
|
20ce469aec | ||
|
|
70c91f777f | ||
|
|
cc24f38d83 | ||
|
|
5ec27db284 | ||
|
|
5d6bc806f0 | ||
|
|
5868ad64b4 | ||
|
|
ac6fcf5ed6 | ||
|
|
231824fd34 | ||
|
|
a3e7efcc58 | ||
|
|
a649307a29 | ||
|
|
b0235757cc | ||
|
|
06ee82a745 | ||
|
|
d2cad7ca8d | ||
|
|
2390aa8f92 | ||
|
|
674c4a4a06 | ||
|
|
768402088a | ||
|
|
084033cc90 | ||
|
|
51801b1b36 | ||
|
|
71054197f2 | ||
|
|
610f96415f | ||
|
|
34fa336f00 | ||
|
|
d92d62bce9 | ||
|
|
cf14d41d19 | ||
|
|
719ade19f7 | ||
|
|
1a8a97daf1 | ||
|
|
d9dffa8e6d | ||
|
|
973588defb | ||
|
|
c704c1ca3a | ||
|
|
c33a268b91 | ||
|
|
9821f1d9c8 | ||
|
|
be6e0b67be | ||
|
|
b9b1fa6164 | ||
|
|
28585dd6f9 | ||
|
|
47ca7b821b | ||
|
|
9ce2dfd100 | ||
|
|
473ccd09d7 | ||
|
|
cc2e1d44b2 | ||
|
|
2e8f159d38 | ||
|
|
6581d16125 | ||
|
|
562bc56e83 | ||
|
|
4493cd7916 | ||
|
|
1cd9e45915 | ||
|
|
acb6bc6dd6 | ||
|
|
b7b17c5d21 | ||
|
|
bbd9211845 | ||
|
|
fc6796e20f | ||
|
|
6040a27126 | ||
|
|
1c483148dc | ||
|
|
128442c062 | ||
|
|
141854f076 | ||
|
|
f72cc6764b | ||
|
|
d95ecfaa8e | ||
|
|
6c96f4e974 | ||
|
|
28cee291c6 | ||
|
|
155f32c00f | ||
|
|
071ba05d81 | ||
|
|
2ee5aea06b | ||
|
|
3bb8de6d33 | ||
|
|
79ac01da34 | ||
|
|
6e4fbb0ece | ||
|
|
167ed5e0d3 | ||
|
|
91f3304f78 | ||
|
|
7928e73a32 | ||
|
|
d61d186544 | ||
|
|
dc356e88d0 | ||
|
|
d0d5574580 | ||
|
|
29617059b3 | ||
|
|
bf05fc81dd | ||
|
|
a2c5bf70f0 | ||
|
|
ea19006465 | ||
|
|
89f685ff9a | ||
|
|
ecc76033dc | ||
|
|
e843b0711d | ||
|
|
eddfaf7df0 | ||
|
|
d1150ab5f8 | ||
|
|
cc3996ca76 | ||
|
|
1965aecfba | ||
|
|
ce34ae44d8 | ||
|
|
f5a2d7bc47 | ||
|
|
24295025ef | ||
|
|
e3f56f6498 | ||
|
|
bd0c3cff3f | ||
|
|
7c4ab035a0 | ||
|
|
2593080f77 | ||
|
|
0d4595d511 | ||
|
|
bf820c2c27 | ||
|
|
a12718d354 | ||
|
|
b23c1ae606 | ||
|
|
7c59dcbcb9 | ||
|
|
15cacba7c9 | ||
|
|
adbe88daa6 | ||
|
|
5350c012f7 | ||
|
|
a91f377cf5 | ||
|
|
c3ae5ac210 | ||
|
|
f4ce740c06 | ||
|
|
3ff8d34053 | ||
|
|
f362f09380 | ||
|
|
62b789dff5 | ||
|
|
84a9db597a | ||
|
|
89fd700e32 | ||
|
|
9741b1794c | ||
|
|
001a6000f8 | ||
|
|
bf61069fed | ||
|
|
d93def8b5b | ||
|
|
540394e266 | ||
|
|
425b1c80cc | ||
|
|
47ae6f5378 | ||
|
|
48601e4215 | ||
|
|
ed80083fe8 | ||
|
|
d041e0a8d1 | ||
|
|
de85be5832 | ||
|
|
81d59d8bf5 | ||
|
|
5d3d732c25 | ||
|
|
0c2d2f4e0a | ||
|
|
3d9108fb48 | ||
|
|
25c616bc32 | ||
|
|
148187025a | ||
|
|
115b0dc078 | ||
|
|
78bf6ba3bf | ||
|
|
e31c391af4 | ||
|
|
6ed4be9a64 | ||
|
|
d626e7e4b1 | ||
|
|
e7dd4fee51 | ||
|
|
146075de69 | ||
|
|
9fce6c54f6 | ||
|
|
f189eb3b7e | ||
|
|
ed77cacb1a | ||
|
|
2d4fe301cf | ||
|
|
e5fe1fe565 | ||
|
|
83010f1a28 | ||
|
|
864e50e38c | ||
|
|
0a99258f3e | ||
|
|
cfae997de4 | ||
|
|
b345baf20e | ||
|
|
d532052c7b | ||
|
|
1c02fb4387 | ||
|
|
2a99649e1e | ||
|
|
994bf922af | ||
|
|
36094e2bea | ||
|
|
6243b41956 | ||
|
|
32170cc089 | ||
|
|
c1a3d48944 | ||
|
|
75855826e7 | ||
|
|
d35363b10c | ||
|
|
ad1b733498 | ||
|
|
9159dfbb7d | ||
|
|
b8acd339b3 | ||
|
|
51e035eb3e | ||
|
|
2fd8e3edc3 | ||
|
|
faf20ee36e | ||
|
|
e1494808f3 | ||
|
|
05cf052204 | ||
|
|
242f05fc77 | ||
|
|
dd29fcc1dd | ||
|
|
d5013546d1 | ||
|
|
058c0837f0 | ||
|
|
e01c646562 | ||
|
|
3afca50930 | ||
|
|
94ca18e95c | ||
|
|
707eae92a8 | ||
|
|
b4a4519876 | ||
|
|
4f41b7aa6e | ||
|
|
b9267a3dfc | ||
|
|
a53c4214f0 | ||
|
|
343695e23e | ||
|
|
e17e9c8ce9 | ||
|
|
676c3a2e3d | ||
|
|
e821611744 | ||
|
|
d69c492577 | ||
|
|
eb91eefc80 | ||
|
|
f570c81366 | ||
|
|
b3f23278b1 | ||
|
|
3fa2bfa7cf | ||
|
|
582d6bef1a | ||
|
|
04c65cc59e | ||
|
|
268c4982c3 | ||
|
|
8983a0c024 | ||
|
|
1cbe901e4d | ||
|
|
4894abd1f1 | ||
|
|
1fac13247f | ||
|
|
59cfacf007 | ||
|
|
5f916fbf27 | ||
|
|
c70e254dbf | ||
|
|
9d42a05759 | ||
|
|
59b6522d59 | ||
|
|
46f8453b5b | ||
|
|
b4b0940918 | ||
|
|
22ad7214b0 | ||
|
|
1ba693ffd5 | ||
|
|
6ee0d8a05e | ||
|
|
d3ff2922fd | ||
|
|
5e2824abeb | ||
|
|
926e23bf19 | ||
|
|
841598232c | ||
|
|
540b6abcab | ||
|
|
38d5917915 | ||
|
|
da6bd20b42 | ||
|
|
8859fa78fd | ||
|
|
4de6b9ce47 | ||
|
|
f595f4cdb9 | ||
|
|
1581e1e009 | ||
|
|
7cb9bd4bc2 | ||
|
|
32e72bb355 | ||
|
|
950402a144 | ||
|
|
f598551d9c | ||
|
|
c3f08318d4 | ||
|
|
f0343b08b5 | ||
|
|
20a1fcb9f5 | ||
|
|
253ede1c9a | ||
|
|
d4454703e4 | ||
|
|
9737b62813 | ||
|
|
06bd1a838f | ||
|
|
4343167240 | ||
|
|
7762aca019 | ||
|
|
6ebc1188e8 | ||
|
|
8b358b0955 | ||
|
|
b201b09719 | ||
|
|
4c9d108f08 | ||
|
|
564a7d3684 | ||
|
|
d832e9e6d9 | ||
|
|
aa574b6236 | ||
|
|
d7894eb847 | ||
|
|
5e067fa72d | ||
|
|
b1bf68a0ad | ||
|
|
89a8f24b14 | ||
|
|
43ecdc913a | ||
|
|
0f14ee557d | ||
|
|
9b88d1d491 | ||
|
|
606a3fa3ce | ||
|
|
a7cace0fdc | ||
|
|
ae314108a3 | ||
|
|
d0180f05d5 | ||
|
|
07df8d0d09 | ||
|
|
4552f70f7e | ||
|
|
a6912c3cb5 | ||
|
|
4bdeacfd05 | ||
|
|
01f549f408 | ||
|
|
f7bbb5029b | ||
|
|
658b5219c3 | ||
|
|
fb505ab161 | ||
|
|
284b3179ad | ||
|
|
532ffacf5a | ||
|
|
2b4d386eb2 | ||
|
|
bc20ecbe60 | ||
|
|
4878395460 | ||
|
|
467ec809b5 | ||
|
|
ceb6850670 | ||
|
|
63abf33414 | ||
|
|
bcd7fcaee7 | ||
|
|
d18581828d | ||
|
|
54209e1535 | ||
|
|
2ed59a866f | ||
|
|
41b3096600 | ||
|
|
42adfa8175 | ||
|
|
12bcf71028 | ||
|
|
a826d0b2ff | ||
|
|
59cab8a417 | ||
|
|
da6a62b984 | ||
|
|
806c5909c4 | ||
|
|
c00847f173 | ||
|
|
626e5d3e4b | ||
|
|
f5e8a9c2e8 | ||
|
|
3364709e53 | ||
|
|
67d172fd08 | ||
|
|
f3a420d85c | ||
|
|
aba1f05c5b | ||
|
|
8fdc0ad3da | ||
|
|
3db57ee1d9 | ||
|
|
b3841adcc1 | ||
|
|
0b0b3c0088 | ||
|
|
a64a8d9605 | ||
|
|
0a0d3ba527 | ||
|
|
a351fbb345 | ||
|
|
46359cfbfe | ||
|
|
f52004cb76 | ||
|
|
0e3848874a | ||
|
|
71ba31a0f4 | ||
|
|
7b1e77340b | ||
|
|
bebd4742b9 | ||
|
|
b933027523 | ||
|
|
bd1d852393 | ||
|
|
648365f336 | ||
|
|
12b6a69146 | ||
|
|
cd312c3ab9 | ||
|
|
d2d243caec | ||
|
|
865434d1b1 | ||
|
|
0858e324dd | ||
|
|
618986e216 | ||
|
|
cc3dfe9fd4 | ||
|
|
6ee8466ac0 | ||
|
|
3b7dd21440 | ||
|
|
528dc25fcb | ||
|
|
762d8e3ebb | ||
|
|
ef251c256d | ||
|
|
da3015c72c | ||
|
|
601f457e6f | ||
|
|
ec805f38d7 | ||
|
|
61710369f4 | ||
|
|
4824d53fab | ||
|
|
65cc817573 | ||
|
|
9bb7dd6e5d | ||
|
|
fadb3280e3 | ||
|
|
b64dfa34af | ||
|
|
584a81fac6 | ||
|
|
4233e4f8b4 | ||
|
|
28da4aac2f | ||
|
|
c37dd803c8 | ||
|
|
27abb55006 | ||
|
|
c607aa1c47 | ||
|
|
79f8f6bd55 | ||
|
|
1446dd936a | ||
|
|
8664f56eeb | ||
|
|
1c2514d5db | ||
|
|
34c8b7cf0b | ||
|
|
63af4370b5 | ||
|
|
832e0f6497 | ||
|
|
b198942742 | ||
|
|
b60250287e | ||
|
|
86ba242f33 | ||
|
|
0639d39d5a | ||
|
|
ee745f8a55 | ||
|
|
243fc8bc20 | ||
|
|
807730805c | ||
|
|
c8abdf00b5 | ||
|
|
21aaf4a03e | ||
|
|
8ea639eba8 | ||
|
|
a7e6fd1412 | ||
|
|
636b8289f6 | ||
|
|
79290eed0d | ||
|
|
9f927605da | ||
|
|
e69b5a6b17 | ||
|
|
cbe6c2c901 | ||
|
|
875685b705 | ||
|
|
ad6f0d1b62 | ||
|
|
4a66a2f5bb | ||
|
|
a8040abd52 | ||
|
|
72a14719ac | ||
|
|
2b827a1fae | ||
|
|
e45520c43b | ||
|
|
0fb33d12d6 | ||
|
|
ebe44ed99e | ||
|
|
23ba7fe73b | ||
|
|
4efa97ee0e | ||
|
|
ce80fc190d | ||
|
|
8bfe3a5473 | ||
|
|
07a38e3e58 | ||
|
|
360c63fad9 | ||
|
|
2a5edc4f91 | ||
|
|
dba21cadaf | ||
|
|
fa9191dd8f | ||
|
|
4043d5abcb | ||
|
|
eff56f74da | ||
|
|
d97a9bccde | ||
|
|
55741b524d | ||
|
|
186d3f15a4 | ||
|
|
841f6f05df | ||
|
|
ebc2a516bb | ||
|
|
9e029ad6ae | ||
|
|
b2135a8f42 | ||
|
|
8cbffd1cee | ||
|
|
ff22077adf | ||
|
|
60c0a1ab92 | ||
|
|
58eeecbcb8 | ||
|
|
876456b932 | ||
|
|
18db50ca56 | ||
|
|
cce1ccc967 | ||
|
|
e5537dd8f1 | ||
|
|
0c7ba2ae67 | ||
|
|
bbfc672582 | ||
|
|
a65dc4966b | ||
|
|
4780f87278 | ||
|
|
b11d911e4a | ||
|
|
155aad8bf2 | ||
|
|
6e1d4ef961 | ||
|
|
cfa5a04e3a | ||
|
|
7d1c47c2fc | ||
|
|
957c55955d | ||
|
|
0226ab9609 | ||
|
|
b888561d98 | ||
|
|
f210851294 | ||
|
|
73e394d5ec | ||
|
|
63f8811b67 | ||
|
|
d01ce71343 | ||
|
|
fe00aae7e3 | ||
|
|
d4347d0cff | ||
|
|
b033d59b8a | ||
|
|
aedbfd7bab | ||
|
|
b93822502e | ||
|
|
f053f0546b | ||
|
|
af3b3d0fab | ||
|
|
b1fa677330 | ||
|
|
9691a0f978 | ||
|
|
0b1a387003 | ||
|
|
4ce503f55e | ||
|
|
74947a7efd | ||
|
|
85cd71cb8a | ||
|
|
3ad7d86f74 | ||
|
|
ac9194ec87 | ||
|
|
96e8208f3d | ||
|
|
895360ce8b | ||
|
|
59e34ef353 | ||
|
|
11e556c099 | ||
|
|
a9579a6594 | ||
|
|
5a1fe2a9e5 | ||
|
|
1c5c792cf3 | ||
|
|
dbe9494dbf | ||
|
|
b116effa2b | ||
|
|
d361ceb45b | ||
|
|
35709f5389 | ||
|
|
b45a4cf20a | ||
|
|
009ceeeede | ||
|
|
19fb9df5cf | ||
|
|
0829df01aa | ||
|
|
78ac068a3f | ||
|
|
57da3df860 | ||
|
|
74241e3d9c | ||
|
|
6a4921d7d1 | ||
|
|
271e5f339e | ||
|
|
ec89db1bed | ||
|
|
7346cbe48c | ||
|
|
ac3049f3ab | ||
|
|
e82db95bbc | ||
|
|
0d0f167396 | ||
|
|
b35a0325b8 | ||
|
|
3572d3fbe7 | ||
|
|
7304269866 | ||
|
|
d7535b0551 | ||
|
|
0437a4bd92 | ||
|
|
d881908ecc | ||
|
|
3715bc8bc5 | ||
|
|
a9f00a46f5 | ||
|
|
d9a7275682 | ||
|
|
80f6a0159c | ||
|
|
f2e1053b88 | ||
|
|
e975968637 | ||
|
|
a778d353c4 | ||
|
|
d40e67b47d | ||
|
|
9196973d1c | ||
|
|
242d20884c | ||
|
|
b909af873d | ||
|
|
e6f7ba5ac9 | ||
|
|
4ecb28b3bb | ||
|
|
d0ea4168bc | ||
|
|
fd9464ced1 | ||
|
|
49eb93af2e | ||
|
|
9274570fa4 | ||
|
|
319a701a16 | ||
|
|
807c8d0f2c | ||
|
|
29d97274fe | ||
|
|
eb1dc502cd | ||
|
|
622fb19c4a | ||
|
|
5705b5b6a0 | ||
|
|
1d1a2213c1 | ||
|
|
4dd3df26a5 | ||
|
|
39293482d2 | ||
|
|
9813e5f531 | ||
|
|
48adbec011 | ||
|
|
a9a5d7467a | ||
|
|
b8a0891c4c | ||
|
|
53567d4646 | ||
|
|
3395f3d7c7 | ||
|
|
e197091bb2 | ||
|
|
ede0395d39 | ||
|
|
17963964c7 | ||
|
|
bb0e2e4a2d | ||
|
|
ce4e608cf4 | ||
|
|
944f961ee5 | ||
|
|
5335e73707 | ||
|
|
d05e2b500f | ||
|
|
b2f3b74062 | ||
|
|
16e42f6469 | ||
|
|
a31dc83635 | ||
|
|
7b99130bfa | ||
|
|
f57468126a | ||
|
|
d17fee6b7c | ||
|
|
1a943e42a9 | ||
|
|
2b80ca80ae | ||
|
|
24e26bb7d7 | ||
|
|
6133cf6bdf | ||
|
|
085c7a1ccc | ||
|
|
dd0b2137d6 | ||
|
|
8a4ba2a66c | ||
|
|
3e7841afc9 | ||
|
|
1427671a8c | ||
|
|
a15317e21d | ||
|
|
b10a37f232 | ||
|
|
144de09423 | ||
|
|
a60e4e06e1 | ||
|
|
9eccf93b66 | ||
|
|
220f6a31de | ||
|
|
8cb4f22467 | ||
|
|
a2a2594f5a | ||
|
|
87df407743 | ||
|
|
cf007f091a | ||
|
|
680c35e0dc | ||
|
|
1a385c21d7 | ||
|
|
cced74d4b0 | ||
|
|
1db555581b | ||
|
|
63e0c028d9 | ||
|
|
ee82dc213f | ||
|
|
d2c09b9d33 | ||
|
|
21a3eeacc8 | ||
|
|
48768b5d6c | ||
|
|
96294c092c | ||
|
|
9a3fde2f13 | ||
|
|
6520a31938 | ||
|
|
f1779c9e68 | ||
|
|
9cc35d7b12 | ||
|
|
02347e05d8 | ||
|
|
a4196a901a | ||
|
|
9b2dd0d6c9 | ||
|
|
0efb28be19 | ||
|
|
5d9941d073 | ||
|
|
82cfbaba4e | ||
|
|
9868c66cdb | ||
|
|
3a32857683 | ||
|
|
d7a3e1839e | ||
|
|
1496d940bf | ||
|
|
bd57ec19d2 | ||
|
|
da54f9769b | ||
|
|
2e4b814d6d | ||
|
|
3f93fb3648 | ||
|
|
176e729a87 | ||
|
|
62f79e7592 | ||
|
|
f60f770b98 | ||
|
|
3c434d18e3 | ||
|
|
c9b52c81a6 | ||
|
|
5be6ea2766 | ||
|
|
98f5e1e4ee | ||
|
|
de6fc6481e | ||
|
|
dcc6b828a8 | ||
|
|
7da91f7875 | ||
|
|
d84f930a54 | ||
|
|
bdd5e8bd91 | ||
|
|
d1280a9031 | ||
|
|
08b8f01c44 | ||
|
|
fd227960b9 | ||
|
|
0efc0b965b | ||
|
|
bbe134bd1a | ||
|
|
91f7debb08 | ||
|
|
871a601e37 | ||
|
|
bd7ad20b7b | ||
|
|
873d878252 | ||
|
|
8c63cac4c5 | ||
|
|
283913010f | ||
|
|
109582335b | ||
|
|
3f09fbd710 | ||
|
|
ccb96ead10 | ||
|
|
5c48899d92 | ||
|
|
5f5d7084fa | ||
|
|
7b9c26d40a | ||
|
|
0c96da48f9 | ||
|
|
fbbe031b2c | ||
|
|
868ac57a4a | ||
|
|
7c21a114db | ||
|
|
e7573d3bd7 | ||
|
|
772d5a222d | ||
|
|
9eaca3e093 | ||
|
|
2eb61af76f | ||
|
|
ad9d4e41ff | ||
|
|
6a2e0e5810 | ||
|
|
a9c6582487 | ||
|
|
b66028e0e0 | ||
|
|
3ac4e55dc2 | ||
|
|
950991ff1b | ||
|
|
a1b07065b2 | ||
|
|
a1075224d3 | ||
|
|
d707a9f9a8 | ||
|
|
90b04aa798 | ||
|
|
5d1532e811 | ||
|
|
443d62580b | ||
|
|
541819ea8f | ||
|
|
b09ea0e66a | ||
|
|
8272e121f4 | ||
|
|
5d2534f497 | ||
|
|
1e7eef90f9 | ||
|
|
44df567936 | ||
|
|
d595cb9a31 | ||
|
|
e8a72d19e1 | ||
|
|
dde3b63fb9 | ||
|
|
87d4d4e1f4 | ||
|
|
7aca740296 | ||
|
|
6c9bc6951f | ||
|
|
74726b44ab | ||
|
|
18a57bf975 | ||
|
|
b2578b1736 | ||
|
|
eec765bc48 | ||
|
|
060c0b1b44 | ||
|
|
ba90228586 | ||
|
|
8017172f0e | ||
|
|
b4ea5e9299 | ||
|
|
59f2c8b62e | ||
|
|
9a28158e5f | ||
|
|
4d97453881 | ||
|
|
8488f9db3c | ||
|
|
51586c7dd5 | ||
|
|
7b74384a8e | ||
|
|
33afa4d0d7 | ||
|
|
0980e0a201 | ||
|
|
c7d35f13f4 | ||
|
|
eebc5c6e62 | ||
|
|
ecb97fd5c1 | ||
|
|
bf76b77cf6 | ||
|
|
21571bf54b | ||
|
|
7b8f73f0af | ||
|
|
9313ff82ae | ||
|
|
c22acd6dd1 | ||
|
|
0f3fd89228 | ||
|
|
7f93eedbac | ||
|
|
b2457f38b1 | ||
|
|
04366dd50e | ||
|
|
dc0121509a | ||
|
|
8bab4ae606 | ||
|
|
91c9e175d0 | ||
|
|
a1299239a2 | ||
|
|
7cdb52e740 | ||
|
|
e2d6652ef1 | ||
|
|
814725a2ba | ||
|
|
da6e6145f2 | ||
|
|
ee715b13b0 | ||
|
|
b006a458db | ||
|
|
a18611fb76 | ||
|
|
1af30dad1d | ||
|
|
79c06b5c42 | ||
|
|
6861021c7a | ||
|
|
5435fca6b3 | ||
|
|
53c801bb81 | ||
|
|
bb0b26e03c | ||
|
|
10d849dc51 | ||
|
|
b69403e00c | ||
|
|
120009c6b4 | ||
|
|
940dfa4a7e | ||
|
|
b7d3ae039c | ||
|
|
5b056388a0 | ||
|
|
9d16b7c445 | ||
|
|
cf21793262 | ||
|
|
632e926098 | ||
|
|
aaa1d18865 | ||
|
|
851c6de3eb | ||
|
|
9963e6f29f | ||
|
|
d31ee6a5b8 | ||
|
|
a5650f1f35 | ||
|
|
426a3bf252 | ||
|
|
736eff06ea | ||
|
|
ac5f249164 | ||
|
|
0841362c26 | ||
|
|
e344b0860d | ||
|
|
c0d029c71d | ||
|
|
07247a1afd | ||
|
|
47e052d180 | ||
|
|
da0bed3b5e | ||
|
|
c9b409844f | ||
|
|
2c392a53e6 | ||
|
|
f18d457a83 | ||
|
|
6f884c9308 | ||
|
|
a45bfa4dc3 | ||
|
|
1529f3e6dc | ||
|
|
d48927787b | ||
|
|
9173a15eb9 | ||
|
|
76629ebd25 | ||
|
|
659301a808 | ||
|
|
408c09541a | ||
|
|
29ddb5e5c1 | ||
|
|
4429bdcf8e | ||
|
|
9f12f6362b | ||
|
|
9fa29bcde7 | ||
|
|
346f1591ef | ||
|
|
749ea12b4a | ||
|
|
20ad724e5a | ||
|
|
8f44a8e77a | ||
|
|
8345c83afd | ||
|
|
6761be6952 | ||
|
|
2879c2a96e | ||
|
|
a092dd8760 | ||
|
|
4246149bf2 | ||
|
|
c2ad331ca5 | ||
|
|
fc24062f66 | ||
|
|
8164f484dd | ||
|
|
2721419324 | ||
|
|
251b66a8d0 | ||
|
|
fdb8c862f9 | ||
|
|
3d518f2e8e | ||
|
|
9cfc75b7db | ||
|
|
528b448450 | ||
|
|
48f8e033b6 | ||
|
|
761c3b95d9 | ||
|
|
ac229bfcd6 | ||
|
|
1894a2e4e7 | ||
|
|
327f0ce7c4 | ||
|
|
5ae12022d1 | ||
|
|
18ccb32bfe | ||
|
|
d7303f1289 | ||
|
|
cab8aaf040 | ||
|
|
ca21047859 | ||
|
|
ae27a34bb0 | ||
|
|
90305a4379 | ||
|
|
033df2f407 | ||
|
|
b2b1f91f38 | ||
|
|
947235fa72 | ||
|
|
329ded9615 | ||
|
|
86cfa9d98f | ||
|
|
1bdca7e615 | ||
|
|
36c33fba14 | ||
|
|
71794e0164 | ||
|
|
3b784b64c0 | ||
|
|
06f3bb4f63 | ||
|
|
7685af770c | ||
|
|
80510a778b | ||
|
|
d7c1b8b0e2 | ||
|
|
bf0b70cbcd | ||
|
|
1fa79af412 | ||
|
|
42f5d28b77 | ||
|
|
a5cfb81cc4 | ||
|
|
4b53a8dfea | ||
|
|
32ccfe3458 | ||
|
|
fe71006542 | ||
|
|
8a337fbf2a | ||
|
|
ff514f8663 | ||
|
|
97d905cf51 | ||
|
|
ddc2850632 | ||
|
|
ea6b020850 | ||
|
|
d40ae35505 | ||
|
|
c9cd2a0f5c | ||
|
|
c0ae0e3eea | ||
|
|
0b2233cf7b | ||
|
|
d8cb6497f0 | ||
|
|
e5d468f03f | ||
|
|
a33d1420ba | ||
|
|
70f03e80bc | ||
|
|
f091a32174 | ||
|
|
ff8b9eb3b7 | ||
|
|
08736cca16 | ||
|
|
10a4ec1c0b | ||
|
|
5159fe7a17 | ||
|
|
fe52040b48 | ||
|
|
af439b678e | ||
|
|
77ced857ea | ||
|
|
24efbf2ea9 | ||
|
|
5b17df65e9 | ||
|
|
8b721886f5 | ||
|
|
dbf109f051 | ||
|
|
56e4e493b1 | ||
|
|
8916f0dbbc | ||
|
|
3a5bc6adda | ||
|
|
f6e49bd8eb | ||
|
|
15ce10671e | ||
|
|
a0ab24a132 | ||
|
|
ee75392a9e | ||
|
|
6fd7c84276 | ||
|
|
df5bfdde80 | ||
|
|
8e74945b7e | ||
|
|
5d2a1e478c | ||
|
|
e110b1f6a5 | ||
|
|
803eb84f3f | ||
|
|
562de0f002 | ||
|
|
156e7ce373 | ||
|
|
939a2e8b1f | ||
|
|
792d2ce5e6 | ||
|
|
03424165a4 | ||
|
|
f2a65b4fd9 | ||
|
|
6afbd1d13d | ||
|
|
d2a5898e53 | ||
|
|
fa0c843f39 | ||
|
|
459aad2d2b | ||
|
|
0fa8f4e824 | ||
|
|
82eff21dbf | ||
|
|
6bf9d1c9bb | ||
|
|
71bfd2a1ad | ||
|
|
4b2152a05c | ||
|
|
6a80c8c1de | ||
|
|
c4dd2e3005 | ||
|
|
4006e53243 | ||
|
|
f894859df9 | ||
|
|
c9a33350ac | ||
|
|
0c847eefdf | ||
|
|
9710501a03 | ||
|
|
11fe1aee10 | ||
|
|
3e3990eba4 | ||
|
|
06f53a0b47 | ||
|
|
9a7c6202cc | ||
|
|
5d932060ee | ||
|
|
8803374126 | ||
|
|
3c424c1c33 | ||
|
|
9f8e1689f6 | ||
|
|
2717a7bbee | ||
|
|
29bc8bfbfc | ||
|
|
af428a236d | ||
|
|
25be687762 | ||
|
|
d6b5fb9a25 | ||
|
|
e818b1ee73 | ||
|
|
92db828e3a | ||
|
|
61bed8e72d | ||
|
|
f774d861c2 | ||
|
|
65b375edeb | ||
|
|
b19799f764 | ||
|
|
2e41d149fe | ||
|
|
c576d5a3a2 | ||
|
|
6b95be4ca5 | ||
|
|
1712b175d8 | ||
|
|
46db76a6cc | ||
|
|
0e708a1f51 | ||
|
|
65369b6a4b | ||
|
|
ab311dd8d9 | ||
|
|
2b2a406cce | ||
|
|
3ad1bfad2b | ||
|
|
b028811d36 | ||
|
|
6a6b29923d | ||
|
|
0581415ae5 | ||
|
|
d473ac3f78 | ||
|
|
093e01d865 | ||
|
|
2d7626684f | ||
|
|
698671c700 | ||
|
|
0d06fb8a0d | ||
|
|
6e6c40bd3b | ||
|
|
4067d0cd28 | ||
|
|
5b19404c13 | ||
|
|
e6f81b01d6 | ||
|
|
25d9231d30 | ||
|
|
3284670153 | ||
|
|
ea920c1252 | ||
|
|
987e2eff51 | ||
|
|
67c165ff25 | ||
|
|
e7aa563352 | ||
|
|
56926dc14c | ||
|
|
2d0eb7e7bb | ||
|
|
54e7bc454a | ||
|
|
01bed7cc4b | ||
|
|
728002ecce | ||
|
|
e45ae8f9dc | ||
|
|
5d11e27eb0 | ||
|
|
fbc5c6f0d2 | ||
|
|
edb999578a | ||
|
|
d1f51acb1c | ||
|
|
b867df7315 | ||
|
|
a8068a5669 | ||
|
|
ab17064006 | ||
|
|
d3c1538083 | ||
|
|
b2ef10a699 | ||
|
|
fba3f71238 | ||
|
|
af3dcf049d | ||
|
|
a30222bec7 | ||
|
|
86af11b662 | ||
|
|
750adcf376 | ||
|
|
c200d43f51 | ||
|
|
f4093cbe51 | ||
|
|
4366b16a74 | ||
|
|
cfdd1ac38c | ||
|
|
3e10f18079 | ||
|
|
c7c73e7094 | ||
|
|
c7e5816b2e | ||
|
|
50a89b7b1a | ||
|
|
1aad872333 | ||
|
|
73b42b5430 | ||
|
|
e93fec45ac | ||
|
|
23933c4706 | ||
|
|
9e14daac1f | ||
|
|
aa079b2920 | ||
|
|
bac24e1c97 | ||
|
|
c72f602045 | ||
|
|
c22a8a9d18 | ||
|
|
2759d75125 | ||
|
|
980381194b | ||
|
|
8370a72776 | ||
|
|
e0f9344d20 | ||
|
|
3fde98049f | ||
|
|
40c04a1f4e | ||
|
|
5386aadbb7 | ||
|
|
5e0903086e | ||
|
|
ff47610424 | ||
|
|
84e178d12e | ||
|
|
f2a263f86c | ||
|
|
3c750104a5 | ||
|
|
f69c85e6b0 | ||
|
|
6e4de79bfb | ||
|
|
2d112edee5 | ||
|
|
4a634e8418 | ||
|
|
e31f2c79ac | ||
|
|
cc3889b166 | ||
|
|
7bbdac9012 | ||
|
|
d04a42ee92 | ||
|
|
fa80b66ac2 | ||
|
|
ae19604eab | ||
|
|
6e7daf4e85 | ||
|
|
86d3628b1c | ||
|
|
9be14a2a0c | ||
|
|
091c5a9621 | ||
|
|
c566ead9ef | ||
|
|
d97bbfb1b1 | ||
|
|
ea6e94d99d | ||
|
|
f0ae8cbb8e | ||
|
|
1a6e93f0df | ||
|
|
8fe128ec0f | ||
|
|
f3cd433e80 | ||
|
|
0964f461eb | ||
|
|
fa409ac4f5 | ||
|
|
3753256611 | ||
|
|
b378b0cf79 | ||
|
|
e5646bbbfd | ||
|
|
66538ccd02 | ||
|
|
d63c043368 | ||
|
|
65dce752d4 | ||
|
|
268b272f4d | ||
|
|
eb0b83c507 | ||
|
|
f009ad6dd6 | ||
|
|
6b543a793a | ||
|
|
05de5055ab | ||
|
|
688ea7a1d3 | ||
|
|
fc02efd90f | ||
|
|
6039009e3f | ||
|
|
a9cb378eab | ||
|
|
fcfa45717c | ||
|
|
9333f70add | ||
|
|
30704338e6 | ||
|
|
17a519f961 | ||
|
|
74aba9d6e8 | ||
|
|
43fcbc9af9 | ||
|
|
fa3e0d6186 | ||
|
|
20ce518d33 | ||
|
|
f9481db5a6 | ||
|
|
1b42a25ccb | ||
|
|
e3edcb88df | ||
|
|
bef22ba534 | ||
|
|
10d6a7e1dc | ||
|
|
b39098a592 | ||
|
|
a2c6dad243 | ||
|
|
b76da91013 | ||
|
|
e7f97a8ae7 | ||
|
|
e792c338aa | ||
|
|
133810550f | ||
|
|
97168043ff | ||
|
|
40c4ce0a37 | ||
|
|
318564ccf2 | ||
|
|
9c1a9769b2 | ||
|
|
89ea09fba2 | ||
|
|
9384f96549 | ||
|
|
69b143ada6 | ||
|
|
a97b6f80d2 | ||
|
|
ad47ce7d1b | ||
|
|
d09d340e0f | ||
|
|
751ed5a8e8 | ||
|
|
a0667d49b8 | ||
|
|
8c45d0b76a | ||
|
|
319567eb67 | ||
|
|
7a38806134 | ||
|
|
b6755a1047 | ||
|
|
69360a49ec | ||
|
|
3876c0f47f | ||
|
|
5fe8f76c34 | ||
|
|
e556261e84 | ||
|
|
8d09c19988 | ||
|
|
4fd0150945 | ||
|
|
f96f3151f9 | ||
|
|
047e0d8001 | ||
|
|
5f88247810 | ||
|
|
d12725ca0e | ||
|
|
dc9f2fc360 | ||
|
|
2c865aa0ff | ||
|
|
f11f3dd88e | ||
|
|
c503849107 | ||
|
|
ce8b042919 | ||
|
|
92a762e5e4 | ||
|
|
eb4f9700bc | ||
|
|
49e3a42550 | ||
|
|
1ab56096f8 | ||
|
|
afc388637f | ||
|
|
93fab486ff | ||
|
|
e36210b99a | ||
|
|
f6299c60a0 | ||
|
|
06bc0dea02 | ||
|
|
11ce604938 |
No files matched your search
@@ -0,0 +1,77 @@
|
||||
name: 🐛 Report a Bug
|
||||
description: Report a problem with Multiverse-Core.
|
||||
title: "[Bug]: "
|
||||
labels: ["Bug: Unconfirmed"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
|
||||
If you are having issues with other submodules of Multiverse, please go to their respective git repo:
|
||||
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues/new/choose
|
||||
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues/new/choose
|
||||
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues/new/choose
|
||||
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues/new/choose
|
||||
|
||||
Not sure if this is a bug with Multiverse-Core? Feel free to ask on our Discord server: https://discord.gg/NZtfKky
|
||||
|
||||
When completing the report, please ensure all fields are filled with the correct details requested. Failure to do so will result in your issue being closed.
|
||||
- type: input
|
||||
id: mutliverse-version-info
|
||||
attributes:
|
||||
label: '`/mv version -p` output'
|
||||
description: Run `/mv version -p` in the console, then copy and paste the link from the output of the command into this box.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: server-logs
|
||||
attributes:
|
||||
label: Server logs
|
||||
description: >
|
||||
Include full startup log and console error (if any). upload all relevant logs to either https://paste.gg
|
||||
or https://gist.github.com, save and the paste the link in this box.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: server-version
|
||||
attributes:
|
||||
label: Server Version
|
||||
description: Output of `/version` command.
|
||||
placeholder: server version info
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: bug-description
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: Describe in detail what the bug is about. Include the expected behaviour and actual behaviour.
|
||||
placeholder: "Example: When running `/mv` it cause the server to crash..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce-steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Provide detailed intructions to trigger the bug.
|
||||
placeholder: |
|
||||
Example:
|
||||
1. Start a server with only multiverse installed.
|
||||
2. Run `/mv` command.
|
||||
3. Players all get kicked with a "server closed" message.
|
||||
...
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: agreements
|
||||
attributes:
|
||||
label: Agreements
|
||||
description: Ensure you have done the following being submitting this issue.
|
||||
options:
|
||||
- label: I have searched for and ensured there isn't already an open or resolved issue(s) regarding this.
|
||||
required: true
|
||||
- label: >
|
||||
I was able to reproduce my issue on a freshly setup and up-to-date server with the latest
|
||||
version of Multiverse plugins with no other plugins and with no kinds of other server or client mods.
|
||||
required: true
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 💬 Multiverse Discord Server
|
||||
url: https://discord.gg/NZtfKky
|
||||
about: Need help with using Multiverse-Core or just want to chat with the devs? Join the Multiverse Discord Server for help!
|
||||
@@ -0,0 +1,41 @@
|
||||
name: 💡 Request a Feature
|
||||
description: Suggest a feature you want to see in Multiverse-Core!
|
||||
title: "[Idea]: "
|
||||
labels: ["Type: Idea"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to share your ideas!
|
||||
|
||||
If you are look for other submodules of Multiverse, go to their respective git repo:
|
||||
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues/new/choose
|
||||
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues/new/choose
|
||||
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues/new/choose
|
||||
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues/new/choose
|
||||
|
||||
Not sure if your feature fits in Multiverse-Core? Feel free to ask on our Discord server: https://discord.gg/NZtfKky
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Describe the feature
|
||||
description: What feature are you suggesting?
|
||||
placeholder: "Example: I hope multiverse can implement random teleport feature..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature-reasoning
|
||||
attributes:
|
||||
label: How is the feature useful to all Multiverse users?
|
||||
description: How is the feature useful to all players, server owners and/or developers?
|
||||
placeholder: "Example: Random teleporting can be integrated into many multiverse modules such as mv-portals..."
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: agreements
|
||||
attributes:
|
||||
label: Agreements
|
||||
description: Ensure you have done the following being submitting this issue.
|
||||
options:
|
||||
- label: I have searched for and ensured there isn't already an open issue regarding this.
|
||||
required: true
|
||||
@@ -0,0 +1,2 @@
|
||||
prerelease:
|
||||
- '*'
|
||||
@@ -0,0 +1,17 @@
|
||||
name: "Pull Request Labeler"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
prerelease_labeler:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -0,0 +1,90 @@
|
||||
name: Manually promote last prerelease to release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version to promote'
|
||||
required: true
|
||||
version-bump:
|
||||
description: 'Version bump to apply - should usually match the version bump used for the prerelease since last release'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- 'patch'
|
||||
- 'minor'
|
||||
- 'major'
|
||||
|
||||
jobs:
|
||||
manually_promote_release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Verify input version is prerelease
|
||||
run: |
|
||||
if [[ "${{ github.event.inputs.version }}" != *"pre"* ]]; then
|
||||
echo "Version must be a prerelease"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Get release info
|
||||
id: get-release
|
||||
uses: cardinalby/git-get-release-action@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
tag: ${{ github.event.inputs.version }}
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ steps.get-release.outputs.tag_name }}
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Remove prerelease tag
|
||||
run: |
|
||||
echo "Removing prerelease tag from version"
|
||||
echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV
|
||||
|
||||
- name: Build
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: clean build -x test -x checkstyleMain -x checkstyleTest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_VERSION: ${{ env.VERSION }}
|
||||
|
||||
- name: Create release
|
||||
id: release
|
||||
uses: Multiverse/release-on-push-action@skip_prs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
bump_version_scheme: ${{ github.event.inputs.version-bump }}
|
||||
tag_prefix: ''
|
||||
release_name: "<RELEASE_VERSION>"
|
||||
use_github_release_notes: true
|
||||
ref: ${{ steps.get-release.outputs.target_commitish }}
|
||||
skip_prs: true
|
||||
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_VERSION: ${{ env.VERSION }}
|
||||
|
||||
- name: Upload release artifact
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
|
||||
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
|
||||
tag: ${{ steps.release.outputs.tag_name }}
|
||||
@@ -0,0 +1,64 @@
|
||||
name: Create Release Version & Publish Package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
release_on_push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Test & Build
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: clean build -x assemble -x shadowJar
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create release
|
||||
id: release
|
||||
uses: Multiverse/release-on-push-action@support_prerelease
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
bump_version_scheme: norelease
|
||||
tag_prefix: ''
|
||||
release_name: "<RELEASE_VERSION>"
|
||||
use_github_release_notes: true
|
||||
|
||||
- name: Modify version scheme
|
||||
run: |
|
||||
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
|
||||
echo "Replacing prerelease version scheme with SNAPSHOT"
|
||||
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Using release version scheme"
|
||||
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
GITHUB_VERSION: ${{ env.VERSION }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload release artifact
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
|
||||
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
|
||||
tag: ${{ steps.release.outputs.tag_name }}
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Require PR Labels
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, labeled, unlabeled, synchronize]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
require_label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: mheap/github-action-required-labels@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
mode: exactly
|
||||
count: 1
|
||||
labels: "release:major, release:minor, release:patch, no version bump"
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Run unit tests against all PRs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Run unit tests
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+16
-1
@@ -2,6 +2,7 @@
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
/.checkstyle
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
@@ -11,6 +12,7 @@
|
||||
|
||||
# maven
|
||||
/target
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
@@ -30,4 +32,17 @@
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
.idea/
|
||||
|
||||
# Fern's utils
|
||||
uploadtoserver.sh
|
||||
|
||||
# Testing files:
|
||||
debug.log
|
||||
|
||||
# Doxygen
|
||||
/docs/html
|
||||
debug.txt
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
@@ -1,7 +0,0 @@
|
||||
[submodule "lib/allpay"]
|
||||
path = lib/allpay
|
||||
url = git://github.com/FernFerret/AllPay.git
|
||||
[submodule "lib/commandhandler"]
|
||||
path = lib/commandhandler
|
||||
url = git://github.com/PneumatiCraft/CommandHandler.git
|
||||
branch = notrie
|
||||
@@ -0,0 +1,6 @@
|
||||
Copyright (c) 2011, The Multiverse Team All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the The Multiverse Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,5 +1,44 @@
|
||||
Copyright (c) 2011, The Multiverse Team All rights reserved.
|
||||

|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
[](https://github.com/Multiverse/Multiverse-Core/actions/workflows/build.yml)
|
||||
[](https://dev.bukkit.org/projects/multiverse-core)
|
||||
[](https://ci.onarandombox.com/job/Multiverse-Core/)
|
||||
[](https://discord.gg/NZtfKky)
|
||||
[](https://patreon.com/dumptruckman)
|
||||
[](LICENSE.md)
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the The Multiverse Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
About
|
||||
========
|
||||
[Multiverse](https://dev.bukkit.org/projects/multiverse-core) was created at the dawn of Bukkit multiworld support. It has since then grown into a **complete world management solution!** Multiverse provides the easiest to use world management solution for your Minecraft server, big or small, and with great addons like [Portals](https://dev.bukkit.org/projects/multiverse-portals) and [NetherPortals](https://dev.bukkit.org/projects/multiverse-netherportals/), what's not to love!
|
||||
<br><br>
|
||||
Now it's time to create your very own Multiverse server, do check out our [Wiki](https://github.com/Multiverse/Multiverse-Core/wiki) and [Usage Guide](https://github.com/Multiverse/Multiverse-Core/wiki/Basics) to get started. Feel free to hop onto our [Discord](https://discord.gg/NZtfKky) if you have any question or just want to have a chat with us!
|
||||
|
||||
### Amazing sub-modules available:
|
||||
* [Multiverse-NetherPortals](https://github.com/Multiverse/Multiverse-NetherPortals) -> Have separate nether and end worlds for each of your overworlds!
|
||||
* [Multiverse-Portals](https://github.com/Multiverse/Multiverse-Portals) -> Make custom portals to go to any destination!
|
||||
* [Multiverse-Inventories](https://github.com/Multiverse/Multiverse-Inventories) -> Have separated players stats and inventories per world or per group of worlds.
|
||||
* [Multiverse-SignPortals](https://github.com/Multiverse/Multiverse-SignPortals) -> Signs as teleprompters!
|
||||
|
||||
Building
|
||||
========
|
||||
Simply build the source with Gradle:
|
||||
```
|
||||
./gradlew build
|
||||
```
|
||||
More details are available on the [build instructions wiki page](https://github.com/Multiverse/Multiverse-Core/wiki/Building).
|
||||
|
||||
|
||||
Contributing
|
||||
=======
|
||||
**Want to help improve Multiverse?** There are several ways you can support and contribute to the project.
|
||||
* Take a look at our "Bug: Unconfirmed" issues, where you can find issues that need extra testing and investigation.
|
||||
* Want others to love Multiverse too? You can join the [Multiverse Discord community](https://discord.gg/NZtfKky) and help others with issues and setup!
|
||||
* A Multiverse guru? You can update our [Wiki](https://github.com/Multiverse/Multiverse-Core/wiki) with your latest tip, tricks and guides! The wiki open for all to edit and improve.
|
||||
* Love coding? You could look at ["State: Open to PR"](https://github.com/Multiverse/Multiverse-Core/labels/State%3A%20Open%20to%20PR) and ["Resolution: Accepted"](https://github.com/Multiverse/Multiverse-Core/labels/Resolution%3A%20Accepted) issues. We're always happy to receive bug fixes and feature additions as [pull requests](https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/).
|
||||
* If you'd like to make a financial contribution to the project, do consider joining our [patreon](https://www.patreon.com/dumptruckman) or make a one-time donation [here](https://paypal.me/dumptruckman)!
|
||||
|
||||
Additionally, we would like to give a big thanks to everyone that has supported Multiverse over the years, as well as those in the years to come. Thank you!
|
||||
|
||||
License
|
||||
=======
|
||||
Multiverse-Core is licensed under BSD-3-Clause License. Please see [LICENSE.md](LICENSE.md) for more info.
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'checkstyle'
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||
id "org.jetbrains.kotlin.jvm" version "1.8.10"
|
||||
}
|
||||
|
||||
version = System.getenv('GITHUB_VERSION') ?: 'local'
|
||||
group = 'com.onarandombox.multiversecore'
|
||||
description = 'Multiverse-Core'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.onarandombox.com/content/groups/public')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://hub.spigotmc.org/nexus/content/groups/public/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://jitpack.io')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.minebench.de/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.maven.apache.org/maven2/')
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'aikar repo'
|
||||
url = uri('https://repo.aikar.co/content/groups/aikar/')
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'glaremasters repo'
|
||||
url = 'https://repo.glaremasters.me/repository/towny/'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
oldTestImplementation.extendsFrom implementation
|
||||
oldTestRuntime.extendsFrom runtime
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
|
||||
|
||||
// Economy
|
||||
implementation('com.github.MilkBowl:VaultAPI:1.7.1') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
|
||||
// Command Framework
|
||||
api 'co.aikar:acf-paper:0.5.1-SNAPSHOT'
|
||||
|
||||
// Config
|
||||
api('me.main__.util:SerializationConfig:1.7') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
api('io.github.townyadvanced.commentedconfiguration:CommentedConfiguration:1.0.0') {
|
||||
exclude group: 'org.spigotmc', module: 'spigot-api'
|
||||
}
|
||||
|
||||
// Utils
|
||||
api('com.dumptruckman.minecraft:Logging:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
api 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
|
||||
api 'org.bstats:bstats-bukkit:2.2.1'
|
||||
api 'net.minidev:json-smart:2.4.8'
|
||||
api 'org.jetbrains:annotations:22.0.0'
|
||||
|
||||
// Tests
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10'
|
||||
testImplementation 'com.github.seeseemelk:MockBukkit-v1.19:2.141.0'
|
||||
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
|
||||
// Old Tests
|
||||
oldTestImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT'
|
||||
oldTestImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
oldTestImplementation 'junit:junit:4.13.1'
|
||||
oldTestImplementation 'org.mockito:mockito-core:3.11.2'
|
||||
oldTestImplementation 'commons-io:commons-io:2.7'
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
|
||||
configurations {
|
||||
[apiElements, runtimeElements].each {
|
||||
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
|
||||
it.outgoing.artifact(shadowJar)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sourceSets {
|
||||
oldTest {
|
||||
java {
|
||||
compileClasspath += main.output
|
||||
runtimeClasspath += main.output
|
||||
srcDir file('src/old-test/java')
|
||||
}
|
||||
resources.srcDir file('src/old-test/resources')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core"
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ext.bitlyAccessToken = System.getenv('BITLY_ACCESS_TOKEN') ?: 'bitly-access-token'
|
||||
|
||||
task prepareSource(type: Sync) {
|
||||
inputs.property 'bitlyAccessToken', bitlyAccessToken
|
||||
from sourceSets.main.java
|
||||
into "$buildDir/src"
|
||||
filter(ReplaceTokens, tokens: [
|
||||
'bitly-access-token': bitlyAccessToken,
|
||||
])
|
||||
}
|
||||
|
||||
compileJava {
|
||||
source = prepareSource.outputs
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
// We're not using Kotlin in the plugin itself, just tests!
|
||||
enabled = false
|
||||
}
|
||||
configurations {
|
||||
compileOnly {
|
||||
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
|
||||
}
|
||||
runtimeOnly {
|
||||
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
def props = [version: "${project.version}"]
|
||||
inputs.properties props
|
||||
filteringCharset 'UTF-8'
|
||||
filesMatching('plugin.yml') {
|
||||
expand props
|
||||
}
|
||||
|
||||
// This task should never be skipped. The tests depend on this having been run but we want the new version number
|
||||
// that is created after tests are run and before we run again to publish.
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
|
||||
checkstyle {
|
||||
toolVersion = '6.1.1'
|
||||
configFile file('config/mv_checks.xml')
|
||||
ignoreFailures = true
|
||||
}
|
||||
|
||||
|
||||
javadoc {
|
||||
source = sourceSets.main.allJava
|
||||
classpath = configurations.compileClasspath
|
||||
}
|
||||
|
||||
|
||||
project.configurations.api.canBeResolved = true
|
||||
|
||||
shadowJar {
|
||||
relocate 'co.alkar.commands', 'com.onarandombox.acf'
|
||||
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.MultiverseCore.utils.CoreLogging'
|
||||
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.MultiverseCore.utils.DebugFileLogger'
|
||||
relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter'
|
||||
relocate 'io.github.townyadvanced.commentedconfiguration', 'com.onarandombox.commentedconfiguration'
|
||||
relocate 'me.main__.util', 'com.onarandombox.serializationconfig'
|
||||
relocate 'org.bstats', 'com.onarandombox.bstats'
|
||||
|
||||
configurations = [project.configurations.api]
|
||||
|
||||
archiveFileName = "$baseName-$version.$extension"
|
||||
|
||||
dependencies {
|
||||
exclude(dependency {
|
||||
it.moduleGroup == 'org.jetbrains.kotlin'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn shadowJar
|
||||
jar.enabled = false
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
+1813
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,141 @@
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Multiverse 2 Copyright (c) the Multiverse Team 2011. ~
|
||||
~ Multiverse 2 is licensed under the BSD License. ~
|
||||
~ For more information please check the README.md file included ~
|
||||
~ with this project. ~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
<!-- Future reference: valid severity values are 'ignore', 'info', 'warning', 'error' -->
|
||||
<module name="Checker">
|
||||
<module name="JavadocPackage">
|
||||
<property name="allowLegacy" value="true"/>
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile" />
|
||||
<module name="Translation"/>
|
||||
<module name="FileLength"/>
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
<module name="RegexpSingleline">
|
||||
<property name="message" value="Line has trailing spaces."/>
|
||||
<property name="format" value="\s+$"/>
|
||||
</module>
|
||||
<module name="SuppressWithNearbyCommentFilter">
|
||||
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<!-- Make suppression possible -->
|
||||
<module name="FileContentsHolder"/>
|
||||
<!-- Actual checks -->
|
||||
<module name="LineLength">
|
||||
<property name="max" value="160"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private methods -->
|
||||
<property name="tokens" value="METHOD_DEF"/><!-- We don't need javadoc for constructors -->
|
||||
</module>
|
||||
<module name="JavadocType"/>
|
||||
<module name="JavadocVariable">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
|
||||
</module>
|
||||
<module name="JavadocStyle"/>
|
||||
<module name="WriteTag">
|
||||
<property name="tag" value="@author"/>
|
||||
<property name="tagFormat" value="\S"/>
|
||||
<property name="severity" value="ignore"/>
|
||||
<property name="tagSeverity" value="warning"/>
|
||||
</module>
|
||||
<module name="ConstantName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
<module name="AvoidStarImport">
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="excludes" value="com.onarandombox.MultiverseCore.utils,com.onarandombox.MultiverseCore.configuration,com.onarandombox.MultiverseCore.commandsold,com.onarandombox.MultiverseCore.destination"/>
|
||||
</module>
|
||||
<module name="IllegalImport"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="MethodLength">
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="countEmpty" value="false"/>
|
||||
</module>
|
||||
<module name="ParameterNumber"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoWhitespaceAfter">
|
||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="OperatorWrap"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="RedundantModifier"/>
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock">
|
||||
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
|
||||
</module>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="HiddenField">
|
||||
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
|
||||
</module>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber">
|
||||
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<!-- Don't like errors for `final` missing
|
||||
<module name="DesignForExtension"/>
|
||||
<module name="FinalClass"/>
|
||||
-->
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
<module name="VisibilityModifier">
|
||||
<property name="protectedAllowed" value="true"/>
|
||||
</module>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<!-- Don't like errors for `final` missing
|
||||
<module name="FinalParameters"/>
|
||||
-->
|
||||
<module name="TodoComment">
|
||||
<property name="severity" value="info"/>
|
||||
</module>
|
||||
<module name="UpperEll"/>
|
||||
<module name="Indentation"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverride"/>
|
||||
</module>
|
||||
</module>
|
||||
Whitespace-only changes.
Vendored
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,244 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
-1
Submodule lib/allpay deleted from b6b450e8b6.
Submodule lib/commandhandler deleted from ac9d8c94e4.
@@ -1,160 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.onarandombox.multiversecore</groupId>
|
||||
<artifactId>Multiverse-Core</artifactId>
|
||||
<version>2.0</version>
|
||||
<name>Multiverse-Core</name>
|
||||
<description>World Management Plugin</description>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.number>UNKNOWN</project.build.number>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/artifactory/repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<plugins>
|
||||
<!-- Compiler -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Build Helper - Additional Source Folders -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-wsdl-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.basedir}/lib/allpay/src</source>
|
||||
<source>${project.basedir}/lib/commandhandler/src</source>
|
||||
<source>${project.basedir}/lib/commandhandler/lib/ShellParser/src</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
<artifactId>maven-replacer-plugin</artifactId>
|
||||
<version>1.3.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>replace</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<file>target/classes/plugin.yml</file>
|
||||
<replacements>
|
||||
<replacement>
|
||||
<token>maven-version-number</token>
|
||||
<value>${project.version}-${project.build.number}</value>
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Jar Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!-- Bukkit Dependency -->
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Bukkit Dependency -->
|
||||
|
||||
<!-- Start of Economy Dependencies -->
|
||||
<dependency>
|
||||
<groupId>cosine.boseconomy</groupId>
|
||||
<artifactId>BOSEconomy</artifactId>
|
||||
<version>0.6.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>fr.crafter.tickleman.RealShop</groupId>
|
||||
<artifactId>RealShop</artifactId>
|
||||
<version>0.63</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.iConomy</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>5.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.nijiko.coelho.iConomy</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>4.65</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.earth2me.essentials</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.4.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of Economy Dependencies -->
|
||||
|
||||
<!-- Start of Permissions Dependencies -->
|
||||
<dependency>
|
||||
<groupId>com.nijikokun.bukkit</groupId>
|
||||
<artifactId>Permissions</artifactId>
|
||||
<version>3.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
</dependency>
|
||||
<!-- End of Permissions Dependencies -->
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
rootProject.name = 'multiverse-core'
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Server;
|
||||
|
||||
public interface LoggablePlugin {
|
||||
public void log(Level level, String msg);
|
||||
|
||||
public Server getServer();
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.onarandombox.utils.MVDestination;
|
||||
import com.pneumaticraft.commandhandler.PermissionsInterface;
|
||||
|
||||
public class MVPermissions implements PermissionsInterface {
|
||||
|
||||
private MultiverseCore plugin;
|
||||
private PermissionHandler permissions = null;
|
||||
|
||||
/**
|
||||
* Constructor FTW
|
||||
*
|
||||
* @param plugin Pass along the Core Plugin.
|
||||
*/
|
||||
public MVPermissions(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
// We have to see if permissions was loaded before MV was
|
||||
if (this.plugin.getServer().getPluginManager().getPlugin("Permissions") != null) {
|
||||
this.setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
|
||||
this.plugin.log(Level.INFO, "- Attached to Permissions");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Player can teleport to the Destination world from there current world.
|
||||
*
|
||||
* @param p
|
||||
* @param w
|
||||
* @return
|
||||
*/
|
||||
public Boolean canTravelFromWorld(Player p, MVWorld w) {
|
||||
List<String> blackList = w.getWorldBlacklist();
|
||||
|
||||
boolean returnValue = true;
|
||||
|
||||
for (String s : blackList) {
|
||||
if (s.equalsIgnoreCase(p.getWorld().getName())) {
|
||||
returnValue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public boolean canTravelFromLocation(Player teleporter, Location location) {
|
||||
if (!this.plugin.isMVWorld(location.getWorld().getName())) {
|
||||
return false;
|
||||
}
|
||||
return canTravelFromWorld(teleporter, this.plugin.getMVWorld(location.getWorld().getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the Player has the permissions to enter this world.
|
||||
*
|
||||
* @param p
|
||||
* @param w
|
||||
* @return
|
||||
*/
|
||||
public Boolean canEnterWorld(Player p, MVWorld w) {
|
||||
return this.hasPermission(p, "multiverse.access." + w.getName(), false);
|
||||
}
|
||||
|
||||
public Boolean canEnterLocation(Player p, Location l) {
|
||||
if (l == null) {
|
||||
return false;
|
||||
}
|
||||
String worldName = l.getWorld().getName();
|
||||
if (!this.plugin.isMVWorld(worldName)) {
|
||||
return false;
|
||||
}
|
||||
return this.hasPermission(p, "multiverse.access." + worldName, false);
|
||||
}
|
||||
|
||||
public Boolean canEnterDestination(Player p, MVDestination d) {
|
||||
if (d == null || d.getLocation(p) == null) {
|
||||
return false;
|
||||
}
|
||||
String worldName = d.getLocation(p).getWorld().getName();
|
||||
if (!this.plugin.isMVWorld(worldName)) {
|
||||
return false;
|
||||
}
|
||||
if(!canEnterLocation(p, d.getLocation(p))) {
|
||||
return false;
|
||||
}
|
||||
return this.hasPermission(p, d.getRequiredPermission(), false);
|
||||
}
|
||||
|
||||
public void setPermissions(PermissionHandler handler) {
|
||||
this.permissions = handler;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// NO one can access a null permission (mainly used for destinations):w
|
||||
if(node == null) {
|
||||
return false;
|
||||
}
|
||||
// Everyone can access an empty permission
|
||||
// Currently used for the PlayerDestination
|
||||
if(node.equals("")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
boolean opFallback = this.plugin.getConfig().getBoolean("opfallback", true);
|
||||
if (this.permissions != null && this.permissions.has(player, node)) {
|
||||
// If Permissions is enabled we check against them.
|
||||
// this.plugin.log(Level.WARNING, "Allowed by P3/P2 ");
|
||||
return true;
|
||||
} else if (sender.hasPermission(node)) {
|
||||
// If Now check the bukkit permissions
|
||||
// this.plugin.log(Level.WARNING, "Allowed by BukkitPerms");
|
||||
return true;
|
||||
} else if (player.isOp() && opFallback) {
|
||||
// If Player is Op we always let them use it if they have the fallback enabled!
|
||||
// this.plugin.log(Level.WARNING, "Allowed by OP");
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the Player doesn't have Permissions and isn't an Op then
|
||||
// we return true if OP is not required, otherwise we return false
|
||||
// This allows us to act as a default permission guidance
|
||||
|
||||
// If they have the op fallback disabled, NO commands will work without a permissions plugin.
|
||||
return !isOpRequired && opFallback;
|
||||
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
String opsfallback = "";
|
||||
if(this.plugin.getConfig().getBoolean("opfallback", true)) {
|
||||
opsfallback = " WITH OPs.txt fallback";
|
||||
}
|
||||
if (this.permissions != null) {
|
||||
return "Permissions " + this.plugin.getServer().getPluginManager().getPlugin("Permissions").getDescription().getVersion() + opsfallback;
|
||||
}
|
||||
|
||||
return "Bukkit Permissions" + opsfallback;
|
||||
}
|
||||
|
||||
public boolean hasAnyPermission(CommandSender sender, List<String> nodes, boolean isOpRequired) {
|
||||
for (String node : nodes) {
|
||||
if (this.hasPermission(sender, node, isOpRequired)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAllPermission(CommandSender sender, List<String> nodes, boolean isOpRequired) {
|
||||
for (String node : nodes) {
|
||||
if (!this.hasPermission(sender, node, isOpRequired)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
public class MVPlayerSession {
|
||||
|
||||
private Player player; // Player holder, may be unnecessary.
|
||||
|
||||
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
|
||||
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
|
||||
|
||||
// private Location bedSpawn;
|
||||
//
|
||||
// // Beds are 2 blocks, thus we need to store both places
|
||||
// private Location bedA;
|
||||
// private Location bedB;
|
||||
|
||||
private Configuration config; // Configuration file to find out Cooldown Timers.
|
||||
|
||||
public MVPlayerSession(Player player, Configuration config, MultiverseCore multiVerseCore) {
|
||||
this.player = player;
|
||||
this.config = config;
|
||||
// this.bedSpawn = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Teleport time.
|
||||
*/
|
||||
public void teleport() {
|
||||
this.teleportLast = (new Date()).getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab whether the cooldown on Portal use has expired or not.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getTeleportable() {
|
||||
Long time = (new Date()).getTime();
|
||||
if ((time - this.teleportLast) > this.config.getInt("portalcooldown", 5000)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Message to the Player as long as enough time has passed since the last message.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void message(String msg) {
|
||||
Long time = (new Date()).getTime();
|
||||
if ((time - this.messageLast) > this.config.getInt("messagecooldown", 2000)) {
|
||||
this.player.sendMessage(msg);
|
||||
this.messageLast = time;
|
||||
}
|
||||
}
|
||||
|
||||
// Commented out bed code, i'll get rid of it soon.
|
||||
// --FF
|
||||
|
||||
// public void setRespawnLocation(Location location) {
|
||||
// this.bedSpawn = location;
|
||||
// }
|
||||
|
||||
// // This one simply spawns the player closer to the bed.
|
||||
// public Location getBedRespawnLocation() {
|
||||
// // There is a bedrespawn set
|
||||
// if (this.bedSpawn != null) {
|
||||
// if (!this.bs.playerCanSpawnHereSafely(this.bedSpawn) || !bedStillExists(this.bedSpawn)) {
|
||||
// this.bedSpawn = null;
|
||||
// return this.bedSpawn;
|
||||
// }
|
||||
// Location actualRespawn = this.bedSpawn;
|
||||
// Location bedRespawn = new Location(actualRespawn.getWorld(), actualRespawn.getX(), actualRespawn.getY(), actualRespawn.getZ());
|
||||
// bedRespawn.setY(bedRespawn.getY() - .25);
|
||||
// return bedRespawn;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private boolean bedStillExists(Location bedSpawn) {
|
||||
// //System.out.print("Dangers:");
|
||||
// //this.bs.showDangers(bedSpawn);
|
||||
// Location locationDown = new Location(bedSpawn.getWorld(), bedSpawn.getX(), bedSpawn.getY(), bedSpawn.getZ());
|
||||
// locationDown.setY(locationDown.getY() - 1);
|
||||
// if (locationDown.getBlock().getType() != Material.BED_BLOCK) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
public interface MVPlugin extends LoggablePlugin {
|
||||
public String dumpVersionInfo(String buffer);
|
||||
public MultiverseCore getCore();
|
||||
public void setCore(MultiverseCore core);
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
|
||||
import com.onarandombox.utils.BlockSafety;
|
||||
|
||||
public class MVTeleport {
|
||||
|
||||
MultiverseCore plugin;
|
||||
|
||||
BlockSafety bs = new BlockSafety();
|
||||
|
||||
public MVTeleport(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be specific to beds, and check on top of the bed then around it.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Location getSafeBedDestination(Location bedLocation) {
|
||||
// System.out.print(bedLocation);
|
||||
Location idealLocation = bedLocation;
|
||||
idealLocation.setY(idealLocation.getY() + 1);
|
||||
idealLocation.setX(idealLocation.getX() + .5);
|
||||
idealLocation.setZ(idealLocation.getZ() + .5);
|
||||
// System.out.print(idealLocation);
|
||||
if (this.bs.playerCanSpawnHereSafely(idealLocation)) {
|
||||
// System.out.print(idealLocation);
|
||||
return bedLocation;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Location getSafeLocation(Location l) {
|
||||
|
||||
// Check around the player first in a configurable radius:
|
||||
// TODO: Make this configurable
|
||||
Location safe = checkAboveAndBelowLocation(l, 6, 9);
|
||||
if (safe != null) {
|
||||
safe.setX(safe.getBlockX() + .5);
|
||||
safe.setZ(safe.getBlockZ() + .5);
|
||||
}
|
||||
return safe;
|
||||
}
|
||||
|
||||
private Location checkAboveAndBelowLocation(Location l, int tolerance, int radius) {
|
||||
// Tolerance must be an even number:
|
||||
if (tolerance % 2 != 0) {
|
||||
tolerance += 1;
|
||||
}
|
||||
// We want half of it, so we can go up and down
|
||||
tolerance /= 2;
|
||||
|
||||
// For now this will just do a straight up block.
|
||||
Location locToCheck = l.clone();
|
||||
// Check the main level
|
||||
Location safe = this.checkAroundLocation(locToCheck, radius);
|
||||
if (safe != null) {
|
||||
return safe;
|
||||
}
|
||||
// We've already checked zero right above this.
|
||||
int currentLevel = 1;
|
||||
while (currentLevel <= tolerance) {
|
||||
// Check above
|
||||
locToCheck = l.clone();
|
||||
locToCheck.add(0, currentLevel, 0);
|
||||
safe = this.checkAroundLocation(locToCheck, radius);
|
||||
if (safe != null) {
|
||||
return safe;
|
||||
}
|
||||
|
||||
// Check below
|
||||
locToCheck = l.clone();
|
||||
locToCheck.subtract(0, currentLevel, 0);
|
||||
safe = this.checkAroundLocation(locToCheck, radius);
|
||||
if (safe != null) {
|
||||
return safe;
|
||||
}
|
||||
currentLevel++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* For my crappy algorithm, radius MUST be odd
|
||||
*
|
||||
* @param l
|
||||
* @param radius
|
||||
* @return
|
||||
*/
|
||||
private Location checkAroundLocation(Location l, int diameter) {
|
||||
if (diameter % 2 == 0) {
|
||||
diameter += 1;
|
||||
}
|
||||
Location checkLoc = l.clone();
|
||||
|
||||
// Start at 3, the min diameter around a block
|
||||
int loopcounter = 3;
|
||||
while (loopcounter <= diameter) {
|
||||
boolean foundSafeArea = checkAroundSpecificDiameter(checkLoc, loopcounter);
|
||||
// If a safe area was found:
|
||||
if (foundSafeArea) {
|
||||
// Return the checkLoc, it is the safe location.
|
||||
return checkLoc;
|
||||
}
|
||||
// Otherwise, let's reset our location
|
||||
checkLoc = l.clone();
|
||||
// And increment the radius
|
||||
loopcounter += 2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkAroundSpecificDiameter(Location checkLoc, int circle) {
|
||||
// Adjust the circle to get how many blocks to step out.
|
||||
// A radius of 3 makes the block step 1
|
||||
// A radius of 5 makes the block step 2
|
||||
// A radius of 7 makes the block step 3
|
||||
// ...
|
||||
int adjustedCircle = ((circle - 1) / 2);
|
||||
checkLoc.add(adjustedCircle, 0, 0);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
// Now we go to the right that adjustedCircle many
|
||||
for (int i = 0; i < adjustedCircle; i++) {
|
||||
checkLoc.add(0, 0, 1);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then down adjustedCircle *2
|
||||
for (int i = 0; i < adjustedCircle * 2; i++) {
|
||||
checkLoc.add(-1, 0, 0);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then left adjustedCircle *2
|
||||
for (int i = 0; i < adjustedCircle * 2; i++) {
|
||||
checkLoc.add(0, 0, -1);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then up Then left adjustedCircle *2
|
||||
for (int i = 0; i < adjustedCircle * 2; i++) {
|
||||
checkLoc.add(1, 0, 0);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then finish up by doing adjustedCircle - 1
|
||||
for (int i = 0; i < adjustedCircle - 1; i++) {
|
||||
checkLoc.add(0, 0, 1);
|
||||
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean safelyTeleport(Entity e, Location l) {
|
||||
if (this.bs.playerCanSpawnHereSafely(l)) {
|
||||
e.teleport(l);
|
||||
//this.plugin.log(Level.WARNING, "The first location you gave me was safe.");
|
||||
return true;
|
||||
}
|
||||
if(e instanceof Minecart) {
|
||||
Minecart m = (Minecart)e;
|
||||
if(!this.bs.canSpawnCartSafely(m)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(e instanceof Vehicle) {
|
||||
Vehicle v = (Vehicle)e;
|
||||
if(!this.bs.canSpawnVehicleSafely(v)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Location safeLocation = this.getSafeLocation(l);
|
||||
if (safeLocation != null) {
|
||||
// Add offset to account for a vehicle on dry land!
|
||||
if (!this.bs.isEntitiyOnTrack(e, safeLocation)) {
|
||||
safeLocation.setY(safeLocation.getBlockY() + .5);
|
||||
}
|
||||
e.teleport(safeLocation);
|
||||
//this.plugin.log(Level.WARNING, "Had to look for a bit, but I found a safe place for ya!");
|
||||
return true;
|
||||
}
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
p.sendMessage("No safe locations found!");
|
||||
}
|
||||
else if (e.getPassenger() instanceof Player) {
|
||||
Player p = (Player) e.getPassenger();
|
||||
p.sendMessage("No safe locations found!");
|
||||
}
|
||||
this.plugin.log(Level.WARNING, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,645 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
enum EnglishChatColor {
|
||||
AQUA("AQUA", ChatColor.AQUA),
|
||||
BLACK("BLACK", ChatColor.BLACK),
|
||||
BLUE("BLUE", ChatColor.BLUE),
|
||||
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
|
||||
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
|
||||
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
|
||||
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
|
||||
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
|
||||
DARKRED("DARKRED", ChatColor.DARK_RED),
|
||||
GOLD("GOLD", ChatColor.GOLD),
|
||||
GRAY("GRAY", ChatColor.GRAY),
|
||||
GREEN("GREEN", ChatColor.GREEN),
|
||||
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
|
||||
RED("RED", ChatColor.RED),
|
||||
YELLOW("YELLOW", ChatColor.YELLOW),
|
||||
WHITE("WHITE", ChatColor.WHITE);
|
||||
private ChatColor color;
|
||||
private String text;
|
||||
|
||||
EnglishChatColor(String name, ChatColor color) {
|
||||
this.color = color;
|
||||
this.text = name;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public ChatColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public static EnglishChatColor fromString(String text) {
|
||||
if (text != null) {
|
||||
for (EnglishChatColor c : EnglishChatColor.values()) {
|
||||
if (text.equalsIgnoreCase(c.text)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnglishChatColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
public class MVWorld {
|
||||
|
||||
private MultiverseCore plugin; // Hold the Plugin Instance.
|
||||
private Configuration config; // Hold the Configuration File.
|
||||
|
||||
private World world; // The World Instance.
|
||||
private Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL
|
||||
private Long seed;
|
||||
|
||||
private String name; // The Worlds Name, EG its folder name.
|
||||
private String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes.
|
||||
private ChatColor aliasColor; // Color for this world
|
||||
|
||||
private boolean allowAnimals; // Does this World allow Animals to Spawn?
|
||||
private boolean allowMonsters; // Does this World allow Monsters to Spawn?
|
||||
|
||||
private boolean keepSpawnInMemory; // Does the World have the spawn loaded all the time?
|
||||
|
||||
private Boolean pvp; // Does this World allow PVP?
|
||||
private Boolean fakepvp; // Should this world have fakePVP on? (used for PVP zones)
|
||||
|
||||
private String respawnWorld; // Contains the name of the World to respawn the player to
|
||||
|
||||
private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
|
||||
|
||||
private HashMap<String, List<String>> masterList;
|
||||
|
||||
private Double scaling; // How stretched/compressed distances are
|
||||
private Double price; // How much does it cost to enter this world
|
||||
private int currency = -1; // What is the currency
|
||||
/**
|
||||
* The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID
|
||||
*/
|
||||
private String generator;
|
||||
private Permission permission;
|
||||
private Permission exempt;
|
||||
|
||||
private boolean canSave = false; // Prevents all the setters from constantly saving to the config when being called from the constructor.
|
||||
private boolean allowWeather;
|
||||
|
||||
public MVWorld(World world, Configuration config, MultiverseCore instance, Long seed, String generatorString) {
|
||||
this.config = config;
|
||||
this.plugin = instance;
|
||||
|
||||
// Set local values that CANNOT be changed by user
|
||||
this.world = world;
|
||||
this.name = world.getName();
|
||||
this.generator = generatorString;
|
||||
this.seed = seed;
|
||||
this.environment = world.getEnvironment();
|
||||
|
||||
// Initialize our lists
|
||||
this.initLists();
|
||||
|
||||
// Write these files to the config (once it's saved)
|
||||
if (generatorString != null) {
|
||||
config.setProperty("worlds." + this.name + ".generator", this.generator);
|
||||
}
|
||||
if (seed != null) {
|
||||
config.setProperty("worlds." + this.name + ".seed", this.seed);
|
||||
}
|
||||
config.setProperty("worlds." + this.name + ".environment", this.environment.toString());
|
||||
|
||||
// Set local values that CAN be changed by the user
|
||||
this.setAlias(config.getString("worlds." + this.name + ".alias.name", ""));
|
||||
this.setAliasColor(config.getString("worlds." + this.name + ".alias.color", ChatColor.WHITE.toString()));
|
||||
this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true));
|
||||
this.setScaling(config.getDouble("worlds." + this.name + ".scale", 1.0));
|
||||
this.setRespawnToWorld(config.getString("worlds." + this.name + ".respawnworld", ""));
|
||||
this.setEnableWeather(config.getBoolean("worlds." + this.name + ".allowweather", true));
|
||||
|
||||
this.setAnimals(config.getBoolean("worlds." + this.name + ".animals.spawn", true));
|
||||
this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true));
|
||||
this.setPrice(config.getDouble("worlds." + this.name + ".entryfee.amount", 0.0));
|
||||
this.setCurrency(config.getInt("worlds." + this.name + ".entryfee.currency", -1));
|
||||
this.getMobExceptions();
|
||||
|
||||
this.setSpawnInMemory(config.getBoolean("worlds." + this.name + ".keepspawninmemory", true));
|
||||
|
||||
this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
|
||||
this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
|
||||
this.translateTempSpawn(config);
|
||||
|
||||
this.canSave = true;
|
||||
saveConfig();
|
||||
|
||||
this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.TRUE);
|
||||
this.exempt = new Permission("multiverse.exempt." + this.getName(), "A player who has this does not pay to enter this world, or use any MV portals in it " + this.getName(), PermissionDefault.OP);
|
||||
try {
|
||||
this.plugin.getServer().getPluginManager().addPermission(this.permission);
|
||||
this.plugin.getServer().getPluginManager().addPermission(this.exempt);
|
||||
addToUpperLists(this.permission);
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private void setEnableWeather(boolean weather) {
|
||||
this.allowWeather = weather;
|
||||
// Disable any current weather
|
||||
if (!weather) {
|
||||
this.getCBWorld().setStorm(false);
|
||||
this.getCBWorld().setThundering(false);
|
||||
}
|
||||
this.config.setProperty("worlds." + this.name + ".allowweather", weather);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
private void addToUpperLists(Permission permission) {
|
||||
Permission all = this.plugin.getServer().getPluginManager().getPermission("multiverse.*");
|
||||
Permission allWorlds = this.plugin.getServer().getPluginManager().getPermission("multiverse.access.*");
|
||||
Permission allExemption = this.plugin.getServer().getPluginManager().getPermission("multiverse.exempt.*");
|
||||
|
||||
if (allWorlds == null) {
|
||||
allWorlds = new Permission("multiverse.access.*");
|
||||
this.plugin.getServer().getPluginManager().addPermission(allWorlds);
|
||||
}
|
||||
allWorlds.getChildren().put(permission.getName(), true);
|
||||
if (allExemption == null) {
|
||||
allExemption = new Permission("multiverse.exempt.*");
|
||||
this.plugin.getServer().getPluginManager().addPermission(allExemption);
|
||||
}
|
||||
allExemption.getChildren().put(this.exempt.getName(), true);
|
||||
if (all == null) {
|
||||
all = new Permission("multiverse.*");
|
||||
this.plugin.getServer().getPluginManager().addPermission(all);
|
||||
}
|
||||
all.getChildren().put("multiverse.access.*", true);
|
||||
all.getChildren().put("multiverse.exempt.*", true);
|
||||
|
||||
this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(all);
|
||||
this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(allWorlds);
|
||||
}
|
||||
|
||||
private void translateTempSpawn(Configuration config) {
|
||||
String tempspawn = config.getString("worlds." + this.name + ".tempspawn", "");
|
||||
if (tempspawn.length() > 0) {
|
||||
String[] coordsString = tempspawn.split(":");
|
||||
if (coordsString.length >= 3) {
|
||||
int[] coords = new int[3];
|
||||
try {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
coords[i] = Integer.parseInt(coordsString[i]);
|
||||
}
|
||||
this.world.setSpawnLocation(coords[0], coords[1], coords[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
this.plugin.log(Level.WARNING, "A MV1 spawn value was found, but it could not be migrated. Format Error. Sorry.");
|
||||
}
|
||||
} else {
|
||||
this.plugin.log(Level.WARNING, "A MV1 spawn value was found, but it could not be migrated. Format Error. Sorry.");
|
||||
}
|
||||
|
||||
this.config.removeProperty("worlds." + this.name + ".tempspawn");
|
||||
}
|
||||
}
|
||||
|
||||
public String getColoredWorldString() {
|
||||
ChatColor color = this.getAliasColor();
|
||||
if (color == null) {
|
||||
if (this.environment == Environment.NETHER) {
|
||||
color = ChatColor.RED;
|
||||
} else if (this.environment == Environment.NORMAL) {
|
||||
color = ChatColor.GREEN;
|
||||
} else if (this.environment == Environment.SKYLANDS) {
|
||||
color = ChatColor.AQUA;
|
||||
}
|
||||
}
|
||||
return this.getAliasColor() + this.getAlias() + ChatColor.WHITE;
|
||||
}
|
||||
|
||||
private void getMobExceptions() {
|
||||
List<String> temp;
|
||||
temp = this.config.getStringList("worlds." + this.name + ".animals.exceptions", new ArrayList<String>());
|
||||
// Add Animals to the exclusion list
|
||||
|
||||
for (String s : temp) {
|
||||
this.masterList.get("animals").add(s.toUpperCase());
|
||||
}
|
||||
temp = this.config.getStringList("worlds." + this.name + ".monsters.exceptions", new ArrayList<String>());
|
||||
// Add Monsters to the exclusion list
|
||||
for (String s : temp) {
|
||||
this.masterList.get("monsters").add(s.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
public World getCBWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
private void initLists() {
|
||||
this.masterList = new HashMap<String, List<String>>();
|
||||
this.blockBlacklist = new ArrayList<Integer>();
|
||||
// Only int list, we don't need to add it to the masterlist
|
||||
this.masterList.put("worldblacklist", new ArrayList<String>());
|
||||
this.masterList.put("animals", new ArrayList<String>());
|
||||
this.masterList.put("monsters", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public boolean clearVariable(String property) {
|
||||
if (property.equalsIgnoreCase("blockblacklist")) {
|
||||
this.blockBlacklist.clear();
|
||||
} else if (this.masterList.keySet().contains(property)) {
|
||||
this.masterList.get(property).clear();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.blockBlacklist);
|
||||
this.saveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean addToList(String list, String value) {
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
try {
|
||||
int intVal = Integer.parseInt(value);
|
||||
return addToList(list, intVal);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} else if (this.masterList.keySet().contains(list)) {
|
||||
|
||||
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
|
||||
this.masterList.get(list).add(value.toUpperCase());
|
||||
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
|
||||
this.syncMobs();
|
||||
} else {
|
||||
this.masterList.get(list).add(value);
|
||||
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
|
||||
}
|
||||
saveConfig();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeFromList(String list, String value) {
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
try {
|
||||
int intVal = Integer.parseInt(value);
|
||||
return removeFromList(list, intVal);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (this.masterList.keySet().contains(list)) {
|
||||
|
||||
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
|
||||
this.masterList.get(list).remove(value.toUpperCase());
|
||||
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
|
||||
this.syncMobs();
|
||||
} else {
|
||||
this.masterList.get(list).remove(value);
|
||||
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
|
||||
}
|
||||
saveConfig();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void syncMobs() {
|
||||
|
||||
if (this.getAnimalList().isEmpty()) {
|
||||
this.world.setSpawnFlags(this.world.getAllowMonsters(), this.allowAnimals);
|
||||
} else {
|
||||
this.world.setSpawnFlags(this.world.getAllowMonsters(), true);
|
||||
}
|
||||
if (this.getMonsterList().isEmpty()) {
|
||||
this.world.setSpawnFlags(this.allowMonsters, this.world.getAllowAnimals());
|
||||
} else {
|
||||
this.world.setSpawnFlags(true, this.world.getAllowAnimals());
|
||||
}
|
||||
this.plugin.getWorldPurger().purgeWorld(null, this);
|
||||
}
|
||||
|
||||
private boolean addToList(String list, Integer value) {
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
this.blockBlacklist.add(value);
|
||||
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
|
||||
saveConfig();
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private boolean removeFromList(String list, Integer value) {
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
this.blockBlacklist.remove(value);
|
||||
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
|
||||
saveConfig();
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private boolean setVariable(String name, boolean value) {
|
||||
if (name.equalsIgnoreCase("pvp")) {
|
||||
this.setPvp(value);
|
||||
} else if (name.equalsIgnoreCase("animals")) {
|
||||
this.setAnimals(value);
|
||||
} else if (name.equalsIgnoreCase("monsters")) {
|
||||
this.setMonsters(value);
|
||||
} else if (name.equalsIgnoreCase("memory") || name.equalsIgnoreCase("spawnmemory")) {
|
||||
this.setSpawnInMemory(value);
|
||||
} else if (name.equalsIgnoreCase("weather") || name.equalsIgnoreCase("storm")) {
|
||||
this.setEnableWeather(value);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setSpawnInMemory(boolean value) {
|
||||
this.world.setKeepSpawnInMemory(value);
|
||||
this.keepSpawnInMemory = value;
|
||||
this.config.setProperty("worlds." + this.name + ".keepspawninmemory", value);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
private boolean setVariable(String name, double value) {
|
||||
if (name.equalsIgnoreCase("scaling") || name.equalsIgnoreCase("scale")) {
|
||||
this.setScaling(value);
|
||||
return true;
|
||||
}
|
||||
if (name.equalsIgnoreCase("price")) {
|
||||
this.setPrice(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the one people have access to. It'll handle the rest.
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public boolean setVariable(String name, String value) {
|
||||
if (name.equalsIgnoreCase("alias")) {
|
||||
this.setAlias(value);
|
||||
return true;
|
||||
}
|
||||
if (name.equalsIgnoreCase("respawn")) {
|
||||
this.setRespawnToWorld(value);
|
||||
return true;
|
||||
}
|
||||
if (name.equalsIgnoreCase("aliascolor") || name.equalsIgnoreCase("color")) {
|
||||
this.setAliasColor(value);
|
||||
return true;
|
||||
}
|
||||
if (name.equalsIgnoreCase("currency") || name.equalsIgnoreCase("curr")) {
|
||||
try {
|
||||
int intValue = Integer.parseInt(value);
|
||||
this.setCurrency(intValue);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (name.equalsIgnoreCase("price")) {
|
||||
try {
|
||||
double doubValue = Double.parseDouble(value);
|
||||
return this.setPrice(doubValue);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
boolean boolValue = Boolean.parseBoolean(value);
|
||||
return this.setVariable(name, boolValue);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
double doubValue = Double.parseDouble(value);
|
||||
return this.setVariable(name, doubValue);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Environment getEnvironment() {
|
||||
return this.environment;
|
||||
}
|
||||
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public Long getSeed() {
|
||||
return this.seed;
|
||||
}
|
||||
|
||||
public void setSeed(Long seed) {
|
||||
this.seed = seed;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
if (this.alias == null || this.alias.length() == 0) {
|
||||
return this.name;
|
||||
}
|
||||
return this.alias;
|
||||
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
this.config.setProperty("worlds." + this.name + ".alias.name", alias);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
public Boolean allowAnimalSpawning() {
|
||||
return this.allowAnimals;
|
||||
}
|
||||
|
||||
private void setAnimals(Boolean animals) {
|
||||
this.allowAnimals = animals;
|
||||
// If animals are a boolean, then we can turn them on or off on the server
|
||||
// If there are ANY exceptions, there will be something spawning, so turn them on
|
||||
this.config.setProperty("worlds." + this.name + ".animals.spawn", animals);
|
||||
saveConfig();
|
||||
this.syncMobs();
|
||||
}
|
||||
|
||||
public List<String> getAnimalList() {
|
||||
return this.masterList.get("animals");
|
||||
}
|
||||
|
||||
public Boolean allowMonsterSpawning() {
|
||||
return this.allowMonsters;
|
||||
}
|
||||
|
||||
private void setMonsters(Boolean monsters) {
|
||||
this.allowMonsters = monsters;
|
||||
// If monsters are a boolean, then we can turn them on or off on the server
|
||||
// If there are ANY exceptions, there will be something spawning, so turn them on
|
||||
this.config.setProperty("worlds." + this.name + ".monsters.spawn", monsters);
|
||||
saveConfig();
|
||||
this.syncMobs();
|
||||
}
|
||||
|
||||
public List<String> getMonsterList() {
|
||||
return this.masterList.get("monsters");
|
||||
}
|
||||
|
||||
public Boolean getPvp() {
|
||||
return this.pvp;
|
||||
}
|
||||
|
||||
public void setPvp(Boolean pvp) {
|
||||
this.fakepvp = this.plugin.getConfig().getBoolean("fakepvp", false);
|
||||
if (this.fakepvp) {
|
||||
this.world.setPVP(true);
|
||||
} else {
|
||||
this.world.setPVP(pvp);
|
||||
}
|
||||
this.pvp = pvp;
|
||||
this.config.setProperty("worlds." + this.name + ".pvp", pvp);
|
||||
saveConfig();
|
||||
|
||||
}
|
||||
|
||||
public List<Integer> getBlockBlacklist() {
|
||||
return this.blockBlacklist;
|
||||
}
|
||||
|
||||
public List<String> getWorldBlacklist() {
|
||||
return this.masterList.get("worldblacklist");
|
||||
}
|
||||
|
||||
public Double getScaling() {
|
||||
return this.scaling;
|
||||
}
|
||||
|
||||
public void setScaling(Double scaling) {
|
||||
if (scaling <= 0) {
|
||||
// Disallow negative or 0 scalings.
|
||||
scaling = 1.0;
|
||||
}
|
||||
this.scaling = scaling;
|
||||
this.config.setProperty("worlds." + this.name + ".scaling", scaling);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the chat color from a string.
|
||||
*
|
||||
* @param aliasColor
|
||||
*/
|
||||
public void setAliasColor(String aliasColor) {
|
||||
EnglishChatColor color = EnglishChatColor.fromString(aliasColor);
|
||||
if (color == null) {
|
||||
color = EnglishChatColor.WHITE;
|
||||
}
|
||||
this.aliasColor = color.getColor();
|
||||
this.config.setProperty("worlds." + this.name + ".alias.color", color.getText());
|
||||
saveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
public boolean isValidAliasColor(String aliasColor) {
|
||||
return (EnglishChatColor.fromString(aliasColor) != null);
|
||||
}
|
||||
|
||||
public ChatColor getAliasColor() {
|
||||
return this.aliasColor;
|
||||
}
|
||||
|
||||
public boolean clearList(String property) {
|
||||
if (property.equalsIgnoreCase("blockblacklist")) {
|
||||
this.blockBlacklist.clear();
|
||||
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
|
||||
saveConfig();
|
||||
return true;
|
||||
} else if (this.masterList.containsKey(property)) {
|
||||
this.masterList.get(property).clear();
|
||||
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.masterList.get(property));
|
||||
this.syncMobs();
|
||||
saveConfig();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getFakePVP() {
|
||||
return this.fakepvp;
|
||||
}
|
||||
|
||||
public String getRespawnToWorld() {
|
||||
return this.respawnWorld;
|
||||
}
|
||||
|
||||
public void setRespawnToWorld(String respawnToWorld) {
|
||||
this.respawnWorld = respawnToWorld;
|
||||
this.config.setProperty("worlds." + this.name + ".respawnworld", respawnToWorld);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
public Permission getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
public int getCurrency() {
|
||||
return this.currency;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return this.price;
|
||||
}
|
||||
|
||||
private boolean setCurrency(int currency) {
|
||||
this.currency = currency;
|
||||
config.getInt("worlds." + this.name + ".entryfee.currency", currency);
|
||||
saveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean setPrice(double price) {
|
||||
this.price = price;
|
||||
config.setProperty("worlds." + this.name + ".entryfee.amount", price);
|
||||
saveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isExempt(Player p) {
|
||||
return (this.plugin.getPermissions().hasPermission(p, this.exempt.getName(), true));
|
||||
}
|
||||
|
||||
public Permission getExempt() {
|
||||
return this.exempt;
|
||||
}
|
||||
|
||||
private void saveConfig() {
|
||||
if (this.canSave) {
|
||||
this.config.save();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getWeatherEnabled() {
|
||||
return this.allowWeather;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,316 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.api.MVConfig;
|
||||
import com.onarandombox.MultiverseCore.event.MVDebugModeEvent;
|
||||
import me.main__.util.SerializationConfig.NoSuchPropertyException;
|
||||
import me.main__.util.SerializationConfig.Property;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
/**
|
||||
* Our configuration.
|
||||
*/
|
||||
public class MultiverseCoreConfiguration extends SerializationConfig implements MVConfig {
|
||||
private static MultiverseCoreConfiguration instance;
|
||||
|
||||
/**
|
||||
* Sets the statically saved instance.
|
||||
* @param instance The new instance.
|
||||
*/
|
||||
public static void setInstance(MultiverseCoreConfiguration instance) {
|
||||
MultiverseCoreConfiguration.instance = instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the static instance of config is set.
|
||||
*/
|
||||
public static boolean isSet() {
|
||||
return instance != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the statically saved instance.
|
||||
* @return The statically saved instance.
|
||||
*/
|
||||
@Deprecated
|
||||
public static MultiverseCoreConfiguration getInstance() {
|
||||
if (instance == null)
|
||||
throw new IllegalStateException("The instance wasn't set!");
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Property
|
||||
private volatile boolean enforceaccess;
|
||||
@Property
|
||||
private volatile boolean prefixchat;
|
||||
@Property
|
||||
private volatile String prefixchatformat;
|
||||
@Property
|
||||
private volatile boolean teleportintercept;
|
||||
@Property
|
||||
private volatile boolean firstspawnoverride;
|
||||
@Property
|
||||
private volatile boolean displaypermerrors;
|
||||
@Property
|
||||
private volatile int globaldebug;
|
||||
@Property
|
||||
private volatile boolean silentstart;
|
||||
@Property
|
||||
private volatile double version;
|
||||
@Property
|
||||
private volatile String firstspawnworld;
|
||||
@Property
|
||||
private volatile boolean defaultportalsearch;
|
||||
@Property
|
||||
private volatile int portalsearchradius;
|
||||
@Property
|
||||
private volatile boolean autopurge;
|
||||
@Property
|
||||
private volatile boolean idonotwanttodonate;
|
||||
|
||||
public MultiverseCoreConfiguration() {
|
||||
super();
|
||||
MultiverseCoreConfiguration.setInstance(this);
|
||||
}
|
||||
|
||||
public MultiverseCoreConfiguration(Map<String, Object> values) {
|
||||
super(values);
|
||||
MultiverseCoreConfiguration.setInstance(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void setDefaults() {
|
||||
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
enforceaccess = false;
|
||||
prefixchat = false;
|
||||
prefixchatformat = "[%world%]%chat%";
|
||||
teleportintercept = true;
|
||||
firstspawnoverride = true;
|
||||
displaypermerrors = true;
|
||||
globaldebug = 0;
|
||||
this.version = 2.9;
|
||||
silentstart = false;
|
||||
defaultportalsearch = true;
|
||||
portalsearchradius = 128;
|
||||
autopurge = true;
|
||||
idonotwanttodonate = false;
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setConfigProperty(String property, String value) {
|
||||
try {
|
||||
return this.setProperty(property, value, true);
|
||||
} catch (NoSuchPropertyException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// And here we go:
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getEnforceAccess() {
|
||||
return this.enforceaccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setEnforceAccess(boolean enforceAccess) {
|
||||
this.enforceaccess = enforceAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getPrefixChat() {
|
||||
return this.prefixchat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPrefixChat(boolean prefixChat) {
|
||||
this.prefixchat = prefixChat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getPrefixChatFormat() {
|
||||
return this.prefixchatformat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPrefixChatFormat(String prefixChatFormat) {
|
||||
this.prefixchatformat = prefixChatFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getTeleportIntercept() {
|
||||
return this.teleportintercept;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setTeleportIntercept(boolean teleportIntercept) {
|
||||
this.teleportintercept = teleportIntercept;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getFirstSpawnOverride() {
|
||||
return this.firstspawnoverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setFirstSpawnOverride(boolean firstSpawnOverride) {
|
||||
this.firstspawnoverride = firstSpawnOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getDisplayPermErrors() {
|
||||
return this.displaypermerrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDisplayPermErrors(boolean displayPermErrors) {
|
||||
this.displaypermerrors = displayPermErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getGlobalDebug() {
|
||||
return this.globaldebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setGlobalDebug(int globalDebug) {
|
||||
this.globaldebug = globalDebug;
|
||||
Logging.setDebugLevel(globalDebug);
|
||||
Bukkit.getPluginManager().callEvent(new MVDebugModeEvent(globalDebug));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public double getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getFirstSpawnWorld() {
|
||||
return this.firstspawnworld;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setFirstSpawnWorld(String firstSpawnWorld) {
|
||||
this.firstspawnworld = firstSpawnWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSilentStart(boolean silentStart) {
|
||||
Logging.setShowingConfig(!silentStart);
|
||||
this.silentstart = silentStart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSilentStart() {
|
||||
return silentstart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseDefaultPortalSearch(boolean useDefaultPortalSearch) {
|
||||
defaultportalsearch = useDefaultPortalSearch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsingDefaultPortalSearch() {
|
||||
return defaultportalsearch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalSearchRadius(int searchRadius) {
|
||||
this.portalsearchradius = searchRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPortalSearchRadius() {
|
||||
return portalsearchradius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoPurgeEnabled() {
|
||||
return autopurge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoPurgeEnabled(boolean autopurge) {
|
||||
this.autopurge = autopurge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowingDonateMessage() {
|
||||
return !idonotwanttodonate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowDonateMessage(boolean showDonateMessage) {
|
||||
this.idonotwanttodonate = !showDonateMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.anchor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Manages anchors.
|
||||
*/
|
||||
public class AnchorManager {
|
||||
private MultiverseCore plugin;
|
||||
private Map<String, Location> anchors;
|
||||
private FileConfiguration anchorConfig;
|
||||
|
||||
public AnchorManager(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
this.anchors = new HashMap<String, Location>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all anchors.
|
||||
*/
|
||||
public void loadAnchors() {
|
||||
this.anchors = new HashMap<String, Location>();
|
||||
this.anchorConfig = YamlConfiguration.loadConfiguration(new File(this.plugin.getDataFolder(), "anchors.yml"));
|
||||
this.ensureConfigIsPrepared();
|
||||
ConfigurationSection anchorsSection = this.anchorConfig.getConfigurationSection("anchors");
|
||||
Set<String> anchorKeys = anchorsSection.getKeys(false);
|
||||
for (String key : anchorKeys) {
|
||||
//world:x,y,z:pitch:yaw
|
||||
Location anchorLocation = plugin.getLocationManipulation().stringToLocation(anchorsSection.getString(key, ""));
|
||||
if (anchorLocation != null) {
|
||||
Logging.config("Loading anchor: '%s'...", key);
|
||||
this.anchors.put(key, anchorLocation);
|
||||
} else {
|
||||
Logging.warning("The location for anchor '%s' is INVALID.", key);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureConfigIsPrepared() {
|
||||
if (this.anchorConfig.getConfigurationSection("anchors") == null) {
|
||||
this.anchorConfig.createSection("anchors");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves all anchors.
|
||||
* @return True if all anchors were successfully saved.
|
||||
*/
|
||||
public boolean saveAnchors() {
|
||||
try {
|
||||
this.anchorConfig.save(new File(this.plugin.getDataFolder(), "anchors.yml"));
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
Logging.severe("Failed to save anchors.yml. Please check your file permissions.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link Location} associated with an anchor.
|
||||
* @param anchor The name of the anchor.
|
||||
* @return The {@link Location}.
|
||||
*/
|
||||
public Location getAnchorLocation(String anchor) {
|
||||
if (this.anchors.containsKey(anchor)) {
|
||||
return this.anchors.get(anchor);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves an anchor.
|
||||
* @param anchor The name of the anchor.
|
||||
* @param location The location of the anchor as string.
|
||||
* @return True if the anchor was successfully saved.
|
||||
*/
|
||||
public boolean saveAnchorLocation(String anchor, String location) {
|
||||
Location parsed = plugin.getLocationManipulation().stringToLocation(location);
|
||||
return parsed != null && this.saveAnchorLocation(anchor, parsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves an anchor.
|
||||
* @param anchor The name of the anchor.
|
||||
* @param l The {@link Location} of the anchor.
|
||||
* @return True if the anchor was successfully saved.
|
||||
*/
|
||||
public boolean saveAnchorLocation(String anchor, Location l) {
|
||||
if (l == null) {
|
||||
return false;
|
||||
}
|
||||
this.anchorConfig.set("anchors." + anchor, plugin.getLocationManipulation().locationToString(l));
|
||||
this.anchors.put(anchor, l);
|
||||
return this.saveAnchors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all anchors.
|
||||
* @return An unmodifiable {@link Set} containing all anchors.
|
||||
*/
|
||||
public Set<String> getAllAnchors() {
|
||||
return Collections.unmodifiableSet(this.anchors.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all anchors that the specified {@link Player} can access.
|
||||
* @param p The {@link Player}.
|
||||
* @return An unmodifiable {@link Set} containing all anchors the specified {@link Player} can access.
|
||||
*/
|
||||
public Set<String> getAnchors(Player p) {
|
||||
if (p == null) {
|
||||
return this.anchors.keySet();
|
||||
}
|
||||
Set<String> myAnchors = new HashSet<String>();
|
||||
for (String anchor : this.anchors.keySet()) {
|
||||
Location ancLoc = this.anchors.get(anchor);
|
||||
if (ancLoc == null) {
|
||||
continue;
|
||||
}
|
||||
MVWorld mvWorld = this.plugin.getMVWorldManager().getMVWorld(ancLoc.getWorld());
|
||||
if (mvWorld != null) {
|
||||
if (!this.plugin.getPlayerActionChecker().hasAccessToWorld(p, mvWorld).asBoolean()) {
|
||||
Logging.finer("Player '%s' does not have access to anchor '%s' in world '%s'.",
|
||||
p.getName(), anchor, mvWorld.getName());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
myAnchors.add(anchor);
|
||||
}
|
||||
return Collections.unmodifiableSet(myAnchors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the specified anchor.
|
||||
* @param s The name of the anchor.
|
||||
* @return True if the anchor was successfully deleted.
|
||||
*/
|
||||
public boolean deleteAnchor(String s) {
|
||||
if (this.anchors.containsKey(s)) {
|
||||
this.anchors.remove(s);
|
||||
this.anchorConfig.set("anchors." + s, null);
|
||||
return this.saveAnchors();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* this package contains the classes that are used for the anchor system.
|
||||
*/
|
||||
package com.onarandombox.MultiverseCore.anchor;
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* Used to get block/location-related information.
|
||||
*/
|
||||
public interface BlockSafety {
|
||||
/**
|
||||
* This function checks whether the block at the given coordinates are above air or not.
|
||||
* @param l The {@link Location} of the block.
|
||||
* @return True if the block at that {@link Location} is above air.
|
||||
*/
|
||||
boolean isBlockAboveAir(Location l);
|
||||
|
||||
/**
|
||||
* Checks if a player can spawn safely at the given coordinates.
|
||||
* @param world The {@link World}.
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param z The z-coordinate.
|
||||
* @return True if a player can spawn safely at the given coordinates.
|
||||
*/
|
||||
boolean playerCanSpawnHereSafely(World world, double x, double y, double z);
|
||||
|
||||
/**
|
||||
* This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air
|
||||
* etc. This also ensures there is enough space for a player to spawn!
|
||||
*
|
||||
* @param l The {@link Location}
|
||||
* @return Whether the player can spawn safely at the given {@link Location}
|
||||
*/
|
||||
boolean playerCanSpawnHereSafely(Location l);
|
||||
|
||||
/**
|
||||
* Gets a safe bed spawn location OR null if the bed is invalid.
|
||||
* @param l The location of the bead head (block with the pillow on it).
|
||||
* @return Safe location around the bed or null if no location was found.
|
||||
*/
|
||||
Location getSafeBedSpawn(Location l);
|
||||
|
||||
/**
|
||||
* Gets the location of the top block at the specified {@link Location}.
|
||||
* @param l Any {@link Location}.
|
||||
* @return The {@link Location} of the top-block.
|
||||
*/
|
||||
Location getTopBlock(Location l);
|
||||
|
||||
/**
|
||||
* Gets the location of the top block at the specified {@link Location}.
|
||||
* @param l Any {@link Location}.
|
||||
* @return The {@link Location} of the top-block.
|
||||
*/
|
||||
Location getBottomBlock(Location l);
|
||||
|
||||
/**
|
||||
* Checks if an entity would be on track at the specified {@link Location}.
|
||||
* @param l The {@link Location}.
|
||||
* @return True if an entity would be on tracks at the specified {@link Location}.
|
||||
*/
|
||||
boolean isEntitiyOnTrack(Location l);
|
||||
|
||||
/**
|
||||
* Checks if the specified {@link Minecart} can spawn safely.
|
||||
* @param cart The {@link Minecart}.
|
||||
* @return True if the minecart can spawn safely.
|
||||
*/
|
||||
boolean canSpawnCartSafely(Minecart cart);
|
||||
|
||||
/**
|
||||
* Checks if the specified {@link Vehicle} can spawn safely.
|
||||
* @param vehicle The {@link Vehicle}.
|
||||
* @return True if the vehicle can spawn safely.
|
||||
*/
|
||||
boolean canSpawnVehicleSafely(Vehicle vehicle);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface Destination<T extends DestinationInstance> {
|
||||
/**
|
||||
* Returns the identifier or prefix that is required for this destination.
|
||||
*
|
||||
* <p>Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
|
||||
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
|
||||
* Please check the wiki when adding a custom destination!</p>
|
||||
*
|
||||
* @return The identifier or prefix that is required for this destination.
|
||||
*/
|
||||
@NotNull String getIdentifier();
|
||||
|
||||
/**
|
||||
* Returns the destination instance for the given destination parameters.
|
||||
*
|
||||
* @param destinationParams The destination parameters. ex: p:MyPortal:nw
|
||||
* @return The destination instance, or null if the destination parameters are invalid.
|
||||
*/
|
||||
@Nullable T getDestinationInstance(@Nullable String destinationParams);
|
||||
|
||||
/**
|
||||
* Returns a list of possible destinations for the given destination parameters.
|
||||
*
|
||||
* @param issuer The command issuer.
|
||||
* @param destinationParams The destination parameters. ex: p:MyPortal:nw
|
||||
* @return A list of possible destinations.
|
||||
*/
|
||||
@NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer, @Nullable String destinationParams);
|
||||
|
||||
/**
|
||||
* Should the Multiverse SafeTeleporter be used?
|
||||
*
|
||||
* <p>If not, MV will blindly take people to the location specified.</p>
|
||||
*
|
||||
* @return True if the SafeTeleporter will be used, false if not.
|
||||
*/
|
||||
boolean checkTeleportSafety();
|
||||
|
||||
/**
|
||||
* Returns the teleporter to use for this destination.
|
||||
*
|
||||
* <p>By default, Multiverse will automatically use SafeTeleporter. If you want to use a different teleporter, you can
|
||||
* override this method.</p>
|
||||
*
|
||||
* @return The custom teleporter to use for this destination. Return null to use the default teleporter.
|
||||
*/
|
||||
@Nullable Teleporter getTeleporter();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface DestinationInstance {
|
||||
/**
|
||||
* Gets the exact location to teleport an entity to.
|
||||
*
|
||||
* @param teleportee The entity to teleport.
|
||||
* @return The location to teleport to.
|
||||
*/
|
||||
@Nullable Location getLocation(@NotNull Entity teleportee);
|
||||
|
||||
/**
|
||||
* Gets the velocity to apply to an entity after teleporting.
|
||||
*
|
||||
* @param teleportee The entity to teleport.
|
||||
* @return A vector representing the speed/direction the player should travel when arriving at the destination.
|
||||
*/
|
||||
@Nullable Vector getVelocity(@NotNull Entity teleportee);
|
||||
|
||||
/**
|
||||
* Gets the permission suffix to check for when teleporting to this destination.
|
||||
* This is used for finer per world/player permissions, such as "multiverse.teleport.self.worldname".
|
||||
*
|
||||
* <p>For example, if the destination is "w:world", the permission suffix is "world".</p>
|
||||
*
|
||||
* @return The permission suffix.
|
||||
*/
|
||||
@Nullable String getFinerPermissionSuffix();
|
||||
|
||||
/**
|
||||
* Serialises the destination instance to a savable string.
|
||||
*
|
||||
* <p>This is used when plugins save destinations to configuration,
|
||||
* and when the destination is displayed to the user.</p>
|
||||
*
|
||||
* @return The serialised destination instance.
|
||||
*/
|
||||
@NotNull String serialise();
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Used to manipulate locations.
|
||||
*/
|
||||
public interface LocationManipulation {
|
||||
/**
|
||||
* Convert a Location into a Colon separated string to allow us to store it in text.
|
||||
* <p>
|
||||
* WORLD:X,Y,Z:yaw:pitch
|
||||
* <p>
|
||||
* The corresponding String2Loc function is {@link #stringToLocation}
|
||||
*
|
||||
* @param location The Location to save.
|
||||
* @return The location as a string in this format: WORLD:x,y,z:yaw:pitch
|
||||
*/
|
||||
String locationToString(Location location);
|
||||
|
||||
/**
|
||||
* This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
|
||||
*
|
||||
* @param l The location to round to the block location
|
||||
* @return A rounded location.
|
||||
*/
|
||||
Location getBlockLocation(Location l);
|
||||
|
||||
/**
|
||||
* Returns a new location from a given string. The format is as follows:
|
||||
* <p>
|
||||
* WORLD:X,Y,Z:yaw:pitch
|
||||
* <p>
|
||||
* The corresponding Location2String function is {@link #stringToLocation}
|
||||
*
|
||||
* @param locationString The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
|
||||
* @return A new location defined by the string or null if the string was invalid.
|
||||
*/
|
||||
Location stringToLocation(String locationString);
|
||||
|
||||
/**
|
||||
* Returns a colored string with the coords.
|
||||
*
|
||||
* @param l The {@link Location}
|
||||
* @return The {@link String}
|
||||
*/
|
||||
String strCoords(Location l);
|
||||
|
||||
/**
|
||||
* Converts a location to a printable readable formatted string including pitch/yaw.
|
||||
*
|
||||
* @param l The {@link Location}
|
||||
* @return The {@link String}
|
||||
*/
|
||||
String strCoordsRaw(Location l);
|
||||
|
||||
/**
|
||||
* Return the NESW Direction a Location is facing.
|
||||
*
|
||||
* @param location The {@link Location}
|
||||
* @return The NESW Direction
|
||||
*/
|
||||
String getDirection(Location location);
|
||||
|
||||
/**
|
||||
* Returns the float yaw position for the given cardinal direction.
|
||||
*
|
||||
* @param orientation The cardinal direction
|
||||
* @return The yaw
|
||||
*/
|
||||
float getYaw(String orientation);
|
||||
|
||||
/**
|
||||
* Returns a speed float from a given vector.
|
||||
*
|
||||
* @param v The {@link Vector}
|
||||
* @return The speed
|
||||
*/
|
||||
float getSpeed(Vector v);
|
||||
|
||||
/**
|
||||
* Returns a translated vector from the given direction.
|
||||
*
|
||||
* @param v The old {@link Vector}
|
||||
* @param direction The new direction
|
||||
* @return The translated {@link Vector}
|
||||
*/
|
||||
Vector getTranslatedVector(Vector v, String direction);
|
||||
|
||||
/**
|
||||
* Returns the next Location that a {@link Vehicle} is traveling at.
|
||||
*
|
||||
* @param v The {@link Vehicle}
|
||||
* @return The {@link Location}
|
||||
*/
|
||||
Location getNextBlock(Vehicle v);
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
|
||||
/**
|
||||
* The configuration of MultiverseCore.
|
||||
*/
|
||||
public interface MVConfig extends ConfigurationSerializable {
|
||||
/**
|
||||
* Sets a property using a {@link String}.
|
||||
* @param property The name of the property.
|
||||
* @param value The value.
|
||||
* @return True on success, false if the operation failed.
|
||||
*/
|
||||
boolean setConfigProperty(String property, String value);
|
||||
|
||||
/**
|
||||
* Sets firstSpawnWorld.
|
||||
* @param firstSpawnWorld The new value.
|
||||
*/
|
||||
void setFirstSpawnWorld(String firstSpawnWorld);
|
||||
|
||||
/**
|
||||
* Gets firstSpawnWorld.
|
||||
* @return firstSpawnWorld.
|
||||
*/
|
||||
String getFirstSpawnWorld();
|
||||
|
||||
/**
|
||||
* Sets version.
|
||||
* @param version The new value.
|
||||
*/
|
||||
void setVersion(int version);
|
||||
|
||||
/**
|
||||
* Gets version.
|
||||
* @return version.
|
||||
*/
|
||||
double getVersion();
|
||||
|
||||
/**
|
||||
* Sets globalDebug.
|
||||
* @param globalDebug The new value.
|
||||
*/
|
||||
void setGlobalDebug(int globalDebug);
|
||||
|
||||
/**
|
||||
* Gets globalDebug.
|
||||
* @return globalDebug.
|
||||
*/
|
||||
int getGlobalDebug();
|
||||
|
||||
/**
|
||||
* Sets displayPermErrors.
|
||||
* @param displayPermErrors The new value.
|
||||
*/
|
||||
void setDisplayPermErrors(boolean displayPermErrors);
|
||||
|
||||
/**
|
||||
* Gets displayPermErrors.
|
||||
* @return displayPermErrors.
|
||||
*/
|
||||
boolean getDisplayPermErrors();
|
||||
|
||||
/**
|
||||
* Sets firstSpawnOverride.
|
||||
* @param firstSpawnOverride The new value.
|
||||
*/
|
||||
void setFirstSpawnOverride(boolean firstSpawnOverride);
|
||||
|
||||
/**
|
||||
* Gets firstSpawnOverride.
|
||||
* @return firstSpawnOverride.
|
||||
*/
|
||||
boolean getFirstSpawnOverride();
|
||||
|
||||
/**
|
||||
* Sets teleportIntercept.
|
||||
* @param teleportIntercept The new value.
|
||||
*/
|
||||
void setTeleportIntercept(boolean teleportIntercept);
|
||||
|
||||
/**
|
||||
* Gets teleportIntercept.
|
||||
* @return teleportIntercept.
|
||||
*/
|
||||
boolean getTeleportIntercept();
|
||||
|
||||
/**
|
||||
* Sets prefixChat.
|
||||
* @param prefixChat The new value.
|
||||
*/
|
||||
void setPrefixChat(boolean prefixChat);
|
||||
|
||||
/**
|
||||
* Gets prefixChat.
|
||||
* @return prefixChat.
|
||||
*/
|
||||
boolean getPrefixChat();
|
||||
|
||||
/**
|
||||
* Sets prefixChatFormat.
|
||||
* @param prefixChatFormat The new value.
|
||||
*/
|
||||
void setPrefixChatFormat(String prefixChatFormat);
|
||||
|
||||
/**
|
||||
* Gets prefixChatFormat.
|
||||
* @return prefixChatFormat.
|
||||
*/
|
||||
String getPrefixChatFormat();
|
||||
|
||||
/**
|
||||
* Sets enforceAccess.
|
||||
* @param enforceAccess The new value.
|
||||
*/
|
||||
void setEnforceAccess(boolean enforceAccess);
|
||||
|
||||
/**
|
||||
* Gets enforceAccess.
|
||||
* @return enforceAccess.
|
||||
*/
|
||||
boolean getEnforceAccess();
|
||||
|
||||
/**
|
||||
* Sets whether to suppress startup messages.
|
||||
*
|
||||
* @param silentStart true to suppress messages.
|
||||
*/
|
||||
void setSilentStart(boolean silentStart);
|
||||
|
||||
/**
|
||||
* Whether we are suppressing startup messages.
|
||||
*
|
||||
* @return true if we are suppressing startup messages.
|
||||
*/
|
||||
boolean getSilentStart();
|
||||
|
||||
/**
|
||||
* Sets whether or not to let Bukkit determine portal search radius on its own or if Multiverse should give input.
|
||||
*
|
||||
* @param useDefaultPortalSearch True to let Bukkit determine portal search radius on its own.
|
||||
*/
|
||||
void setUseDefaultPortalSearch(boolean useDefaultPortalSearch);
|
||||
|
||||
/**
|
||||
* Gets whether or not Bukkit will be determining portal search radius on its own or if Multiverse should help.
|
||||
*
|
||||
* @return True means Bukkit will use its own default values.
|
||||
*/
|
||||
boolean isUsingDefaultPortalSearch();
|
||||
|
||||
/**
|
||||
* Sets the radius at which vanilla style portals will be searched for to connect to worlds together.
|
||||
*
|
||||
* @param searchRadius The portal search radius.
|
||||
*/
|
||||
void setPortalSearchRadius(int searchRadius);
|
||||
|
||||
/**
|
||||
* Gets the radius at which vanilla style portals will be searched for to connect to worlds together.
|
||||
*
|
||||
* @return The portal search radius.
|
||||
*/
|
||||
int getPortalSearchRadius();
|
||||
|
||||
/**
|
||||
* Gets whether or not the automatic purge of entities is enabled.
|
||||
*
|
||||
* @return True if automatic purge is enabled.
|
||||
*/
|
||||
boolean isAutoPurgeEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether or not the automatic purge of entities is enabled.
|
||||
*
|
||||
* @param autopurge True if automatic purge should be enabled.
|
||||
*/
|
||||
void setAutoPurgeEnabled(boolean autopurge);
|
||||
|
||||
/**
|
||||
* Gets whether or not the donation/patreon messages are shown.
|
||||
*
|
||||
* @return True if donation/patreon messages should be shown.
|
||||
*/
|
||||
boolean isShowingDonateMessage();
|
||||
|
||||
/**
|
||||
* Sets whether or not the donation/patreon messages are shown.
|
||||
*
|
||||
* @param idonotwanttodonate True if donation/patreon messages should be shown.
|
||||
*/
|
||||
void setShowDonateMessage(boolean idonotwanttodonate);
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.anchor.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
|
||||
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
|
||||
import com.onarandombox.MultiverseCore.economy.MVEconomist;
|
||||
import com.onarandombox.MultiverseCore.teleportation.SimpleBlockSafety;
|
||||
import com.onarandombox.MultiverseCore.teleportation.SimpleLocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.teleportation.SimpleSafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
|
||||
import com.onarandombox.MultiverseCore.utils.player.PlayerActionChecker;
|
||||
|
||||
/**
|
||||
* Multiverse 2 Core API
|
||||
* <p>
|
||||
* This API contains a bunch of useful things you can get out of Multiverse in general!
|
||||
*/
|
||||
public interface MVCore extends MVPlugin {
|
||||
/**
|
||||
* Retrieves Multiverse's friendly economist. The economist can be used for dealing with economies without
|
||||
* worrying about any of the messy details.
|
||||
*
|
||||
* @return the economy manager for Multiverse.
|
||||
*/
|
||||
MVEconomist getEconomist();
|
||||
|
||||
/**
|
||||
* Reloads the Multiverse Configuration files:
|
||||
* worlds.yml and config.yml.
|
||||
*/
|
||||
void loadConfigs();
|
||||
|
||||
/**
|
||||
* Gets the {@link UnsafeCallWrapper} class.
|
||||
*
|
||||
* @return A non-null {@link UnsafeCallWrapper}.
|
||||
*/
|
||||
UnsafeCallWrapper getUnsafeCallWrapper();
|
||||
|
||||
/**
|
||||
* Multiverse uses {@link MVCommandManager} to make adding and using commands
|
||||
* a piece of cake.
|
||||
*
|
||||
* @return A non-null {@link MVCommandManager}.
|
||||
*/
|
||||
MVCommandManager getMVCommandManager();
|
||||
|
||||
/**
|
||||
* Gets the class responsible for loading many different destinations
|
||||
* on demand.
|
||||
*
|
||||
* @return A valid {@link DestinationsProvider}.
|
||||
*/
|
||||
DestinationsProvider getDestinationsProvider();
|
||||
|
||||
/**
|
||||
* Gets the primary class responsible for managing Multiverse Worlds.
|
||||
*
|
||||
* @return {@link MVWorldManager}.
|
||||
*/
|
||||
MVWorldManager getMVWorldManager();
|
||||
|
||||
/**
|
||||
* Saves the Multiverse-Config.
|
||||
*
|
||||
* @return Whether the Multiverse-Config was successfully saved
|
||||
*/
|
||||
boolean saveMVConfig();
|
||||
|
||||
/**
|
||||
* Saves all configs.
|
||||
*
|
||||
* @return Whether the config was successfully saved
|
||||
*/
|
||||
boolean saveAllConfigs();
|
||||
|
||||
/**
|
||||
* Gets the {@link AnchorManager}.
|
||||
*
|
||||
* @return The {@link AnchorManager}
|
||||
*/
|
||||
AnchorManager getAnchorManager();
|
||||
|
||||
/**
|
||||
* Decrements the number of plugins that have specifically hooked into core.
|
||||
*/
|
||||
void decrementPluginCount();
|
||||
|
||||
/**
|
||||
* Increments the number of plugins that have specifically hooked into core.
|
||||
*/
|
||||
void incrementPluginCount();
|
||||
|
||||
/**
|
||||
* Returns the number of plugins that have specifically hooked into core.
|
||||
*
|
||||
* @return The number if plugins that have hooked into core.
|
||||
*/
|
||||
int getPluginCount();
|
||||
|
||||
/**
|
||||
* Gets the {@link PlayerActionChecker} instance.
|
||||
*
|
||||
* @return The {@link PlayerActionChecker} instance.
|
||||
*/
|
||||
PlayerActionChecker getPlayerActionChecker();
|
||||
|
||||
/**
|
||||
* Gets the {@link BlockSafety} this {@link MVCore} is using.
|
||||
* @return The {@link BlockSafety} this {@link MVCore} is using.
|
||||
* @see BlockSafety
|
||||
* @see SimpleBlockSafety
|
||||
*/
|
||||
BlockSafety getBlockSafety();
|
||||
|
||||
/**
|
||||
* Sets the {@link BlockSafety} this {@link MVCore} is using.
|
||||
* @param blockSafety The new {@link BlockSafety}.
|
||||
* @see BlockSafety
|
||||
* @see SimpleBlockSafety
|
||||
*/
|
||||
void setBlockSafety(BlockSafety blockSafety);
|
||||
|
||||
/**
|
||||
* Gets the {@link LocationManipulation} this {@link MVCore} is using.
|
||||
* @return The {@link LocationManipulation} this {@link MVCore} is using.
|
||||
* @see LocationManipulation
|
||||
* @see SimpleLocationManipulation
|
||||
*/
|
||||
LocationManipulation getLocationManipulation();
|
||||
|
||||
/**
|
||||
* Sets the {@link LocationManipulation} this {@link MVCore} is using.
|
||||
* @param locationManipulation The new {@link LocationManipulation}.
|
||||
* @see LocationManipulation
|
||||
* @see SimpleLocationManipulation
|
||||
*/
|
||||
void setLocationManipulation(LocationManipulation locationManipulation);
|
||||
|
||||
/**
|
||||
* Gets the {@link SafeTTeleporter} this {@link MVCore} is using.
|
||||
* @return The {@link SafeTTeleporter} this {@link MVCore} is using.
|
||||
* @see SafeTTeleporter
|
||||
* @see SimpleSafeTTeleporter
|
||||
*/
|
||||
SafeTTeleporter getSafeTTeleporter();
|
||||
|
||||
/**
|
||||
* Sets the {@link SafeTTeleporter} this {@link MVCore} is using.
|
||||
* @param safeTTeleporter The new {@link SafeTTeleporter}.
|
||||
* @see SafeTTeleporter
|
||||
* @see SimpleSafeTTeleporter
|
||||
*/
|
||||
void setSafeTTeleporter(SafeTTeleporter safeTTeleporter);
|
||||
|
||||
/**
|
||||
* Gets the {@link MVConfig}.
|
||||
* @return The configuration.
|
||||
*/
|
||||
MVConfig getMVConfig();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
/**
|
||||
* This interface is implemented by every official Multiverse-plugin.
|
||||
*/
|
||||
public interface MVPlugin {
|
||||
/**
|
||||
* Gets the reference to MultiverseCore.
|
||||
*
|
||||
* @return A valid {@link com.onarandombox.MultiverseCore}.
|
||||
*/
|
||||
MVCore getCore();
|
||||
|
||||
/**
|
||||
* Allows Multiverse or a plugin to query another Multiverse plugin to see what version its protocol is. This
|
||||
* number
|
||||
* should change when something will break the code.
|
||||
*
|
||||
* @return The Integer protocol version.
|
||||
*/
|
||||
int getProtocolVersion();
|
||||
|
||||
/**
|
||||
* Parse the Authors Array into a readable String with ',' and 'and'.
|
||||
*
|
||||
* @return The readable authors-{@link String}
|
||||
*/
|
||||
String getAuthors();
|
||||
}
|
||||
@@ -0,0 +1,646 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
|
||||
import com.onarandombox.MultiverseCore.world.configuration.AddProperties;
|
||||
import com.onarandombox.MultiverseCore.world.configuration.AllowedPortalType;
|
||||
import com.onarandombox.MultiverseCore.world.configuration.EnglishChatColor;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* The API for a Multiverse Handled World.
|
||||
*/
|
||||
public interface MVWorld {
|
||||
/**
|
||||
* Returns the Bukkit world object that this world describes.
|
||||
*
|
||||
* @return A {@link World}
|
||||
*/
|
||||
World getCBWorld();
|
||||
|
||||
/**
|
||||
* Gets the name of this world. The name cannot be changed.
|
||||
* <p>
|
||||
* Note for plugin developers: Usually {@link #getAlias()}
|
||||
* is what you want to use instead of this method.
|
||||
*
|
||||
* @return The name of the world as a String.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the type of this world. As of 1.2 this will be:
|
||||
* FLAT, NORMAL or VERSION_1_1
|
||||
* <p>
|
||||
* This is <b>not</b> the generator.
|
||||
*
|
||||
* @return The Type of this world.
|
||||
*/
|
||||
WorldType getWorldType();
|
||||
|
||||
/**
|
||||
* Gets the environment of this world.
|
||||
*
|
||||
* @return A {@link org.bukkit.World.Environment}.
|
||||
*/
|
||||
World.Environment getEnvironment();
|
||||
|
||||
/**
|
||||
* Sets the environment of a world.
|
||||
* <p>
|
||||
* Note: This will ONLY take effect once the world is unloaded/reloaded.
|
||||
*
|
||||
* @param environment A {@link org.bukkit.World.Environment}.
|
||||
*/
|
||||
void setEnvironment(World.Environment environment);
|
||||
|
||||
/**
|
||||
* Gets the difficulty of this world.
|
||||
*
|
||||
* @return The difficulty of this world.
|
||||
*/
|
||||
Difficulty getDifficulty();
|
||||
|
||||
/**
|
||||
* Sets the difficulty of this world and returns true if success.
|
||||
* Valid string values are either an integer of difficulty(0-3) or
|
||||
* the name that resides in the Bukkit enum, ex. {@code PEACEFUL}
|
||||
*
|
||||
* @param difficulty The difficulty to set the world to as a string.
|
||||
* @return True if success, false if the provided string
|
||||
* could not be translated to a difficulty.
|
||||
* @deprecated Use {@link #setDifficulty(Difficulty)} or, if you have to
|
||||
* pass a string, use {@link #setPropertyValue(String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setDifficulty(String difficulty);
|
||||
|
||||
/**
|
||||
* Sets the difficulty of this world and returns {@code true} on success.
|
||||
* Valid string values are either an integer of difficulty(0-3) or
|
||||
* the name that resides in the Bukkit enum, ex. PEACEFUL
|
||||
*
|
||||
* @param difficulty The new difficulty.
|
||||
* @return True if success, false if the operation failed... for whatever reason.
|
||||
*/
|
||||
boolean setDifficulty(Difficulty difficulty);
|
||||
|
||||
/**
|
||||
* Gets the world seed of this world.
|
||||
*
|
||||
* @return The Long version of the seed.
|
||||
*/
|
||||
long getSeed();
|
||||
|
||||
/**
|
||||
* Sets the seed of this world.
|
||||
*
|
||||
* @param seed A Long that is the seed.
|
||||
*/
|
||||
void setSeed(long seed);
|
||||
|
||||
/**
|
||||
* Gets the generator of this world.
|
||||
*
|
||||
* @return The name of the generator.
|
||||
*/
|
||||
String getGenerator();
|
||||
|
||||
/**
|
||||
* Sets the generator of this world.
|
||||
*
|
||||
* @param generator The new generator's name.
|
||||
*/
|
||||
void setGenerator(String generator);
|
||||
|
||||
/**
|
||||
* Gets the help-message for a property.
|
||||
* @param property The name of the property.
|
||||
* @return The help-message.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found.
|
||||
*/
|
||||
String getPropertyHelp(String property) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Gets a property as {@link String}.
|
||||
*
|
||||
* @param property The name of a world property to get.
|
||||
* @return The string-representation of that property.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
*/
|
||||
String getPropertyValue(String property) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Sets a property to a given value.
|
||||
*
|
||||
* @param property The name of a world property to set.
|
||||
* @param value A value in string representation, it will be parsed to the correct type.
|
||||
* @return True if the value was set, false if not.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
*/
|
||||
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Adds a value to the given property. The property must be a {@link AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link AddProperties} to add a value to.
|
||||
* @param value A value in string representation, it will be parsed to the correct type.
|
||||
* @return True if the value was added, false if not.
|
||||
* @deprecated We changed the entire world-config-system. This is not compatible any more.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean addToVariable(String property, String value);
|
||||
|
||||
/**
|
||||
* Removes a value from the given property. The property must be a {@link AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link AddProperties} to remove a value
|
||||
* from.
|
||||
* @param value A value in string representation, it will be parsed to the correct type.
|
||||
* @return True if the value was removed, false if not.
|
||||
* @deprecated We changed the entire world-config-system. This is not compatible any more.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean removeFromVariable(String property, String value);
|
||||
|
||||
/**
|
||||
* Removes all values from the given property. The property must be a {@link AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link AddProperties} to clear.
|
||||
* @return True if it was cleared, false if not.
|
||||
* @deprecated We changed the entire world-config-system. This is not compatible any more.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean clearVariable(String property);
|
||||
|
||||
/**
|
||||
* Clears a list property (sets it to []).
|
||||
*
|
||||
* @param property The property to clear.
|
||||
* @return True if success, false if fail.
|
||||
* @deprecated We changed the entire world-config-system. This is not compatible any more.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean clearList(String property);
|
||||
// end of old config stuff
|
||||
|
||||
/**
|
||||
* Gets the alias of this world.
|
||||
* <p>
|
||||
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
|
||||
*
|
||||
* @return The alias of the world as a String.
|
||||
*/
|
||||
String getAlias();
|
||||
|
||||
/**
|
||||
* Sets the alias of the world.
|
||||
*
|
||||
* @param alias A string that is the new alias.
|
||||
*/
|
||||
void setAlias(String alias);
|
||||
|
||||
/**
|
||||
* Gets the color that this world's name/alias will display as.
|
||||
*
|
||||
* @return The color of this world.
|
||||
*/
|
||||
ChatColor getColor();
|
||||
|
||||
/**
|
||||
* Sets the color that this world's name/alias will display as.
|
||||
*
|
||||
* @param color A valid color name.
|
||||
* @return True if the color was set, false if not.
|
||||
*/
|
||||
boolean setColor(String color);
|
||||
|
||||
/**
|
||||
* Gets the style that this world's name/alias will display as.
|
||||
*
|
||||
* @return The style of this world. {@code null} for "normal" style.
|
||||
*/
|
||||
ChatColor getStyle();
|
||||
|
||||
/**
|
||||
* Sets the style that this world's name/alias will display as.
|
||||
*
|
||||
* @param style A valid style name.
|
||||
* @return True if the style was set, false if not.
|
||||
*/
|
||||
boolean setStyle(String style);
|
||||
|
||||
/**
|
||||
* Tells you if someone entered a valid color.
|
||||
*
|
||||
* @param color A string that may translate to a color.
|
||||
* @return True if it is a color, false if not.
|
||||
*
|
||||
* @deprecated This has been moved: {@link EnglishChatColor#isValidAliasColor(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isValidAliasColor(String color);
|
||||
|
||||
/**
|
||||
* Returns a very nicely colored string (using Alias and Color if they are set).
|
||||
*
|
||||
* @return A nicely colored string.
|
||||
*/
|
||||
String getColoredWorldString();
|
||||
|
||||
// animals&monster stuff
|
||||
/**
|
||||
* Gets whether or not animals are allowed to spawn in this world.
|
||||
*
|
||||
* @return True if ANY animal can, false if no animals can spawn.
|
||||
*/
|
||||
boolean canAnimalsSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not animals can spawn.
|
||||
* If there are values in {@link #getAnimalList()} and this is false,
|
||||
* those animals become the exceptions, and will spawn
|
||||
*
|
||||
* @param allowAnimalSpawn True to allow spawning of monsters, false to prevent.
|
||||
*/
|
||||
void setAllowAnimalSpawn(boolean allowAnimalSpawn);
|
||||
|
||||
/**
|
||||
* Returns a list of animals. This list always negates the {@link #canAnimalsSpawn()} result.
|
||||
*
|
||||
* @return A list of animals that will spawn if {@link #canAnimalsSpawn()} is false.
|
||||
*/
|
||||
List<String> getAnimalList();
|
||||
|
||||
/**
|
||||
* Gets whether or not monsters are allowed to spawn in this world.
|
||||
*
|
||||
* @return True if ANY monster can, false if no monsters can spawn.
|
||||
*/
|
||||
boolean canMonstersSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not monsters can spawn.
|
||||
* If there are values in {@link #getMonsterList()} and this is false,
|
||||
* those monsters become the exceptions, and will spawn
|
||||
*
|
||||
* @param allowMonsterSpawn True to allow spawning of monsters, false to prevent.
|
||||
*/
|
||||
void setAllowMonsterSpawn(boolean allowMonsterSpawn);
|
||||
|
||||
/**
|
||||
* Returns a list of monsters. This list always negates the {@link #canMonstersSpawn()} result.
|
||||
*
|
||||
* @return A list of monsters that will spawn if {@link #canMonstersSpawn()} is false.
|
||||
*/
|
||||
List<String> getMonsterList();
|
||||
// end of animal&monster stuff
|
||||
|
||||
/**
|
||||
* Gets whether or not PVP is enabled in this world in some form (fake or not).
|
||||
*
|
||||
* @return True if players can take damage from other players.
|
||||
*/
|
||||
boolean isPVPEnabled();
|
||||
|
||||
/**
|
||||
* Turn pvp on or off. This setting is used to set the world's PVP mode.
|
||||
*
|
||||
* @param pvpMode True to enable PVP damage, false to disable it.
|
||||
*/
|
||||
void setPVPMode(boolean pvpMode);
|
||||
|
||||
/**
|
||||
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
|
||||
*
|
||||
* @return True if this world has fakepvp on
|
||||
* @deprecated This is deprecated.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean getFakePVP();
|
||||
|
||||
/**
|
||||
* Gets whether or not this world will display in chat, mvw and mvl regardless if a user has the
|
||||
* access permissions to go to this world.
|
||||
*
|
||||
* @return True if the world will be hidden, false if not.
|
||||
*/
|
||||
boolean isHidden();
|
||||
|
||||
/**
|
||||
* Sets whether or not this world will display in chat, mvw and mvl regardless if a user has the
|
||||
* access permissions to go to this world.
|
||||
*
|
||||
* @param hidden Set
|
||||
*/
|
||||
void setHidden(boolean hidden);
|
||||
|
||||
/**
|
||||
* Gets whether weather is enabled in this world.
|
||||
*
|
||||
* @return True if weather events will occur, false if not.
|
||||
*/
|
||||
boolean isWeatherEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether or not there will be weather events in a given world.
|
||||
* If set to false, Multiverse will disable the weather in the world immediately.
|
||||
*
|
||||
* @param enableWeather True if weather events should occur in a world, false if not.
|
||||
*/
|
||||
void setEnableWeather(boolean enableWeather);
|
||||
|
||||
/**
|
||||
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
|
||||
*
|
||||
* @return True if CraftBukkit is keeping spawn chunks in memory.
|
||||
*/
|
||||
boolean isKeepingSpawnInMemory();
|
||||
|
||||
/**
|
||||
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
|
||||
* If not, CraftBukkit will attempt to free memory when players have not used that world.
|
||||
* This will not happen immediately.
|
||||
*
|
||||
* @param keepSpawnInMemory If true, CraftBukkit will keep the spawn chunks loaded in memory.
|
||||
*/
|
||||
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
|
||||
|
||||
/**
|
||||
* Gets the spawn location of this world.
|
||||
*
|
||||
* @return The spawn location of this world.
|
||||
*/
|
||||
Location getSpawnLocation();
|
||||
|
||||
/**
|
||||
* Sets the spawn location for a world.
|
||||
*
|
||||
* @param spawnLocation The spawn location for a world.
|
||||
*/
|
||||
void setSpawnLocation(Location spawnLocation);
|
||||
|
||||
/**
|
||||
* Gets whether or not the hunger level of players will go down in a world.
|
||||
*
|
||||
* @return True if it will go down, false if it will remain steady.
|
||||
*/
|
||||
boolean getHunger();
|
||||
|
||||
/**
|
||||
* Sets whether or not the hunger level of players will go down in a world.
|
||||
*
|
||||
* @param hungerEnabled True if hunger will go down, false to keep it at
|
||||
* the level they entered a world with.
|
||||
*/
|
||||
void setHunger(boolean hungerEnabled);
|
||||
|
||||
/**
|
||||
* Gets the GameMode of this world.
|
||||
*
|
||||
* @return The GameMode of this world.
|
||||
*/
|
||||
GameMode getGameMode();
|
||||
|
||||
/**
|
||||
* Sets the game mode of this world.
|
||||
*
|
||||
* @param gameMode A valid game mode string (either
|
||||
* an int ex. 0 or a string ex. creative).
|
||||
* @return True if the game mode was successfully changed, false if not.
|
||||
* @deprecated Use {@link #setGameMode(GameMode)} instead. If you have to
|
||||
* pass a string, use {@link #setPropertyValue(String, String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setGameMode(String gameMode);
|
||||
|
||||
/**
|
||||
* Sets the game mode of this world.
|
||||
*
|
||||
* @param gameMode The new {@link GameMode}.
|
||||
* @return True if the game mode was successfully changed, false if not.
|
||||
*/
|
||||
boolean setGameMode(GameMode gameMode);
|
||||
|
||||
/**
|
||||
* Gets the amount of currency it requires to enter this world.
|
||||
*
|
||||
* @return The amount it costs to enter this world.
|
||||
*/
|
||||
double getPrice();
|
||||
|
||||
/**
|
||||
* Sets the price for entry to this world.
|
||||
* You can think of this like an amount.
|
||||
* The type can be set with {@link #setCurrency(Material)}
|
||||
*
|
||||
* @param price The Amount of money/item to enter the world.
|
||||
*/
|
||||
void setPrice(double price);
|
||||
|
||||
/**
|
||||
* Gets the type of currency that will be used when users enter this world. A value of null indicates a non-item
|
||||
* based currency is used.
|
||||
*
|
||||
* @return The type of currency that will be used when users enter this world.
|
||||
*/
|
||||
@Nullable
|
||||
Material getCurrency();
|
||||
|
||||
/**
|
||||
* Sets the type of item that will be required given the price is not 0.
|
||||
* Use a value of null to specify a non-item based currency.
|
||||
*
|
||||
* @param item The Type of currency that will be used when users enter this world.
|
||||
*/
|
||||
void setCurrency(@Nullable Material item);
|
||||
|
||||
/**
|
||||
* Gets the world players will respawn in if they die in this one.
|
||||
*
|
||||
* @return A world that exists on the server.
|
||||
*/
|
||||
World getRespawnToWorld();
|
||||
|
||||
/**
|
||||
* Sets the world players will respawn in if they die in this one.
|
||||
* Returns true upon success, false upon failure.
|
||||
*
|
||||
* @param respawnWorld The name of a world that exists on the server.
|
||||
* @return True if respawnWorld existed, false if not.
|
||||
*/
|
||||
boolean setRespawnToWorld(String respawnWorld);
|
||||
|
||||
/**
|
||||
* Gets the scaling value of this world.Really only has an effect if you use
|
||||
* Multiverse-NetherPortals.
|
||||
*
|
||||
* @return This world's non-negative, non-zero scale.
|
||||
*/
|
||||
double getScaling();
|
||||
|
||||
/**
|
||||
* Sets the scale of this world. Really only has an effect if you use
|
||||
* Multiverse-NetherPortals.
|
||||
*
|
||||
* @param scaling A scaling value, cannot be negative or 0.
|
||||
* @return Whether the scale was set successfully.
|
||||
*/
|
||||
boolean setScaling(double scaling);
|
||||
|
||||
/**
|
||||
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
*
|
||||
* @return True if the world should heal (default), false if not.
|
||||
*/
|
||||
boolean getAutoHeal();
|
||||
|
||||
/**
|
||||
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
*
|
||||
* @param heal True if the world will heal.
|
||||
*/
|
||||
void setAutoHeal(boolean heal);
|
||||
|
||||
/**
|
||||
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
*
|
||||
* @return True if Multiverse should adjust the spawn, false if not.
|
||||
*/
|
||||
boolean getAdjustSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
*
|
||||
* @param adjust True if multiverse should adjust the spawn, false if not.
|
||||
*/
|
||||
void setAdjustSpawn(boolean adjust);
|
||||
|
||||
/**
|
||||
* Gets whether or not Multiverse should auto-load this world.
|
||||
*
|
||||
* @return True if Multiverse should auto-load this world.
|
||||
*/
|
||||
boolean getAutoLoad();
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-load this world.
|
||||
* <p>
|
||||
* True is default.
|
||||
*
|
||||
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
|
||||
*/
|
||||
void setAutoLoad(boolean autoLoad);
|
||||
|
||||
/**
|
||||
* Gets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
*
|
||||
* @return True if players dying in this world should respawn at their bed.
|
||||
*/
|
||||
boolean getBedRespawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
* <p>
|
||||
* True is default.
|
||||
*
|
||||
* @param autoLoad True if players dying in this world respawn at their bed.
|
||||
*/
|
||||
void setBedRespawn(boolean autoLoad);
|
||||
|
||||
/**
|
||||
* Sets the player limit for this world after which players without an override
|
||||
* permission node will not be allowed in. A value of -1 or less signifies no limit
|
||||
*
|
||||
* @param limit The new limit
|
||||
*/
|
||||
void setPlayerLimit(int limit);
|
||||
|
||||
/**
|
||||
* Gets the player limit for this world after which players without an override
|
||||
* permission node will not be allowed in. A value of -1 or less signifies no limit
|
||||
*
|
||||
* @return The player limit
|
||||
*/
|
||||
int getPlayerLimit();
|
||||
|
||||
/**
|
||||
* Same as {@link #getTime()}, but returns a string.
|
||||
* @return The time as a short string: 12:34pm
|
||||
*/
|
||||
String getTime();
|
||||
|
||||
/**
|
||||
* Sets the current time in a world.
|
||||
* <p>
|
||||
* This method will take the following formats:
|
||||
* 11:37am
|
||||
* 4:30p
|
||||
* day(morning), night, noon, midnight
|
||||
*
|
||||
* @param timeAsString The formatted time to set the world to.
|
||||
* @return True if the time was set, false if not.
|
||||
*/
|
||||
boolean setTime(String timeAsString);
|
||||
|
||||
/**
|
||||
* Sets The types of portals that are allowed in this world.
|
||||
*
|
||||
* @param type The type of portals allowed in this world.
|
||||
*/
|
||||
void allowPortalMaking(AllowedPortalType type);
|
||||
|
||||
/**
|
||||
* Gets which type(s) of portals are allowed to be constructed in this world.
|
||||
*
|
||||
* @return The type of portals that are allowed.
|
||||
*/
|
||||
AllowedPortalType getAllowedPortals();
|
||||
|
||||
// properties that are not "getter+setter" style
|
||||
/**
|
||||
* Gets a list of all the worlds that players CANNOT travel to from this world,
|
||||
* regardless of their access permissions.
|
||||
*
|
||||
* @return A List of world names.
|
||||
*/
|
||||
List<String> getWorldBlacklist();
|
||||
|
||||
/**
|
||||
* Gets all the names of all properties that can be SET.
|
||||
*
|
||||
* @return All property names, with alternating colors.
|
||||
*/
|
||||
String getAllPropertyNames();
|
||||
|
||||
/**
|
||||
* Whether or not players are allowed to fly in this world.
|
||||
*
|
||||
* @return True if players allowed to fly in this world.
|
||||
*/
|
||||
boolean getAllowFlight();
|
||||
|
||||
/**
|
||||
* Sets whether or not players are allowed to fly in this world.
|
||||
*
|
||||
* @param allowFlight True to allow flight in this world.
|
||||
*/
|
||||
void setAllowFlight(final boolean allowFlight);
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.onarandombox.MultiverseCore.world.SimpleWorldPurger;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
/**
|
||||
* Multiverse 2 World Manager API
|
||||
* <p>
|
||||
* This API contains all of the world managing
|
||||
* functions that your heart desires!
|
||||
*/
|
||||
public interface MVWorldManager {
|
||||
/**
|
||||
* Add a new World to the Multiverse Setup.
|
||||
*
|
||||
* @param name World Name
|
||||
* @param env Environment Type
|
||||
* @param seedString The seed in the form of a string.
|
||||
* If the seed is a Long,
|
||||
* it will be interpreted as such.
|
||||
* @param type The Type of the world to be made.
|
||||
* @param generateStructures If true, this world will get NPC villages.
|
||||
* @param generator The Custom generator plugin to use.
|
||||
* @return True if the world is added, false if not.
|
||||
*/
|
||||
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
|
||||
String generator);
|
||||
|
||||
/**
|
||||
* Add a new World to the Multiverse Setup.
|
||||
*
|
||||
* @param name World Name
|
||||
* @param env Environment Type
|
||||
* @param seedString The seed in the form of a string.
|
||||
* If the seed is a Long,
|
||||
* it will be interpreted as such.
|
||||
* @param type The Type of the world to be made.
|
||||
* @param generateStructures If true, this world will get NPC villages.
|
||||
* @param generator The Custom generator plugin to use.
|
||||
* @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.
|
||||
* @return True if the world is added, false if not.
|
||||
*/
|
||||
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
|
||||
String generator, boolean useSpawnAdjust);
|
||||
|
||||
/**
|
||||
* Make a copy of a world.
|
||||
*
|
||||
* @param oldName
|
||||
* Name of world to be copied
|
||||
* @param newName
|
||||
* Name of world to be created
|
||||
* @return True if the world is copied successfully, false if not.
|
||||
*/
|
||||
boolean cloneWorld(String oldName, String newName);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the config and deletes
|
||||
* the folder.
|
||||
*
|
||||
* @param name
|
||||
* The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
boolean deleteWorld(String name);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the
|
||||
* config if wanted, and deletes the folder.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @param removeConfig If true(default), we'll remove the entries from the
|
||||
* config. If false, they'll stay and the world may come back.
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
boolean deleteWorld(String name, boolean removeConfig);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @param removeFromConfig If true(default), we'll remove the entries from the
|
||||
* config. If false, they'll stay and the world may come back.
|
||||
* @param deleteWorldFolder If true the world folder will be completely deleted. If false
|
||||
* only the contents of the world folder will be deleted
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
boolean deleteWorld(String name, boolean removeFromConfig, boolean deleteWorldFolder);
|
||||
|
||||
/**
|
||||
* Unload a world from Multiverse.
|
||||
*
|
||||
* @param name Name of the world to unload
|
||||
* @return True if the world was unloaded, false if not.
|
||||
*/
|
||||
boolean unloadWorld(String name);
|
||||
|
||||
/**
|
||||
* Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.
|
||||
*
|
||||
* @param name Name of the world to unload
|
||||
* @param unloadBukkit True if Bukkit world should be unloaded
|
||||
* @return True if the world was unloaded, false if not.
|
||||
*/
|
||||
boolean unloadWorld(String name, boolean unloadBukkit);
|
||||
|
||||
/**
|
||||
* Loads the world. Only use this if the world has been
|
||||
* unloaded with {@link #unloadWorld(String)}.
|
||||
*
|
||||
* @param name The name of the world to load
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
boolean loadWorld(String name);
|
||||
|
||||
/**
|
||||
* Removes all players from the specified world.
|
||||
*
|
||||
* @param name World to remove players from.
|
||||
*/
|
||||
void removePlayersFromWorld(String name);
|
||||
|
||||
/**
|
||||
* Test if a given chunk generator is valid.
|
||||
*
|
||||
* @param generator The generator name.
|
||||
* @param generatorID The generator id.
|
||||
* @param worldName The worldName to use as the default.
|
||||
* @return A {@link ChunkGenerator} or null
|
||||
*/
|
||||
ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName);
|
||||
|
||||
/**
|
||||
* Returns a list of all the worlds Multiverse knows about.
|
||||
*
|
||||
* @return A list of {@link MVWorld}.
|
||||
*/
|
||||
Collection<MVWorld> getMVWorlds();
|
||||
|
||||
|
||||
/**
|
||||
* Returns a {@link MVWorld} if it exists, and null if it does not.
|
||||
* This will search name AND alias.
|
||||
*
|
||||
* @param name The name or alias of the world to get.
|
||||
* @return A {@link MVWorld} or null.
|
||||
*/
|
||||
MVWorld getMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Returns a {@link MVWorld} if the world with name given exists, and null if it does not.
|
||||
* This will search optionally for alias names.
|
||||
*
|
||||
* @param name The name or optionally the alias of the world to get.
|
||||
* @param checkAliases Indicates whether to check for world alias name.
|
||||
* @return A {@link MVWorld} or null.
|
||||
*/
|
||||
MVWorld getMVWorld(String name, boolean checkAliases);
|
||||
|
||||
/**
|
||||
* Returns a {@link MVWorld} if it exists, and null if it does not.
|
||||
*
|
||||
* @param world The Bukkit world to check.
|
||||
* @return A {@link MVWorld} or null.
|
||||
*/
|
||||
MVWorld getMVWorld(World world);
|
||||
|
||||
/**
|
||||
* Checks to see if the given name is a valid {@link MVWorld}
|
||||
* Searches based on world name AND alias.
|
||||
*
|
||||
* @param name The name or alias of the world to check.
|
||||
* @return True if the world exists, false if not.
|
||||
*/
|
||||
boolean isMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Checks to see if the given name is a valid {@link MVWorld}.
|
||||
* Optionally searches by alias is specified.
|
||||
*
|
||||
* @param name The name or alias of the world to check.
|
||||
* @param checkAliases Indicates whether to check for world alias name.
|
||||
* @return True if the world exists, false if not.
|
||||
*/
|
||||
boolean isMVWorld(String name, boolean checkAliases);
|
||||
|
||||
/**
|
||||
* Checks to see if the given world is a valid {@link MVWorld}.
|
||||
*
|
||||
* @param world The Bukkit world to check.
|
||||
* @return True if the world has been loaded into MV2, false if not.
|
||||
*/
|
||||
boolean isMVWorld(World world);
|
||||
|
||||
/**
|
||||
* Load the Worlds & Settings from the configuration file.
|
||||
*
|
||||
* @param forceLoad If set to true, this will perform a total
|
||||
* reset and not just load new worlds.
|
||||
*/
|
||||
void loadWorlds(boolean forceLoad);
|
||||
|
||||
/**
|
||||
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
|
||||
* <p>
|
||||
* This way people will _always_ have some worlds in the list.
|
||||
*/
|
||||
void loadDefaultWorlds();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldPurger}.
|
||||
* <p>
|
||||
* @return The {@link WorldPurger} this {@link MVWorldManager} is using.
|
||||
* @see WorldPurger
|
||||
* @see SimpleWorldPurger
|
||||
*/
|
||||
WorldPurger getTheWorldPurger();
|
||||
|
||||
/**
|
||||
* Gets the world players will spawn in on first join.
|
||||
* Currently this always returns worlds.get(0) from Bukkit.
|
||||
*
|
||||
* @return A Multiverse world that players will spawn in or null if no MV world has been set.
|
||||
*/
|
||||
MVWorld getSpawnWorld();
|
||||
|
||||
/**
|
||||
* Gets the list of worlds in the config, but unloaded.
|
||||
*
|
||||
* @return A List of worlds as strings.
|
||||
*/
|
||||
List<String> getUnloadedWorlds();
|
||||
|
||||
/**
|
||||
* This method populates an internal list and needs to be called after multiverse initialization.
|
||||
*/
|
||||
void getDefaultWorldGenerators();
|
||||
|
||||
/**
|
||||
* Load the config from a file.
|
||||
*
|
||||
* @param file The file to load.
|
||||
* @return A loaded configuration.
|
||||
*/
|
||||
FileConfiguration loadWorldConfig(File file);
|
||||
|
||||
/**
|
||||
* Saves the world config to disk.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
boolean saveWorldsConfig();
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list and from the config.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
boolean removeWorldFromConfig(String name);
|
||||
|
||||
/**
|
||||
* Sets the initial spawn world for new players.
|
||||
*
|
||||
* @param world The World new players should spawn in.
|
||||
*/
|
||||
void setFirstSpawnWorld(String world);
|
||||
|
||||
/**
|
||||
* Gets the world players should spawn in first.
|
||||
*
|
||||
* @return The {@link MVWorld} new players should spawn in.
|
||||
*/
|
||||
MVWorld getFirstSpawnWorld();
|
||||
|
||||
/**
|
||||
* Regenerates a world.
|
||||
*
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed If the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed);
|
||||
|
||||
/**
|
||||
* Regenerates a world.
|
||||
*
|
||||
* @param name Name of the world to regenerate
|
||||
* @param useNewSeed If a new seed should be used
|
||||
* @param randomSeed If the new seed should be random
|
||||
* @param seed The seed of the world.
|
||||
* @param keepGameRules If GameRules should be kept on world regen.
|
||||
*
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed, boolean keepGameRules);
|
||||
|
||||
boolean isKeepingSpawnInMemory(World world);
|
||||
|
||||
/**
|
||||
* Checks whether Multiverse knows about a provided unloaded world. This
|
||||
* method will check the parameter against the alias mappings.
|
||||
*
|
||||
* @param name The name of the unloaded world
|
||||
* @param includeLoaded The value to return if the world is loaded
|
||||
*
|
||||
* @return True if the world exists and is unloaded. False if the world
|
||||
* does not exist. {@code includeLoaded} if the world exists and is loaded.
|
||||
*/
|
||||
boolean hasUnloadedWorld(String name, boolean includeLoaded);
|
||||
|
||||
/**
|
||||
* Get all the possible worlds that Multiverse has detected to be importable.
|
||||
*
|
||||
* @return A collection of world names that are deemed importable.
|
||||
*/
|
||||
Collection<String> getPotentialWorlds();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
|
||||
import com.onarandombox.MultiverseCore.teleportation.TeleportResult;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
/**
|
||||
* Used to safely teleport people.
|
||||
*/
|
||||
public interface SafeTTeleporter extends Teleporter {
|
||||
|
||||
/**
|
||||
* Gets the next safe location around the given location.
|
||||
* @param l A {@link Location}.
|
||||
* @return A safe {@link Location}.
|
||||
*/
|
||||
Location getSafeLocation(Location l);
|
||||
|
||||
/**
|
||||
* Gets the next safe location around the given location.
|
||||
* @param l A {@link Location}.
|
||||
* @param tolerance The tolerance.
|
||||
* @param radius The radius.
|
||||
* @return A safe {@link Location}.
|
||||
*/
|
||||
Location getSafeLocation(Location l, int tolerance, int radius);
|
||||
|
||||
/**
|
||||
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
|
||||
* it's not, will adjust the final destination accordingly.
|
||||
*
|
||||
* @param teleporter Person who performed the teleport command.
|
||||
* @param teleportee Entity to teleport
|
||||
* @param destination Destination to teleport them to
|
||||
* @return true for success, false for failure
|
||||
*/
|
||||
TeleportResult safelyTeleport(BukkitCommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination);
|
||||
|
||||
/**
|
||||
* Safely teleport the entity to the Location. This may perform checks to
|
||||
* see if the place is safe, and if
|
||||
* it's not, will adjust the final destination accordingly.
|
||||
*
|
||||
* @param teleporter Person who issued the teleport command.
|
||||
* @param teleportee Entity to teleport.
|
||||
* @param location Location to teleport them to.
|
||||
* @param safely Should the destination be checked for safety before teleport?
|
||||
* @return true for success, false for failure.
|
||||
*/
|
||||
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location,
|
||||
boolean safely);
|
||||
|
||||
/**
|
||||
* Returns a safe location for the entity to spawn at.
|
||||
*
|
||||
* @param entity The entity to spawn
|
||||
* @param destination The MVDestination to take the entity to.
|
||||
* @return A new location to spawn the entity at.
|
||||
*/
|
||||
Location getSafeLocation(Entity entity, DestinationInstance destination);
|
||||
|
||||
/**
|
||||
* Finds a portal-block next to the specified {@link Location}.
|
||||
* @param l The {@link Location}
|
||||
* @return The next portal-block's {@link Location}.
|
||||
*/
|
||||
Location findPortalBlockNextTo(Location l);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
|
||||
import com.onarandombox.MultiverseCore.teleportation.TeleportResult;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public interface Teleporter {
|
||||
/**
|
||||
* Teleport the entity to the Multiverse Destination.
|
||||
*
|
||||
* @param teleporter Person who performed the teleport command.
|
||||
* @param teleportee Entity to teleport
|
||||
* @param destination Destination to teleport them to
|
||||
* @return true for success, false for failure
|
||||
*/
|
||||
TeleportResult teleport(BukkitCommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
/**
|
||||
* Used to remove animals from worlds that don't belong there.
|
||||
*/
|
||||
public interface WorldPurger {
|
||||
/**
|
||||
* Synchronizes the given worlds with their settings.
|
||||
*
|
||||
* @param worlds A list of {@link MVWorld}
|
||||
*/
|
||||
void purgeWorlds(List<MVWorld> worlds);
|
||||
|
||||
/**
|
||||
* Convenience method for {@link #purgeWorld(MVWorld, java.util.List, boolean, boolean)} that takes the settings from the world-config.
|
||||
*
|
||||
* @param world The {@link MVWorld}.
|
||||
*/
|
||||
void purgeWorld(MVWorld world);
|
||||
|
||||
/**
|
||||
* Clear all animals/monsters that do not belong to a world according to the config.
|
||||
*
|
||||
* @param mvworld The {@link MVWorld}.
|
||||
* @param thingsToKill A {@link List} of animals/monsters to be killed.
|
||||
* @param negateAnimals Whether the monsters in the list should be negated.
|
||||
* @param negateMonsters Whether the animals in the list should be negated.
|
||||
*/
|
||||
void purgeWorld(MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
|
||||
boolean negateMonsters);
|
||||
|
||||
/**
|
||||
* Clear all animals/monsters that do not belong to a world according to the config.
|
||||
*
|
||||
* @param mvworld The {@link MVWorld}.
|
||||
* @param thingsToKill A {@link List} of animals/monsters to be killed.
|
||||
* @param negateAnimals Whether the monsters in the list should be negated.
|
||||
* @param negateMonsters Whether the animals in the list should be negated.
|
||||
* @param sender The {@link CommandSender} that initiated the action. He will/should be notified.
|
||||
*/
|
||||
void purgeWorld(MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
|
||||
boolean negateMonsters, CommandSender sender);
|
||||
|
||||
/**
|
||||
* Determines whether the specified creature should be killed.
|
||||
*
|
||||
* @param e The creature.
|
||||
* @param thingsToKill A {@link List} of animals/monsters to be killed.
|
||||
* @param negateAnimals Whether the monsters in the list should be negated.
|
||||
* @param negateMonsters Whether the animals in the list should be negated.
|
||||
* @return {@code true} if the creature should be killed, otherwise {@code false}.
|
||||
*/
|
||||
boolean shouldWeKillThisCreature(Entity e, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters);
|
||||
|
||||
/**
|
||||
* Determines whether the specified creature should be killed and automatically reads the params from a world object.
|
||||
*
|
||||
* @param w The world.
|
||||
* @param e The creature.
|
||||
* @return {@code true} if the creature should be killed, otherwise {@code false}.
|
||||
*/
|
||||
boolean shouldWeKillThisCreature(MVWorld w, Entity e);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.onarandombox.MultiverseCore.api.operation;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents one or more action result.
|
||||
*/
|
||||
public interface OperationResult {
|
||||
/**
|
||||
* Get the name of the result.
|
||||
*
|
||||
* @return The name of the result.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Check if the result is successful.
|
||||
*
|
||||
* @return true if the result is successful.
|
||||
*/
|
||||
boolean asBoolean();
|
||||
|
||||
/**
|
||||
* Check if the result is in the response.
|
||||
*
|
||||
* @param result The result to check.
|
||||
* @return true if the result is in the response.
|
||||
*/
|
||||
boolean hasResult(@Nullable OperationResult result);
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package com.onarandombox.MultiverseCore.api.operation;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A response that have multiple results.
|
||||
*/
|
||||
public class OperationResultChain implements OperationResult {
|
||||
|
||||
/**
|
||||
* Create a new {@link OperationResultChain} instance.
|
||||
* Does not continue if one result is not successful.
|
||||
*
|
||||
* @return The new {@link OperationResultChain} instance.
|
||||
*/
|
||||
public static OperationResultChain create() {
|
||||
return new OperationResultChain(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link OperationResultChain} instance.
|
||||
*
|
||||
* @param continueIfFail If true, the response will continue to add results even if one of the results is not successful.
|
||||
* @return The new {@link OperationResultChain} instance.
|
||||
*/
|
||||
public static OperationResultChain create(boolean continueIfFail) {
|
||||
return new OperationResultChain(continueIfFail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a response with a single result.
|
||||
* Does not continue if one result is not successful.
|
||||
*
|
||||
* @param result The result.
|
||||
* @return The new {@link OperationResultChain} instance.
|
||||
*/
|
||||
public static OperationResultChain of(OperationResult result) {
|
||||
return new OperationResultChain(false).addResult(result);
|
||||
}
|
||||
|
||||
private final Set<OperationResult> results;
|
||||
private final boolean continueIfFail;
|
||||
|
||||
private boolean isSuccessful = true;
|
||||
|
||||
/**
|
||||
* @param continueIfFail If true, the response will continue to add results even if one of the results is not successful.
|
||||
*/
|
||||
protected OperationResultChain(boolean continueIfFail) {
|
||||
this.results = new HashSet<>();
|
||||
this.continueIfFail = continueIfFail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a result to the response.
|
||||
*
|
||||
* @param resultSupplier The supplier of the result.
|
||||
* @return self
|
||||
*/
|
||||
public @NotNull OperationResultChain then(Supplier<OperationResult> resultSupplier) {
|
||||
if (!continueIfFail && !isSuccessful) {
|
||||
return this;
|
||||
}
|
||||
return addResult(resultSupplier.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a result to the response.
|
||||
*
|
||||
* @param result The result.
|
||||
* @return self
|
||||
*/
|
||||
public @NotNull OperationResultChain addResult(OperationResult result) {
|
||||
if (!continueIfFail && !isSuccessful) {
|
||||
return this;
|
||||
}
|
||||
|
||||
results.add(result);
|
||||
if (!result.asBoolean()) {
|
||||
isSuccessful = false;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return results.stream().map(OperationResult::getName).collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean asBoolean() {
|
||||
return isSuccessful;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean hasResult(@Nullable OperationResult result) {
|
||||
return results.contains(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ActionResponse{" +
|
||||
"results=" + getName() +
|
||||
"; continueIfFail=" + continueIfFail +
|
||||
"; isSuccessful=" + isSuccessful +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.onarandombox.MultiverseCore.api.operation;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A simple implementation of {@link OperationResult}.
|
||||
*/
|
||||
public class SimpleOperationResult implements OperationResult {
|
||||
|
||||
/**
|
||||
* Creates a new ActionResult that is successful with the given name.
|
||||
*
|
||||
* @param name The name of the result.
|
||||
* @return The new ActionResult.
|
||||
*/
|
||||
public static OperationResult forSuccess(String name) {
|
||||
return new SimpleOperationResult(name, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ActionResult that is unsuccessful with the given name.
|
||||
*
|
||||
* @param name The name of the result.
|
||||
* @return The new ActionResult.
|
||||
*/
|
||||
public static OperationResult forFailure(String name) {
|
||||
return new SimpleOperationResult(name, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ActionResult.
|
||||
*
|
||||
* @param name The name of the result.
|
||||
* @param isSuccessful true if the result is successful.
|
||||
* @return The new ActionResult.
|
||||
*/
|
||||
public static OperationResult of(String name, boolean isSuccessful) {
|
||||
return new SimpleOperationResult(name, isSuccessful);
|
||||
}
|
||||
|
||||
private final String name;
|
||||
private final boolean booleanState;
|
||||
|
||||
/**
|
||||
* Creates a new ActionResult.
|
||||
*
|
||||
* @param name The name of the result.
|
||||
* @param isSuccessful true if the result is successful.
|
||||
*/
|
||||
protected SimpleOperationResult(String name, boolean isSuccessful) {
|
||||
this.name = name;
|
||||
this.booleanState = isSuccessful;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean asBoolean() {
|
||||
return booleanState;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean hasResult(@Nullable OperationResult result) {
|
||||
return result == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SimpleActionResult{" +
|
||||
"name='" + name + '\'' +
|
||||
", booleanState=" + booleanState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* This package contains the Operation API.
|
||||
*/
|
||||
package com.onarandombox.MultiverseCore.api.operation;
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
|
||||
* plugins when interacting with Multiverse.
|
||||
*/
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class CheckCommand extends MultiverseCoreCommand {
|
||||
public CheckCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("check")
|
||||
@CommandPermission("multiverse.core.check")
|
||||
@CommandCompletion("@players @destinations|@mvworlds")
|
||||
@Syntax("<player> <destination>")
|
||||
@Description("Checks if a player can teleport to a destination.")
|
||||
public void onCheckCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Syntax("<player>")
|
||||
@Description("Player to check destination on.")
|
||||
Player player,
|
||||
|
||||
@Syntax("<destination>")
|
||||
@Description("A destination location, e.g. a world name.")
|
||||
ParsedDestination<?> destination
|
||||
) {
|
||||
issuer.sendMessage("Checking " + player + " to " + destination + "...");
|
||||
//TODO More detailed output on permissions required.
|
||||
if (!this.plugin.getPlayerActionChecker().canUseParsedDestination(issuer.getIssuer(), player, destination).asBoolean()) {
|
||||
issuer.sendMessage("You don't have permission to use this destination.");
|
||||
}
|
||||
if (!this.plugin.getPlayerActionChecker().canGoToDestination(issuer.getIssuer(), player, destination).asBoolean()) {
|
||||
issuer.sendMessage("You don't have permission to teleport to this destination.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Single;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class CloneCommand extends MultiverseCoreCommand {
|
||||
public CloneCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("clone")
|
||||
@CommandPermission("multiverse.core.clone")
|
||||
@CommandCompletion("@mvworlds:scope=both @empty")
|
||||
@Syntax("<world> <new world name>")
|
||||
@Description("Clones a world.")
|
||||
public void onCloneCommand(CommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("The target world to clone.")
|
||||
String worldName,
|
||||
|
||||
@Single
|
||||
@Conditions("validWorldName:scope=new")
|
||||
@Syntax("<new world name>")
|
||||
@Description("The new cloned world name.")
|
||||
String newWorldName
|
||||
) {
|
||||
issuer.sendMessage(String.format("Cloning world '%s' to '%s'...", worldName, newWorldName));
|
||||
|
||||
if (!this.plugin.getMVWorldManager().cloneWorld(worldName, newWorldName)) {
|
||||
issuer.sendMessage(String.format("%sWorld could not be cloned! See console for more details.", ChatColor.RED));
|
||||
return;
|
||||
}
|
||||
issuer.sendMessage(String.format("%sCloned world '%s'!", ChatColor.GREEN, newWorldName));
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,23 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ConfirmCommand extends MultiverseCommand {
|
||||
|
||||
public ConfirmCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class ConfirmCommand extends MultiverseCoreCommand {
|
||||
public ConfirmCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
// Any command that is dangerous should require op
|
||||
this.setName("Confirms a command that could destroy life, the universe and everything.");
|
||||
this.setCommandUsage("/mv confirm");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvconfirm");
|
||||
this.addKey("mv confirm");
|
||||
this.setPermission("multiverse.core.confirm", "If you have not been prompted to use this, it will not do anything.", PermissionDefault.OP);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
this.plugin.getCommandHandler().confirmQueuedCommand(sender);
|
||||
@Subcommand("confirm")
|
||||
@CommandPermission("multiverse.core.confirm")
|
||||
@Description("Confirms dangerous commands before executing them.")
|
||||
public void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
|
||||
this.plugin.getMVCommandManager().getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.LocationManipulation;
|
||||
|
||||
public class CoordCommand extends MultiverseCommand {
|
||||
|
||||
private LocationManipulation locMan = new LocationManipulation();
|
||||
|
||||
public CoordCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Coordinates");
|
||||
this.setCommandUsage("/mv coord");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mv coord");
|
||||
this.addKey("mvcoord");
|
||||
this.addKey("mvco");
|
||||
this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
World world = p.getWorld();
|
||||
|
||||
if(!this.plugin.isMVWorld(world.getName())) {
|
||||
this.plugin.showNotMVWorldMessage(sender, world.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
MVWorld mvworld = this.plugin.getMVWorld(world.getName());
|
||||
// TODO: Convert to fancy stuff
|
||||
|
||||
p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
|
||||
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
|
||||
p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
|
||||
p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
|
||||
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
|
||||
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + LocationManipulation.getDirection(p.getLocation()));
|
||||
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + Material.getMaterial(world.getBlockTypeIdAt(p.getLocation())));
|
||||
} else {
|
||||
sender.sendMessage("This command needs to be used from a Player.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,127 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
|
||||
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CreateCommand extends MultiverseCommand {
|
||||
|
||||
public CreateCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class CreateCommand extends MultiverseCoreCommand {
|
||||
public CreateCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Create World");
|
||||
this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]]");
|
||||
this.setArgRange(2, 6);
|
||||
this.addKey("mvcreate");
|
||||
this.addKey("mvc");
|
||||
this.addKey("mv create");
|
||||
this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP);
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " skylands");
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -s gargamel");
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
|
||||
|
||||
registerFlagGroup(CommandFlagGroup.builder("mvcreate")
|
||||
.add(CommandValueFlag.builder("--seed", String.class)
|
||||
.addAlias("-s")
|
||||
.completion(() -> Collections.singleton(String.valueOf(new Random().nextLong())))
|
||||
.build())
|
||||
.add(CommandValueFlag.builder("--generator", String.class)
|
||||
.addAlias("-g")
|
||||
.completion(() -> Arrays.stream(Bukkit.getServer().getPluginManager().getPlugins())
|
||||
.filter(Plugin::isEnabled)
|
||||
.filter(genplugin -> this.plugin.getUnsafeCallWrapper().wrap(
|
||||
() -> genplugin.getDefaultWorldGenerator("world", ""),
|
||||
genplugin.getName(),
|
||||
"Get generator"
|
||||
) != null)
|
||||
.map(genplugin -> genplugin.getDescription().getName())
|
||||
.collect(Collectors.toList()))
|
||||
.build())
|
||||
.add(CommandValueFlag.builder("--world-type", WorldType.class)
|
||||
.addAlias("-t")
|
||||
.context((value) -> {
|
||||
try {
|
||||
return WorldType.valueOf(value.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new InvalidCommandArgument("Invalid world type: " + value);
|
||||
}
|
||||
})
|
||||
.completion(() -> {
|
||||
List<String> types = new ArrayList<>();
|
||||
for (WorldType type : WorldType.values()) {
|
||||
types.add(type.name().toLowerCase());
|
||||
}
|
||||
return types;
|
||||
})
|
||||
.build())
|
||||
.add(CommandFlag.builder("--adjust-spawn")
|
||||
.addAlias("-n")
|
||||
.build())
|
||||
.add(CommandFlag.builder("--no-structures")
|
||||
.addAlias("-a")
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() % 2 != 0) {
|
||||
sender.sendMessage("You must preface your SEED with -s OR your GENERATOR with -g. Type /mv for help");
|
||||
return;
|
||||
}
|
||||
String worldName = args.get(0);
|
||||
String env = args.get(1);
|
||||
String seed = CommandHandler.getFlag("-s", args);
|
||||
String generator = CommandHandler.getFlag("-g", args);
|
||||
@Subcommand("create")
|
||||
@CommandPermission("multiverse.core.create")
|
||||
@CommandCompletion("@empty @flags:groupName=mvcreate")
|
||||
@Syntax("<name> <environment> --seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
|
||||
@Description("{@@mv-core.create.description}")
|
||||
public void onCreateCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
if (new File(worldName).exists() || this.plugin.isMVWorld(worldName)) {
|
||||
sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
|
||||
sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
|
||||
return;
|
||||
}
|
||||
@Conditions("validWorldName:scope=new")
|
||||
@Syntax("<name>")
|
||||
@Description("{@@mv-core.create.name.description}")
|
||||
String worldName,
|
||||
|
||||
Environment environment = this.plugin.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
@Syntax("<environment>")
|
||||
@Description("{@@mv-core.create.environment.description}")
|
||||
World.Environment environment,
|
||||
|
||||
@Optional
|
||||
@Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
|
||||
@Description("{@@mv-core.create.flags.description}")
|
||||
String[] flags
|
||||
) {
|
||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES, "{worldName}", worldName);
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ENVIRONMENT, "{environment}", environment.name());
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_SEED, "{seed}", parsedFlags.flagValue("--seed", "RANDOM", String.class));
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_WORLDTYPE, "{worldType}", parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class).name());
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ADJUSTSPAWN, "{adjustSpawn}", String.valueOf(parsedFlags.hasFlag("--adjust-spawn")));
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_GENERATOR, "{generator}", parsedFlags.flagValue("--generator", "null", String.class));
|
||||
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_STRUCTURES, "{structures}", String.valueOf(!parsedFlags.hasFlag("--no-structures")));
|
||||
|
||||
issuer.sendInfo(MVCorei18n.CREATE_LOADING);
|
||||
|
||||
if (!worldManager.addWorld(
|
||||
worldName,
|
||||
environment,
|
||||
parsedFlags.flagValue("--seed", String.class),
|
||||
parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class),
|
||||
parsedFlags.hasFlag("--adjust-spawn"),
|
||||
parsedFlags.flagValue("--generator", String.class),
|
||||
parsedFlags.hasFlag("--no-structures")
|
||||
)) {
|
||||
issuer.sendError(MVCorei18n.CREATE_FAILED, "{worldName}", worldName);
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "Starting world creation...");
|
||||
if (this.plugin.addWorld(worldName, environment, seed, generator)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
}
|
||||
return;
|
||||
issuer.sendInfo(MVCorei18n.CREATE_SUCCESS, "{worldName}", worldName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class DebugCommand extends MultiverseCoreCommand {
|
||||
public DebugCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("debug")
|
||||
@CommandPermission("multiverse.core.debug")
|
||||
@Description("{@@mv-core.debug.info.description}")
|
||||
public void onShowDebugCommand(BukkitCommandIssuer issuer) {
|
||||
this.displayDebugMode(issuer);
|
||||
}
|
||||
|
||||
@Subcommand("debug")
|
||||
@CommandPermission("multiverse.core.debug")
|
||||
@CommandCompletion("@range:3")
|
||||
@Syntax("<{@@mv-core.debug.change.syntax}>")
|
||||
@Description("{@@mv-core.debug.change.description}")
|
||||
public void onChangeDebugCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Syntax("<{@@mv-core.debug.change.syntax}>")
|
||||
@Description("{@@mv-core.debug.change.level.description}")
|
||||
int level) {
|
||||
|
||||
this.plugin.getMVConfig().setGlobalDebug(level);
|
||||
this.plugin.saveAllConfigs();
|
||||
this.displayDebugMode(issuer);
|
||||
}
|
||||
|
||||
private void displayDebugMode(BukkitCommandIssuer issuer) {
|
||||
final int debugLevel = this.plugin.getMVConfig().getGlobalDebug();
|
||||
if (debugLevel == 0) {
|
||||
issuer.sendInfo(MVCorei18n.DEBUG_INFO_OFF);
|
||||
return;
|
||||
}
|
||||
issuer.sendInfo(MVCorei18n.DEBUG_INFO_ON, "{level}", String.valueOf(debugLevel));
|
||||
Logging.fine("Multiverse Debug ENABLED.");
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,49 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Single;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DeleteCommand extends MultiverseCommand {
|
||||
|
||||
public DeleteCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class DeleteCommand extends MultiverseCoreCommand {
|
||||
public DeleteCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Delete World");
|
||||
this.setCommandUsage("/mv delete" + ChatColor.GREEN + " {WORLD}");
|
||||
this.setArgRange(1, 1);
|
||||
this.addKey("mvdelete");
|
||||
this.addKey("mv delete");
|
||||
this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Class<?> paramTypes[] = { String.class };
|
||||
List<Object> objectArgs = new ArrayList<Object>(args);
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", objectArgs, paramTypes, ChatColor.GREEN + "World Deleted!", ChatColor.RED + "World could NOT be deleted!");
|
||||
@Subcommand("delete")
|
||||
@CommandPermission("multiverse.core.delete")
|
||||
@CommandCompletion("@mvworlds:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("Deletes a world on your server PERMANENTLY.")
|
||||
public void onDeleteCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Single
|
||||
@Conditions("validWorldName:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("The world you want to delete.")
|
||||
String worldName
|
||||
) {
|
||||
this.plugin.getMVCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||
issuer.getIssuer(),
|
||||
() -> {
|
||||
issuer.sendMessage(String.format("Deleting world '%s'...", worldName));
|
||||
if (!this.plugin.getMVWorldManager().deleteWorld(worldName)) {
|
||||
issuer.sendMessage(String.format("%sThere was an issue deleting '%s'! Please check console for errors.", ChatColor.RED, worldName));
|
||||
return;
|
||||
}
|
||||
issuer.sendMessage(String.format("%sWorld %s was deleted!", ChatColor.GREEN, worldName));
|
||||
},
|
||||
"Are you sure you want to delete world '" + worldName + "'?"
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
|
||||
public class EnvironmentCommand extends MultiverseCommand {
|
||||
|
||||
public EnvironmentCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("List Environments");
|
||||
this.setCommandUsage("/mv env");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvenv");
|
||||
this.addKey("mv env");
|
||||
this.addKey("mv environment");
|
||||
this.addKey("mv environments");
|
||||
this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
|
||||
public static void showEnvironments(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
|
||||
sender.sendMessage(ChatColor.GREEN + "NORMAL");
|
||||
sender.sendMessage(ChatColor.RED + "NETHER");
|
||||
sender.sendMessage(ChatColor.AQUA + "SKYLANDS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Flags;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.commandtools.context.GameRuleValue;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameRule;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class GameruleCommand extends MultiverseCoreCommand {
|
||||
public GameruleCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("gamerule")
|
||||
@CommandPermission("multiverse.core.gamerule")
|
||||
@CommandCompletion("@gamerules true|false|@range:1-10 @mvworlds:multiple|*")
|
||||
@Syntax("<Gamerule> <Gamerule value> [World or *]")
|
||||
@Description("Changes a gamerule in one or more worlds")
|
||||
public void onGameruleCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Syntax("<Gamerule>")
|
||||
@Description("Gamerule to set")
|
||||
GameRule gamerule,
|
||||
|
||||
@Syntax("<Value>")
|
||||
@Description("Value of gamerule")
|
||||
GameRuleValue gameRuleValue,
|
||||
|
||||
@Flags("resolve=issuerAware")
|
||||
@Syntax("[World or *]")
|
||||
@Description("World to apply gamerule to, current world by default")
|
||||
MVWorld[] worlds
|
||||
) {
|
||||
Object value = gameRuleValue.getValue();
|
||||
boolean success = true;
|
||||
for(MVWorld world : worlds) {
|
||||
// Set gamerules and add false to list if it fails
|
||||
if (!world.getCBWorld().setGameRule(gamerule, value)) {
|
||||
issuer.sendMessage(ChatColor.RED + "Failed to set gamerule " + gamerule.getName() + " to " + value + " in " + world.getName() + ". It should be a " + gamerule.getType());
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
// Tell user if it was successful
|
||||
if (success) {
|
||||
if (worlds.length == 1) {
|
||||
issuer.sendMessage(ChatColor.GREEN + "Successfully set " + gamerule.getName() + " to " + value + " in " + worlds[0].getName());
|
||||
}
|
||||
else if (worlds.length > 1) {
|
||||
issuer.sendMessage(ChatColor.GREEN + "Successfully set " + gamerule.getName() + " to " + value + " in " + worlds.length + " worlds.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
// This file is no longer licensed under that silly CC license. I have blanked it out and will start implementaiton of my own in a few days. For now there is no help.
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class HelpCommand extends MultiverseCommand {
|
||||
private static final int CMDS_PER_PAGE = 7;
|
||||
|
||||
public HelpCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Get Help with Multiverse");
|
||||
this.setCommandUsage("/mv " + ChatColor.GOLD + "[FILTER] [PAGE #]");
|
||||
this.setArgRange(0, 2);
|
||||
this.addKey("mv");
|
||||
this.addKey("mvh");
|
||||
this.addKey("mvhelp");
|
||||
this.addKey("mv help");
|
||||
this.addKey("mvsearch");
|
||||
this.addKey("mv search");
|
||||
this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
|
||||
|
||||
int page = 1;
|
||||
|
||||
String filter = "";
|
||||
|
||||
if (args.size() == 0)
|
||||
{
|
||||
filter = "";
|
||||
page = 1;
|
||||
} else if (args.size() == 1) {
|
||||
try {
|
||||
page = Integer.parseInt(args.get(0));
|
||||
} catch (NumberFormatException ex) {
|
||||
filter = args.get(0);
|
||||
page = 1;
|
||||
}
|
||||
} else if (args.size() == 2) {
|
||||
filter = args.get(0);
|
||||
try {
|
||||
page = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException ex) {
|
||||
page = 1;
|
||||
}
|
||||
}
|
||||
|
||||
List<Command> availableCommands = new ArrayList<Command>(this.plugin.getCommandHandler().getCommands(sender));
|
||||
if (filter.length() > 0) {
|
||||
availableCommands = this.getFilteredCommands(availableCommands, filter);
|
||||
if (availableCommands.size() == 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No commands matched your filter: " + ChatColor.AQUA + filter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
|
||||
for (Command c : availableCommands) {
|
||||
sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int totalPages = (int) Math.ceil(availableCommands.size() / (CMDS_PER_PAGE + 0.0));
|
||||
|
||||
if (page > totalPages) {
|
||||
page = totalPages;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + " Page " + page + " of " + totalPages);
|
||||
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
|
||||
|
||||
this.showPage(page, sender, availableCommands);
|
||||
|
||||
}
|
||||
|
||||
private List<Command> getFilteredCommands(List<Command> availableCommands, String filter) {
|
||||
List<Command> filtered = new ArrayList<Command>();
|
||||
|
||||
for (Command c : availableCommands) {
|
||||
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(c);
|
||||
} else if (c.getCommandName().matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(c);
|
||||
} else if (c.getCommandDesc().matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(c);
|
||||
}else if (c.getCommandUsage().matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(c);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private String stitchThisString(List<String> list) {
|
||||
String returnstr = "";
|
||||
for (String s : list) {
|
||||
returnstr += s + " ";
|
||||
}
|
||||
return returnstr;
|
||||
}
|
||||
|
||||
private void showPage(int page, CommandSender sender, List<Command> cmds) {
|
||||
int start = (page - 1) * CMDS_PER_PAGE;
|
||||
int end = start + CMDS_PER_PAGE;
|
||||
for (int i = start; i < end; i++) {
|
||||
// For consistancy, print some extra lines if it's a player:
|
||||
if (i < cmds.size()) {
|
||||
sender.sendMessage(ChatColor.AQUA + cmds.get(i).getCommandUsage());
|
||||
} else if (sender instanceof Player) {
|
||||
sender.sendMessage(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +1,88 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ImportCommand extends MultiverseCommand {
|
||||
|
||||
public ImportCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class ImportCommand extends MultiverseCoreCommand {
|
||||
public ImportCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Import World");
|
||||
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]");
|
||||
this.setArgRange(2, 3);
|
||||
this.addKey("mvimport");
|
||||
this.addKey("mvim");
|
||||
this.addKey("mv import");
|
||||
this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.OP);
|
||||
|
||||
registerFlagGroup(CommandFlagGroup.builder("mvimport")
|
||||
.add(CommandValueFlag.builder("--generator", String.class)
|
||||
.addAlias("-g")
|
||||
.completion(() -> Arrays.stream(Bukkit.getServer().getPluginManager().getPlugins())
|
||||
.filter(Plugin::isEnabled)
|
||||
.filter(genplugin -> this.plugin.getUnsafeCallWrapper().wrap(
|
||||
() -> genplugin.getDefaultWorldGenerator("world", ""),
|
||||
genplugin.getName(),
|
||||
"Get generator"
|
||||
) != null)
|
||||
.map(genplugin -> genplugin.getDescription().getName())
|
||||
.collect(Collectors.toList()))
|
||||
.build())
|
||||
.add(CommandFlag.builder("--adjust-spawn")
|
||||
.addAlias("-a")
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
String worldName = args.get(0);
|
||||
if (this.plugin.isMVWorld(worldName) && new File(worldName).exists()) {
|
||||
sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");
|
||||
@Subcommand("import")
|
||||
@CommandPermission("multiverse.core.import")
|
||||
@CommandCompletion("@mvworlds:scope=potential @flags:groupName=mvimport")
|
||||
@Syntax("<name> <env> --generator [generator[:id]] --adjust-spawn")
|
||||
@Description("Imports a existing world folder.")
|
||||
public void onImportCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=new")
|
||||
@Syntax("<name>")
|
||||
@Description("Name of the world folder.")
|
||||
String worldName,
|
||||
|
||||
@Syntax("<env>")
|
||||
@Description("The world's environment. See: /mv env")
|
||||
World.Environment environment,
|
||||
|
||||
@Optional
|
||||
@Syntax("--generator [generator[:id]] --adjust-spawn")
|
||||
@Description("Other world settings. See: https://gg.gg/nn8c2")
|
||||
String[] flags) {
|
||||
|
||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||
|
||||
issuer.sendMessage(String.format("Starting import of world '%s'...", worldName));
|
||||
|
||||
if (!this.worldManager.addWorld(
|
||||
worldName, environment,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
parsedFlags.flagValue("--generator", String.class),
|
||||
parsedFlags.hasFlag("--adjust-spawn"))
|
||||
) {
|
||||
issuer.sendMessage(String.format("%sFailed! See console for more details.", ChatColor.RED));
|
||||
return;
|
||||
}
|
||||
|
||||
String generator = null;
|
||||
if (args.size() == 3) {
|
||||
generator = args.get(2);
|
||||
}
|
||||
|
||||
String env = args.get(1);
|
||||
Environment environment = this.plugin.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (new File(worldName).exists() && env != null) {
|
||||
sender.sendMessage(ChatColor.AQUA + "Starting world import...");
|
||||
this.plugin.addWorld(worldName, environment, null, generator);
|
||||
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
||||
return;
|
||||
} else if (env == null) {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
sender.sendMessage("That world type did not exist.");
|
||||
sender.sendMessage("For a list of available world types, type: /mvenv");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
sender.sendMessage("That world folder does not exist...");
|
||||
}
|
||||
issuer.sendMessage(String.format("%sComplete!", ChatColor.GREEN));
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.FancyColorScheme;
|
||||
import com.onarandombox.utils.FancyHeader;
|
||||
import com.onarandombox.utils.FancyMessage;
|
||||
import com.onarandombox.utils.FancyText;
|
||||
|
||||
public class InfoCommand extends MultiverseCommand {
|
||||
|
||||
public InfoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("World Information");
|
||||
this.setCommandUsage("/mv info" + ChatColor.GOLD + " [WORLD] [PAGE]");
|
||||
this.setArgRange(0, 2);
|
||||
this.addKey("mvinfo");
|
||||
this.addKey("mvi");
|
||||
this.addKey("mv info");
|
||||
this.setPermission("multiverse.core.info", "Returns detailed information on the world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
String worldName = "";
|
||||
int pageNum = 0;
|
||||
|
||||
if (args.size() == 0) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
worldName = p.getWorld().getName();
|
||||
} else {
|
||||
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (args.size() == 1) {
|
||||
if (this.plugin.getMVWorld(args.get(0)) != null) {
|
||||
// then we have a world!
|
||||
worldName = args.get(0);
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
worldName = p.getWorld().getName();
|
||||
try {
|
||||
pageNum = Integer.parseInt(args.get(0)) - 1;
|
||||
} catch (NumberFormatException e) {
|
||||
pageNum = 0;
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args.size() == 2) {
|
||||
worldName = args.get(0);
|
||||
try {
|
||||
pageNum = Integer.parseInt(args.get(1)) - 1;
|
||||
} catch (NumberFormatException e) {
|
||||
pageNum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.plugin.isMVWorld(worldName)) {
|
||||
showPage(pageNum, sender, this.buildEntireCommand(this.plugin.getMVWorld(worldName)));
|
||||
} else if (this.plugin.getServer().getWorld(worldName) != null) {
|
||||
sender.sendMessage("That world exists, but multiverse does not know about it!");
|
||||
sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
|
||||
sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
|
||||
}
|
||||
}
|
||||
|
||||
private List<List<FancyText>> buildEntireCommand(MVWorld world) {
|
||||
List<FancyText> message = new ArrayList<FancyText>();
|
||||
List<List<FancyText>> worldInfo = new ArrayList<List<FancyText>>();
|
||||
// Page 1
|
||||
FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
|
||||
message.add(new FancyHeader("General Info", colors));
|
||||
message.add(new FancyMessage("World Name: ", world.getName(), colors));
|
||||
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
|
||||
message.add(new FancyMessage("Seed: ", world.getCBWorld().getSeed() + "", colors));
|
||||
Location spawn = world.getCBWorld().getSpawnLocation();
|
||||
message.add(new FancyMessage("Spawn Location: ", "(" + spawn.getBlockX() + ", " + spawn.getBlockY() + ", " + spawn.getBlockZ() + ")", colors));
|
||||
message.add(new FancyMessage("World Scale: ", world.getScaling().toString(), colors));
|
||||
if (world.getPrice() > 0) {
|
||||
message.add(new FancyMessage("Price to enter this world: ", this.plugin.getBank().getFormattedAmount(world.getPrice(), world.getCurrency()), colors));
|
||||
} else {
|
||||
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
|
||||
}
|
||||
|
||||
if (world.getRespawnToWorld() != null) {
|
||||
MVWorld respawn = this.plugin.getMVWorld(world.getRespawnToWorld());
|
||||
if (respawn != null) {
|
||||
message.add(new FancyMessage("Players will respawn in: ", respawn.getColoredWorldString(), colors));
|
||||
} else {
|
||||
message.add(new FancyMessage("Players will respawn in: ", ChatColor.RED + "!!INVALID!!", colors));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
worldInfo.add(message);
|
||||
// Page 2
|
||||
message = new ArrayList<FancyText>();
|
||||
message.add(new FancyHeader("PVP Settings", colors));
|
||||
message.add(new FancyMessage("Multiverse Setting: ", world.getPvp().toString(), colors));
|
||||
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
|
||||
message.add(new FancyMessage("Fake PVP Enabled: ", world.getFakePVP() + "", colors));
|
||||
worldInfo.add(message);
|
||||
// Page 3
|
||||
message = new ArrayList<FancyText>();
|
||||
message.add(new FancyHeader("Monster Settings", colors));
|
||||
message.add(new FancyMessage("Multiverse Setting: ", world.allowMonsterSpawning().toString(), colors));
|
||||
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
|
||||
if (MultiverseCore.MobsDisabledInDefaultWorld) {
|
||||
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Monsters WILL NOT SPAWN IN THIS WORLD.", colors));
|
||||
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Check your server log for more details.", colors));
|
||||
}
|
||||
if (world.getMonsterList().size() > 0) {
|
||||
if (world.allowMonsterSpawning()) {
|
||||
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
|
||||
} else {
|
||||
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
|
||||
}
|
||||
} else {
|
||||
message.add(new FancyMessage("Monsters that CAN spawn: ", world.allowMonsterSpawning() ? "ALL" : "NONE", colors));
|
||||
}
|
||||
worldInfo.add(message);
|
||||
|
||||
// Page 4
|
||||
message = new ArrayList<FancyText>();
|
||||
message.add(new FancyHeader("Animal Settings", colors));
|
||||
message.add(new FancyMessage("Multiverse Setting: ", world.allowAnimalSpawning().toString(), colors));
|
||||
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
|
||||
if (world.getMonsterList().size() > 0) {
|
||||
if (world.allowMonsterSpawning()) {
|
||||
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
|
||||
} else {
|
||||
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
|
||||
}
|
||||
} else {
|
||||
message.add(new FancyMessage("Animals that CAN spawn: ", world.allowAnimalSpawning() ? "ALL" : "NONE", colors));
|
||||
}
|
||||
worldInfo.add(message);
|
||||
|
||||
return worldInfo;
|
||||
}
|
||||
|
||||
private String toCommaSeperated(List<String> list) {
|
||||
if(list == null || list.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
if(list.size() == 1) {
|
||||
return list.get(0);
|
||||
}
|
||||
String result = list.get(0);
|
||||
|
||||
for (int i = 1; i < list.size() - 1; i++) {
|
||||
result += ", " + list.get(i);
|
||||
}
|
||||
result += " and " + list.get(list.size() - 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ChatColor getChatColor(boolean positive) {
|
||||
return positive ? ChatColor.GREEN : ChatColor.RED;
|
||||
}
|
||||
|
||||
private void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
|
||||
page = page < 0 ? 0 : page;
|
||||
page = page > doc.size() - 1 ? doc.size() - 1 : page;
|
||||
boolean altColor = false;
|
||||
boolean appendedPageNum = false;
|
||||
if (sender instanceof Player) {
|
||||
List<FancyText> list = doc.get(page);
|
||||
for (FancyText fancyT : list) {
|
||||
if (fancyT instanceof FancyMessage) {
|
||||
FancyMessage text = (FancyMessage) fancyT;
|
||||
text.setAltColor(altColor);
|
||||
altColor = !altColor;
|
||||
sender.sendMessage(text.getFancyText());
|
||||
} else if (fancyT instanceof FancyHeader) {
|
||||
FancyHeader text = (FancyHeader) fancyT;
|
||||
if (!appendedPageNum) {
|
||||
text.appendText(ChatColor.DARK_PURPLE + " [ Page " + (page + 1) + " of " + doc.size() + " ]");
|
||||
appendedPageNum = true;
|
||||
}
|
||||
sender.sendMessage(text.getFancyText());
|
||||
altColor = false;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (List<FancyText> list : doc) {
|
||||
for (FancyText fancyT : list) {
|
||||
if (fancyT instanceof FancyMessage) {
|
||||
FancyMessage text = (FancyMessage) fancyT;
|
||||
text.setAltColor(altColor);
|
||||
altColor = !altColor;
|
||||
sender.sendMessage(text.getFancyText());
|
||||
} else {
|
||||
FancyText text = fancyT;
|
||||
if (appendedPageNum) {
|
||||
sender.sendMessage(" ");
|
||||
} else {
|
||||
appendedPageNum = true;
|
||||
}
|
||||
sender.sendMessage(text.getFancyText());
|
||||
altColor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class ListCommand extends MultiverseCommand {
|
||||
|
||||
public ListCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("World Listing");
|
||||
this.setCommandUsage("/mv list");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvlist");
|
||||
this.addKey("mvl");
|
||||
this.addKey("mv list");
|
||||
this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
|
||||
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
||||
for (MVWorld world : this.plugin.getMVWorlds()) {
|
||||
|
||||
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ChatColor color = ChatColor.GOLD;
|
||||
Environment env = world.getEnvironment();
|
||||
if (env == Environment.NETHER) {
|
||||
color = ChatColor.RED;
|
||||
} else if (env == Environment.NORMAL) {
|
||||
color = ChatColor.GREEN;
|
||||
} else if (env == Environment.SKYLANDS) {
|
||||
color = ChatColor.AQUA;
|
||||
}
|
||||
output += world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment() + " \n";
|
||||
|
||||
}
|
||||
String[] response = output.split("\n");
|
||||
for (String msg : response) {
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Single;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class LoadCommand extends MultiverseCoreCommand {
|
||||
public LoadCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Subcommand("load")
|
||||
@CommandPermission("multiverse.core.load")
|
||||
@CommandCompletion("@mvworlds:scope=unloaded")
|
||||
@Syntax("<world>")
|
||||
@Description("Loads a world. World must be already in worlds.yml, else please use /mv import.")
|
||||
public void onLoadCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Single
|
||||
@Conditions("validWorldName:scope=unloaded")
|
||||
@Syntax("<world>")
|
||||
@Description("Name of world you want to load.")
|
||||
String worldName
|
||||
) {
|
||||
issuer.sendMessage(String.format("Loading world '%s'...", worldName));
|
||||
|
||||
if (!this.plugin.getMVWorldManager().loadWorld(worldName)) {
|
||||
issuer.sendMessage(String.format("Error trying to load world '%s'!", worldName));
|
||||
return;
|
||||
}
|
||||
issuer.sendMessage(String.format("Loaded world '%s'!", worldName));
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
// This will contain all the properties that support the ADD/REMOVE
|
||||
// Anything not in here will only support the SET action
|
||||
|
||||
public class ModifyAddCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyAddCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Modify a World (Add a value)");
|
||||
this.setCommandUsage("/mv modify " + ChatColor.GREEN + "add {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
|
||||
this.setArgRange(2, 3);
|
||||
this.addKey("mvm add");
|
||||
this.addKey("mvmadd");
|
||||
this.addKey("mv modify add");
|
||||
this.addKey("mvmodify add");
|
||||
this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// We NEED a world from the command line
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
|
||||
if (args.size() == 2 && p == null) {
|
||||
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
|
||||
sender.sendMessage(this.getCommandDesc());
|
||||
sender.sendMessage(this.getCommandUsage());
|
||||
sender.sendMessage("Nothing changed.");
|
||||
return;
|
||||
}
|
||||
|
||||
MVWorld world;
|
||||
String value = args.get(0);
|
||||
String property = args.get(1);
|
||||
|
||||
if (args.size() == 2) {
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = this.plugin.getMVWorld(args.get(2));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
sender.sendMessage("That world does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ModifyCommand.validateAction(Action.Add, property)) {
|
||||
sender.sendMessage("Sorry, you can't ADD to " + property);
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.addToList(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
|
||||
} else {
|
||||
sender.sendMessage(value + " could not be added to " + property);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class ModifyClearCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyClearCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Modify a World (Clear a property)");
|
||||
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " clear {PROPERTY}" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setArgRange(1, 2);
|
||||
this.addKey("mvm clear");
|
||||
this.addKey("mvmclear");
|
||||
this.addKey("mv modify clear");
|
||||
this.addKey("mvmodify clear");
|
||||
this.setPermission("multiverse.core.modify.clear", "Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// We NEED a world from the command line
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
if (args.size() == 1 && p == null) {
|
||||
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
|
||||
sender.sendMessage(this.getCommandDesc());
|
||||
sender.sendMessage(this.getCommandUsage());
|
||||
sender.sendMessage("Nothing changed.");
|
||||
return;
|
||||
}
|
||||
|
||||
MVWorld world;
|
||||
String property = args.get(0);
|
||||
|
||||
if (args.size() == 1) {
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = this.plugin.getMVWorld(args.get(1));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
sender.sendMessage("That world does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ModifyCommand.validateAction(Action.Clear, property)) {
|
||||
sender.sendMessage("Sorry, you can't use CLEAR with " + property);
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/cgB2B");
|
||||
return;
|
||||
}
|
||||
if (world.clearList(property)) {
|
||||
sender.sendMessage(property + " was cleared. It contains 0 values now.");
|
||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + property + ChatColor.WHITE + " was " + ChatColor.GREEN + "CLEARED" + ChatColor.WHITE + ". It contains " + ChatColor.LIGHT_PURPLE + "0" + ChatColor.WHITE + " values now.");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property + ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
enum AddProperties {
|
||||
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
|
||||
}
|
||||
|
||||
enum Action {
|
||||
Set, Add, Remove, Clear
|
||||
}
|
||||
|
||||
// Color == Aliascolor
|
||||
enum SetProperties {
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm
|
||||
}
|
||||
|
||||
public class ModifyCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Modify a World");
|
||||
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " {set|add|remove|clear} ...");
|
||||
this.setArgRange(2, 3);
|
||||
this.addKey("mvm");
|
||||
this.addKey("mvmodify");
|
||||
this.addKey("mv modify");
|
||||
Map<String, Boolean> children = new HashMap<String, Boolean>();
|
||||
children.put("multiverse.core.modify.add", true);
|
||||
children.put("multiverse.core.modify.modify", true);
|
||||
children.put("multiverse.core.modify.clear", true);
|
||||
children.put("multiverse.core.modify.remove", true);
|
||||
Permission modify = new Permission("multiverse.core.modify", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP, children);
|
||||
this.setPermission(modify);
|
||||
}
|
||||
|
||||
protected static boolean validateAction(Action action, String property) {
|
||||
if (action == Action.Set) {
|
||||
try {
|
||||
SetProperties.valueOf(property);
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
AddProperties.valueOf(property);
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// This is just a place holder. The real commands are in:
|
||||
// ModifyAddCommand
|
||||
// ModifyRemoveCommand
|
||||
// ModifySetCommand
|
||||
// ModifyClearCommand
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class ModifyRemoveCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyRemoveCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Modify a World (Remove a value)");
|
||||
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " remove {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setArgRange(2, 3);
|
||||
this.addKey("mvm remove");
|
||||
this.addKey("mvmremove");
|
||||
this.addKey("mv modify remove");
|
||||
this.addKey("mvmodify remove");
|
||||
this.addKey("mvm delete");
|
||||
this.addKey("mvmdelete");
|
||||
this.addKey("mv modify delete");
|
||||
this.addKey("mvmodify delete");
|
||||
this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// We NEED a world from the command line
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
|
||||
if (args.size() == 2 && p == null) {
|
||||
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
|
||||
sender.sendMessage(this.getCommandDesc());
|
||||
sender.sendMessage(this.getCommandUsage());
|
||||
sender.sendMessage("Nothing changed.");
|
||||
return;
|
||||
}
|
||||
|
||||
MVWorld world;
|
||||
String value = args.get(0);
|
||||
String property = args.get(1);
|
||||
|
||||
if (args.size() == 2) {
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = this.plugin.getMVWorld(args.get(2));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
sender.sendMessage("That world does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ModifyCommand.validateAction(Action.Remove, property)) {
|
||||
sender.sendMessage("Sorry, you can't REMOVE anything from" + property);
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
|
||||
return;
|
||||
}
|
||||
if (world.removeFromList(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY + value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class ModifySetCommand extends MultiverseCommand {
|
||||
|
||||
public ModifySetCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Modify a World (Set a value)");
|
||||
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setArgRange(2, 3);
|
||||
this.addKey("mvm set");
|
||||
this.addKey("mvmset");
|
||||
this.addKey("mv modify set");
|
||||
this.addKey("mvmodify set");
|
||||
this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// We NEED a world from the command line
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
|
||||
if (args.size() == 2 && p == null) {
|
||||
sender.sendMessage("From the command line, WORLD is required.");
|
||||
sender.sendMessage(this.getCommandDesc());
|
||||
sender.sendMessage(this.getCommandUsage());
|
||||
sender.sendMessage("Nothing changed.");
|
||||
return;
|
||||
}
|
||||
|
||||
MVWorld world;
|
||||
String value = args.get(1);
|
||||
String property = args.get(0);
|
||||
|
||||
if (args.size() == 2) {
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = this.plugin.getMVWorld(args.get(2));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
sender.sendMessage("That world does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ModifyCommand.validateAction(Action.Set, property)) {
|
||||
sender.sendMessage("Sorry, you can't SET " + property);
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/l54PH");
|
||||
return;
|
||||
}
|
||||
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
|
||||
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
|
||||
} else if (world.setVariable(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "There was an error setting " + ChatColor.GRAY + property);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public abstract class MultiverseCommand extends Command {
|
||||
|
||||
protected MultiverseCore plugin;
|
||||
public MultiverseCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void runCommand(CommandSender sender, List<String> args);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A base command for Multiverse.
|
||||
*/
|
||||
abstract class MultiverseCoreCommand extends MultiverseCommand {
|
||||
protected final MultiverseCore plugin;
|
||||
protected final MVWorldManager worldManager;
|
||||
|
||||
protected MultiverseCoreCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.worldManager = plugin.getMVWorldManager();
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.PurgeWorlds;
|
||||
|
||||
public class PurgeCommand extends MultiverseCommand {
|
||||
|
||||
public PurgeCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Purge World of Creatures");
|
||||
this.setCommandUsage("/mv purge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}");
|
||||
this.setArgRange(1, 2);
|
||||
this.addKey("mvpurge");
|
||||
this.addKey("mv purge");
|
||||
this.setPermission("multiverse.core.purge", "Removed the specified type of mob from the specified world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
if (args.size() == 1 && p == null) {
|
||||
sender.sendMessage("This command requires a WORLD when being run from the console!");
|
||||
sender.sendMessage(this.getCommandUsage());
|
||||
return;
|
||||
}
|
||||
String worldName = null;
|
||||
String deathName = null;
|
||||
if (args.size() == 1) {
|
||||
worldName = p.getWorld().getName();
|
||||
deathName = args.get(0);
|
||||
} else {
|
||||
worldName = args.get(0);
|
||||
deathName = args.get(1);
|
||||
}
|
||||
|
||||
if (!worldName.equalsIgnoreCase("all") && !this.plugin.isMVWorld(worldName)) {
|
||||
((MultiverseCore)this.plugin).showNotMVWorldMessage(sender, worldName);
|
||||
sender.sendMessage("It cannot be purged.");
|
||||
return;
|
||||
}
|
||||
|
||||
List<MVWorld> worldsToRemoveEntitiesFrom = new ArrayList<MVWorld>();
|
||||
// Handle all case any user who names a world "all" should know better...
|
||||
if (worldName.equalsIgnoreCase("all")) {
|
||||
worldsToRemoveEntitiesFrom.addAll(this.plugin.getMVWorlds());
|
||||
} else {
|
||||
worldsToRemoveEntitiesFrom.add(this.plugin.getMVWorld(worldName));
|
||||
}
|
||||
|
||||
PurgeWorlds purger = this.plugin.getWorldPurger();
|
||||
ArrayList<String> thingsToKill = new ArrayList<String>();
|
||||
if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
|
||||
thingsToKill.add(deathName.toUpperCase());
|
||||
} else {
|
||||
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
|
||||
}
|
||||
for (MVWorld w : worldsToRemoveEntitiesFrom) {
|
||||
purger.purgeWorld(sender, w, thingsToKill, false, false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class RegenCommand extends MultiverseCoreCommand {
|
||||
public RegenCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
registerFlagGroup(CommandFlagGroup.builder("mvregen")
|
||||
.add(CommandValueFlag.builder("--seed", String.class)
|
||||
.addAlias("-s")
|
||||
.completion(() -> Collections.singleton(String.valueOf(new Random().nextLong())))
|
||||
.optional()
|
||||
.build())
|
||||
.add(CommandFlag.builder("--keep-gamerules")
|
||||
.addAlias("-k")
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
@Subcommand("regen")
|
||||
@CommandPermission("multiverse.core.regen")
|
||||
@CommandCompletion("@mvworlds:scope=both @flags:groupName=mvregen")
|
||||
@Syntax("<world> --seed [seed] --keep-gamerules")
|
||||
@Description("Regenerates a world on your server. The previous state will be lost PERMANENTLY.")
|
||||
public void onRegenCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("World that you want to regen.")
|
||||
String worldName,
|
||||
|
||||
@Optional
|
||||
@Syntax("--seed [seed] --keep-gamerules")
|
||||
@Description("Other world settings. See: http://gg.gg/nn8lk")
|
||||
String[] flags
|
||||
) {
|
||||
ParsedCommandFlags parsedFlags = parseFlags(flags);
|
||||
|
||||
this.plugin.getMVCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||
issuer.getIssuer(),
|
||||
() -> {
|
||||
issuer.sendMessage(String.format("Regenerating world '%s'...", worldName));
|
||||
if (!this.plugin.getMVWorldManager().regenWorld(
|
||||
worldName,
|
||||
parsedFlags.hasFlag("--seed"),
|
||||
!parsedFlags.hasFlagValue("--seed"),
|
||||
parsedFlags.flagValue("--seed", String.class),
|
||||
parsedFlags.hasFlag("--keep-gamerules")
|
||||
)) {
|
||||
issuer.sendMessage(String.format("%sThere was an issue regenerating '%s'! Please check console for errors.", ChatColor.RED, worldName));
|
||||
return;
|
||||
}
|
||||
issuer.sendMessage(String.format("%sWorld %s was regenerated!", ChatColor.GREEN, worldName));
|
||||
},
|
||||
"Are you sure you want to regenerate world '" + worldName + "'?"
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -3,42 +3,40 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReloadCommand extends MultiverseCommand {
|
||||
|
||||
public ReloadCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class ReloadCommand extends MultiverseCoreCommand {
|
||||
public ReloadCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Reload Configs");
|
||||
this.setCommandUsage("/mv reload");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvreload");
|
||||
this.addKey("mv reload");
|
||||
this.setPermission("multiverse.core.reload", "Reloads worlds.yml and config.yml.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
sender.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
|
||||
@Subcommand("reload")
|
||||
@CommandPermission("multiverse.core.reload")
|
||||
@Description("Reloads config files for all multiverse modules.")
|
||||
public void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
|
||||
issuer.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
|
||||
this.plugin.loadConfigs();
|
||||
this.plugin.loadWorlds(true);
|
||||
|
||||
// Create the event
|
||||
List<String> configsLoaded = new ArrayList<String>();
|
||||
this.plugin.getAnchorManager().loadAnchors();
|
||||
this.plugin.getMVWorldManager().loadWorlds(true);
|
||||
|
||||
List<String> configsLoaded = new ArrayList<>();
|
||||
configsLoaded.add("Multiverse-Core - config.yml");
|
||||
configsLoaded.add("Multiverse-Core - worlds.yml");
|
||||
configsLoaded.add("Multiverse-Core - anchors.yml");
|
||||
|
||||
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
|
||||
this.plugin.getServer().getPluginManager().callEvent(configReload);
|
||||
for(String s : configReload.getAllConfigsLoaded()) {
|
||||
sender.sendMessage(s);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Reload Complete!");
|
||||
}
|
||||
|
||||
configReload.getAllConfigsLoaded().forEach(issuer::sendMessage);
|
||||
issuer.sendMessage(String.format("%sReload Complete!", ChatColor.GREEN));
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,41 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Single;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RemoveCommand extends MultiverseCommand {
|
||||
|
||||
public RemoveCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class RemoveCommand extends MultiverseCoreCommand {
|
||||
public RemoveCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Remove World");
|
||||
this.setCommandUsage("/mv remove" + ChatColor.GREEN + " {WORLD}");
|
||||
this.setArgRange(1, 1);
|
||||
this.addKey("mvremove");
|
||||
this.addKey("mv remove");
|
||||
this.setPermission("multiverse.core.remove", "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (this.plugin.removeWorldFromConfig(args.get(0))) {
|
||||
sender.sendMessage("World removed from config!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to remove world from config!");
|
||||
@Subcommand("remove")
|
||||
@CommandPermission("multiverse.core.remove")
|
||||
@CommandCompletion("@mvworlds:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.")
|
||||
public void onRemoveCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Single
|
||||
@Conditions("mvworlds:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("World you want to remove from mv's knowledge.")
|
||||
String worldName
|
||||
) {
|
||||
if (!this.plugin.getMVWorldManager().removeWorldFromConfig(worldName)) {
|
||||
issuer.sendMessage(String.format("%sError trying to remove world from config!", ChatColor.RED));
|
||||
return;
|
||||
}
|
||||
issuer.sendMessage(String.format("World '%s' is removed from config!", worldName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RootCommand extends MultiverseCoreCommand {
|
||||
public RootCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@CommandAlias("mv")
|
||||
public void onRootCommand(CommandIssuer issuer) {
|
||||
PluginDescriptionFile description = this.plugin.getDescription();
|
||||
issuer.sendMessage(ChatColor.GREEN + description.getName() + " version " + description.getVersion());
|
||||
issuer.sendMessage(ChatColor.GREEN + "See " + ChatColor.WHITE + "/mv help" + ChatColor.GREEN + " for commands available.");
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class SetSpawnCommand extends MultiverseCommand {
|
||||
|
||||
public SetSpawnCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Set World Spawn");
|
||||
this.setCommandUsage("/mv setspawn");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvsetspawn");
|
||||
this.addKey("mvss");
|
||||
this.addKey("mv set spawn");
|
||||
this.addKey("mv setspawn");
|
||||
this.addKey("mvset spawn");
|
||||
this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
Location l = p.getLocation();
|
||||
World w = p.getWorld();
|
||||
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
p.sendMessage(w.getName() + " - Spawn set to X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
||||
} else {
|
||||
sender.sendMessage("You cannot use this command from the console.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class SleepCommand extends MultiverseCommand {
|
||||
|
||||
public SleepCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Go to Sleep");
|
||||
this.setCommandUsage("/mv sleep");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mv sleep");
|
||||
this.setPermission("multiverse.core.sleep", "Takes you the latest bed you've slept in (Currently BROKEN).", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
|
||||
if (p == null) {
|
||||
return;
|
||||
}
|
||||
// MVPlayerSession session = this.plugin.getPlayerSession(p);
|
||||
// if (session.getBedRespawnLocation() != null) {
|
||||
// p.teleport(session.getBedRespawnLocation());
|
||||
// } else {
|
||||
// sender.sendMessage("Hmm this is awkward...");
|
||||
// sender.sendMessage("Something is wrong with your bed.");
|
||||
// sender.sendMessage("It has either been destroyed or obstructed.");
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class SpawnCommand extends MultiverseCommand {
|
||||
|
||||
public SpawnCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
Permission otherPerm = new Permission("multiverse.core.spawn.other", "Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
|
||||
this.setName("Spawn");
|
||||
this.setCommandUsage("/mv spawn" + ChatColor.GOLD + " [PLAYER]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mvspawn");
|
||||
this.addKey("mv spawn");
|
||||
this.addKey("mvs");
|
||||
this.setPermission("multiverse.core.spawn.self", "Teleports you to the Spawn Point of the world you are in.", PermissionDefault.OP);
|
||||
this.addAdditonalPermission(otherPerm);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
// If a persons name was passed in, you must be A. the console, or B have permissions
|
||||
if (args.size() == 1) {
|
||||
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.other", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.core.spawn.other)");
|
||||
return;
|
||||
}
|
||||
Player target = this.plugin.getServer().getPlayer(args.get(0));
|
||||
if (target != null) {
|
||||
target.sendMessage("Teleporting to this world's spawn...");
|
||||
target.teleport(target.getWorld().getSpawnLocation());
|
||||
if (player != null) {
|
||||
target.sendMessage("You were teleported by: " + ChatColor.YELLOW + player.getName());
|
||||
} else {
|
||||
target.sendMessage("You were teleported by: " + ChatColor.LIGHT_PURPLE + "the console");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(args.get(0) + " is not logged on right now!");
|
||||
}
|
||||
} else {
|
||||
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.self", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.core.spawn.self)");
|
||||
return;
|
||||
}
|
||||
if (player != null) {
|
||||
player.sendMessage("Teleporting to this world's spawn...");
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
} else {
|
||||
sender.sendMessage("From the console, you must provide a PLAYER.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,118 +1,54 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVTeleport;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Flags;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.MVDestination;
|
||||
import com.onarandombox.utils.DestinationFactory;
|
||||
import com.onarandombox.utils.InvalidDestination;
|
||||
|
||||
public class TeleportCommand extends MultiverseCommand {
|
||||
private MVTeleport playerTeleporter;
|
||||
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class TeleportCommand extends MultiverseCoreCommand {
|
||||
public TeleportCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
Permission self = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP);
|
||||
Permission other = new Permission("multiverse.core.tp.other", "Allows you to teleport others to other worlds.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
this.setName("Teleport");
|
||||
this.setCommandUsage("/mv tp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}");
|
||||
this.setArgRange(1, 2);
|
||||
this.addKey("mvtp");
|
||||
this.addKey("mv tp");
|
||||
this.playerTeleporter = new MVTeleport(this.plugin);
|
||||
// setPermission in some for is REQUIRED
|
||||
this.setPermission(self);
|
||||
this.addAdditonalPermission(other);
|
||||
@Subcommand("teleport|tp")
|
||||
@CommandCompletion("@players|@mvworlds:playerOnly|@destinations:playerOnly @mvworlds|@destinations")
|
||||
@Syntax("[player] <destination>")
|
||||
@Description("Allows you to the teleport to a location on your server!")
|
||||
public void onTeleportCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Flags("resolve=issuerAware")
|
||||
@Syntax("[player]")
|
||||
@Description("Target player to teleport.")
|
||||
Player[] players,
|
||||
|
||||
@Syntax("<destination>")
|
||||
@Description("Location, can be a world name.")
|
||||
ParsedDestination<?> destination
|
||||
) {
|
||||
// TODO Add warning if teleporting too many players at once.
|
||||
for (Player player : players) {
|
||||
if (!this.plugin.getPlayerActionChecker().canUseParsedDestination(issuer.getIssuer(), player, destination).asBoolean()) {
|
||||
issuer.sendMessage("You don't have permission to use this destination.");
|
||||
continue;
|
||||
}
|
||||
issuer.sendMessage("Teleporting "
|
||||
+ (issuer.getPlayer() == player ? "you" : player.getName())
|
||||
+ " to " + destination + "...");
|
||||
this.plugin.getDestinationsProvider().playerTeleport(issuer, player, destination);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
Player teleporter = null;
|
||||
Player teleportee = null;
|
||||
if (sender instanceof Player) {
|
||||
teleporter = (Player) sender;
|
||||
}
|
||||
|
||||
String destinationName;
|
||||
|
||||
if (args.size() == 2) {
|
||||
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.other", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport another player. (multiverse.core.tp.other)");
|
||||
return;
|
||||
}
|
||||
teleportee = this.plugin.getServer().getPlayer(args.get(0));
|
||||
if (teleportee == null) {
|
||||
sender.sendMessage("Sorry, I couldn't find player: " + args.get(0));
|
||||
return;
|
||||
}
|
||||
destinationName = args.get(1);
|
||||
|
||||
} else {
|
||||
destinationName = args.get(0);
|
||||
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.self", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.core.tp.self)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("From the console, you must specifiy a player to teleport");
|
||||
return;
|
||||
}
|
||||
teleporter = (Player) sender;
|
||||
teleportee = (Player) sender;
|
||||
}
|
||||
|
||||
DestinationFactory df = this.plugin.getDestinationFactory();// .parseDestination(worldName, (MultiverseCore) this.plugin);
|
||||
MVDestination d = df.getDestination(destinationName);
|
||||
if (d != null && d instanceof InvalidDestination) {
|
||||
sender.sendMessage("Multiverse does not know how to take you to: " + ChatColor.RED + destinationName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (teleporter != null && !this.plugin.getPermissions().canEnterDestination(teleporter, d)) {
|
||||
if (teleportee.equals(teleporter)) {
|
||||
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
||||
} else {
|
||||
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
|
||||
}
|
||||
return;
|
||||
} else if (teleporter != null && !this.plugin.getPermissions().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
|
||||
if (teleportee.equals(teleporter)) {
|
||||
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + "THERE from " + ChatColor.GREEN + teleporter.getWorld().getName());
|
||||
} else {
|
||||
teleporter.sendMessage("DOH! Doesn't look like " + ChatColor.GREEN + teleporter.getWorld().getName() + " can get to " + ChatColor.RED + "THERE from where they are...");
|
||||
}
|
||||
return;
|
||||
}
|
||||
Location l = d.getLocation(teleportee);
|
||||
if (l == null) {
|
||||
teleporter.sendMessage("Sorry Boss, I tried everything, but just couldn't teleport ya there!");
|
||||
return;
|
||||
}
|
||||
if (!this.playerTeleporter.safelyTeleport(teleportee, l)) {
|
||||
Class<?> paramTypes[] = { Player.class, Location.class };
|
||||
List<Object> items = new ArrayList<Object>();
|
||||
items.add(teleportee);
|
||||
items.add(l);
|
||||
String player = "you";
|
||||
if (!teleportee.equals(teleporter)) {
|
||||
player = teleportee.getName();
|
||||
}
|
||||
String message = ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " did not teleport " + ChatColor.AQUA + player + ChatColor.WHITE + " to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items, paramTypes, message, "Would you like to try anyway?", "", "", 15);
|
||||
} else {
|
||||
teleportee.setVelocity(d.getVelocity());
|
||||
}
|
||||
public boolean hasPermission(CommandIssuer issuer) {
|
||||
return this.plugin.getDestinationsProvider().getRegisteredDestinations().stream()
|
||||
.anyMatch(destination -> this.plugin.getPlayerActionChecker().canUseDestinationType(issuer.getIssuer(), destination).asBoolean());
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,40 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class UnloadCommand extends MultiverseCommand {
|
||||
|
||||
public UnloadCommand(MultiverseCore plugin) {
|
||||
@CommandAlias("mv")
|
||||
public class UnloadCommand extends MultiverseCoreCommand {
|
||||
public UnloadCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Unload World");
|
||||
this.setCommandUsage("/mv unload" + ChatColor.GREEN + " {WORLD}");
|
||||
this.setArgRange(1, 1);
|
||||
this.addKey("mvunload");
|
||||
this.addKey("mv unload");
|
||||
this.setPermission("multiverse.core.unload", "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (this.plugin.removeWorldFromList(args.get(0))) {
|
||||
sender.sendMessage("World Unloaded!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to unload world!");
|
||||
@Subcommand("unload")
|
||||
@CommandPermission("multiverse.core.unload")
|
||||
@CommandCompletion("@mvworlds")
|
||||
@Syntax("<world>")
|
||||
@Description("Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.")
|
||||
public void onUnloadCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Syntax("<world>")
|
||||
@Description("Name of the world you want to unload.")
|
||||
MVWorld world
|
||||
) {
|
||||
issuer.sendMessage(String.format("Unloading world '%s'...", world.getColoredWorldString()));
|
||||
|
||||
//TODO API: Should be able to use MVWorld object directly
|
||||
if (!this.plugin.getMVWorldManager().unloadWorld(world.getName())) {
|
||||
issuer.sendMessage(String.format("Error unloading world '%s'! See console for more details.", world.getColoredWorldString()));
|
||||
return;
|
||||
}
|
||||
issuer.sendMessage(String.format("Unloaded world '%s'!", world.getColoredWorldString()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.CommandHelp;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.HelpCommand;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandAlias("mv")
|
||||
public class UsageCommand extends MultiverseCoreCommand {
|
||||
public UsageCommand(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@HelpCommand
|
||||
@Subcommand("help")
|
||||
@CommandPermission("multiverse.core.help")
|
||||
@CommandCompletion("@commands:mv")
|
||||
@Syntax("[filter] [page]")
|
||||
@Description("Show Multiverse-Core Command usage.")
|
||||
public void onUsageCommand(CommandHelp help) {
|
||||
if (help.getIssuer().isPlayer()) {
|
||||
// Prevent flooding the chat
|
||||
help.setPerPage(4);
|
||||
}
|
||||
this.plugin.getMVCommandManager().showUsage(help);
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent;
|
||||
|
||||
public class VersionCommand extends MultiverseCommand {
|
||||
|
||||
public VersionCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Multiverse Version");
|
||||
this.setCommandUsage("/mv version " + ChatColor.GOLD + "-p");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv version");
|
||||
this.addKey("mvv");
|
||||
this.addKey("mvversion");
|
||||
this.setPermission("multiverse.core.version", "Dumps version info to the console, optionally to pastebin.com with a -p.", PermissionDefault.TRUE);
|
||||
}
|
||||
|
||||
private String pasteBinBuffer = "";
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage("Version info dumped to console. Please check your server logs.");
|
||||
}
|
||||
|
||||
logAndAddToPasteBinBuffer("Multiverse-Core Version: " + this.plugin.getDescription().getVersion());
|
||||
logAndAddToPasteBinBuffer("Bukkit Version: " + this.plugin.getServer().getVersion());
|
||||
logAndAddToPasteBinBuffer("Loaded Worlds: " + this.plugin.getMVWorlds().size());
|
||||
logAndAddToPasteBinBuffer("Multiverse Plugins Loaded: " + this.plugin.getPluginCount());
|
||||
logAndAddToPasteBinBuffer("Economy being used: " + this.plugin.getBank().getEconUsed());
|
||||
logAndAddToPasteBinBuffer("Permissions Plugin: " + this.plugin.getPermissions().getType());
|
||||
logAndAddToPasteBinBuffer("Dumping Config Values: (version " + this.plugin.getConfig().getString("version", "NOT SET") + ")");
|
||||
logAndAddToPasteBinBuffer("messagecooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||
logAndAddToPasteBinBuffer("teleportcooldown: " + this.plugin.getConfig().getString("teleportcooldown", "NOT SET"));
|
||||
logAndAddToPasteBinBuffer("worldnameprefix: " + this.plugin.getConfig().getString("worldnameprefix", "NOT SET"));
|
||||
logAndAddToPasteBinBuffer("opfallback: " + this.plugin.getConfig().getString("opfallback", "NOT SET"));
|
||||
logAndAddToPasteBinBuffer("disableautoheal: " + this.plugin.getConfig().getString("disableautoheal", "NOT SET"));
|
||||
logAndAddToPasteBinBuffer("fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
|
||||
logAndAddToPasteBinBuffer("Special Code: FRN001");
|
||||
|
||||
MVVersionRequestEvent versionEvent = new MVVersionRequestEvent(pasteBinBuffer);
|
||||
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
|
||||
pasteBinBuffer = versionEvent.getPasteBinBuffer();
|
||||
|
||||
if (args.size() == 1 && args.get(0).equalsIgnoreCase("-p")) {
|
||||
String pasteBinUrl = postToPasteBin();
|
||||
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteBinUrl);
|
||||
this.plugin.log(Level.INFO, "Version info dumped here: " + pasteBinUrl);
|
||||
}
|
||||
}
|
||||
|
||||
private void logAndAddToPasteBinBuffer(String string) {
|
||||
this.pasteBinBuffer += "[Multiverse-Core] " + string + "\n";
|
||||
this.plugin.log(Level.INFO, string);
|
||||
}
|
||||
|
||||
private String postToPasteBin() {
|
||||
try {
|
||||
String data = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("33ab32380506d99d872b69d35dc9d007", "UTF-8");
|
||||
data += "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
|
||||
data += "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(this.pasteBinBuffer, "UTF-8");
|
||||
|
||||
URL url = new URL("http://pastebin.com/api/api_post.php");
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
|
||||
wr.write(data);
|
||||
wr.flush();
|
||||
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
String pasteBinUrl = "";
|
||||
while ((line = rd.readLine()) != null) {
|
||||
pasteBinUrl = line;
|
||||
}
|
||||
wr.close();
|
||||
rd.close();
|
||||
return pasteBinUrl;
|
||||
} catch (Exception e) {
|
||||
System.out.print(e);
|
||||
return "Error Posting to pastebin.com";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class WhoCommand extends MultiverseCommand {
|
||||
|
||||
public WhoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Who?");
|
||||
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv who");
|
||||
this.addKey("mvw");
|
||||
this.addKey("mvwho");
|
||||
this.setPermission("multiverse.core.list.who", "States who is in what world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// If this command was sent from a Player then we need to check Permissions
|
||||
Player p = null;
|
||||
// By default, show all from the console
|
||||
boolean showAll = true;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
showAll = false;
|
||||
}
|
||||
|
||||
List<MVWorld> worlds = new ArrayList<MVWorld>();
|
||||
|
||||
if (args.size() > 0) {
|
||||
if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
|
||||
showAll = true;
|
||||
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
|
||||
} else if (this.plugin.isMVWorld(args.get(0))) {
|
||||
worlds.add(this.plugin.getMVWorld(args.get(0)));
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "World does not exist");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
|
||||
}
|
||||
|
||||
if (worlds.size() == 0) {
|
||||
sender.sendMessage("Multiverse does not know about any of your worlds :(");
|
||||
} else if (worlds.size() == 1) {
|
||||
sender.sendMessage(ChatColor.AQUA + "--- " + "Players in" + ChatColor.YELLOW + worlds.get(0) + ChatColor.AQUA + " ---");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.AQUA + "--- There are players in ---");
|
||||
}
|
||||
|
||||
for (MVWorld world : worlds) {
|
||||
if (!(this.plugin.isMVWorld(world.getName()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
List<Player> players = world.getCBWorld().getPlayers();
|
||||
|
||||
String result = "";
|
||||
if (players.size() <= 0 && !showAll) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (players.size() <= 0) {
|
||||
result = "Empty";
|
||||
} else {
|
||||
for (Player player : players) {
|
||||
result += player.getName() + " ";
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(world.getColoredWorldString() + ChatColor.WHITE + " - " + result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* This package contains all the commands for Multiverse-Core.
|
||||
*/
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import co.aikar.commands.PaperCommandCompletions;
|
||||
import co.aikar.commands.RegisteredCommand;
|
||||
import co.aikar.commands.RootCommand;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
|
||||
import org.bukkit.GameRule;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MVCommandCompletions extends PaperCommandCompletions {
|
||||
protected final MVCommandManager commandManager;
|
||||
private final MultiverseCore plugin;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public MVCommandCompletions(MVCommandManager mvCommandManager, MultiverseCore plugin) {
|
||||
super(mvCommandManager);
|
||||
this.commandManager = mvCommandManager;
|
||||
this.plugin = plugin;
|
||||
this.worldManager = plugin.getMVWorldManager();
|
||||
|
||||
registerAsyncCompletion("commands", this::suggestCommands);
|
||||
registerAsyncCompletion("destinations", this::suggestDestinations);
|
||||
registerAsyncCompletion("flags", this::suggestFlags);
|
||||
registerStaticCompletion("gamerules", this::suggestGamerules);
|
||||
registerAsyncCompletion("mvworlds", this::suggestMVWorlds);
|
||||
|
||||
setDefaultCompletion("destinations", ParsedDestination.class);
|
||||
setDefaultCompletion("flags", String[].class);
|
||||
setDefaultCompletion("gamerules", GameRule.class);
|
||||
setDefaultCompletion("mvworlds", MVWorld.class);
|
||||
}
|
||||
|
||||
private Collection<String> suggestCommands(BukkitCommandCompletionContext context) {
|
||||
String rootCmdName = context.getConfig();
|
||||
if (rootCmdName == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
RootCommand rootCommand = this.plugin.getMVCommandManager().getRegisteredRootCommands().stream()
|
||||
.unordered()
|
||||
.filter(c -> c.getCommandName().equals(rootCmdName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (rootCommand == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return rootCommand.getSubCommands().entries().stream()
|
||||
.filter(entry -> checkPerms(context.getIssuer(), entry.getValue()))
|
||||
.map(Map.Entry::getKey)
|
||||
.filter(cmdName -> !cmdName.startsWith("__"))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private boolean checkPerms(CommandIssuer issuer, RegisteredCommand<?> command) {
|
||||
return this.plugin.getMVCommandManager().hasPermission(issuer, command.getRequiredPermissions());
|
||||
}
|
||||
|
||||
private Collection<String> suggestDestinations(BukkitCommandCompletionContext context) {
|
||||
if (context.hasConfig("playerOnly") && !context.getIssuer().isPlayer()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return this.plugin.getDestinationsProvider()
|
||||
.suggestDestinations((BukkitCommandIssuer)context.getIssuer(), context.getInput());
|
||||
}
|
||||
|
||||
private Collection<String> suggestFlags(@NotNull BukkitCommandCompletionContext context) {
|
||||
return this.commandManager.getFlagsManager().suggest(
|
||||
context.getConfig("groupName", ""), context.getContextValue(String[].class));
|
||||
}
|
||||
|
||||
private Collection<String> suggestGamerules() {
|
||||
return Arrays.stream(GameRule.values()).map(GameRule::getName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Collection<String> suggestMVWorlds(BukkitCommandCompletionContext context) {
|
||||
if (context.hasConfig("playerOnly") && !context.getIssuer().isPlayer()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (!context.hasConfig("multiple")) {
|
||||
return getMVWorldNames(context);
|
||||
}
|
||||
|
||||
String input = context.getInput();
|
||||
int lastComma = input.lastIndexOf(',');
|
||||
String currentWorldsString = input.substring(0, lastComma + 1);
|
||||
Set<String> currentWorlds = Sets.newHashSet(input.split(","));
|
||||
return getMVWorldNames(context).stream()
|
||||
.filter(world -> !currentWorlds.contains(world))
|
||||
.map(world -> currentWorldsString + world)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<String> getMVWorldNames(BukkitCommandCompletionContext context) {
|
||||
String scope = context.getConfig("scope", "loaded");
|
||||
List<String> worlds = new ArrayList<>();
|
||||
switch (scope) {
|
||||
case "both":
|
||||
worlds.addAll(worldManager.getUnloadedWorlds());
|
||||
case "loaded":
|
||||
worldManager.getMVWorlds()
|
||||
.stream()
|
||||
.map(MVWorld::getName)
|
||||
.forEach(worlds::add);
|
||||
break;
|
||||
case "unloaded":
|
||||
worlds.addAll(worldManager.getUnloadedWorlds());
|
||||
break;
|
||||
case "potential":
|
||||
worlds.addAll(worldManager.getPotentialWorlds());
|
||||
break;
|
||||
}
|
||||
return worlds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.BukkitConditionContext;
|
||||
import co.aikar.commands.CommandConditions;
|
||||
import co.aikar.commands.ConditionContext;
|
||||
import co.aikar.commands.ConditionFailedException;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.world.WorldNameChecker;
|
||||
|
||||
public class MVCommandConditions {
|
||||
static void load(MVCommandManager commandManager, MultiverseCore plugin) {
|
||||
new MVCommandConditions(commandManager, plugin);
|
||||
}
|
||||
|
||||
private final MVCommandManager commandManager;
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
public MVCommandConditions(MVCommandManager commandManager, MultiverseCore plugin) {
|
||||
this.commandManager = commandManager;
|
||||
this.plugin = plugin;
|
||||
|
||||
CommandConditions<BukkitCommandIssuer, BukkitCommandExecutionContext, BukkitConditionContext> conditions
|
||||
= commandManager.getCommandConditions();
|
||||
|
||||
conditions.addCondition(String.class, "validWorldName", this::checkValidWorldName);
|
||||
}
|
||||
|
||||
private void checkValidWorldName(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext executionContext,
|
||||
String worldName
|
||||
) {
|
||||
String scope = context.getConfigValue("scope", "loaded");
|
||||
|
||||
switch (scope) {
|
||||
// Worlds that are loaded
|
||||
case "loaded":
|
||||
if (!this.plugin.getMVWorldManager().isMVWorld(worldName)) {
|
||||
throw new ConditionFailedException("World with name '" + worldName + "' does not exist or is not loaded!");
|
||||
}
|
||||
break;
|
||||
// Worlds that are unloaded
|
||||
case "unloaded":
|
||||
if (!this.plugin.getMVWorldManager().hasUnloadedWorld(worldName, false)) {
|
||||
if (this.plugin.getMVWorldManager().isMVWorld(worldName)) {
|
||||
throw new ConditionFailedException("World with name '" + worldName + "' is loaded already!");
|
||||
}
|
||||
throw new ConditionFailedException("World with name '" + worldName + "' does not exist!");
|
||||
}
|
||||
break;
|
||||
// World that are loaded or unloaded
|
||||
case "both":
|
||||
if (!this.plugin.getMVWorldManager().hasUnloadedWorld(worldName, true)) {
|
||||
throw new ConditionFailedException("World with name '" + worldName + "' does not exist!");
|
||||
}
|
||||
break;
|
||||
// World that are does not exist
|
||||
case "new":
|
||||
if (this.plugin.getMVWorldManager().hasUnloadedWorld(worldName, true)) {
|
||||
throw new ConditionFailedException("World with name '" + worldName + "' already exists!");
|
||||
}
|
||||
switch (WorldNameChecker.checkName(worldName)) {
|
||||
case INVALID_CHARS:
|
||||
throw new ConditionFailedException("World name '" + worldName + "' contains invalid characters!");
|
||||
case BLACKLISTED:
|
||||
throw new ConditionFailedException("World name '" + worldName + "' is used for critical server operations and is blacklisted!");
|
||||
}
|
||||
break;
|
||||
// Probably a typo happened here
|
||||
default:
|
||||
throw new ConditionFailedException("Unknown scope '" + scope + "'!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import co.aikar.commands.PaperCommandContexts;
|
||||
import co.aikar.commands.contexts.ContextResolver;
|
||||
import com.google.common.base.Strings;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.commandtools.context.GameRuleValue;
|
||||
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
|
||||
import com.onarandombox.MultiverseCore.display.filters.ContentFilter;
|
||||
import com.onarandombox.MultiverseCore.display.filters.DefaultContentFilter;
|
||||
import com.onarandombox.MultiverseCore.display.filters.RegexContentFilter;
|
||||
import com.onarandombox.MultiverseCore.utils.player.PlayerFinder;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MVCommandContexts extends PaperCommandContexts {
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
public MVCommandContexts(MVCommandManager mvCommandManager, MultiverseCore plugin) {
|
||||
super(mvCommandManager);
|
||||
this.plugin = plugin;
|
||||
|
||||
registerIssuerOnlyContext(BukkitCommandIssuer.class, BukkitCommandExecutionContext::getIssuer);
|
||||
registerOptionalContext(ContentFilter.class, this::parseContentFilter);
|
||||
registerContext(ParsedDestination.class, this::parseDestination);
|
||||
registerContext(GameRule.class, this::parseGameRule);
|
||||
registerContext(GameRuleValue.class, this::parseGameRuleValue);
|
||||
registerIssuerAwareContext(MVWorld.class, this::parseMVWorld);
|
||||
registerIssuerAwareContext(MVWorld[].class, this::parseMVWorldArray);
|
||||
registerIssuerAwareContext(Player.class, this::parsePlayer);
|
||||
registerIssuerAwareContext(Player[].class, this::parsePlayerArray);
|
||||
}
|
||||
|
||||
private ContentFilter parseContentFilter(BukkitCommandExecutionContext context) {
|
||||
if (Strings.isNullOrEmpty(context.getFirstArg())) {
|
||||
return DefaultContentFilter.get();
|
||||
}
|
||||
String filterString = context.popFirstArg();
|
||||
return RegexContentFilter.fromString(filterString);
|
||||
}
|
||||
|
||||
private ParsedDestination<?> parseDestination(BukkitCommandExecutionContext context) {
|
||||
String destination = context.popFirstArg();
|
||||
if (Strings.isNullOrEmpty(destination)) {
|
||||
throw new InvalidCommandArgument("No destination specified.");
|
||||
}
|
||||
|
||||
ParsedDestination<?> parsedDestination = plugin.getDestinationsProvider().parseDestination(destination);
|
||||
if (parsedDestination == null) {
|
||||
throw new InvalidCommandArgument("The destination " + destination + " is not valid.");
|
||||
}
|
||||
|
||||
return parsedDestination;
|
||||
}
|
||||
|
||||
private GameRule<?> parseGameRule(BukkitCommandExecutionContext context) {
|
||||
String gameRuleName = context.popFirstArg();
|
||||
if (Strings.isNullOrEmpty(gameRuleName)) {
|
||||
throw new InvalidCommandArgument("No game rule specified.");
|
||||
}
|
||||
|
||||
GameRule<?> gameRule = GameRule.getByName(gameRuleName);
|
||||
if (gameRule == null) {
|
||||
throw new InvalidCommandArgument("The game rule " + gameRuleName + " is not valid.");
|
||||
}
|
||||
|
||||
return gameRule;
|
||||
}
|
||||
|
||||
private GameRuleValue parseGameRuleValue(BukkitCommandExecutionContext context) {
|
||||
GameRule<?> gameRule = (GameRule<?>) context.getResolvedArg(GameRule.class);
|
||||
if (gameRule == null) {
|
||||
throw new InvalidCommandArgument("No game rule specified.");
|
||||
}
|
||||
String valueString = context.getFirstArg();
|
||||
if (Strings.isNullOrEmpty(valueString)) {
|
||||
throw new InvalidCommandArgument("No game rule value specified.");
|
||||
}
|
||||
|
||||
ContextResolver<?, BukkitCommandExecutionContext> resolver = getResolver(gameRule.getType());
|
||||
if (resolver == null) {
|
||||
return new GameRuleValue(valueString);
|
||||
}
|
||||
|
||||
Object resolvedValue = resolver.getContext(context);
|
||||
if (resolvedValue == null) {
|
||||
throw new InvalidCommandArgument("The game rule value " + valueString + " is not valid for game rule " + gameRule.getName() + ".");
|
||||
}
|
||||
|
||||
return new GameRuleValue(resolvedValue);
|
||||
}
|
||||
|
||||
private MVWorld parseMVWorld(BukkitCommandExecutionContext context) {
|
||||
String resolve = context.getFlagValue("resolve", "");
|
||||
|
||||
// Get world based on sender only
|
||||
if (resolve.equals("issuerOnly")) {
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
return plugin.getMVWorldManager().getMVWorld(context.getIssuer().getPlayer().getWorld());
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("This command can only be used by a player in a Multiverse World.");
|
||||
}
|
||||
|
||||
String worldName = context.getFirstArg();
|
||||
MVWorld world = plugin.getMVWorldManager().getMVWorld(worldName);
|
||||
|
||||
// Get world based on input, fallback to sender if input is not a world
|
||||
if (resolve.equals("issuerAware")) {
|
||||
if (world != null) {
|
||||
context.popFirstArg();
|
||||
return world;
|
||||
}
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
return plugin.getMVWorldManager().getMVWorld(context.getIssuer().getPlayer().getWorld());
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Player is not in a Multiverse World.");
|
||||
}
|
||||
|
||||
// Get world based on input only
|
||||
if (world != null) {
|
||||
context.popFirstArg();
|
||||
return world;
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("World " + worldName + " is not a loaded multiverse world.");
|
||||
}
|
||||
|
||||
private MVWorld[] parseMVWorldArray(BukkitCommandExecutionContext context) {
|
||||
String resolve = context.getFlagValue("resolve", "");
|
||||
|
||||
MVWorld playerWorld = null;
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
playerWorld = plugin.getMVWorldManager().getMVWorld(context.getIssuer().getPlayer().getWorld());
|
||||
}
|
||||
|
||||
// Get world based on sender only
|
||||
if (resolve.equals("issuerOnly")) {
|
||||
if (playerWorld != null) {
|
||||
return new MVWorld[]{playerWorld};
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("This command can only be used by a player in a Multiverse World.");
|
||||
}
|
||||
|
||||
String worldStrings = context.getFirstArg();
|
||||
String[] worldNames = worldStrings.split(",");
|
||||
Set<MVWorld> worlds = new HashSet<>(worldNames.length);
|
||||
for (String worldName : worldNames) {
|
||||
if ("*".equals(worldName)) {
|
||||
worlds.addAll(plugin.getMVWorldManager().getMVWorlds());
|
||||
break;
|
||||
}
|
||||
MVWorld world = plugin.getMVWorldManager().getMVWorld(worldName);
|
||||
if (world == null) {
|
||||
throw new InvalidCommandArgument("World " + worldName + " is not a loaded multiverse world.");
|
||||
}
|
||||
worlds.add(world);
|
||||
}
|
||||
|
||||
// Get world based on input, fallback to sender if input is not a world
|
||||
if (resolve.equals("issuerAware")) {
|
||||
if (!worlds.isEmpty()) {
|
||||
context.popFirstArg();
|
||||
return worlds.toArray(new MVWorld[0]);
|
||||
}
|
||||
if (playerWorld != null) {
|
||||
return new MVWorld[]{playerWorld};
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Player is not in a Multiverse World.");
|
||||
}
|
||||
|
||||
// Get world based on input only
|
||||
if (!worlds.isEmpty()) {
|
||||
context.popFirstArg();
|
||||
return worlds.toArray(new MVWorld[0]);
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("World " + worldStrings + " is not a loaded multiverse world.");
|
||||
}
|
||||
|
||||
private Player parsePlayer(BukkitCommandExecutionContext context) {
|
||||
String resolve = context.getFlagValue("resolve", "");
|
||||
|
||||
// Get player based on sender only
|
||||
if (resolve.equals("issuerOnly")) {
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
return context.getIssuer().getPlayer();
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("This command can only be used by a player.");
|
||||
}
|
||||
|
||||
String playerIdentifier = context.getFirstArg();
|
||||
Player player = PlayerFinder.get(playerIdentifier, context.getSender());
|
||||
|
||||
// Get player based on input, fallback to sender if input is not a player
|
||||
if (resolve.equals("issuerAware")) {
|
||||
if (player != null) {
|
||||
context.popFirstArg();
|
||||
return player;
|
||||
}
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
return context.getIssuer().getPlayer();
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Invalid player: " + playerIdentifier
|
||||
+ ". Either specify an online player or use this command as a player.");
|
||||
}
|
||||
|
||||
// Get player based on input only
|
||||
if (player != null) {
|
||||
context.popFirstArg();
|
||||
return player;
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Player " + playerIdentifier + " not found.");
|
||||
}
|
||||
|
||||
|
||||
private Player[] parsePlayerArray(BukkitCommandExecutionContext context) {
|
||||
String resolve = context.getFlagValue("resolve", "");
|
||||
|
||||
// Get player based on sender only
|
||||
if (resolve.equals("issuerOnly")) {
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
return new Player[]{context.getIssuer().getPlayer()};
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("This command can only be used by a player.");
|
||||
}
|
||||
|
||||
String playerIdentifier = context.getFirstArg();
|
||||
Player[] players = PlayerFinder.getMulti(playerIdentifier, context.getSender()).toArray(new Player[0]);
|
||||
|
||||
// Get player based on input, fallback to sender if input is not a player
|
||||
if (resolve.equals("issuerAware")) {
|
||||
if (players.length > 0) {
|
||||
context.popFirstArg();
|
||||
return players;
|
||||
}
|
||||
if (context.getIssuer().isPlayer()) {
|
||||
return new Player[]{context.getIssuer().getPlayer()};
|
||||
}
|
||||
if (context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Invalid player: " + playerIdentifier
|
||||
+ ". Either specify an online player or use this command as a player.");
|
||||
}
|
||||
|
||||
// Get player based on input only
|
||||
if (players.length > 0) {
|
||||
context.popFirstArg();
|
||||
return players;
|
||||
}
|
||||
if (!context.isOptional()) {
|
||||
return null;
|
||||
}
|
||||
throw new InvalidCommandArgument("Player " + playerIdentifier + " not found.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.CommandCompletions;
|
||||
import co.aikar.commands.CommandContexts;
|
||||
import co.aikar.commands.CommandHelp;
|
||||
import co.aikar.commands.HelpEntry;
|
||||
import co.aikar.commands.PaperCommandManager;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagsManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.CommandQueueManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Main class to manage permissions.
|
||||
*/
|
||||
public class MVCommandManager extends PaperCommandManager {
|
||||
|
||||
private final MultiverseCore plugin;
|
||||
private CommandFlagsManager flagsManager;
|
||||
private CommandQueueManager commandQueueManager;
|
||||
private PluginLocales pluginLocales;
|
||||
|
||||
public MVCommandManager(@NotNull MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
|
||||
// Setup conditions
|
||||
MVCommandConditions.load(this, plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class responsible for flag handling.
|
||||
*
|
||||
* @return A not-null {@link CommandFlagsManager}.
|
||||
*/
|
||||
public synchronized @NotNull CommandFlagsManager getFlagsManager() {
|
||||
if (this.flagsManager == null) {
|
||||
this.flagsManager = new CommandFlagsManager();
|
||||
}
|
||||
return flagsManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class responsible for locale handling.
|
||||
*
|
||||
* @return A not-null {@link PluginLocales}.
|
||||
*/
|
||||
@Override
|
||||
public PluginLocales getLocales() {
|
||||
if (this.pluginLocales == null) {
|
||||
this.pluginLocales = new PluginLocales(this);
|
||||
this.locales = pluginLocales; // For parent class
|
||||
this.pluginLocales.loadLanguages();
|
||||
}
|
||||
return this.pluginLocales;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manager for command that requires /mv confirm before execution.
|
||||
*
|
||||
* @return A non-null {@link CommandQueueManager}.
|
||||
*/
|
||||
public synchronized @NotNull CommandQueueManager getCommandQueueManager() {
|
||||
if (this.commandQueueManager == null) {
|
||||
this.commandQueueManager = new CommandQueueManager(this.plugin);
|
||||
}
|
||||
return commandQueueManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class responsible for parsing string args into objects.
|
||||
*
|
||||
* @return A not-null {@link CommandContexts}.
|
||||
*/
|
||||
@Override
|
||||
public synchronized @NotNull CommandContexts<BukkitCommandExecutionContext> getCommandContexts() {
|
||||
if (this.contexts == null) {
|
||||
this.contexts = new MVCommandContexts(this, plugin);
|
||||
}
|
||||
return this.contexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class responsible for tab-completion handling.
|
||||
*
|
||||
* @return A not-null {@link CommandCompletions}.
|
||||
*/
|
||||
@Override
|
||||
public synchronized @NotNull CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions() {
|
||||
if (this.completions == null) {
|
||||
this.completions = new MVCommandCompletions(this, plugin);
|
||||
}
|
||||
return this.completions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standardise usage command formatting for all mv modules.
|
||||
*
|
||||
* @param help The target {@link CommandHelp}.
|
||||
*/
|
||||
public void showUsage(@NotNull CommandHelp help) {
|
||||
List<HelpEntry> entries = help.getHelpEntries();
|
||||
if (entries.size() == 1) {
|
||||
this.plugin.getMVCommandManager().getHelpFormatter().showDetailedHelp(help, entries.get(0));
|
||||
return;
|
||||
}
|
||||
help.showHelp();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import com.onarandombox.MultiverseCore.api.MVPlugin;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagsManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class MultiverseCommand extends BaseCommand {
|
||||
protected final CommandFlagsManager flagsManager;
|
||||
private String flagGroupName;
|
||||
|
||||
protected MultiverseCommand(@NotNull MVPlugin plugin) {
|
||||
this.flagsManager = plugin.getCore().getMVCommandManager().getFlagsManager();
|
||||
}
|
||||
|
||||
protected void registerFlagGroup(@NotNull CommandFlagGroup flagGroup) {
|
||||
if (flagGroupName != null) {
|
||||
throw new IllegalStateException("Flag group already registered! (name: " + flagGroupName + ")");
|
||||
}
|
||||
flagsManager.registerFlagGroup(flagGroup);
|
||||
flagGroupName = flagGroup.getName();
|
||||
}
|
||||
|
||||
protected @NotNull ParsedCommandFlags parseFlags(@NotNull String[] flags) {
|
||||
return flagsManager.parse(flagGroupName, flags);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools;
|
||||
|
||||
import co.aikar.commands.BukkitCommandManager;
|
||||
import co.aikar.commands.BukkitLocales;
|
||||
import com.onarandombox.MultiverseCore.utils.file.FileResClassLoader;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Locale manager with additional methods for loading locales from plugin's locales folder.
|
||||
*/
|
||||
public class PluginLocales extends BukkitLocales {
|
||||
|
||||
private static final String DEFAULT_LOCALE_FOLDER_PATH = "locales";
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link PluginLocales}.
|
||||
*
|
||||
* @param manager The command manager.
|
||||
*/
|
||||
public PluginLocales(BukkitCommandManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a {@link FileResClassLoader} to the list of class loaders to load locales data from.
|
||||
*
|
||||
* @param plugin The plugin.
|
||||
* @return True if the class loader was added successfully.
|
||||
*/
|
||||
public boolean addFileResClassLoader(@NotNull Plugin plugin) {
|
||||
return this.addBundleClassLoader(new FileResClassLoader(plugin, DEFAULT_LOCALE_FOLDER_PATH));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a {@link FileResClassLoader} to the list of class loaders to load locales data from.
|
||||
*
|
||||
* @param plugin The plugin.
|
||||
* @param localesFolderPath The path to the folder containing the locales.
|
||||
* @return True if the class loader was added successfully.
|
||||
*/
|
||||
public boolean addFileResClassLoader(@NotNull Plugin plugin, @NotNull String localesFolderPath) {
|
||||
return this.addBundleClassLoader(new FileResClassLoader(plugin, localesFolderPath));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools.context;
|
||||
|
||||
public class GameRuleValue {
|
||||
private final Object value;
|
||||
|
||||
public GameRuleValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.onarandombox.MultiverseCore.commandtools.flags;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a flag.
|
||||
*/
|
||||
public class CommandFlag {
|
||||
/**
|
||||
* A builder for a flag.
|
||||
*
|
||||
* @param key The key for the new flag.
|
||||
* @return The builder.
|
||||
*/
|
||||
public static @NotNull Builder<?> builder(@NotNull String key){
|
||||
return new Builder<>(key);
|
||||
}
|
||||
|
||||
private final String key;
|
||||
private final List<String> aliases;
|
||||
|
||||
/**
|
||||
* Creates a new flag.
|
||||
*
|
||||
* @param builder The builder.
|
||||
*/
|
||||
protected CommandFlag(@NotNull Builder<?> builder) {
|
||||
key = builder.key;
|
||||
aliases = builder.aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key of this flag.
|
||||
*
|
||||
* @return The key of this flag.
|
||||
*/
|
||||
public @NotNull String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the aliases of this flag.
|
||||
*
|
||||
* @return The aliases of this flag.
|
||||
*/
|
||||
public @NotNull List<String> getAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder for a flag.
|
||||
*
|
||||
* @param <S> The type of the builder.
|
||||
*/
|
||||
public static class Builder<S extends Builder<?>> {
|
||||
private final String key;
|
||||
private final List<String> aliases;
|
||||
|
||||
/**
|
||||
* Create a new builder.
|
||||
*
|
||||
* @param key The key for the new flag.
|
||||
*/
|
||||
public Builder(@NotNull String key) {
|
||||
this.key = key;
|
||||
aliases = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add one or more alias to the flag.
|
||||
*
|
||||
* @param alias The alias to add.
|
||||
* @return The builder.
|
||||
*/
|
||||
public @NotNull S addAlias(@NotNull String...alias){
|
||||
Collections.addAll(this.aliases, alias);
|
||||
return (S) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the flag.
|
||||
*
|
||||
* @return The flag.
|
||||
*/
|
||||
public @NotNull CommandFlag build(){
|
||||
return new CommandFlag(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 273 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user