Compare commits
807 Commits
Author | SHA1 | Date |
---|---|---|
Jeremy Wood | 17129f68d2 | |
Jeremy Wood | e00b06692f | |
Jeremy Wood | a2339fac2f | |
Jeremy Wood | 227cddab7c | |
Ben Woo | ff88b30959 | |
Jeremy Wood | fa6a01d690 | |
Jeremy Wood | 5f9a002a07 | |
Jeremy Wood | 3198fcc4b1 | |
Jeremy Wood | d50e8c1dde | |
Jeremy Wood | 87271aa4eb | |
Jeremy Wood | 5b8984a492 | |
Jeremy Wood | 49fcadf434 | |
Jeremy Wood | 950fe1217a | |
Jeremy Wood | 8b895d41f7 | |
Jeremy Wood | dcbcca9a62 | |
Jeremy Wood | bc830ee780 | |
Jeremy Wood | 407dcb3125 | |
Jeremy Wood | 405a033d85 | |
Jeremy Wood | 073d13cf4d | |
Jeremy Wood | e8e8c4aff6 | |
Jeremy Wood | 67f2f1f6b0 | |
Jeremy Wood | d7f236492b | |
Jeremy Wood | 086c3e8af0 | |
Jeremy Wood | c62c1278ec | |
Jeremy Wood | 1d47473cd3 | |
Jeremy Wood | f725723932 | |
Jeremy Wood | 28edf86c96 | |
Jeremy Wood | ab2dd9d316 | |
Jeremy Wood | e04b0faa85 | |
Jeremy Wood | 6a309f04dc | |
Jeremy Wood | cb7ee2fc26 | |
Jeremy Wood | 2143930fac | |
Ben Woo | 5f12aa53b4 | |
Jeremy Wood | 1d371fb625 | |
Ben Woo | 320dc82b83 | |
Ben Woo | 3683f93522 | |
Jeremy Wood | 288474cd20 | |
Ben Woo | 16ceaa4c40 | |
Jeremy Wood | e9f55e43ee | |
Jeremy Wood | 31f4f20bd8 | |
Jeremy Wood | bae909a9e8 | |
Jeremy Wood | ee5408764f | |
Ben Woo | e2e0574baa | |
zax71 | e1b6bf75b0 | |
Ben Woo | 7017689758 | |
Ben Woo | 58d51f57e5 | |
Jeremy Wood | ccd417db3e | |
Jeremy Wood | 0eb67bee9c | |
Ben Woo | 9b22bdf2ab | |
Ben Woo | 91e5d343cd | |
Ben Woo | 743feea807 | |
Ben Woo | d5d1c94566 | |
Ben Woo | f67d8efb44 | |
Ben Woo | 70132c0da4 | |
Ben Woo | 9c3914d409 | |
Ben Woo | db89482e29 | |
Ben Woo | fdb9125f3a | |
Ben Woo | c3b17d33c3 | |
Jeremy Wood | e9d8db668f | |
Ben Woo | 60a4b6fc89 | |
Jeremy Wood | f59267374f | |
Ben Woo | b1c0e94a4b | |
Ben Woo | 61254bfccb | |
Ben Woo | 3f5a17e39a | |
Ben Woo | 7c6f1b5fc4 | |
Jeremy Wood | 06b87801fe | |
Ben Woo | a92e5c95aa | |
Jeremy Wood | 590972c933 | |
Ben Woo | 007b7149a1 | |
Ben Woo | 8b18ccbd1d | |
Jeremy Wood | 73e0b30836 | |
Ben Woo | 42c8e414c2 | |
Ben Woo | 82a274bad2 | |
Ben Woo | 8aa01026ea | |
Ben Woo | 750d1ea4fa | |
Ben Woo | 586ac4a90e | |
Jeremy Wood | 816d5f86d6 | |
Ben Woo | 7e8ebfb8cd | |
Jeremy Wood | 350d228975 | |
Ben Woo | 2126efe27c | |
Ben Woo | 3330bd3031 | |
Ben Woo | 4f5b4126f4 | |
Ben Woo | c4a80d7b78 | |
Ben Woo | d31f7e9d87 | |
Ben Woo | 356d67edf4 | |
Jeremy Wood | 8865cfb53f | |
Ben Woo | bf72328c37 | |
Ben Woo | 9a80620aa1 | |
Ben Woo | 982eb28f2a | |
Ben Woo | 4ecd65a589 | |
Ben Woo | 5fbe16ed5a | |
Ben Woo | 582d256f38 | |
Jeremy Wood | 26e587805d | |
Ben Woo | 3ad2322db7 | |
Jeremy Wood | 8764108edd | |
Jeremy Wood | 5fa8e9acf6 | |
Jeremy Wood | 0ead2da16f | |
Ben Woo | fd4bc7cf60 | |
Jeremy Wood | ad296fde1f | |
Ben Woo | 6f39a2c97d | |
Jeremy Wood | befb2b54d8 | |
Zax71 | efcd14830e | |
Zax71 | 491bb2467f | |
Zax71 | dfbe81c785 | |
Zax71 | 986bafc13d | |
Zax71 | 9b4613ce84 | |
Jeremy Wood | 48e875d13e | |
Jeremy Wood | 14b54d5269 | |
Jeremy Wood | 1c24b17c90 | |
Ben Woo | 346ac94737 | |
zax71 | 6d351300de | |
Jeremy Wood | 8a69d6ad43 | |
Ben Woo | 3b44ea218d | |
Ben Woo | 68c97f7ae6 | |
zax71 | 68411ae6bf | |
zax71 | 2c5e86c689 | |
Jeremy Wood | 4eca331430 | |
Jeremy Wood | b6574245b8 | |
Jeremy Wood | 85d744d79f | |
Jeremy Wood | e536dff1a8 | |
Jeremy Wood | 39287f55ef | |
Ben Woo | d5ebde53b9 | |
Jeremy Wood | 101ddae443 | |
zax71 | c3eb0ee8bd | |
zax71 | 6a8c0b6255 | |
Jeremy Wood | 2b97f7310f | |
Jeremy Wood | 073091525b | |
Jeremy Wood | 79b9c12319 | |
Jeremy Wood | 01f745b027 | |
Jeremy Wood | 9725bdfeeb | |
Jeremy Wood | cdf9767959 | |
Jeremy Wood | 66e21da6b2 | |
Jeremy Wood | 87b14d3944 | |
Jeremy Wood | 7bbeb90320 | |
Jeremy Wood | cd895d03dc | |
Jeremy Wood | ee2a304148 | |
Jeremy Wood | 06e9e33da4 | |
Jeremy Wood | 7065ffaea2 | |
Jeremy Wood | 1bc4e68ff9 | |
Jeremy Wood | 4e53d13290 | |
Jeremy Wood | 90344d36df | |
Jeremy Wood | f36a56e854 | |
Jeremy Wood | 5d4bacc80e | |
Jeremy Wood | d88bf6e137 | |
Jeremy Wood | 63f5d769d8 | |
Jeremy Wood | 9a9bfc03b9 | |
Jeremy Wood | 28112ef4d8 | |
Jeremy Wood | 7e5a3238b8 | |
Jeremy Wood | 3279a6a38d | |
Jeremy Wood | b64e48769d | |
Jeremy Wood | ff8002fc13 | |
Jeremy Wood | 2af835f0c3 | |
Jeremy Wood | bf25b65f09 | |
Jeremy Wood | 52eb3d820f | |
Jeremy Wood | 908fcb1e44 | |
Jeremy Wood | 73cd26aea3 | |
Jeremy Wood | 758d25812b | |
Ben Woo | fa0ef421c7 | |
Ben Woo | e936a6271f | |
Jeremy Wood | 7362e543da | |
Jeremy Wood | 8a46d70301 | |
Jeremy Wood | a168e5cb48 | |
Jeremy Wood | ae578f9491 | |
Jeremy Wood | e72122378d | |
Jeremy Wood | fd2ea3df09 | |
Jeremy Wood | e94e071c6e | |
Jeremy Wood | 0e19236cdc | |
Jeremy Wood | 1c12756acf | |
Jeremy Wood | bcfde80c07 | |
Jeremy Wood | 8dc9e864eb | |
Jeremy Wood | fec820f4ba | |
Jeremy Wood | ff9ffad302 | |
Jeremy Wood | fc2cb6aeae | |
Jeremy Wood | d2776ef448 | |
Jeremy Wood | 36ef41b710 | |
Jeremy Wood | 9258ebd8c7 | |
Jeremy Wood | d528cbcafd | |
Jeremy Wood | 760c193b0e | |
Jeremy Wood | 7c6edcb081 | |
Jeremy Wood | 009a94f74d | |
Jeremy Wood | bd6fb4e51c | |
Jeremy Wood | 2fdef44744 | |
Jeremy Wood | 5b991f44e2 | |
zax71 | 871ba16b67 | |
zax71 | e90c50d170 | |
zax71 | d1be3bd0be | |
Jeremy Wood | 4d40b3f7e4 | |
Chris | 1877479094 | |
Ben Woo | 20ce469aec | |
Kermina Awad | 70c91f777f | |
Ben Woo | cc24f38d83 | |
nicegamer7 | 5ec27db284 | |
Ben Woo | 5d6bc806f0 | |
Kisaragi | 5868ad64b4 | |
nicegamer7 | ac6fcf5ed6 | |
Ben Woo | 231824fd34 | |
Ben Woo | a3e7efcc58 | |
Artuto | a649307a29 | |
nicegamer7 | b0235757cc | |
Ben Woo | 06ee82a745 | |
Ben Woo | d2cad7ca8d | |
nicegamer7 | 2390aa8f92 | |
nicegamer7 | 674c4a4a06 | |
Ben Woo | 768402088a | |
Ben Woo | 084033cc90 | |
Ben Woo | 51801b1b36 | |
Jeremy Wood | 71054197f2 | |
Jeremy Wood | 610f96415f | |
Jeremy Wood | 34fa336f00 | |
Jeremy Wood | d92d62bce9 | |
Jeremy Wood | cf14d41d19 | |
Jeremy Wood | 719ade19f7 | |
Ben Woo | 1a8a97daf1 | |
nicegamer7 | d9dffa8e6d | |
nicegamer7 | 973588defb | |
nicegamer7 | c704c1ca3a | |
Ben Woo | c33a268b91 | |
Kermina Awad | 9821f1d9c8 | |
Kermina Awad | be6e0b67be | |
Kermina Awad | b9b1fa6164 | |
Kermina Awad | 28585dd6f9 | |
Ben Woo | 47ca7b821b | |
nicegamer7 | 9ce2dfd100 | |
Ben Woo | 473ccd09d7 | |
Ben Woo | cc2e1d44b2 | |
Jeremy Wood | 2e8f159d38 | |
Jeremy Wood | 6581d16125 | |
Jeremy Wood | 562bc56e83 | |
Ben Woo | 4493cd7916 | |
nicegamer7 | 1cd9e45915 | |
ccuser44 | acb6bc6dd6 | |
Ben Woo | b7b17c5d21 | |
Jeremy Wood | bbd9211845 | |
Jeremy Wood | fc6796e20f | |
Jeremy Wood | 6040a27126 | |
Jeremy Wood | 1c483148dc | |
nicegamer7 | 128442c062 | |
Kermina Awad | 141854f076 | |
xSavior_of_God | f72cc6764b | |
benwoo1110 | d95ecfaa8e | |
benwoo1110 | 6c96f4e974 | |
Ben Woo | 28cee291c6 | |
Ben Woo | 155f32c00f | |
Ben Woo | 071ba05d81 | |
Ben Woo | 2ee5aea06b | |
Ben Woo | 3bb8de6d33 | |
Ben Woo | 79ac01da34 | |
Kermina Awad | 6e4fbb0ece | |
Kermina Awad | 167ed5e0d3 | |
Kermina Awad | 91f3304f78 | |
Kermina Awad | 7928e73a32 | |
Kermina Awad | d61d186544 | |
nicegamer7 | dc356e88d0 | |
Kermina Awad | d0d5574580 | |
Ben Woo | 29617059b3 | |
Sam Goodger | bf05fc81dd | |
nicegamer7 | a2c5bf70f0 | |
benwoo1110 | ea19006465 | |
benwoo1110 | 89f685ff9a | |
benwoo1110 | ecc76033dc | |
Ben Woo | e843b0711d | |
Ben Woo | eddfaf7df0 | |
nicegamer7 | d1150ab5f8 | |
benwoo1110 | cc3996ca76 | |
benwoo1110 | 1965aecfba | |
benwoo1110 | ce34ae44d8 | |
benwoo1110 | f5a2d7bc47 | |
benwoo1110 | 24295025ef | |
Ben Woo | e3f56f6498 | |
Ben Woo | bd0c3cff3f | |
Ben Woo | 7c4ab035a0 | |
Ben Woo | 2593080f77 | |
benwoo1110 | 0d4595d511 | |
benwoo1110 | bf820c2c27 | |
benwoo1110 | a12718d354 | |
benwoo1110 | b23c1ae606 | |
Ben Woo | 7c59dcbcb9 | |
Ben Woo | 15cacba7c9 | |
Ben Woo | adbe88daa6 | |
Kermina Awad | 5350c012f7 | |
benwoo1110 | a91f377cf5 | |
Ben Woo | c3ae5ac210 | |
Ben Woo | f4ce740c06 | |
Kermina Awad | 3ff8d34053 | |
benwoo1110 | f362f09380 | |
benwoo1110 | 62b789dff5 | |
benwoo1110 | 84a9db597a | |
nicegamer7 | 89fd700e32 | |
benwoo1110 | 9741b1794c | |
Ben Woo | 001a6000f8 | |
Kermina Awad | bf61069fed | |
Ben Woo | d93def8b5b | |
nicegamer7 | 540394e266 | |
benwoo1110 | 425b1c80cc | |
Kermina Awad | 47ae6f5378 | |
benwoo1110 | 48601e4215 | |
Alexander Krantz | ed80083fe8 | |
Ben Woo | d041e0a8d1 | |
benwoo1110 | de85be5832 | |
Ben Woo | 81d59d8bf5 | |
benwoo1110 | 5d3d732c25 | |
Jeremy Wood | 0c2d2f4e0a | |
Jeremy Wood | 3d9108fb48 | |
Jeremy Wood | 25c616bc32 | |
Jeremy Wood | 148187025a | |
Jeremy Wood | 115b0dc078 | |
Jeremy Wood | 78bf6ba3bf | |
Kermina Awad | e31c391af4 | |
Jeremy Wood | 6ed4be9a64 | |
Jeremy Wood | d626e7e4b1 | |
Jeremy Wood | e7dd4fee51 | |
Ben Woo | 146075de69 | |
Jeremy Wood | 9fce6c54f6 | |
Ben Woo | f189eb3b7e | |
benwoo1110 | ed77cacb1a | |
Kermina Awad | 2d4fe301cf | |
Jeremy Wood | e5fe1fe565 | |
Jeremy Wood | 83010f1a28 | |
Jeremy Wood | 864e50e38c | |
Jeremy Wood | 0a99258f3e | |
benwoo1110 | cfae997de4 | |
benwoo1110 | b345baf20e | |
benwoo1110 | d532052c7b | |
Jeremy Wood | 1c02fb4387 | |
Jeremy Wood | 2a99649e1e | |
Kermina Awad | 994bf922af | |
Ben Woo | 36094e2bea | |
Jeremy Wood | 6243b41956 | |
benwoo1110 | 32170cc089 | |
Jeremy Wood | c1a3d48944 | |
nicegamer7 | 75855826e7 | |
Jeremy Wood | d35363b10c | |
Jeremy Wood | ad1b733498 | |
benwoo1110 | 9159dfbb7d | |
Robert Timm | b8acd339b3 | |
nicegamer7 | 51e035eb3e | |
Jeremy Wood | 2fd8e3edc3 | |
Jad | faf20ee36e | |
benwoo1110 | e1494808f3 | |
benwoo1110 | 05cf052204 | |
Jeremy Wood | 242f05fc77 | |
Jeremy Wood | dd29fcc1dd | |
Kermina Awad | d5013546d1 | |
Kermina Awad | 058c0837f0 | |
Kermina Awad | e01c646562 | |
Jeremy Wood | 3afca50930 | |
Kermina Awad | 94ca18e95c | |
Kermina Awad | 707eae92a8 | |
Kermina Awad | b4a4519876 | |
Kermina Awad | 4f41b7aa6e | |
Kermina Awad | b9267a3dfc | |
Kermina Awad | a53c4214f0 | |
Kermina Awad | 343695e23e | |
Kermina Awad | e17e9c8ce9 | |
Kermina Awad | 676c3a2e3d | |
Kermina Awad | e821611744 | |
Kermina Awad | d69c492577 | |
Kermina Awad | eb91eefc80 | |
Kermina Awad | f570c81366 | |
Jeremy Wood | b3f23278b1 | |
Jeremy Wood | 3fa2bfa7cf | |
Jeremy Wood | 582d6bef1a | |
Jeremy Wood | 04c65cc59e | |
Kermina Awad | 268c4982c3 | |
Kermina Awad | 8983a0c024 | |
Kermina Awad | 1cbe901e4d | |
Kermina Awad | 4894abd1f1 | |
nicegamer7 | 1fac13247f | |
Jeremy Wood | 59cfacf007 | |
Jeremy Wood | 5f916fbf27 | |
wellnesscookie | c70e254dbf | |
A248 | 9d42a05759 | |
Jonathan Leitschuh | 59b6522d59 | |
Niels Boehm | 46f8453b5b | |
Jeremy Wood | b4b0940918 | |
Jeremy Wood | 22ad7214b0 | |
Jeremy Wood | 1ba693ffd5 | |
Jeremy Wood | 6ee0d8a05e | |
Jeremy Wood | d3ff2922fd | |
Jeremy Wood | 5e2824abeb | |
Jeremy Wood | 926e23bf19 | |
Jeremy Wood | 841598232c | |
Jeremy Wood | 540b6abcab | |
Jeremy Wood | 38d5917915 | |
Jeremy Wood | da6bd20b42 | |
Jeremy Wood | 8859fa78fd | |
Jeremy Wood | 4de6b9ce47 | |
Jeremy Wood | f595f4cdb9 | |
Jeremy Wood | 1581e1e009 | |
Jeremy Wood | 7cb9bd4bc2 | |
Jeremy Wood | 32e72bb355 | |
Jeremy Wood | 950402a144 | |
Jeremy Wood | f598551d9c | |
Brokkonaut | c3f08318d4 | |
Jeremy Wood | f0343b08b5 | |
Jeremy Wood | 20a1fcb9f5 | |
Jeremy Wood | 253ede1c9a | |
Jeremy Wood | d4454703e4 | |
Jeremy Wood | 9737b62813 | |
Brokkonaut | 06bd1a838f | |
BaronyCraft | 4343167240 | |
Jeremy Wood | 7762aca019 | |
Jeremy Wood | 6ebc1188e8 | |
Jeremy Wood | 8b358b0955 | |
Jeremy Wood | b201b09719 | |
Jeremy Wood | 4c9d108f08 | |
Jeremy Wood | 564a7d3684 | |
Jeremy Wood | d832e9e6d9 | |
Jeremy Wood | aa574b6236 | |
Jeremy Wood | d7894eb847 | |
Jeremy Wood | 5e067fa72d | |
Jeremy Wood | b1bf68a0ad | |
Jeremy Wood | 89a8f24b14 | |
Jeremy Wood | 43ecdc913a | |
Jeremy Wood | 0f14ee557d | |
Jeremy Wood | 9b88d1d491 | |
Jeremy Wood | 606a3fa3ce | |
Jeremy Wood | a7cace0fdc | |
Jeremy Wood | ae314108a3 | |
Brokkonaut | d0180f05d5 | |
Jeremy Wood | 07df8d0d09 | |
Jeremy Wood | 4552f70f7e | |
Jeremy Wood | a6912c3cb5 | |
Jeremy Wood | 4bdeacfd05 | |
Jeremy Wood | 01f549f408 | |
Jeremy Wood | f7bbb5029b | |
Jeremy Wood | 658b5219c3 | |
Jeremy Wood | fb505ab161 | |
Jeremy Wood | 284b3179ad | |
Jeremy Wood | 532ffacf5a | |
Jeremy Wood | 2b4d386eb2 | |
Jeremy Wood | bc20ecbe60 | |
Jeremy Wood | 4878395460 | |
Jeremy Wood | 467ec809b5 | |
Jeremy Wood | ceb6850670 | |
Jeremy Wood | 63abf33414 | |
Jeremy Wood | bcd7fcaee7 | |
Jeremy Wood | d18581828d | |
Jeremy Wood | 54209e1535 | |
Jeremy Wood | 2ed59a866f | |
Jeremy Wood | 41b3096600 | |
Jeremy Wood | 42adfa8175 | |
Jeremy Wood | 12bcf71028 | |
Jeremy Wood | a826d0b2ff | |
Jeremy Wood | 59cab8a417 | |
RezzedUp | da6a62b984 | |
Jeremy Wood | 806c5909c4 | |
Eric Stokes | c00847f173 | |
Eric Stokes | 626e5d3e4b | |
Eric Stokes | f5e8a9c2e8 | |
Eric Stokes | 3364709e53 | |
Eric Stokes | 67d172fd08 | |
Eric Stokes | f3a420d85c | |
rlf | aba1f05c5b | |
rlf | 8fdc0ad3da | |
Eric Stokes | 3db57ee1d9 | |
httpdop | b3841adcc1 | |
Liam | 0b0b3c0088 | |
Jeremy Wood | a64a8d9605 | |
Jeremy Wood | 0a0d3ba527 | |
Jeremy Wood | a351fbb345 | |
Eric Stokes | 46359cfbfe | |
Eric Stokes | f52004cb76 | |
Eric Stokes | 0e3848874a | |
Eric Stokes | 71ba31a0f4 | |
Eric Stokes | 7b1e77340b | |
Eric Stokes | bebd4742b9 | |
Eric Stokes | b933027523 | |
Eric Stokes | bd1d852393 | |
Eric Stokes | 648365f336 | |
Jeremy Wood | 12b6a69146 | |
Jeremy Wood | cd312c3ab9 | |
Jeremy Wood | d2d243caec | |
Jeremy Wood | 865434d1b1 | |
Romarjosh Villamor | 0858e324dd | |
Jeremy Wood | 618986e216 | |
Jeremy Wood | cc3dfe9fd4 | |
Jeremy Wood | 6ee8466ac0 | |
Jeremy Wood | 3b7dd21440 | |
JBYoshi | 528dc25fcb | |
Jeremy Wood | 762d8e3ebb | |
Simon Rigby | ef251c256d | |
Simon Rigby | da3015c72c | |
Jeremy Wood | 601f457e6f | |
Jeremy Wood | ec805f38d7 | |
Jeremy Wood | 61710369f4 | |
Liam | 4824d53fab | |
Liam | 65cc817573 | |
Jeremy Wood | 9bb7dd6e5d | |
Jeremy Wood | fadb3280e3 | |
Jeremy Wood | b64dfa34af | |
Jeremy Wood | 584a81fac6 | |
Jeremy Wood | 4233e4f8b4 | |
Jeremy Wood | 28da4aac2f | |
Jeremy Wood | c37dd803c8 | |
TWSSYesterday | 27abb55006 | |
TWSSYesterday | c607aa1c47 | |
Jeremy Wood | 79f8f6bd55 | |
Justin F. | 1446dd936a | |
Jeremy Wood | 8664f56eeb | |
Jeremy Wood | 1c2514d5db | |
Jeremy Wood | 34c8b7cf0b | |
Jeremy Wood | 63af4370b5 | |
Jeremy Wood | 832e0f6497 | |
Jeremy Wood | b198942742 | |
antiroot | b60250287e | |
Jeremy Wood | 86ba242f33 | |
Jeremy Wood | 0639d39d5a | |
Jeremy Wood | ee745f8a55 | |
Jeremy Wood | 243fc8bc20 | |
Jeremy Wood | 807730805c | |
Jeremy Wood | c8abdf00b5 | |
Jeremy Wood | 21aaf4a03e | |
Jeremy Wood | 8ea639eba8 | |
Eric Stokes | a7e6fd1412 | |
Jeremy Wood | 636b8289f6 | |
main() | 79290eed0d | |
Jeremy Wood | 9f927605da | |
Jeremy Wood | e69b5a6b17 | |
bloodshot | cbe6c2c901 | |
main() | 875685b705 | |
Björn Teichmann | ad6f0d1b62 | |
main() | 4a66a2f5bb | |
main() | a8040abd52 | |
Jeremy Wood | 72a14719ac | |
main() | 2b827a1fae | |
main() | e45520c43b | |
main() | 0fb33d12d6 | |
main() | ebe44ed99e | |
Jeremy Wood | 23ba7fe73b | |
Jeremy Wood | 4efa97ee0e | |
Ryan Leach | ce80fc190d | |
Jeremy Wood | 8bfe3a5473 | |
Jeremy Wood | 07a38e3e58 | |
Jeremy Wood | 360c63fad9 | |
Jeremy Wood | 2a5edc4f91 | |
main() | dba21cadaf | |
main() | fa9191dd8f | |
main() | 4043d5abcb | |
Jeremy Wood | eff56f74da | |
Jeremy Wood | d97a9bccde | |
Jeremy Wood | 55741b524d | |
Jeremy Wood | 186d3f15a4 | |
Jeremy Wood | 841f6f05df | |
Jeremy Wood | ebc2a516bb | |
Jeremy Wood | 9e029ad6ae | |
main() | b2135a8f42 | |
Jeremy Wood | 8cbffd1cee | |
Jeremy Wood | ff22077adf | |
Jeremy Wood | 60c0a1ab92 | |
Jeremy Wood | 58eeecbcb8 | |
Jeremy Wood | 876456b932 | |
Jeremy Wood | 18db50ca56 | |
Jeremy Wood | cce1ccc967 | |
Jeremy Wood | e5537dd8f1 | |
Jeremy Wood | 0c7ba2ae67 | |
Jeremy Wood | bbfc672582 | |
Jeremy Wood | a65dc4966b | |
Jeremy Wood | 4780f87278 | |
Jeremy Wood | b11d911e4a | |
Jeremy Wood | 155aad8bf2 | |
Jeremy Wood | 6e1d4ef961 | |
Jeremy Wood | cfa5a04e3a | |
Jeremy Wood | 7d1c47c2fc | |
Jeremy Wood | 957c55955d | |
main() | 0226ab9609 | |
Jeremy Wood | b888561d98 | |
Jeremy Wood | f210851294 | |
main() | 73e394d5ec | |
Jeremy Wood | 63f8811b67 | |
Jeremy Wood | d01ce71343 | |
Jeremy Wood | fe00aae7e3 | |
Jeremy Wood | d4347d0cff | |
Jeremy Wood | b033d59b8a | |
Jeremy Wood | aedbfd7bab | |
Jeremy Wood | b93822502e | |
Jeremy Wood | f053f0546b | |
Jeremy Wood | af3b3d0fab | |
Jeremy Wood | b1fa677330 | |
main() | 9691a0f978 | |
Ammar Askar | 0b1a387003 | |
Jeremy Wood | 4ce503f55e | |
main() | 74947a7efd | |
main() | 85cd71cb8a | |
Jeremy Wood | 3ad7d86f74 | |
Jeremy Wood | ac9194ec87 | |
main() | 96e8208f3d | |
Ammar Askar | 895360ce8b | |
main() | 59e34ef353 | |
Ammar Askar | 11e556c099 | |
main() | a9579a6594 | |
Ammar Askar | 5a1fe2a9e5 | |
Eric Stokes | 1c5c792cf3 | |
Eric Stokes | dbe9494dbf | |
Jeremy Wood | b116effa2b | |
Jeremy Wood | d361ceb45b | |
Eric Stokes | 35709f5389 | |
Eric Stokes | b45a4cf20a | |
Eric Stokes | 009ceeeede | |
Jeremy Wood | 19fb9df5cf | |
Jeremy Wood | 0829df01aa | |
Jeremy Wood | 78ac068a3f | |
Jeremy Wood | 57da3df860 | |
Jeremy Wood | 74241e3d9c | |
Jeremy Wood | 6a4921d7d1 | |
Jeremy Wood | 271e5f339e | |
Eric Stokes | ec89db1bed | |
Jeremy Wood | 7346cbe48c | |
Jeremy Wood | ac3049f3ab | |
Jeremy Wood | e82db95bbc | |
Jeremy Wood | 0d0f167396 | |
Jeremy Wood | b35a0325b8 | |
Jeremy Wood | 3572d3fbe7 | |
Jeremy Wood | 7304269866 | |
Jeremy Wood | d7535b0551 | |
main() | 0437a4bd92 | |
main() | d881908ecc | |
Jeremy Wood | 3715bc8bc5 | |
main() | a9f00a46f5 | |
Jeremy Wood | d9a7275682 | |
Jeremy Wood | 80f6a0159c | |
Jeremy Wood | f2e1053b88 | |
Jeremy Wood | e975968637 | |
Jeremy Wood | a778d353c4 | |
Jeremy Wood | d40e67b47d | |
Jeremy Wood | 9196973d1c | |
Jeremy Wood | 242d20884c | |
main() | b909af873d | |
main() | e6f7ba5ac9 | |
main() | 4ecb28b3bb | |
main() | d0ea4168bc | |
main() | fd9464ced1 | |
Jeremy Wood | 49eb93af2e | |
Jeremy Wood | 9274570fa4 | |
Jeremy Wood | 319a701a16 | |
Jeremy Wood | 807c8d0f2c | |
Jeremy Wood | 29d97274fe | |
Jeremy Wood | eb1dc502cd | |
Jeremy Wood | 622fb19c4a | |
Jeremy Wood | 5705b5b6a0 | |
main() | 1d1a2213c1 | |
Jeremy Wood | 4dd3df26a5 | |
main() | 39293482d2 | |
main() | 9813e5f531 | |
main() | 48adbec011 | |
main() | a9a5d7467a | |
main() | b8a0891c4c | |
main() | 53567d4646 | |
main() | 3395f3d7c7 | |
Jeremy Wood | e197091bb2 | |
Jeremy Wood | ede0395d39 | |
Jeremy Wood | 17963964c7 | |
Jeremy Wood | bb0e2e4a2d | |
Jeremy Wood | ce4e608cf4 | |
Jeremy Wood | 944f961ee5 | |
Jeremy Wood | 5335e73707 | |
Jeremy Wood | d05e2b500f | |
Jeremy Wood | b2f3b74062 | |
Jeremy Wood | 16e42f6469 | |
Jeremy Wood | a31dc83635 | |
Jeremy Wood | 7b99130bfa | |
Matt H | f57468126a | |
Jeremy Wood | d17fee6b7c | |
Jeremy Wood | 1a943e42a9 | |
Jeremy Wood | 2b80ca80ae | |
Jeremy Wood | 24e26bb7d7 | |
Jeremy Wood | 6133cf6bdf | |
Jeremy Wood | 085c7a1ccc | |
main() | dd0b2137d6 | |
main() | 8a4ba2a66c | |
Jeremy Wood | 3e7841afc9 | |
Jeremy Wood | 1427671a8c | |
Jeremy Wood | a15317e21d | |
main() | b10a37f232 | |
main() | 144de09423 | |
main() | a60e4e06e1 | |
Jeremy Wood | 9eccf93b66 | |
main() | 220f6a31de | |
main() | 8cb4f22467 | |
Jeremy Wood | a2a2594f5a | |
Jeremy Wood | 87df407743 | |
Jeremy Wood | cf007f091a | |
Jeremy Wood | 680c35e0dc | |
Jeremy Wood | 1a385c21d7 | |
Jeremy Wood | cced74d4b0 | |
Jeremy Wood | 1db555581b | |
Jeremy Wood | 63e0c028d9 | |
main() | ee82dc213f | |
heisan213 | d2c09b9d33 | |
main() | 21a3eeacc8 | |
main() | 48768b5d6c | |
main() | 96294c092c | |
main() | 9a3fde2f13 | |
main() | 6520a31938 | |
main() | f1779c9e68 | |
main() | 9cc35d7b12 | |
main() | 02347e05d8 | |
main() | a4196a901a | |
main() | 9b2dd0d6c9 | |
Jeremy Wood | 0efb28be19 | |
main() | 5d9941d073 | |
main() | 82cfbaba4e | |
main() | 9868c66cdb | |
main() | 3a32857683 | |
main() | d7a3e1839e | |
main() | 1496d940bf | |
Jeremy Wood | bd57ec19d2 | |
Jeremy Wood | da54f9769b | |
Jeremy Wood | 2e4b814d6d | |
Eric Stokes | 3f93fb3648 | |
main() | 176e729a87 | |
main() | 62f79e7592 | |
main() | f60f770b98 | |
Eric Stokes | 3c434d18e3 | |
Eric Stokes | c9b52c81a6 | |
Eric Stokes | 5be6ea2766 | |
main() | 98f5e1e4ee | |
main() | de6fc6481e | |
main() | dcc6b828a8 | |
Eric Stokes | 7da91f7875 | |
Eric Stokes | d84f930a54 | |
main() | bdd5e8bd91 | |
main() | d1280a9031 | |
main() | 08b8f01c44 | |
main() | fd227960b9 | |
main() | 0efc0b965b | |
main() | bbe134bd1a | |
main() | 91f7debb08 | |
main() | 871a601e37 | |
main() | bd7ad20b7b | |
main() | 873d878252 | |
main() | 8c63cac4c5 | |
main() | 283913010f | |
main() | 109582335b | |
main() | 3f09fbd710 | |
main() | ccb96ead10 | |
Eric Stokes | 5c48899d92 | |
Eric Stokes | 5f5d7084fa | |
Eric Stokes | 7b9c26d40a | |
Eric Stokes | 0c96da48f9 | |
Eric Stokes | fbbe031b2c | |
main() | 868ac57a4a | |
main() | 7c21a114db | |
main() | e7573d3bd7 | |
main() | 772d5a222d | |
Eric Stokes | 9eaca3e093 | |
Eric Stokes | 2eb61af76f | |
Eric Stokes | ad9d4e41ff | |
Eric Stokes | 6a2e0e5810 | |
Eric Stokes | a9c6582487 | |
Eric Stokes | b66028e0e0 | |
Eric Stokes | 3ac4e55dc2 | |
Eric Stokes | 950991ff1b | |
main() | a1b07065b2 | |
main() | a1075224d3 | |
Eric Stokes | d707a9f9a8 | |
Eric Stokes | 90b04aa798 | |
main() | 5d1532e811 | |
main() | 443d62580b | |
Eric Stokes | 541819ea8f | |
Eric Stokes | b09ea0e66a | |
Eric Stokes | 8272e121f4 | |
main() | 5d2534f497 | |
main() | 1e7eef90f9 | |
main() | 44df567936 | |
main() | d595cb9a31 | |
Eric Stokes | e8a72d19e1 | |
Eric Stokes | dde3b63fb9 | |
Eric Stokes | 87d4d4e1f4 | |
Eric Stokes | 7aca740296 | |
Eric Stokes | 6c9bc6951f | |
Eric Stokes | 74726b44ab | |
Eric Stokes | 18a57bf975 | |
main() | b2578b1736 | |
main() | eec765bc48 | |
main() | 060c0b1b44 | |
Eric Stokes | ba90228586 | |
main() | 8017172f0e | |
main() | b4ea5e9299 | |
main() | 59f2c8b62e | |
main() | 9a28158e5f | |
Eric Stokes | 4d97453881 | |
Eric Stokes | 8488f9db3c | |
main() | 51586c7dd5 | |
Eric Stokes | 7b74384a8e | |
main() | 33afa4d0d7 | |
main() | 0980e0a201 | |
main() | c7d35f13f4 | |
main() | eebc5c6e62 | |
Eric Stokes | ecb97fd5c1 | |
Eric Stokes | bf76b77cf6 | |
Eric Stokes | 21571bf54b | |
Eric Stokes | 7b8f73f0af | |
Eric Stokes | 9313ff82ae | |
Eric Stokes | c22acd6dd1 | |
Eric Stokes | 0f3fd89228 | |
Eric Stokes | 7f93eedbac | |
Eric Stokes | b2457f38b1 | |
main() | 8bab4ae606 | |
main() | a1299239a2 | |
main() | 7cdb52e740 | |
main() | e2d6652ef1 | |
main() | 814725a2ba | |
main() | da6e6145f2 | |
main() | ee715b13b0 | |
main() | a18611fb76 | |
main() | 9173a15eb9 |
|
@ -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,34 @@
|
|||
name: 'Call: GitHub Release'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
release_mode:
|
||||
description: 'Release mode'
|
||||
required: true
|
||||
type: string
|
||||
version_bump:
|
||||
description: 'Version bump'
|
||||
required: false
|
||||
type: string
|
||||
promote_from:
|
||||
description: 'Promote from'
|
||||
required: false
|
||||
type: string
|
||||
outputs:
|
||||
release_created:
|
||||
description: 'Release created'
|
||||
value: ${{ jobs.github_release.outputs.release_created }}
|
||||
tag_name:
|
||||
description: 'Tag name'
|
||||
value: ${{ jobs.github_release.outputs.tag_name }}
|
||||
|
||||
jobs:
|
||||
github_release:
|
||||
uses: ./.github/workflows/generic.github_release.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
plugin_name: multiverse-core
|
||||
release_mode: ${{ inputs.release_mode }}
|
||||
version_bump: ${{ inputs.version_bump }}
|
||||
promote_from: ${{ inputs.promote_from }}
|
|
@ -0,0 +1,83 @@
|
|||
name: 'Call: Platform Uploads'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
target_tag:
|
||||
description: 'Version to upload'
|
||||
required: true
|
||||
type: string
|
||||
upload_modrinth:
|
||||
description: 'Upload to modrinth.com'
|
||||
required: true
|
||||
type: string
|
||||
upload_dbo:
|
||||
description: 'Upload to dev.bukkit.org'
|
||||
required: true
|
||||
type: string
|
||||
upload_hangar:
|
||||
description: 'Upload to hangar.papermc.io'
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
MODRINTH_TOKEN:
|
||||
required: true
|
||||
DBO_UPLOAD_API_TOKEN:
|
||||
required: true
|
||||
HANGAR_UPLOAD_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
platform_uploads:
|
||||
uses: ./.github/workflows/generic.platform_uploads.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
plugin_name: multiverse-core
|
||||
modrinth_project_id: 3wmN97b8
|
||||
modrinth_dependencies: >
|
||||
[
|
||||
{"project_id": "qvdtDX3s", "dependency_type": "optional"},
|
||||
{"project_id": "8VMk6P0I", "dependency_type": "optional"},
|
||||
{"project_id": "vtawPsTo", "dependency_type": "optional"},
|
||||
{"project_id": "WuErDeI1", "dependency_type": "optional"}
|
||||
]
|
||||
|
||||
dbo_project_id: 30765
|
||||
dbo_project_relations: >
|
||||
[
|
||||
{"slug": "multiverse-inventories", "type": "optionalDependency"},
|
||||
{"slug": "multiverse-portals", "type": "optionalDependency"},
|
||||
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
|
||||
{"slug": "multiverse-signportals", "type": "optionalDependency"},
|
||||
{"slug": "vault", "type": "optionalDependency"}
|
||||
]
|
||||
|
||||
hangar_slug: Multiverse-Core
|
||||
hangar_plugin_dependencies: >
|
||||
{ "PAPER": [
|
||||
{
|
||||
"name": "Multiverse-Inventories",
|
||||
"required": false,
|
||||
"platforms": ["PAPER"]
|
||||
},
|
||||
{
|
||||
"name": "Multiverse-Portals",
|
||||
"required": false,
|
||||
"platforms": ["PAPER"]
|
||||
},
|
||||
{
|
||||
"name": "Multiverse-NetherPortals",
|
||||
"required": false,
|
||||
"platforms": ["PAPER"]
|
||||
},
|
||||
{
|
||||
"name": "Multiverse-SignPortals",
|
||||
"required": false,
|
||||
"platforms": ["PAPER"]
|
||||
}
|
||||
]}
|
||||
|
||||
target_tag: ${{ inputs.target_tag }}
|
||||
upload_modrinth: ${{ inputs.upload_modrinth }}
|
||||
upload_dbo: ${{ inputs.upload_dbo }}
|
||||
upload_hangar: ${{ inputs.upload_hangar }}
|
|
@ -0,0 +1,31 @@
|
|||
name: 'Dispatch: Platform Uploads'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target_tag:
|
||||
description: 'Version to upload'
|
||||
required: true
|
||||
type: string
|
||||
upload_modrinth:
|
||||
description: 'Upload to modrinth.com'
|
||||
required: true
|
||||
type: boolean
|
||||
upload_dbo:
|
||||
description: 'Upload to dev.bukkit.org'
|
||||
required: true
|
||||
type: boolean
|
||||
upload_hangar:
|
||||
description: 'Upload to hangar.papermc.io'
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
dispatch_platform_uploads:
|
||||
uses: ./.github/workflows/call.platform_uploads.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
target_tag: ${{ github.event.inputs.target_tag }}
|
||||
upload_modrinth: ${{ github.event.inputs.upload_modrinth }}
|
||||
upload_dbo: ${{ github.event.inputs.upload_dbo }}
|
||||
upload_hangar: ${{ github.event.inputs.upload_hangar }}
|
|
@ -0,0 +1,38 @@
|
|||
name: 'Dispatch: Promote Release'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target_tag:
|
||||
description: 'Version to promote'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
check_version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Verify input version is prerelease
|
||||
run: |
|
||||
if [[ "${{ github.event.inputs.target_tag }}" != *"pre"* ]]; then
|
||||
echo "Version must be a prerelease"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
github_release:
|
||||
needs: check_version
|
||||
uses: ./.github/workflows/call.github_release.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
release_mode: promote
|
||||
promote_from: ${{ github.event.inputs.target_tag }}
|
||||
|
||||
platform_uploads:
|
||||
needs: github_release
|
||||
if: needs.github_release.outputs.release_created == 'true'
|
||||
uses: ./.github/workflows/call.platform_uploads.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
target_tag: ${{ needs.github_release.outputs.tag_name }}
|
||||
upload_modrinth: 'true'
|
||||
upload_dbo: 'true'
|
||||
upload_hangar: 'true'
|
|
@ -0,0 +1,18 @@
|
|||
name: 'Generic: Checkstyle'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
checkstyle:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: dbelyaev/action-checkstyle@v0.8.4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
checkstyle_version: 10.12.2
|
||||
checkstyle_config: ./config/mv_checks.xml
|
|
@ -0,0 +1,91 @@
|
|||
name: 'Generic: GitHub Release'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
# Plugin specific
|
||||
plugin_name:
|
||||
description: 'Plugin name'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
# Common params
|
||||
release_mode:
|
||||
description: 'Release mode'
|
||||
required: true
|
||||
type: string
|
||||
version_bump:
|
||||
description: 'Version bump'
|
||||
required: false
|
||||
type: string
|
||||
promote_from:
|
||||
description: 'Promote from'
|
||||
required: false
|
||||
type: string
|
||||
outputs:
|
||||
release_created:
|
||||
description: 'Release created'
|
||||
value: ${{ jobs.github_release.outputs.release_created }}
|
||||
tag_name:
|
||||
description: 'Tag name'
|
||||
value: ${{ jobs.github_release.outputs.tag_name }}
|
||||
|
||||
jobs:
|
||||
github_release:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_created: ${{ steps.release.outputs.release_created }}
|
||||
tag_name: ${{ steps.release.outputs.tag_name }}
|
||||
steps:
|
||||
- name: Echo inputs
|
||||
run: |
|
||||
echo "release_mode: ${{ inputs.release_mode }}"
|
||||
echo "version_bump: ${{ inputs.version_bump }}"
|
||||
echo "promote_from: ${{ inputs.promote_from }}"
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.promote_from }}
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Build and test
|
||||
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: benwoo1110/semantic-release-action@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release_mode: ${{ inputs.release_mode }}
|
||||
version_bump: ${{ inputs.version_bump }}
|
||||
promote_from: ${{ inputs.promote_from }}
|
||||
|
||||
- name: Publish package
|
||||
if: steps.release.outputs.release_created == 'true'
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: publish -x test
|
||||
env:
|
||||
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload release artifact
|
||||
if: steps.release.outputs.release_created == 'true'
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/libs/${{ inputs.plugin_name }}-${{ steps.release.outputs.publish_version }}.jar
|
||||
asset_name: ${{ inputs.plugin_name }}-${{ steps.release.outputs.tag_name }}.jar
|
||||
tag: ${{ steps.release.outputs.tag_name }}
|
|
@ -0,0 +1,140 @@
|
|||
name: 'Generic: Platform Uploads'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
# Plugin specific params
|
||||
plugin_name:
|
||||
description: 'Plugin name'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
modrinth_project_id:
|
||||
description: 'modrinth.com project ID'
|
||||
required: true
|
||||
type: string
|
||||
modrinth_dependencies:
|
||||
description: 'modrinth.com project dependencies'
|
||||
required: false
|
||||
type: string
|
||||
default: '[]'
|
||||
|
||||
dbo_project_id:
|
||||
description: 'dev.bukkit.org project ID'
|
||||
required: true
|
||||
type: string
|
||||
dbo_project_relations:
|
||||
description: 'dev.bukkit.org project relations'
|
||||
required: false
|
||||
type: string
|
||||
default: '[]'
|
||||
|
||||
hangar_slug:
|
||||
description: 'hangar.papermc.io project slug'
|
||||
required: true
|
||||
type: string
|
||||
hangar_plugin_dependencies:
|
||||
description: 'hangar.papermc.io project dependencies'
|
||||
required: false
|
||||
type: string
|
||||
default: '{}'
|
||||
|
||||
# Common params
|
||||
target_tag:
|
||||
description: 'Version to upload'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
upload_modrinth:
|
||||
description: 'Upload to modrinth.com'
|
||||
required: true
|
||||
type: string
|
||||
upload_dbo:
|
||||
description: 'Upload to dev.bukkit.org'
|
||||
required: true
|
||||
type: string
|
||||
upload_hangar:
|
||||
description: 'Upload to hangar.papermc.io'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
secrets:
|
||||
MODRINTH_TOKEN:
|
||||
required: true
|
||||
DBO_UPLOAD_API_TOKEN:
|
||||
required: true
|
||||
HANGAR_UPLOAD_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
platform_uploads:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get release info
|
||||
id: release-info
|
||||
uses: cardinalby/git-get-release-action@1.2.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag: ${{ inputs.target_tag }}
|
||||
|
||||
- name: Download release artifact
|
||||
id: release-artifact
|
||||
uses: dsaltares/fetch-gh-release-asset@1.1.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: tags/${{ steps.release-info.outputs.tag_name }}
|
||||
file: ${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar
|
||||
|
||||
- name: Parse release type
|
||||
id: parse-release-type
|
||||
run: |
|
||||
if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
|
||||
echo Setting release_type to Beta
|
||||
echo "release_type=Beta" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo Setting release_type to Release
|
||||
echo "release_type=Release" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Upload to Modrinth
|
||||
if: ${{ !cancelled() && inputs.upload_modrinth == 'true' }}
|
||||
uses: benwoo1110/modrinth-upload-action@v1
|
||||
with:
|
||||
api_token: ${{ secrets.MODRINTH_TOKEN }}
|
||||
project_id: ${{ inputs.modrinth_project_id }}
|
||||
version_number: ${{ steps.release-info.outputs.tag_name }}
|
||||
files: '["${{ github.workspace }}/${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar"]'
|
||||
name: ${{ steps.release-info.outputs.tag_name }}
|
||||
changelog: ${{ steps.release-artifact.outputs.body }}
|
||||
game_versions: 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13
|
||||
version_type: ${{ steps.parse-release-type.outputs.release_type }}
|
||||
loaders: bukkit, spigot, paper
|
||||
dependencies: ${{ inputs.modrinth_dependencies }}
|
||||
|
||||
- name: Upload to DBO
|
||||
if: ${{ !cancelled() && inputs.upload_dbo == 'true' }}
|
||||
uses: benwoo1110/dbo-upload-action@v1
|
||||
with:
|
||||
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
|
||||
project_id: ${{ inputs.dbo_project_id }}
|
||||
changelog: ${{ steps.release-artifact.outputs.body }}
|
||||
changelog_type: markdown
|
||||
display_name: ${{ steps.release-info.outputs.tag_name }}
|
||||
game_versions: 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17, 1.16, 1.15, 1.14, 1.13
|
||||
release_type: ${{ steps.parse-release-type.outputs.release_type }}
|
||||
project_relations: ${{ inputs.dbo_project_relations }}
|
||||
file_path: ${{ github.workspace }}/${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar
|
||||
|
||||
- name: Upload to Hangar
|
||||
if: ${{ !cancelled() && inputs.upload_hangar == 'true' }}
|
||||
uses: benwoo1110/hangar-upload-action@v1
|
||||
with:
|
||||
api_token: ${{ secrets.HANGAR_UPLOAD_TOKEN }}
|
||||
slug: ${{ inputs.hangar_slug }}
|
||||
version: ${{ steps.release-info.outputs.tag_name }}
|
||||
channel: ${{ steps.parse-release-type.outputs.release_type }}
|
||||
files: '[{"path": "${{ github.workspace }}/${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar", "platforms": ["PAPER"]}]'
|
||||
description: ${{ steps.release-artifact.outputs.body }}
|
||||
platform_dependencies: '{"PAPER": ["1.13-1.20.1"]}'
|
||||
plugin_dependencies: ${{ inputs.hangar_plugin_dependencies }}
|
|
@ -0,0 +1,40 @@
|
|||
name: 'Generic: Test'
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
plugin_name:
|
||||
description: 'Plugin name'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
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_VERSION: pr${{ github.event.pull_request.number }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Artifact output
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.plugin_name }}-pr${{ github.event.pull_request.number }}
|
||||
path: build/libs/${{ inputs.plugin_name }}-pr${{ github.event.pull_request.number }}.jar
|
|
@ -0,0 +1,24 @@
|
|||
name: 'Main: Prerelease'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
github_release_on_push:
|
||||
uses: ./.github/workflows/call.github_release.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
release_mode: prerelease
|
||||
version_bump: prlabel
|
||||
|
||||
platform_uploads_on_push:
|
||||
needs: github_release_on_push
|
||||
if: needs.github_release_on_push.outputs.release_created == 'true'
|
||||
uses: ./.github/workflows/call.platform_uploads.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
target_tag: ${{ needs.github_release_on_push.outputs.tag_name }}
|
||||
upload_modrinth: 'true'
|
||||
upload_dbo: 'false'
|
||||
upload_hangar: 'false'
|
|
@ -0,0 +1,9 @@
|
|||
name: 'PR: Checkstyle'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
checkstyle:
|
||||
uses: ./.github/workflows/generic.checkstyle.yml
|
|
@ -0,0 +1,18 @@
|
|||
name: 'PR: Require Label'
|
||||
|
||||
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 release"
|
|
@ -0,0 +1,11 @@
|
|||
name: 'PR: Test'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/generic.test.yml
|
||||
with:
|
||||
plugin_name: multiverse-core
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
# maven
|
||||
/target
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
|
@ -42,3 +43,6 @@ 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.
|
||||
|
56
README.md
56
README.md
|
@ -1,18 +1,50 @@
|
|||
Building
|
||||
========
|
||||
Update the submodules after you clone and before you build with maven.
|
||||
<p align="center">
|
||||
<img src="config/multiverse2-long.png" alt="Multiverse Logo">
|
||||
</p>
|
||||
|
||||
```
|
||||
$ git submodule update --init --recursive
|
||||
$ mvn install
|
||||
```
|
||||
[![Modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/plugin/multiverse-core)
|
||||
[![hangar](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/hangar_vector.svg)](https://hangar.papermc.io/Multiverse/Multiverse-Core)
|
||||
[![bukkit](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/bukkit_vector.svg)](https://dev.bukkit.org/projects/multiverse-core)
|
||||
[![Spigot](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/spigot_vector.svg)](https://www.spigotmc.org/resources/multiverse-core.390/)
|
||||
|
||||
[![Release](https://img.shields.io/nexus/r/com.onarandombox.multiversecore/multiverse-core?server=https%3A%2F%2Frepo.onarandombox.com&label=release&color=dark-green)](https://dev.bukkit.org/projects/multiverse-core)
|
||||
[![Dev builds](https://img.shields.io/nexus/s/com.onarandombox.multiversecore/multiverse-core?server=https%3A%2F%2Frepo.onarandombox.com&label=prerelease&color=orange)](https://ci.onarandombox.com/job/Multiverse-Core/)
|
||||
[![Discord](https://img.shields.io/discord/325459248047980545?label=discord&logo=discord)](https://discord.gg/NZtfKky)
|
||||
[![Support us on Patreon](https://img.shields.io/badge/donate-patreon-white?logo=patreon)](https://patreon.com/dumptruckman)
|
||||
[![License](https://img.shields.io/github/license/Multiverse/Multiverse-Core?color=blue)](LICENSE.md)
|
||||
|
||||
|
||||
# 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!
|
||||
|
||||
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 teleporters!
|
||||
|
||||
## 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).
|
||||
|
||||
License
|
||||
=======
|
||||
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:
|
||||
## Contributing
|
||||
|
||||
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.
|
||||
**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.
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||
}
|
||||
|
||||
version = System.getenv('GITHUB_VERSION') ?: 'local'
|
||||
group = 'com.onarandombox.multiversecore'
|
||||
description = 'Multiverse-Core'
|
||||
|
||||
java.sourceCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
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/')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT'
|
||||
|
||||
implementation('com.github.MilkBowl:VaultAPI:1.7') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
|
||||
compileOnly('me.main__.util:SerializationConfig:1.7') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
}
|
||||
compileOnly('com.pneumaticraft.commandhandler:CommandHandler:11') {
|
||||
exclude group: 'org.bukkit', module: 'bukkit'
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
compileOnly 'com.dumptruckman.minecraft:buscript:2.0-SNAPSHOT'
|
||||
compileOnly 'org.bstats:bstats-bukkit:2.2.1'
|
||||
compileOnly('com.dumptruckman.minecraft:Logging:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
compileOnly 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
|
||||
compileOnly 'org.jetbrains:annotations:16.0.2'
|
||||
|
||||
testImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT'
|
||||
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
|
||||
exclude group: 'junit', module: 'junit'
|
||||
}
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.mockito:mockito-core:3.11.2'
|
||||
testImplementation 'commons-io:commons-io:2.4'
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
testCompileOnly.extendsFrom compileOnly
|
||||
testRuntimeOnly.extendsFrom testCompileOnly
|
||||
|
||||
shadowed.extendsFrom compileOnly {
|
||||
canBeResolved = true
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
|
||||
pom.withXml {
|
||||
asNode().dependencies.'*'.findAll() {
|
||||
it.scope.text() == 'runtime' && project.configurations.implementation.allDependencies.find { dep ->
|
||||
dep.name == it.artifactId.text()
|
||||
}
|
||||
}.each() {
|
||||
it.scope*.value = 'provided'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
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 }
|
||||
}
|
||||
|
||||
|
||||
javadoc {
|
||||
source = sourceSets.main.allJava
|
||||
classpath = configurations.compileClasspath
|
||||
}
|
||||
|
||||
|
||||
project.configurations.api.canBeResolved = true
|
||||
|
||||
shadowJar {
|
||||
relocate 'me.main__.util', 'com.onarandombox.serializationconfig'
|
||||
relocate 'com.pneumaticraft.commandhandler', 'com.onarandombox.commandhandler'
|
||||
relocate 'buscript', 'com.onarandombox.buscript'
|
||||
relocate 'org.bstats', 'com.onarandombox.bstats'
|
||||
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.MultiverseCore.utils.CoreLogging'
|
||||
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.MultiverseCore.utils.DebugFileLogger'
|
||||
relocate 'org.codehaus.jettison', 'com.onarandombox.jettison'
|
||||
relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter'
|
||||
|
||||
configurations = [project.configurations.shadowed]
|
||||
|
||||
archiveFileName = "$baseName-$version.$extension"
|
||||
classifier = ''
|
||||
}
|
||||
|
||||
build.dependsOn shadowJar
|
||||
jar.enabled = false
|
|
@ -6,137 +6,581 @@
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/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">
|
||||
<property name="severity" value="info"/>
|
||||
</module>
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
<property name="severity" value="warning"/>
|
||||
|
||||
<!-- Javadoc Comments -->
|
||||
<module name="JavadocPackage"/><!-- require package-info.java file -->
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<module name="NewlineAtEndOfFile" />
|
||||
<module name="OrderedProperties"/>
|
||||
<module name="Translation"/>
|
||||
<module name="FileLength"/>
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
<module name="UniqueProperties"/>
|
||||
|
||||
<!-- Regexp -->
|
||||
<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"/>
|
||||
|
||||
<!-- Size Violations -->
|
||||
<module name="FileLength">
|
||||
<property name="max" value="2000"/>
|
||||
</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 name="LineLength">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="max" value="120"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
|
||||
|
||||
<!-- Whitespace -->
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<!-- Make suppression possible -->
|
||||
<module name="FileContentsHolder"/>
|
||||
<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>
|
||||
|
||||
<!-- Actual checks -->
|
||||
<module name="LineLength">
|
||||
<property name="max" value="160"/>
|
||||
|
||||
<!-- Annotations -->
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationMostCases"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, INTERFACE_DEF, PACKAGE_DEF, ENUM_CONSTANT_DEF,
|
||||
ENUM_DEF, METHOD_DEF, CTOR_DEF, RECORD_DEF, COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationVariables"/>
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="AnnotationLocation"/>
|
||||
<module name="AnnotationUseStyle"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverride"/>
|
||||
|
||||
<!-- Block Checks -->
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock">
|
||||
<property name="tokens"
|
||||
value="LITERAL_WHILE, LITERAL_TRY, LITERAL_FINALLY, LITERAL_DO, LITERAL_IF,
|
||||
LITERAL_ELSE, LITERAL_FOR, INSTANCE_INIT, STATIC_INIT, LITERAL_SWITCH,
|
||||
LITERAL_SYNCHRONIZED"/>
|
||||
</module>
|
||||
<module name="EmptyCatchBlock">
|
||||
<property name="exceptionVariableName" value="(ignore|expect)"/>
|
||||
</module>
|
||||
<module name="LeftCurly">
|
||||
<property name="ignoreEnums" value="false"/>
|
||||
<property name="tokens"
|
||||
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
|
||||
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
|
||||
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
|
||||
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
|
||||
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="NeedBraces">
|
||||
<property name="id" value="SingleLineIf"/>
|
||||
<property name="tokens" value="LITERAL_IF"/>
|
||||
<property name="allowSingleLineStatement" value="true"/>
|
||||
</module>
|
||||
<module name="NeedBraces">
|
||||
<property name="id" value="NoSingleLineControl"/>
|
||||
<property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlySame"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
|
||||
LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
|
||||
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
|
||||
COMPACT_CTOR_DEF, LITERAL_SWITCH"/>
|
||||
</module>
|
||||
|
||||
<!-- Class Design -->
|
||||
<module name="DesignForExtension">
|
||||
<property name="severity" value="info"/>
|
||||
</module>
|
||||
<module name="FinalClass"/>
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InnerTypeLast"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
<module name="MutableException"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="ThrowsCount">
|
||||
<property name="max" value="0"/>
|
||||
</module>
|
||||
<module name="VisibilityModifier">
|
||||
<property name="protectedAllowed" value="true"/>
|
||||
</module>
|
||||
|
||||
<!-- Coding -->
|
||||
<module name="ArrayTrailingComma"/>
|
||||
<module name="AvoidDoubleBraceInitialization"/>
|
||||
<module name="AvoidNoArgumentSuperConstructorCall"/>
|
||||
<module name="CovariantEquals"/>
|
||||
<module name="DeclarationOrder"/>
|
||||
<module name="DefaultComesLast"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsAvoidNull"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="FallThrough">
|
||||
<property name="checkLastCaseGroup" value="true"/>
|
||||
</module>
|
||||
<module name="HiddenField">
|
||||
<property name="ignoreConstructorParameter" value="true"/>
|
||||
<property name="ignoreSetter" value="true"/>
|
||||
<property name="setterCanReturnItsClass" value="true"/>
|
||||
<property name="ignoreAbstractMethods" value="true"/>
|
||||
</module>
|
||||
<module name="IllegalCatch"/>
|
||||
<module name="IllegalThrows"/>
|
||||
<module name="IllegalToken"/>
|
||||
<module name="IllegalTokenText">
|
||||
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||
<property name="format"
|
||||
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||
<property name="message"
|
||||
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
|
||||
</module>
|
||||
<module name="IllegalType"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber">
|
||||
<property name="ignoreHashCodeMethod" value="true"/>
|
||||
<property name="ignoreAnnotationElementDefaults" value="true"/>
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="ModifiedControlVariable"/>
|
||||
<module name="MultipleStringLiterals">
|
||||
|
||||
</module>
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="NestedForDepth">
|
||||
<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 name="NestedIfDepth"/>
|
||||
<module name="NestedTryDepth"/>
|
||||
<module name="NoClone"/>
|
||||
<module name="NoFinalizer"/>
|
||||
<module name="OneStatementPerLine"/>
|
||||
<module name="PackageDeclaration"/>
|
||||
<module name="ParameterAssignment"/>
|
||||
<module name="RequireThis"/>
|
||||
<module name="ReturnCount"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<module name="StringLiteralEquality"/>
|
||||
<module name="SuperClone"/>
|
||||
<module name="SuperFinalize"/>
|
||||
<module name="UnnecessaryParentheses"/>
|
||||
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
|
||||
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
|
||||
<module name="UnnecessarySemicolonInEnumeration"/>
|
||||
<module name="UnnecessarySemicolonInTryWithResources"/>
|
||||
<module name="UnusedLocalVariable"/>
|
||||
<module name="VariableDeclarationUsageDistance">
|
||||
<property name="allowedDistance" value="3"/>
|
||||
<property name="validateBetweenScopes" value="false"/>
|
||||
</module>
|
||||
<module name="VariableDeclarationUsageDistance">
|
||||
<property name="allowedDistance" value="5"/>
|
||||
<property name="validateBetweenScopes" value="true"/>
|
||||
</module>
|
||||
|
||||
<!-- Imports -->
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="CustomImportOrder">
|
||||
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||
<property name="separateLineBetweenGroups" value="true"/>
|
||||
<property name="customImportOrderRules"
|
||||
value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC"/>
|
||||
<!-- value="SAME_PACKAGE(3)###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC"/>-->
|
||||
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
|
||||
</module>
|
||||
<module name="IllegalImport">
|
||||
<property name="illegalPkgs" value="sun"/>
|
||||
</module>
|
||||
<!-- <module name="ImportOrder"/>-->
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports"/>
|
||||
|
||||
<!-- Javadoc Comments -->
|
||||
<module name="AtclauseOrder">
|
||||
<property name="target"
|
||||
value="CLASS_DEF, COMPACT_CTOR_DEF, CTOR_DEF, ENUM_DEF,
|
||||
INTERFACE_DEF, METHOD_DEF, RECORD_DEF, VARIABLE_DEF"/>
|
||||
</module>
|
||||
<module name="InvalidJavadocPosition"/>
|
||||
<module name="JavadocBlockTagLocation"/>
|
||||
<module name="JavadocContentLocationCheck"/>
|
||||
<module name="JavadocMethod">
|
||||
<property name="accessModifiers" value="public"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="accessModifiers" value="public"/>
|
||||
</module>
|
||||
<module name="JavadocMissingLeadingAsterisk"/>
|
||||
<module name="JavadocMissingWhitespaceAfterAsterisk"/>
|
||||
<module name="JavadocParagraph">
|
||||
<property name="allowNewlineParagraph" value="true"/>
|
||||
</module>
|
||||
<module name="JavadocStyle">
|
||||
<property name="scope" value="package"/>
|
||||
</module>
|
||||
<module name="JavadocTagContinuationIndentation"/>
|
||||
<module name="JavadocType"/>
|
||||
<module name="JavadocVariable">
|
||||
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
|
||||
<property name="scope" value="package"/>
|
||||
</module>
|
||||
<module name="MissingJavadocMethod">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="allowMissingPropertyJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="MissingJavadocMethod">
|
||||
<property name="scope" value="protected"/>
|
||||
<property name="excludeScope" value="public"/>
|
||||
<property name="allowMissingPropertyJavadoc" value="true"/>
|
||||
<property name="minLineCount" value="2"/>
|
||||
</module>
|
||||
<module name="MissingJavadocType">
|
||||
<property name="scope" value="protected"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||
RECORD_DEF, ANNOTATION_DEF"/>
|
||||
<property name="excludeScope" value="nothing"/>
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="RequireEmptyLineBeforeBlockTagGroup"/>
|
||||
<module name="SingleLineJavadoc"/>
|
||||
<module name="SummaryJavadoc">
|
||||
<property name="forbiddenSummaryFragments"
|
||||
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
|
||||
</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.commands,com.onarandombox.MultiverseCore.destination"/>
|
||||
|
||||
<!-- Metrics -->
|
||||
<module name="BooleanExpressionComplexity"/>
|
||||
<module name="ClassDataAbstractionCoupling">
|
||||
<property name="max" value="7"/>
|
||||
<property name="excludedClasses" value="ArrayIndexOutOfBoundsException, ArrayList, Boolean, Byte, Character, Class, Collection, Deprecated, Deque, Double, DoubleStream, EnumSet, Exception, Float, FunctionalInterface, HashMap, HashSet, IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, IntStream, Integer, LinkedHashMap, LinkedHashSet, LinkedList, List, Long, LongStream, Map, NullPointerException, Object, Optional, OptionalDouble, OptionalInt, OptionalLong, Override, Queue, RuntimeException, SafeVarargs, SecurityException, Set, Short, SortedMap, SortedSet, Stream, String, StringBuffer, StringBuilder, SuppressWarnings, Throwable, TreeMap, TreeSet, UnsupportedOperationException, Void, boolean, byte, char, double, float, int, long, short, var, void"/>
|
||||
</module>
|
||||
<module name="IllegalImport"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
<module name="ClassFanOutComplexity">
|
||||
<property name="max" value="20"/>
|
||||
<property name="excludedClasses" value="ArrayIndexOutOfBoundsException, ArrayList, Boolean, Byte, Character, Class, Collection, Deprecated, Deque, Double, DoubleStream, EnumSet, Exception, Float, FunctionalInterface, HashMap, HashSet, IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, IntStream, Integer, LinkedHashMap, LinkedHashSet, LinkedList, List, Long, LongStream, Map, NullPointerException, Object, Optional, OptionalDouble, OptionalInt, OptionalLong, Override, Queue, RuntimeException, SafeVarargs, SecurityException, Set, Short, SortedMap, SortedSet, Stream, String, StringBuffer, StringBuilder, SuppressWarnings, Throwable, TreeMap, TreeSet, UnsupportedOperationException, Void, boolean, byte, char, double, float, int, long, short, var, void"/>
|
||||
</module>
|
||||
<module name="MethodLength"/>
|
||||
<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">
|
||||
<module name="CyclomaticComplexity">
|
||||
<property name="max" value="7"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<module name="JavaNCSS">
|
||||
<property name="methodMaximum" value="50"/>
|
||||
<property name="classMaximum" value="1500"/>
|
||||
<property name="fileMaximum" value="2000"/>
|
||||
<property name="recordMaximum" value="150"/>
|
||||
</module>
|
||||
<module name="NPathComplexity">
|
||||
<property name="max" value="200"/>
|
||||
</module>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="AvoidEscapedUnicodeCharacters">
|
||||
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||
<property name="allowNonPrintableEscapes" value="true"/>
|
||||
</module>
|
||||
<module name="CommentsIndentation">
|
||||
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
|
||||
</module>
|
||||
<module name="Indentation">
|
||||
<property name="basicOffset" value="4"/>
|
||||
<property name="braceAdjustment" value="4"/>
|
||||
<property name="caseIndent" value="4"/>
|
||||
<property name="throwsIndent" value="8"/>
|
||||
<property name="arrayInitIndent" value="4"/>
|
||||
<property name="lineWrappingIndentation" value="8"/>
|
||||
<property name="forceStrictCondition" value="true"/>
|
||||
</module>
|
||||
<module name="NoCodeInFile"/>
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="TodoComment">
|
||||
<property name="format" value="TODO"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="TrailingComment"/>
|
||||
<module name="UncommentedMain"/>
|
||||
<module name="UpperEll"/>
|
||||
|
||||
<!-- Modifiers -->
|
||||
<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"/>
|
||||
|
||||
<!-- Naming Conventions -->
|
||||
<module name="AbbreviationAsWordInName">
|
||||
<property name="ignoreFinal" value="false"/>
|
||||
<property name="allowedAbbreviationLength" value="0"/>
|
||||
<property name="allowedAbbreviations" value="MV"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
|
||||
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF,
|
||||
RECORD_COMPONENT_DEF"/>
|
||||
</module>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly"/>
|
||||
<module name="DoubleCheckedLocking"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="HiddenField">
|
||||
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
|
||||
<module name="AbstractClassName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Abstract class name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber">
|
||||
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
|
||||
<module name="CatchParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="RedundantThrows"/>
|
||||
<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 name="ClassTypeParameterName">
|
||||
<property name="format" value="^[A-Z]{1,3}$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<!-- Don't like errors for `final` missing
|
||||
<module name="FinalParameters"/>
|
||||
-->
|
||||
<module name="TodoComment">
|
||||
<property name="severity" value="info"/>
|
||||
<module name="ConstantName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Constant name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="InterfaceTypeParameterName">
|
||||
<property name="format" value="^[A-Z]{1,3}$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LambdaParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LocalFinalVariableName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Local final variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LocalVariableName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MethodTypeParameterName">
|
||||
<property name="format" value="^[A-Z]{1,3}$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="PackageName">
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="PatternVariableName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Pattern variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="RecordComponentName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Record component name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="RecordTypeParameterName">
|
||||
<property name="format" value="^[A-Z]{1,3}$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Record type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="StaticVariableName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Static variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="TypeName">
|
||||
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||
ANNOTATION_DEF, RECORD_DEF"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
|
||||
<!-- Size Violations -->
|
||||
<module name="AnonInnerLength">
|
||||
<property name="max" value="20"/>
|
||||
</module>
|
||||
<module name="ExecutableStatementCount">
|
||||
<property name="max" value="30"/>
|
||||
</module>
|
||||
<module name="LambdaBodyLength">
|
||||
<property name="max" value="10"/>
|
||||
</module>
|
||||
<module name="MethodCount">
|
||||
<property name="maxTotal" value="100"/>
|
||||
<property name="maxPrivate" value="100"/>
|
||||
<property name="maxPackage" value="100"/>
|
||||
<property name="maxProtected" value="100"/>
|
||||
<property name="maxPublic" value="100"/>
|
||||
</module>
|
||||
<module name="MethodLength">
|
||||
<property name="max" value="50"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="OuterTypeNumber">
|
||||
<property name="max" value="1"/>
|
||||
</module>
|
||||
<module name="ParameterNumber">
|
||||
<property name="max" value="3"/>
|
||||
<property name="ignoreOverriddenMethods" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="RecordComponentNumber">
|
||||
<property name="max" value="8"/>
|
||||
</module>
|
||||
|
||||
<!-- Whitespace -->
|
||||
<module name="EmptyForInitializerPad"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||
<property name="allowMultipleEmptyLines" value="false"/>
|
||||
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
|
||||
<property name="tokens"
|
||||
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF, RECORD_DEF,
|
||||
COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="GenericWhitespace">
|
||||
<message key="ws.followed"
|
||||
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||
<message key="ws.preceded"
|
||||
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||
<message key="ws.illegalFollow"
|
||||
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||
<message key="ws.notPreceded"
|
||||
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="MethodParamPad">
|
||||
<property name="tokens"
|
||||
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
|
||||
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
|
||||
</module>
|
||||
<module name="NoLineWrap">
|
||||
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceAfter">
|
||||
<property name="tokens"
|
||||
value="AT, INC, DEC, UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT,ARRAY_DECLARATOR,INDEX_OP,LITERAL_SYNCHRONIZED,METHOD_REF"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore">
|
||||
<property name="id" value="AllowedWhitespaceBeforeWithoutLinebreak"/>
|
||||
<property name="tokens"
|
||||
value="COMMA, SEMI, POST_INC, POST_DEC, ELLIPSIS, LABELED_STAT"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore">
|
||||
<property name="id" value="AllowedWhitespaceBeforeWithLinebreak"/>
|
||||
<property name="tokens" value="DOT, METHOD_REF"/>
|
||||
<property name="allowLineBreaks" value="true"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
|
||||
<module name="OperatorWrap">
|
||||
<property name="tokens"
|
||||
value="QUESTION, COLON, EQUAL, NOT_EQUAL, DIV, PLUS, MINUS, STAR, MOD,
|
||||
SR, BSR, GE, GT, SL, LE, LT, BXOR, BOR, LOR, BAND, LAND, LITERAL_INSTANCEOF,
|
||||
TYPE_EXTENSION_AND, ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN,
|
||||
STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN,
|
||||
BOR_ASSIGN, BAND_ASSIGN, METHOD_REF"/>
|
||||
</module>
|
||||
<module name="ParenPad">
|
||||
<property name="tokens"
|
||||
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
|
||||
EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
|
||||
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
|
||||
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA,
|
||||
RECORD_DEF"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapNl"/>
|
||||
<property name="option" value="nl"/>
|
||||
<property name="tokens" value="DOT, AT, METHOD_REF"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapEol"/>
|
||||
<property name="option" value="eol"/>
|
||||
<property name="tokens"
|
||||
value="COMMA, SEMI, ELLIPSIS, RPAREN, ARRAY_DECLARATOR, RBRACK"/>
|
||||
</module>
|
||||
<module name="SingleSpaceSeparator"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter">
|
||||
<property name="tokens"
|
||||
value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE, LITERAL_RETURN,
|
||||
LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, LITERAL_FINALLY, DO_WHILE, ELLIPSIS,
|
||||
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_CATCH, LAMBDA,
|
||||
LITERAL_YIELD, LITERAL_CASE"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyLambdas" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
<property name="allowEmptyLoops" value="true"/>
|
||||
<property name="ignoreEnhancedForColon" value="false"/>
|
||||
<property name="tokens"
|
||||
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
|
||||
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
|
||||
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
|
||||
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
|
||||
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
|
||||
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
|
||||
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
|
||||
<message key="ws.notFollowed"
|
||||
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks
|
||||
may only be represented as '{}' when not part of a multi-block statement"/>
|
||||
<message key="ws.notPreceded"
|
||||
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="UpperEll"/>
|
||||
<module name="Indentation"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverride"/>
|
||||
</module>
|
||||
</module>
|
||||
|
|
Binary file not shown.
|
@ -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" "$@"
|
|
@ -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 +0,0 @@
|
|||
Subproject commit 18c55a9070a5e64b2cb0737940290643f324fa7d
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 46a3ab6e4e444cd84f836aa6d36ed02cf6347454
|
274
pom.xml
274
pom.xml
|
@ -1,274 +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.2</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/content/groups/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>doodleproject-repo</id>
|
||||
<name>DoodleProject Maven 2 Repository</name>
|
||||
<url>http://doodleproject.sourceforge.net/maven2/release</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
<url>http://ci.onarandombox.com</url>
|
||||
</ciManagement>
|
||||
|
||||
<!-- Profiles are used to detect whether this is a local or Jenkins build
|
||||
and adjust the build number accordingly -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jenkins</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<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}-b${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>
|
||||
<!-- Maven Source Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.11</version>
|
||||
<configuration>
|
||||
<parallel>methods</parallel>
|
||||
<threadCount>10</threadCount>
|
||||
<excludes>
|
||||
<exclude>**/TestCommandSender.java</exclude>
|
||||
<exclude>**/TestInstanceCreator.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>2.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<enableRulesSummary>true</enableRulesSummary>
|
||||
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!-- Bukkit Dependency -->
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.0.0-R1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Bukkit Dependency -->
|
||||
<!-- Start of Spout -->
|
||||
<dependency>
|
||||
<groupId>org.getspout</groupId>
|
||||
<artifactId>spoutpluginapi</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- End of Spout -->
|
||||
<!-- 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.iCo6</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>6.0</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>
|
||||
<dependency>
|
||||
<groupId>me.ashtheking.currency</groupId>
|
||||
<artifactId>MultiCurrency</artifactId>
|
||||
<version>0.09</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of Economy Dependencies -->
|
||||
<!-- Start of Test Dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-easymock</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- End of Test Dependencies -->
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>OnARandomBox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'multiverse-core'
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,385 @@
|
|||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
|
||||
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 MultiverseCoreConfig {
|
||||
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.
|
||||
*/
|
||||
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 useasyncchat;
|
||||
@Property
|
||||
private volatile boolean teleportintercept;
|
||||
@Property
|
||||
private volatile boolean firstspawnoverride;
|
||||
@Property
|
||||
private volatile boolean displaypermerrors;
|
||||
@Property
|
||||
private volatile boolean enablebuscript;
|
||||
@Property
|
||||
private volatile int globaldebug;
|
||||
@Property
|
||||
private volatile boolean silentstart;
|
||||
@Property
|
||||
private volatile int messagecooldown;
|
||||
@Property
|
||||
private volatile double version;
|
||||
@Property
|
||||
private volatile String firstspawnworld;
|
||||
@Property
|
||||
private volatile int teleportcooldown;
|
||||
@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;
|
||||
useasyncchat = true;
|
||||
prefixchat = false;
|
||||
prefixchatformat = "[%world%]%chat%";
|
||||
teleportintercept = true;
|
||||
firstspawnoverride = true;
|
||||
displaypermerrors = true;
|
||||
enablebuscript = true;
|
||||
globaldebug = 0;
|
||||
messagecooldown = 5000;
|
||||
teleportcooldown = 1000;
|
||||
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 boolean getEnableBuscript() {
|
||||
return this.enablebuscript;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setEnableBuscript(boolean enableBuscript) {
|
||||
this.enablebuscript = enableBuscript;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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 int getMessageCooldown() {
|
||||
return this.messagecooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setMessageCooldown(int messageCooldown) {
|
||||
this.messagecooldown = messageCooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getTeleportCooldown() {
|
||||
return this.teleportcooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setTeleportCooldown(int teleportCooldown) {
|
||||
this.teleportcooldown = teleportCooldown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseAsyncChat(boolean useAsyncChat) {
|
||||
this.useasyncchat = useAsyncChat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getUseAsyncChat() {
|
||||
return this.useasyncchat;
|
||||
}
|
||||
|
||||
@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,655 @@
|
|||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld.NullLocation;
|
||||
import com.onarandombox.MultiverseCore.configuration.EntryFee;
|
||||
import com.onarandombox.MultiverseCore.configuration.SpawnLocation;
|
||||
import com.onarandombox.MultiverseCore.configuration.SpawnSettings;
|
||||
import com.onarandombox.MultiverseCore.configuration.WorldPropertyValidator;
|
||||
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatStyle;
|
||||
import me.main__.util.SerializationConfig.IllegalPropertyValueException;
|
||||
import me.main__.util.SerializationConfig.Property;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
import me.main__.util.SerializationConfig.Serializor;
|
||||
import me.main__.util.SerializationConfig.Validator;
|
||||
import me.main__.util.SerializationConfig.VirtualProperty;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/*
|
||||
* This is a property class, I think we don't need that much javadoc.
|
||||
* BEGIN CHECKSTYLE-SUPPRESSION: Javadoc
|
||||
*/
|
||||
|
||||
@SerializableAs("MVWorld")
|
||||
public class WorldProperties extends SerializationConfig {
|
||||
|
||||
private static final Map<String, String> PROPERTY_ALIASES;
|
||||
|
||||
static {
|
||||
PROPERTY_ALIASES = new HashMap<String, String>();
|
||||
PROPERTY_ALIASES.put("curr", "entryfee.currency");
|
||||
PROPERTY_ALIASES.put("currency", "entryfee.currency");
|
||||
PROPERTY_ALIASES.put("price", "entryfee.amount");
|
||||
PROPERTY_ALIASES.put("scaling", "scale");
|
||||
PROPERTY_ALIASES.put("aliascolor", "color");
|
||||
PROPERTY_ALIASES.put("heal", "autoHeal");
|
||||
PROPERTY_ALIASES.put("storm", "allowWeather");
|
||||
PROPERTY_ALIASES.put("weather", "allowWeather");
|
||||
PROPERTY_ALIASES.put("spawnmemory", "keepSpawnInMemory");
|
||||
PROPERTY_ALIASES.put("memory", "keepSpawnInMemory");
|
||||
PROPERTY_ALIASES.put("mode", "gameMode");
|
||||
PROPERTY_ALIASES.put("diff", "difficulty");
|
||||
PROPERTY_ALIASES.put("spawnlocation", "spawn");
|
||||
PROPERTY_ALIASES.put("limit", "playerLimit");
|
||||
PROPERTY_ALIASES.put("animals", "spawning.animals.spawn");
|
||||
PROPERTY_ALIASES.put("monsters", "spawning.monsters.spawn");
|
||||
PROPERTY_ALIASES.put("animalsrate", "spawning.animals.spawnrate");
|
||||
PROPERTY_ALIASES.put("monstersrate", "spawning.monsters.spawnrate");
|
||||
PROPERTY_ALIASES.put("flight", "allowFlight");
|
||||
PROPERTY_ALIASES.put("fly", "allowFlight");
|
||||
PROPERTY_ALIASES.put("allowfly", "allowFlight");
|
||||
}
|
||||
|
||||
private final boolean keepSpawnFallback;
|
||||
|
||||
public WorldProperties(Map<String, Object> values) {
|
||||
super(values);
|
||||
Object keepSpawnObject = values.get("keepSpawnInMemory");
|
||||
keepSpawnFallback = keepSpawnObject == null || Boolean.parseBoolean(keepSpawnObject.toString());
|
||||
}
|
||||
|
||||
public WorldProperties() {
|
||||
super();
|
||||
keepSpawnFallback = true;
|
||||
}
|
||||
|
||||
public WorldProperties(final boolean fixSpawn, final Environment environment) {
|
||||
super();
|
||||
if (!fixSpawn) {
|
||||
this.adjustSpawn = false;
|
||||
}
|
||||
setScaling(getDefaultScale(environment));
|
||||
keepSpawnFallback = true;
|
||||
}
|
||||
|
||||
void setMVWorld(MVWorld world) {
|
||||
registerObjectUsing(world);
|
||||
registerGlobalValidator(new WorldPropertyValidator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the color-property.
|
||||
*/
|
||||
private static final class EnumPropertySerializor<T extends Enum<T>> implements Serializor<T, String> {
|
||||
@Override
|
||||
public String serialize(T from) {
|
||||
return from.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T deserialize(String serialized, Class<T> wanted) throws IllegalPropertyValueException {
|
||||
try {
|
||||
return Enum.valueOf(wanted, serialized.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalPropertyValueException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the difficulty-property.
|
||||
*/
|
||||
private static final class DifficultyPropertySerializor implements Serializor<Difficulty, String> {
|
||||
@Override
|
||||
public String serialize(Difficulty from) {
|
||||
return from.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Difficulty deserialize(String serialized, Class<Difficulty> wanted) throws IllegalPropertyValueException {
|
||||
try {
|
||||
return Difficulty.getByValue(Integer.parseInt(serialized));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
return Difficulty.valueOf(serialized.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
throw new IllegalPropertyValueException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the gameMode-property.
|
||||
*/
|
||||
private static final class GameModePropertySerializor implements Serializor<GameMode, String> {
|
||||
@Override
|
||||
public String serialize(GameMode from) {
|
||||
return from.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameMode deserialize(String serialized, Class<GameMode> wanted) throws IllegalPropertyValueException {
|
||||
try {
|
||||
return GameMode.getByValue(Integer.parseInt(serialized));
|
||||
} catch (NumberFormatException nfe) {
|
||||
}
|
||||
try {
|
||||
return GameMode.valueOf(serialized.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
throw new IllegalPropertyValueException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializor for the time-property.
|
||||
*/
|
||||
private static final class TimePropertySerializor implements Serializor<Long, String> {
|
||||
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
private static final String TIME_REGEX = "(\\d\\d?):?(\\d\\d)(a|p)?m?";
|
||||
private static final Map<String, String> TIME_ALIASES;
|
||||
static {
|
||||
Map<String, String> staticTimes = new HashMap<String, String>();
|
||||
staticTimes.put("morning", "8:00");
|
||||
staticTimes.put("day", "12:00");
|
||||
staticTimes.put("noon", "12:00");
|
||||
staticTimes.put("midnight", "0:00");
|
||||
staticTimes.put("night", "20:00");
|
||||
|
||||
// now set TIME_ALIASES to a "frozen" map
|
||||
TIME_ALIASES = Collections.unmodifiableMap(staticTimes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serialize(Long from) {
|
||||
// I'm tired, so they get time in 24 hour for now.
|
||||
// Someone else can add 12 hr format if they want :P
|
||||
|
||||
int hours = (int) ((from / 1000 + 8) % 24);
|
||||
int minutes = (int) (60 * (from % 1000) / 1000);
|
||||
|
||||
return String.format("%d:%02d", hours, minutes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long deserialize(String serialized, Class<Long> wanted) throws IllegalPropertyValueException {
|
||||
if (TIME_ALIASES.containsKey(serialized.toLowerCase())) {
|
||||
serialized = TIME_ALIASES.get(serialized.toLowerCase());
|
||||
}
|
||||
// Regex that extracts a time in the following formats:
|
||||
// 11:11pm, 11:11, 23:11, 1111, 1111p, and the aliases at the top of this file.
|
||||
Pattern pattern = Pattern.compile(TIME_REGEX, Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(serialized);
|
||||
matcher.find();
|
||||
int hour = 0;
|
||||
double minute = 0;
|
||||
int count = matcher.groupCount();
|
||||
if (count >= 2) {
|
||||
hour = Integer.parseInt(matcher.group(1));
|
||||
minute = Integer.parseInt(matcher.group(2));
|
||||
}
|
||||
// If there were 4 matches (all, hour, min, am/pm)
|
||||
if (count == 4) {
|
||||
// We want 24 hour time for calcs, but if they
|
||||
// added a p[m], turn it into a 24 hr one.
|
||||
if (matcher.group(3).equals("p")) {
|
||||
hour += 12;
|
||||
}
|
||||
}
|
||||
// Translate 24th hour to 0th hour.
|
||||
if (hour == 24) {
|
||||
hour = 0;
|
||||
}
|
||||
// Clamp the hour
|
||||
if (hour > 23 || hour < 0) {
|
||||
throw new IllegalPropertyValueException("Illegal hour!");
|
||||
}
|
||||
// Clamp the minute
|
||||
if (minute > 59 || minute < 0) {
|
||||
throw new IllegalPropertyValueException("Illegal minute!");
|
||||
}
|
||||
// 60 seconds in a minute, time needs to be in hrs * 1000, per
|
||||
// the bukkit docs.
|
||||
double totaltime = (hour + (minute / 60.0)) * 1000;
|
||||
// Somehow there's an 8 hour offset...
|
||||
totaltime -= 8000;
|
||||
if (totaltime < 0) {
|
||||
totaltime = 24000 + totaltime;
|
||||
}
|
||||
|
||||
return (long) totaltime;
|
||||
}
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Begin properties
|
||||
@Property(description = "Sorry, 'hidden' must either be: true or false.")
|
||||
private volatile boolean hidden;
|
||||
@Property(description = "Alias must be a valid string.")
|
||||
private volatile String alias;
|
||||
@Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'color' must be a valid color-name.")
|
||||
private volatile EnglishChatColor color;
|
||||
@Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'style' must be a valid style-name.")
|
||||
private volatile EnglishChatStyle style;
|
||||
@Property(description = "Sorry, 'pvp' must either be: true or false.", virtualType = Boolean.class, persistVirtual = true)
|
||||
volatile VirtualProperty<Boolean> pvp; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(description = "Scale must be a positive double value. ex: 2.3")
|
||||
private volatile double scale;
|
||||
@Property(description = "You must set this to the NAME not alias of a world.")
|
||||
private volatile String respawnWorld;
|
||||
@Property(description = "Sorry, this must either be: true or false.")
|
||||
private volatile boolean allowWeather;
|
||||
@Property(serializor = DifficultyPropertySerializor.class, virtualType = Difficulty.class, persistVirtual = true,
|
||||
description = "Difficulty must be set as one of the following: peaceful easy normal hard")
|
||||
volatile VirtualProperty<Difficulty> difficulty; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(description = "Sorry, 'animals' must either be: true or false.")
|
||||
private volatile SpawnSettings spawning;
|
||||
@Property
|
||||
volatile EntryFee entryfee;
|
||||
@Property(description = "Sorry, 'hunger' must either be: true or false.")
|
||||
private volatile boolean hunger;
|
||||
@Property(description = "Sorry, 'autoheal' must either be: true or false.")
|
||||
private volatile boolean autoHeal;
|
||||
@Property(description = "Sorry, 'adjustspawn' must either be: true or false.")
|
||||
private volatile boolean adjustSpawn;
|
||||
@Property(serializor = EnumPropertySerializor.class, description = "Allow portal forming must be NONE, ALL, NETHER or END.")
|
||||
private volatile AllowedPortalType portalForm;
|
||||
@Property(serializor = GameModePropertySerializor.class, description = "GameMode must be set as one of the following: survival creative")
|
||||
private volatile GameMode gameMode;
|
||||
@Property(description = "Sorry, this must either be: true or false.", virtualType = Boolean.class, persistVirtual = true)
|
||||
volatile VirtualProperty<Boolean> keepSpawnInMemory; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
volatile SpawnLocation spawnLocation; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(virtualType = Location.class,
|
||||
description = "There is no help available for this variable. Go bug Rigby90 about it.")
|
||||
volatile VirtualProperty<Location> spawn; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property(description = "Set this to false ONLY if you don't want this world to load itself on server restart.")
|
||||
private volatile boolean autoLoad;
|
||||
@Property(description = "If a player dies in this world, shoudld they go to their bed?")
|
||||
private volatile boolean bedRespawn;
|
||||
@Property
|
||||
private volatile List<String> worldBlacklist;
|
||||
@Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
|
||||
description = "Set the time to whatever you want! (Will NOT freeze time)")
|
||||
volatile VirtualProperty<Long> time; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
volatile Environment environment; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
volatile long seed; // SUPPRESS CHECKSTYLE: VisibilityModifier
|
||||
@Property
|
||||
private volatile String generator;
|
||||
@Property
|
||||
private volatile int playerLimit;
|
||||
@Property
|
||||
private volatile boolean allowFlight;
|
||||
// End of properties
|
||||
// --------------------------------------------------------------
|
||||
|
||||
void setValidator(String fieldName, Validator validator) {
|
||||
registerValidator(fieldName, validator); //To change body of overridden methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void copyValues(SerializationConfig other) {
|
||||
super.copyValues(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* This prepares the MVWorld for unloading.
|
||||
*/
|
||||
public void cacheVirtualProperties() {
|
||||
try {
|
||||
this.buildVPropChanges();
|
||||
} catch (IllegalStateException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void setDefaults() {
|
||||
this.hidden = false;
|
||||
this.alias = new String();
|
||||
this.color = EnglishChatColor.WHITE;
|
||||
this.style = EnglishChatStyle.NORMAL;
|
||||
this.scale = 1D;
|
||||
this.respawnWorld = new String();
|
||||
this.allowWeather = true;
|
||||
this.spawning = new SpawnSettings();
|
||||
this.entryfee = new EntryFee();
|
||||
this.hunger = true;
|
||||
this.autoHeal = true;
|
||||
this.adjustSpawn = true;
|
||||
this.portalForm = AllowedPortalType.ALL;
|
||||
this.gameMode = GameMode.SURVIVAL;
|
||||
this.spawnLocation = new NullLocation();
|
||||
this.autoLoad = true;
|
||||
this.bedRespawn = true;
|
||||
this.worldBlacklist = new ArrayList<String>();
|
||||
this.generator = null;
|
||||
this.playerLimit = -1;
|
||||
this.allowFlight = true;
|
||||
}
|
||||
|
||||
private static double getDefaultScale(Environment environment) {
|
||||
if (environment == Environment.NETHER) {
|
||||
return 8.0; // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
} else if (environment == Environment.THE_END) {
|
||||
return 16.0; // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAliases().
|
||||
* @return The alias-map.
|
||||
* @see SerializationConfig
|
||||
*/
|
||||
protected static Map<String, String> getAliases() {
|
||||
return PROPERTY_ALIASES;
|
||||
}
|
||||
|
||||
void flushChanges() {
|
||||
this.flushPendingVPropChanges();
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.setPropertyValueUnchecked("alias", alias);
|
||||
}
|
||||
|
||||
public Environment getEnvironment() {
|
||||
return this.environment;
|
||||
}
|
||||
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.setPropertyValueUnchecked("environment", environment);
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return this.seed;
|
||||
}
|
||||
|
||||
public void setSeed(long seed) {
|
||||
this.setPropertyValueUnchecked("seed", seed);
|
||||
}
|
||||
|
||||
public String getGenerator() {
|
||||
return this.generator;
|
||||
}
|
||||
|
||||
public void setGenerator(String generator) {
|
||||
this.setPropertyValueUnchecked("generator", generator);
|
||||
}
|
||||
|
||||
public int getPlayerLimit() {
|
||||
return this.playerLimit;
|
||||
}
|
||||
|
||||
public void setPlayerLimit(int limit) {
|
||||
this.setPropertyValueUnchecked("playerLimit", limit);
|
||||
}
|
||||
|
||||
public boolean canAnimalsSpawn() {
|
||||
return this.spawning.getAnimalSettings().doSpawn();
|
||||
}
|
||||
|
||||
public void setAllowAnimalSpawn(boolean animals) {
|
||||
this.setPropertyValueUnchecked("spawning.animals.spawn", animals);
|
||||
}
|
||||
|
||||
public List<String> getAnimalList() {
|
||||
// These don't fire events at the moment. Should they?
|
||||
return this.spawning.getAnimalSettings().getExceptions();
|
||||
}
|
||||
|
||||
public boolean canMonstersSpawn() {
|
||||
return this.spawning.getMonsterSettings().doSpawn();
|
||||
}
|
||||
|
||||
public void setAllowMonsterSpawn(boolean monsters) {
|
||||
this.setPropertyValueUnchecked("spawning.monsters.spawn", monsters);
|
||||
}
|
||||
|
||||
public int getAnimalSpawnRate() {
|
||||
return this.spawning.getAnimalSettings().getSpawnRate();
|
||||
}
|
||||
|
||||
public int getMonsterSpawnRate() {
|
||||
return this.spawning.getMonsterSettings().getSpawnRate();
|
||||
}
|
||||
|
||||
public List<String> getMonsterList() {
|
||||
// These don't fire events at the moment. Should they?
|
||||
return this.spawning.getMonsterSettings().getExceptions();
|
||||
}
|
||||
|
||||
public boolean isPVPEnabled() {
|
||||
return this.pvp.get();
|
||||
}
|
||||
|
||||
public void setPVPMode(boolean pvp) {
|
||||
this.setPropertyValueUnchecked("pvp", pvp);
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return this.hidden;
|
||||
}
|
||||
|
||||
public void setHidden(boolean hidden) {
|
||||
this.setPropertyValueUnchecked("hidden", hidden);
|
||||
}
|
||||
|
||||
public List<String> getWorldBlacklist() {
|
||||
return this.worldBlacklist;
|
||||
}
|
||||
|
||||
public double getScaling() {
|
||||
return this.scale;
|
||||
}
|
||||
|
||||
public boolean setScaling(double scaling) {
|
||||
return this.setPropertyValueUnchecked("scale", scaling);
|
||||
}
|
||||
|
||||
public boolean setColor(String aliasColor) {
|
||||
return this.setPropertyUnchecked("color", aliasColor);
|
||||
}
|
||||
|
||||
public boolean setColor(EnglishChatColor color) {
|
||||
return this.setPropertyValueUnchecked("color", color);
|
||||
}
|
||||
|
||||
public EnglishChatColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getRespawnToWorld() {
|
||||
return this.respawnWorld;
|
||||
}
|
||||
|
||||
public boolean setRespawnToWorld(String respawnToWorld) {
|
||||
return this.setPropertyValueUnchecked("respawnWorld", respawnToWorld);
|
||||
}
|
||||
|
||||
public Material getCurrency() {
|
||||
return this.entryfee.getCurrency();
|
||||
}
|
||||
|
||||
public void setCurrency(@Nullable Material currency) {
|
||||
this.setPropertyValueUnchecked("entryfee.currency", currency);
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return this.entryfee.getAmount();
|
||||
}
|
||||
|
||||
public void setPrice(double price) {
|
||||
this.setPropertyValueUnchecked("entryfee.amount", price);
|
||||
}
|
||||
|
||||
public boolean setGameMode(String mode) {
|
||||
return this.setPropertyUnchecked("gameMode", mode);
|
||||
}
|
||||
|
||||
public boolean setGameMode(GameMode mode) {
|
||||
return this.setPropertyValueUnchecked("gameMode", mode);
|
||||
}
|
||||
|
||||
public GameMode getGameMode() {
|
||||
return this.gameMode;
|
||||
}
|
||||
|
||||
public void setEnableWeather(boolean weather) {
|
||||
this.setPropertyValueUnchecked("allowWeather", weather);
|
||||
}
|
||||
|
||||
public boolean isWeatherEnabled() {
|
||||
return this.allowWeather;
|
||||
}
|
||||
|
||||
public boolean isKeepingSpawnInMemory() {
|
||||
if (keepSpawnInMemory == null) {
|
||||
return keepSpawnFallback;
|
||||
}
|
||||
try {
|
||||
return this.keepSpawnInMemory.get();
|
||||
} catch (IllegalStateException e) {
|
||||
return keepSpawnFallback;
|
||||
}
|
||||
}
|
||||
|
||||
public void setKeepSpawnInMemory(boolean value) {
|
||||
this.setPropertyValueUnchecked("keepSpawnInMemory", value);
|
||||
}
|
||||
|
||||
public boolean getHunger() {
|
||||
return this.hunger;
|
||||
}
|
||||
|
||||
public void setHunger(boolean hunger) {
|
||||
this.setPropertyValueUnchecked("hunger", hunger);
|
||||
}
|
||||
|
||||
public Location getSpawnLocation() {
|
||||
return this.spawn.get();
|
||||
}
|
||||
|
||||
public void setSpawnLocation(Location l) {
|
||||
this.setPropertyValueUnchecked("spawn", l);
|
||||
}
|
||||
|
||||
public Difficulty getDifficulty() {
|
||||
return this.difficulty.get();
|
||||
}
|
||||
|
||||
@Deprecated // SUPPRESS CHECKSTYLE: Deprecated
|
||||
public boolean setDifficulty(String difficulty) {
|
||||
return this.setPropertyUnchecked("difficulty", difficulty);
|
||||
}
|
||||
|
||||
public boolean setDifficulty(Difficulty difficulty) {
|
||||
return this.setPropertyValueUnchecked("difficulty", difficulty);
|
||||
}
|
||||
|
||||
public boolean getAutoHeal() {
|
||||
return this.autoHeal;
|
||||
}
|
||||
|
||||
public void setAutoHeal(boolean heal) {
|
||||
this.setPropertyValueUnchecked("autoHeal", heal);
|
||||
}
|
||||
|
||||
public void setAdjustSpawn(boolean adjust) {
|
||||
this.setPropertyValueUnchecked("adjustSpawn", adjust);
|
||||
}
|
||||
|
||||
public boolean getAdjustSpawn() {
|
||||
return this.adjustSpawn;
|
||||
}
|
||||
|
||||
public void setAutoLoad(boolean load) {
|
||||
this.setPropertyValueUnchecked("autoLoad", load);
|
||||
}
|
||||
|
||||
public boolean getAutoLoad() {
|
||||
return this.autoLoad;
|
||||
}
|
||||
|
||||
public void setBedRespawn(boolean respawn) {
|
||||
this.setPropertyValueUnchecked("bedRespawn", respawn);
|
||||
}
|
||||
|
||||
public boolean getBedRespawn() {
|
||||
return this.bedRespawn;
|
||||
}
|
||||
|
||||
public String getAllPropertyNames() {
|
||||
ChatColor myColor = ChatColor.AQUA;
|
||||
StringBuilder result = new StringBuilder();
|
||||
Map<String, Object> serialized = this.serialize();
|
||||
for (String key : serialized.keySet()) {
|
||||
result.append(myColor).append(key).append(' ');
|
||||
myColor = (myColor == ChatColor.AQUA) ? ChatColor.GOLD : ChatColor.AQUA;
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return this.getPropertyUnchecked("time");
|
||||
}
|
||||
|
||||
public boolean setTime(String timeAsString) {
|
||||
return this.setPropertyUnchecked("time", timeAsString);
|
||||
}
|
||||
|
||||
public AllowedPortalType getAllowedPortals() {
|
||||
return portalForm;
|
||||
}
|
||||
|
||||
public void allowPortalMaking(AllowedPortalType portalType) {
|
||||
this.setPropertyValueUnchecked("portalForm", portalType);
|
||||
}
|
||||
|
||||
public EnglishChatStyle getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public boolean setStyle(String style) {
|
||||
return this.setPropertyUnchecked("style", style);
|
||||
}
|
||||
|
||||
public boolean getAllowFlight() {
|
||||
return this.allowFlight;
|
||||
}
|
||||
|
||||
public void setAllowFlight(final boolean allowFlight) {
|
||||
this.setPropertyValueUnchecked("allowFlight", allowFlight);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -7,12 +7,18 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import buscript.Buscript;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.CommandQueueManager;
|
||||
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
|
||||
import com.onarandombox.MultiverseCore.utils.*;
|
||||
import com.onarandombox.MultiverseCore.utils.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.utils.MVEconomist;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.utils.VaultHandler;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -23,18 +29,22 @@ import org.bukkit.entity.Player;
|
|||
public interface Core {
|
||||
|
||||
/**
|
||||
* Gets the Multiverse config file.
|
||||
* Returns the Vault handler used by Multiverse. The returned object will have all methods necessary for
|
||||
* interfacing with Vault.
|
||||
*
|
||||
* @return The Multiverse config file.
|
||||
* @return the Vault handler for Multiverse.
|
||||
* @deprecated we are now using {@link #getEconomist()} for all economy needs.
|
||||
*/
|
||||
FileConfiguration getMVConfiguration();
|
||||
@Deprecated
|
||||
VaultHandler getVaultHandler();
|
||||
|
||||
/**
|
||||
* Gets the Banking system that Multiverse-Core has hooked into.
|
||||
* Retrieves Multiverse's friendly economist. The economist can be used for dealing with economies without
|
||||
* worrying about any of the messy details.
|
||||
*
|
||||
* @return A {@link GenericBank} that can be used for payments.
|
||||
* @return the economy manager for Multiverse.
|
||||
*/
|
||||
GenericBank getBank();
|
||||
MVEconomist getEconomist();
|
||||
|
||||
/**
|
||||
* Reloads the Multiverse Configuration files:
|
||||
|
@ -46,9 +56,9 @@ public interface Core {
|
|||
* Gets the Multiverse message system. This allows you to send messages
|
||||
* to users at specified intervals.
|
||||
*
|
||||
* @return The loaded {@link MVMessaging}.
|
||||
* @return The loaded {@link MultiverseMessaging}.
|
||||
*/
|
||||
MVMessaging getMessaging();
|
||||
MultiverseMessaging getMessaging();
|
||||
|
||||
/**
|
||||
* Gets the {@link MVPlayerSession} for the given player.
|
||||
|
@ -61,14 +71,6 @@ public interface Core {
|
|||
*/
|
||||
MVPlayerSession getPlayerSession(Player player);
|
||||
|
||||
/**
|
||||
* Gets the instantiated Safe-T-Teleporter for performing
|
||||
* safe teleports.
|
||||
*
|
||||
* @return A non-null {@link SafeTTeleporter}.
|
||||
*/
|
||||
SafeTTeleporter getTeleporter();
|
||||
|
||||
/**
|
||||
* Multiverse uses an advanced permissions setup, this object
|
||||
* simplifies getting/setting permissions.
|
||||
|
@ -85,6 +87,15 @@ public interface Core {
|
|||
*/
|
||||
CommandHandler getCommandHandler();
|
||||
|
||||
/**
|
||||
* Manager for command that requires /mv confirm before execution.
|
||||
*
|
||||
* @return A non-null {@link CommandQueueManager}.
|
||||
* @deprecated To be moved to new command manager in 5.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
CommandQueueManager getCommandQueueManager();
|
||||
|
||||
/**
|
||||
* Gets the factory class responsible for loading many different destinations
|
||||
* on demand.
|
||||
|
@ -96,7 +107,7 @@ public interface Core {
|
|||
/**
|
||||
* Gets the primary class responsible for managing Multiverse Worlds.
|
||||
*
|
||||
* @return {@link WorldManager}.
|
||||
* @return {@link MVWorldManager}.
|
||||
*/
|
||||
MVWorldManager getMVWorldManager();
|
||||
|
||||
|
@ -115,30 +126,37 @@ public interface Core {
|
|||
AnchorManager getAnchorManager();
|
||||
|
||||
/**
|
||||
* Used by queued commands to regenerate a world on a delay.
|
||||
* Previously used by queued commands to regenerate a world on a delay.
|
||||
* Do not use api method for any other purpose.
|
||||
*
|
||||
* @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 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.
|
||||
*
|
||||
* @deprecated Use {@link MVWorldManager#regenWorld(String, boolean, boolean, String, boolean)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed);
|
||||
|
||||
/**
|
||||
* Sets the {@link GenericBank}-Bank AllPay is using.
|
||||
* Used by queued commands to regenerate a world on a delay.
|
||||
* Do not use api method for any other purpose.
|
||||
*
|
||||
* @param bank The new {@link GenericBank}
|
||||
*/
|
||||
void setBank(GenericBank bank);
|
||||
|
||||
/**
|
||||
* Gets this plugin's {@link AllPay}-Banker.
|
||||
* @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 An {@link AllPay}-Banker
|
||||
* @return True if success, false if fail.
|
||||
*
|
||||
* @deprecated Use {@link MVWorldManager#regenWorld(String, boolean, boolean, String, boolean)} instead.
|
||||
*/
|
||||
AllPay getBanker();
|
||||
@Deprecated
|
||||
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed, Boolean keepGameRules);
|
||||
|
||||
/**
|
||||
* Decrements the number of plugins that have specifically hooked into core.
|
||||
|
@ -163,4 +181,65 @@ public interface Core {
|
|||
* @return The readable authors-{@link String}
|
||||
*/
|
||||
String getAuthors();
|
||||
|
||||
/**
|
||||
* Gets the {@link BlockSafety} this {@link Core} is using.
|
||||
* @return The {@link BlockSafety} this {@link Core} is using.
|
||||
* @see BlockSafety
|
||||
* @see SimpleBlockSafety
|
||||
*/
|
||||
BlockSafety getBlockSafety();
|
||||
|
||||
/**
|
||||
* Sets the {@link BlockSafety} this {@link Core} is using.
|
||||
* @param blockSafety The new {@link BlockSafety}.
|
||||
* @see BlockSafety
|
||||
* @see SimpleBlockSafety
|
||||
*/
|
||||
void setBlockSafety(BlockSafety blockSafety);
|
||||
|
||||
/**
|
||||
* Gets the {@link LocationManipulation} this {@link Core} is using.
|
||||
* @return The {@link LocationManipulation} this {@link Core} is using.
|
||||
* @see LocationManipulation
|
||||
* @see SimpleLocationManipulation
|
||||
*/
|
||||
LocationManipulation getLocationManipulation();
|
||||
|
||||
/**
|
||||
* Sets the {@link LocationManipulation} this {@link Core} is using.
|
||||
* @param locationManipulation The new {@link LocationManipulation}.
|
||||
* @see LocationManipulation
|
||||
* @see SimpleLocationManipulation
|
||||
*/
|
||||
void setLocationManipulation(LocationManipulation locationManipulation);
|
||||
|
||||
/**
|
||||
* Gets the {@link SafeTTeleporter} this {@link Core} is using.
|
||||
* @return The {@link SafeTTeleporter} this {@link Core} is using.
|
||||
* @see SafeTTeleporter
|
||||
* @see SimpleSafeTTeleporter
|
||||
*/
|
||||
SafeTTeleporter getSafeTTeleporter();
|
||||
|
||||
/**
|
||||
* Sets the {@link SafeTTeleporter} this {@link Core} is using.
|
||||
* @param safeTTeleporter The new {@link SafeTTeleporter}.
|
||||
* @see SafeTTeleporter
|
||||
* @see SimpleSafeTTeleporter
|
||||
*/
|
||||
void setSafeTTeleporter(SafeTTeleporter safeTTeleporter);
|
||||
|
||||
/**
|
||||
* Gets the {@link MultiverseCoreConfig}.
|
||||
* @return The configuration.
|
||||
*/
|
||||
MultiverseCoreConfig getMVConfig();
|
||||
|
||||
/**
|
||||
* Gets the buscript object for Multiverse. This is what handles Javascript processing.
|
||||
*
|
||||
* @return The Multiverse buscript object.
|
||||
*/
|
||||
Buscript getScriptAPI();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -7,11 +7,17 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/** A simple API to require plugins to have a log method. */
|
||||
/**
|
||||
* A simple API to require plugins to have a log method.
|
||||
*
|
||||
* @deprecated Replaced by {@link Logging}.
|
||||
* */
|
||||
@Deprecated
|
||||
public interface LoggablePlugin {
|
||||
/**
|
||||
* Logs a message at the specified level.
|
||||
|
|
|
@ -45,7 +45,7 @@ public interface MVDestination {
|
|||
boolean isThisType(JavaPlugin plugin, String destination);
|
||||
|
||||
/**
|
||||
* Returns the location a specific entity will spawn at.
|
||||
* Returns the location a specific entity will spawn at when being teleported to this Destination.
|
||||
* <p>
|
||||
* To just retrieve the location as it is stored you can just pass null, but be warned some destinations may return
|
||||
* null back to you if you do this. It is always safer to pass an actual entity. This is used so things like
|
||||
|
|
|
@ -30,14 +30,14 @@ public interface MVPlugin extends LoggablePlugin {
|
|||
/**
|
||||
* Gets the reference to MultiverseCore.
|
||||
*
|
||||
* @return A valid {@link MultiverseCore}.
|
||||
* @return A valid {@link com.onarandombox.MultiverseCore}.
|
||||
*/
|
||||
MultiverseCore getCore();
|
||||
|
||||
/**
|
||||
* Sets the reference to MultiverseCore.
|
||||
*
|
||||
* @param core A valid {@link MultiverseCore}.
|
||||
* @param core A valid {@link com.onarandombox.MultiverseCore}.
|
||||
*/
|
||||
void setCore(MultiverseCore core);
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.utils.PurgeWorlds;
|
||||
import com.onarandombox.MultiverseCore.utils.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;
|
||||
|
||||
|
@ -27,35 +29,65 @@ 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 generator The Custom generator plugin to use.
|
||||
* @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, String generator);
|
||||
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 generator The Custom generator plugin to use.
|
||||
* @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, String generator, boolean useSpawnAdjust);
|
||||
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
|
||||
String generator, boolean useSpawnAdjust);
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the
|
||||
* config and deletes the folder.
|
||||
* Make a copy of a world.
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @param oldName Name of world to be copied
|
||||
* @param newName Name of world to be created
|
||||
* @param generator The Custom generator plugin to use. Ignored.
|
||||
* @return True if the world is copied successfully, false if not.
|
||||
* @deprecated Use {@link #cloneWorld(String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean cloneWorld(String oldName, String newName, String generator);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
@ -71,6 +103,17 @@ public interface MVWorldManager {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -79,6 +122,15 @@ public interface MVWorldManager {
|
|||
*/
|
||||
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)}.
|
||||
|
@ -122,6 +174,16 @@ public interface MVWorldManager {
|
|||
*/
|
||||
MultiverseWorld getMVWorld(String name);
|
||||
|
||||
/**
|
||||
* Returns a {@link MultiverseWorld} 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 MultiverseWorld} or null.
|
||||
*/
|
||||
MultiverseWorld getMVWorld(String name, boolean checkAliases);
|
||||
|
||||
/**
|
||||
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
|
||||
*
|
||||
|
@ -131,13 +193,24 @@ public interface MVWorldManager {
|
|||
MultiverseWorld getMVWorld(World world);
|
||||
|
||||
/**
|
||||
* Checks to see if the given name is a valid {@link MultiverseWorld}.
|
||||
* Checks to see if the given name is a valid {@link MultiverseWorld}
|
||||
* 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 MultiverseWorld}.
|
||||
* 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 MultiverseWorld}.
|
||||
*
|
||||
|
@ -147,7 +220,7 @@ public interface MVWorldManager {
|
|||
boolean isMVWorld(World world);
|
||||
|
||||
/**
|
||||
* Load the Worlds & Settings from the configuration file.
|
||||
* 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.
|
||||
|
@ -155,7 +228,7 @@ public interface MVWorldManager {
|
|||
void loadWorlds(boolean forceLoad);
|
||||
|
||||
/**
|
||||
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
|
||||
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
|
||||
* <p>
|
||||
* This way people will _always_ have some worlds in the list.
|
||||
*/
|
||||
|
@ -165,9 +238,21 @@ public interface MVWorldManager {
|
|||
* Return the World Purger.
|
||||
*
|
||||
* @return A valid {@link PurgeWorlds}.
|
||||
* @deprecated {@link PurgeWorlds} is deprecated!
|
||||
*/
|
||||
@Deprecated
|
||||
PurgeWorlds getWorldPurger();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldPurger}.
|
||||
* <p>
|
||||
* TODO: Remove {@link #getWorldPurger()} and replace it with this method.
|
||||
* @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.
|
||||
|
@ -224,4 +309,50 @@ public interface MVWorldManager {
|
|||
* @return The {@link MultiverseWorld} new players should spawn in.
|
||||
*/
|
||||
MultiverseWorld 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,242 @@
|
|||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
|
||||
/**
|
||||
* The configuration of MultiverseCore.
|
||||
*/
|
||||
public interface MultiverseCoreConfig 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 portalCooldown.
|
||||
* @param portalCooldown The new value.
|
||||
*/
|
||||
void setTeleportCooldown(int portalCooldown);
|
||||
|
||||
/**
|
||||
* Gets portalCooldown.
|
||||
* @return portalCooldown.
|
||||
*/
|
||||
int getTeleportCooldown();
|
||||
|
||||
/**
|
||||
* 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 messageCooldown.
|
||||
* @param messageCooldown The new value.
|
||||
*/
|
||||
void setMessageCooldown(int messageCooldown);
|
||||
|
||||
/**
|
||||
* Gets messageCooldown.
|
||||
* @return messageCooldown.
|
||||
*/
|
||||
int getMessageCooldown();
|
||||
|
||||
/**
|
||||
* 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 enableBuscript.
|
||||
* @param enableBuscript The new value.
|
||||
*/
|
||||
void setEnableBuscript(boolean enableBuscript);
|
||||
|
||||
/**
|
||||
* Gets enableBuscript.
|
||||
* @return enableBuscript.
|
||||
*/
|
||||
boolean getEnableBuscript();
|
||||
|
||||
/**
|
||||
* 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 useasyncchat.
|
||||
* @param useAsyncChat The new value.
|
||||
*/
|
||||
void setUseAsyncChat(boolean useAsyncChat);
|
||||
|
||||
/**
|
||||
* Gets useasyncchat.
|
||||
* @return useasyncchat.
|
||||
*/
|
||||
boolean getUseAsyncChat();
|
||||
|
||||
/**
|
||||
* 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,56 @@
|
|||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
* Multiverse-messaging.
|
||||
*/
|
||||
public interface MultiverseMessaging {
|
||||
/**
|
||||
* Sets the message-cooldown.
|
||||
* @param milliseconds The new message-cooldown in milliseconds.
|
||||
*/
|
||||
void setCooldown(int milliseconds);
|
||||
|
||||
/**
|
||||
* Sends a message to the specified sender if the cooldown has passed.
|
||||
*
|
||||
* @param sender The person/console to send the message to.
|
||||
* @param message The message to send.
|
||||
* @param ignoreCooldown If true this message will always be sent. Useful for things like menus
|
||||
* @return true if the message was sent, false if not.
|
||||
*/
|
||||
boolean sendMessage(CommandSender sender, String message, boolean ignoreCooldown);
|
||||
|
||||
/**
|
||||
* Sends a group of messages to the specified sender if the cooldown has passed.
|
||||
* This method is needed, since sending many messages in quick succession would violate
|
||||
* the cooldown.
|
||||
*
|
||||
* @param sender The person/console to send the message to.
|
||||
* @param messages The messages to send.
|
||||
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
|
||||
* @return true if the message was sent, false if not.
|
||||
*/
|
||||
boolean sendMessages(CommandSender sender, String[] messages, boolean ignoreCooldown);
|
||||
|
||||
/**
|
||||
* Sends a group of messages to the specified sender if the cooldown has passed.
|
||||
* This method is needed, since sending many messages in quick succession would violate
|
||||
* the cooldown.
|
||||
*
|
||||
* @param sender The person/console to send the message to.
|
||||
* @param messages The messages to send.
|
||||
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
|
||||
* @return true if the message was sent, false if not.
|
||||
*/
|
||||
boolean sendMessages(CommandSender sender, Collection<String> messages, boolean ignoreCooldown);
|
||||
|
||||
/**
|
||||
* Gets the message-cooldown.
|
||||
* @return The message-cooldown.
|
||||
*/
|
||||
int getCooldown();
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.utils.DebugLog;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
|
||||
/**
|
||||
* Make things easier for MV-Plugins!
|
||||
*/
|
||||
public abstract class MultiversePlugin extends JavaPlugin implements MVPlugin {
|
||||
private MultiverseCore core;
|
||||
/**
|
||||
* Prefix for standard log entrys.
|
||||
*/
|
||||
protected String logTag;
|
||||
private DebugLog debugLog;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Note: You can't override this, use {@link #onPluginEnable()} instead!
|
||||
* @see #onPluginEnable()
|
||||
*/
|
||||
@Override
|
||||
public final void onEnable() {
|
||||
MultiverseCore theCore = (MultiverseCore) this.getServer().getPluginManager().getPlugin("Multiverse-Core");
|
||||
if (theCore == null) {
|
||||
this.getLogger().severe("Core not found! The plugin dev needs to add a dependency!");
|
||||
this.getLogger().severe("Disabling!");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
if (theCore.getProtocolVersion() < this.getProtocolVersion()) {
|
||||
this.getLogger().severe("You need a newer version of Multiverse-Core!");
|
||||
this.getLogger().severe("Disabling!");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
this.setCore(theCore);
|
||||
|
||||
this.getServer().getLogger().info(String.format("%s - Version %s enabled - By %s",
|
||||
this.getDescription().getName(), this.getDescription().getVersion(), getAuthors()));
|
||||
getDataFolder().mkdirs();
|
||||
File debugLogFile = new File(getDataFolder(), "debug.log");
|
||||
try {
|
||||
debugLogFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
debugLog = new DebugLog(this.getDescription().getName(), getDataFolder() + File.separator + "debug.log");
|
||||
debugLog.setTag(String.format("[%s-Debug]", this.getDescription().getName()));
|
||||
|
||||
this.onPluginEnable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the Authors Array into a readable String with ',' and 'and'.
|
||||
*
|
||||
* @return The readable authors-{@link String}
|
||||
*/
|
||||
protected String getAuthors() {
|
||||
String authors = "";
|
||||
List<String> auths = this.getDescription().getAuthors();
|
||||
if (auths.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (auths.size() == 1) {
|
||||
return auths.get(0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < auths.size(); i++) {
|
||||
if (i == this.getDescription().getAuthors().size() - 1) {
|
||||
authors += " and " + this.getDescription().getAuthors().get(i);
|
||||
} else {
|
||||
authors += ", " + this.getDescription().getAuthors().get(i);
|
||||
}
|
||||
}
|
||||
return authors.substring(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the plugin is enabled.
|
||||
* @see #onEnable()
|
||||
*/
|
||||
protected abstract void onPluginEnable();
|
||||
|
||||
/**
|
||||
* You can register commands here.
|
||||
* @param handler The CommandHandler.
|
||||
*/
|
||||
protected abstract void registerCommands(CommandHandler handler);
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!this.isEnabled()) {
|
||||
sender.sendMessage("This plugin is Disabled!");
|
||||
return true;
|
||||
}
|
||||
|
||||
ArrayList<String> allArgs = new ArrayList<String>(args.length + 1);
|
||||
allArgs.add(command.getName());
|
||||
allArgs.addAll(Arrays.asList(args));
|
||||
return this.getCore().getCommandHandler().locateAndRunCommand(sender, allArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(Level level, String msg) {
|
||||
int debugLevel = this.getCore().getMVConfig().getGlobalDebug();
|
||||
if ((level == Level.FINE && debugLevel >= 1) || (level == Level.FINER && debugLevel >= 2)
|
||||
|| (level == Level.FINEST && debugLevel >= 3)) {
|
||||
debugLog.log(level, msg);
|
||||
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
|
||||
String message = new StringBuilder(getLogTag()).append(msg).toString();
|
||||
this.getServer().getLogger().log(level, message);
|
||||
debugLog.log(level, message);
|
||||
}
|
||||
}
|
||||
|
||||
private String getLogTag() {
|
||||
if (logTag == null)
|
||||
logTag = String.format("[%s]", this.getDescription().getName());
|
||||
return logTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the debug log-tag.
|
||||
* @param tag The new tag.
|
||||
*/
|
||||
protected final void setDebugLogTag(String tag) {
|
||||
this.debugLog.setTag(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String dumpVersionInfo(String buffer) {
|
||||
throw new UnsupportedOperationException("This is gone.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final MultiverseCore getCore() {
|
||||
if (this.core == null)
|
||||
throw new IllegalStateException("Core is null!");
|
||||
return this.core;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setCore(MultiverseCore core) {
|
||||
this.core = core;
|
||||
}
|
||||
}
|
|
@ -7,26 +7,25 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.configuration.MVConfigProperty;
|
||||
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
|
||||
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
|
||||
|
||||
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.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The API for a Multiverse Handled World.
|
||||
* <p>
|
||||
* Currently INCOMPLETE
|
||||
*/
|
||||
public interface MultiverseWorld {
|
||||
|
||||
/**
|
||||
* Returns the Bukkit world object that this world describes.
|
||||
*
|
||||
|
@ -35,79 +34,24 @@ public interface MultiverseWorld {
|
|||
World getCBWorld();
|
||||
|
||||
/**
|
||||
* Adds the property to the given value.
|
||||
* It will throw a PropertyDoesNotExistException if the property is not found.
|
||||
* 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.
|
||||
*
|
||||
* @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.
|
||||
* @param sender The sender who wants this value to be set.
|
||||
* @return True if the value was set, false if not.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
* @return The name of the world as a String.
|
||||
*/
|
||||
boolean setProperty(String property, String value, CommandSender sender) throws PropertyDoesNotExistException;
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the actual MVConfigProperty from this world.
|
||||
* It will throw a PropertyDoesNotExistException if the property is not found.
|
||||
* 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.
|
||||
*
|
||||
* @param property The name of a world property to get.
|
||||
* @return A valid MVWorldProperty.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
* @deprecated Use {@link #getProperty(String, Class)} instead
|
||||
* @return The Type of this world.
|
||||
*/
|
||||
@Deprecated
|
||||
MVConfigProperty<?> getProperty(String property) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Gets the string representation of a property.
|
||||
* It will throw a PropertyDoesNotExistException if the property is not found.
|
||||
*
|
||||
* @param property The name of a world property to get.
|
||||
* @return A valid MVWorldProperty.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
*/
|
||||
String getPropertyValue(String property) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Gets the actual MVConfigProperty from this world.
|
||||
* It will throw a PropertyDoesNotExistException if the property is not found.
|
||||
*
|
||||
* @param property The name of a world property to get.
|
||||
* @param expected The type of the expected property. Use Object.class if this doesn't matter for you.
|
||||
* @param <T> The type of the expected property.
|
||||
*
|
||||
* @return A valid MVWorldProperty.
|
||||
*
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
*/
|
||||
<T> MVConfigProperty<T> getProperty(String property, Class<T> expected) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Removes all values from the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to clear.
|
||||
* @return True if it was cleared, false if not.
|
||||
*/
|
||||
boolean clearVariable(String property);
|
||||
|
||||
/**
|
||||
* Adds a value to the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.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.
|
||||
*/
|
||||
boolean addToVariable(String property, String value);
|
||||
|
||||
/**
|
||||
* Removes a value from the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.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.
|
||||
*/
|
||||
boolean removeFromVariable(String property, String value);
|
||||
WorldType getWorldType();
|
||||
|
||||
/**
|
||||
* Gets the environment of this world.
|
||||
|
@ -125,26 +69,163 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
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();
|
||||
long getSeed();
|
||||
|
||||
/**
|
||||
* Sets the seed of this world.
|
||||
*
|
||||
* @param seed A Long that is the seed.
|
||||
*/
|
||||
void setSeed(Long seed);
|
||||
void setSeed(long seed);
|
||||
|
||||
/**
|
||||
* Gets the name of this world. This cannot be changed.
|
||||
* Gets the generator of this world.
|
||||
*
|
||||
* @return The name of the world as a String.
|
||||
* @return The name of the generator.
|
||||
*/
|
||||
String getName();
|
||||
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 com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.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 com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.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 com.onarandombox.MultiverseCore.enums.AddProperties}.
|
||||
*
|
||||
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.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
|
||||
|
||||
// permission stuff
|
||||
/**
|
||||
* Gets the lowercased name of the world. This method is required, since the permissables
|
||||
* lowercase all permissions when recalculating.
|
||||
* <p>
|
||||
* Note: This also means if a user has worlds named: world and WORLD, that they can both
|
||||
* exist, and both be teleported to independently, but their permissions **cannot** be
|
||||
* uniqueified at this time. See bug report #.
|
||||
*
|
||||
* @return The lowercased name of the world.
|
||||
*/
|
||||
String getPermissibleName();
|
||||
|
||||
/**
|
||||
* Gets the permission required to enter this world.
|
||||
*
|
||||
* @return The permission required to be exempt from charges to/from this world.
|
||||
*/
|
||||
Permission getAccessPermission();
|
||||
|
||||
/**
|
||||
* Gets the permission required to be exempt when entering.
|
||||
*
|
||||
* @return The permission required to be exempt when entering.
|
||||
*/
|
||||
Permission getExemptPermission();
|
||||
// end of permission stuff
|
||||
|
||||
/**
|
||||
* Gets the alias of this world.
|
||||
|
@ -162,6 +243,13 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -171,18 +259,29 @@ public interface MultiverseWorld {
|
|||
boolean setColor(String color);
|
||||
|
||||
/**
|
||||
* Gets the color that this world's name/alias will display as.
|
||||
* Gets the style that this world's name/alias will display as.
|
||||
*
|
||||
* @return The color of this world.
|
||||
* @return The style of this world. {@code null} for "normal" style.
|
||||
*/
|
||||
ChatColor getColor();
|
||||
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 com.onarandombox.MultiverseCore.enums.EnglishChatColor#isValidAliasColor(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isValidAliasColor(String color);
|
||||
|
||||
/**
|
||||
|
@ -192,6 +291,7 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
String getColoredWorldString();
|
||||
|
||||
// animals&monster stuff
|
||||
/**
|
||||
* Gets whether or not animals are allowed to spawn in this world.
|
||||
*
|
||||
|
@ -199,6 +299,22 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -207,7 +323,31 @@ public interface MultiverseWorld {
|
|||
boolean canMonstersSpawn();
|
||||
|
||||
/**
|
||||
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
|
||||
* 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.
|
||||
*/
|
||||
|
@ -222,13 +362,6 @@ public interface MultiverseWorld {
|
|||
@Deprecated
|
||||
boolean getFakePVP();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
@ -245,6 +378,13 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
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.
|
||||
|
@ -254,11 +394,11 @@ public interface MultiverseWorld {
|
|||
void setEnableWeather(boolean enableWeather);
|
||||
|
||||
/**
|
||||
* Gets whether weather is enabled in this world.
|
||||
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
|
||||
*
|
||||
* @return True if weather events will occur, false if not.
|
||||
* @return True if CraftBukkit is keeping spawn chunks in memory.
|
||||
*/
|
||||
boolean isWeatherEnabled();
|
||||
boolean isKeepingSpawnInMemory();
|
||||
|
||||
/**
|
||||
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
|
||||
|
@ -270,29 +410,11 @@ public interface MultiverseWorld {
|
|||
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
|
||||
|
||||
/**
|
||||
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
|
||||
* Gets the spawn location of this world.
|
||||
*
|
||||
* @return True if CraftBukkit is keeping spawn chunks in memory.
|
||||
* @return The spawn location of this world.
|
||||
*/
|
||||
boolean isKeepingSpawnInMemory();
|
||||
|
||||
/**
|
||||
* 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. 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.
|
||||
*/
|
||||
boolean setDifficulty(String difficulty);
|
||||
|
||||
/**
|
||||
* Gets the difficulty of this world.
|
||||
*
|
||||
* @return The difficulty of this world.
|
||||
*/
|
||||
Difficulty getDifficulty();
|
||||
Location getSpawnLocation();
|
||||
|
||||
/**
|
||||
* Sets the spawn location for a world.
|
||||
|
@ -302,11 +424,11 @@ public interface MultiverseWorld {
|
|||
void setSpawnLocation(Location spawnLocation);
|
||||
|
||||
/**
|
||||
* Gets the spawn location of this world.
|
||||
* Gets whether or not the hunger level of players will go down in a world.
|
||||
*
|
||||
* @return The spawn location of this world.
|
||||
* @return True if it will go down, false if it will remain steady.
|
||||
*/
|
||||
Location getSpawnLocation();
|
||||
boolean getHunger();
|
||||
|
||||
/**
|
||||
* Sets whether or not the hunger level of players will go down in a world.
|
||||
|
@ -316,22 +438,6 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
void setHunger(boolean hungerEnabled);
|
||||
|
||||
/**
|
||||
* 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 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.
|
||||
*/
|
||||
boolean setGameMode(String gameMode);
|
||||
|
||||
/**
|
||||
* Gets the GameMode of this world.
|
||||
*
|
||||
|
@ -340,27 +446,24 @@ public interface MultiverseWorld {
|
|||
GameMode getGameMode();
|
||||
|
||||
/**
|
||||
* Gets the permission required to enter this world.
|
||||
* Sets the game mode of this world.
|
||||
*
|
||||
* @return The permission required to be exempt from charges to/from 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)}.
|
||||
*/
|
||||
Permission getAccessPermission();
|
||||
@Deprecated
|
||||
boolean setGameMode(String gameMode);
|
||||
|
||||
/**
|
||||
* Gets the permission required to be exempt when entering.
|
||||
* Sets the game mode of this world.
|
||||
*
|
||||
* @return The permission required to be exempt when entering.
|
||||
* @param gameMode The new {@link GameMode}.
|
||||
* @return True if the game mode was successfully changed, false if not.
|
||||
*/
|
||||
Permission getExemptPermission();
|
||||
|
||||
/**
|
||||
* Sets the price for entry to this world.
|
||||
* You can think of this like an amount.
|
||||
* The type can be set with {@link #setCurrency(int)}
|
||||
*
|
||||
* @param price The Amount of money/item to enter the world.
|
||||
*/
|
||||
void setPrice(double price);
|
||||
boolean setGameMode(GameMode gameMode);
|
||||
|
||||
/**
|
||||
* Gets the amount of currency it requires to enter this world.
|
||||
|
@ -369,20 +472,38 @@ public interface MultiverseWorld {
|
|||
*/
|
||||
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 -1 to use an AllPay economy, or any valid itemid
|
||||
* 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(int item);
|
||||
void setCurrency(@Nullable Material item);
|
||||
|
||||
/**
|
||||
* Gets the Type of currency that will be used when users enter this world.
|
||||
* Gets the world players will respawn in if they die in this one.
|
||||
*
|
||||
* @return The Type of currency that will be used when users enter this world.
|
||||
* @return A world that exists on the server.
|
||||
*/
|
||||
int getCurrency();
|
||||
World getRespawnToWorld();
|
||||
|
||||
/**
|
||||
* Sets the world players will respawn in if they die in this one.
|
||||
|
@ -394,11 +515,12 @@ public interface MultiverseWorld {
|
|||
boolean setRespawnToWorld(String respawnWorld);
|
||||
|
||||
/**
|
||||
* Gets the world players will respawn in if they die in this one.
|
||||
* Gets the scaling value of this world.Really only has an effect if you use
|
||||
* Multiverse-NetherPortals.
|
||||
*
|
||||
* @return A world that exists on the server.
|
||||
* @return This world's non-negative, non-zero scale.
|
||||
*/
|
||||
World getRespawnToWorld();
|
||||
double getScaling();
|
||||
|
||||
/**
|
||||
* Sets the scale of this world. Really only has an effect if you use
|
||||
|
@ -410,60 +532,11 @@ public interface MultiverseWorld {
|
|||
boolean setScaling(double scaling);
|
||||
|
||||
/**
|
||||
* Gets the scaling value of this world.Really only has an effect if you use
|
||||
* Multiverse-NetherPortals.
|
||||
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
*
|
||||
* @return This world's non-negative, non-zero scale.
|
||||
* @return True if the world should heal (default), false if not.
|
||||
*/
|
||||
double getScaling();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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 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();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Clears a list property (sets it to []).
|
||||
*
|
||||
* @param property The property to clear.
|
||||
* @return True if success, false if fail.
|
||||
*/
|
||||
boolean clearList(String property);
|
||||
boolean getAutoHeal();
|
||||
|
||||
/**
|
||||
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
|
@ -473,11 +546,11 @@ public interface MultiverseWorld {
|
|||
void setAutoHeal(boolean heal);
|
||||
|
||||
/**
|
||||
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
|
||||
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
*
|
||||
* @return True if the world should heal (default), false if not.
|
||||
* @return True if Multiverse should adjust the spawn, false if not.
|
||||
*/
|
||||
boolean getAutoHeal();
|
||||
boolean getAdjustSpawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
|
@ -487,11 +560,11 @@ public interface MultiverseWorld {
|
|||
void setAdjustSpawn(boolean adjust);
|
||||
|
||||
/**
|
||||
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
|
||||
* Gets whether or not Multiverse should auto-load this world.
|
||||
*
|
||||
* @return True if Multiverse should adjust the spawn, false if not.
|
||||
* @return True if Multiverse should auto-load this world.
|
||||
*/
|
||||
boolean getAdjustSpawn();
|
||||
boolean getAutoLoad();
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-load this world.
|
||||
|
@ -503,11 +576,12 @@ public interface MultiverseWorld {
|
|||
void setAutoLoad(boolean autoLoad);
|
||||
|
||||
/**
|
||||
* Gets whether or not Multiverse should auto-load this world.
|
||||
* 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 Multiverse should auto-load this world.
|
||||
* @return True if players dying in this world should respawn at their bed.
|
||||
*/
|
||||
boolean getAutoLoad();
|
||||
boolean getBedRespawn();
|
||||
|
||||
/**
|
||||
* Sets whether or not a player who dies in this world will respawn in their
|
||||
|
@ -520,23 +594,30 @@ public interface MultiverseWorld {
|
|||
void setBedRespawn(boolean autoLoad);
|
||||
|
||||
/**
|
||||
* Gets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
* 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
|
||||
*
|
||||
* @return True if players dying in this world should respawn at their bed.
|
||||
* @param limit The new limit
|
||||
*/
|
||||
boolean getBedRespawn();
|
||||
void setPlayerLimit(int limit);
|
||||
|
||||
/**
|
||||
* Gets all the names of all properties that can be SET.
|
||||
* 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 All property names, with alternating colors.
|
||||
* @return The player limit
|
||||
*/
|
||||
String getAllPropertyNames();
|
||||
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
|
||||
|
@ -548,8 +629,46 @@ public interface MultiverseWorld {
|
|||
boolean setTime(String timeAsString);
|
||||
|
||||
/**
|
||||
* Same as {@link #getTime()}, but returns a string.
|
||||
* @return The time as a short string: 12:34pm
|
||||
* Sets The types of portals that are allowed in this world.
|
||||
*
|
||||
* @param type The type of portals allowed in this world.
|
||||
*/
|
||||
String getTime();
|
||||
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,71 @@
|
|||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import com.onarandombox.MultiverseCore.enums.TeleportResult;
|
||||
|
||||
/**
|
||||
* 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 d Destination to teleport them to
|
||||
* @return true for success, false for failure
|
||||
*/
|
||||
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, MVDestination d);
|
||||
|
||||
/**
|
||||
* 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 e The entity to spawn
|
||||
* @param d The MVDestination to take the entity to.
|
||||
* @return A new location to spawn the entity at.
|
||||
*/
|
||||
Location getSafeLocation(Entity e, MVDestination d);
|
||||
|
||||
/**
|
||||
* 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,10 @@
|
|||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.enums.TeleportResult;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface Teleporter {
|
||||
TeleportResult teleport(CommandSender teleporter, Player teleportee, MVDestination 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 MultiverseWorld}
|
||||
*/
|
||||
void purgeWorlds(List<MultiverseWorld> worlds);
|
||||
|
||||
/**
|
||||
* Convenience method for {@link #purgeWorld(MultiverseWorld, java.util.List, boolean, boolean)} that takes the settings from the world-config.
|
||||
*
|
||||
* @param world The {@link MultiverseWorld}.
|
||||
*/
|
||||
void purgeWorld(MultiverseWorld world);
|
||||
|
||||
/**
|
||||
* Clear all animals/monsters that do not belong to a world according to the config.
|
||||
*
|
||||
* @param mvworld The {@link MultiverseWorld}.
|
||||
* @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(MultiverseWorld 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 MultiverseWorld}.
|
||||
* @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(MultiverseWorld 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(MultiverseWorld w, Entity e);
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
|
|||
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 java.util.ArrayList;
|
||||
|
@ -34,7 +35,11 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "otherthing");
|
||||
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething " + ChatColor.RED + "-d");
|
||||
this.addCommandExample("/mv anchors ");
|
||||
this.setPermission("multiverse.core.anchor", "Allows management of Anchor Destinations.", PermissionDefault.OP);
|
||||
this.setPermission("multiverse.core.anchor.list", "Allows a player to list all anchors.", PermissionDefault.OP);
|
||||
this.addAdditonalPermission(new Permission("multiverse.core.anchor.create",
|
||||
"Allows a player to create anchors.", PermissionDefault.OP));
|
||||
this.addAdditonalPermission(new Permission("multiverse.core.anchor.delete",
|
||||
"Allows a player to delete anchors.", PermissionDefault.OP));
|
||||
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
}
|
||||
|
||||
|
@ -49,6 +54,11 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||
}
|
||||
|
||||
private void showList(CommandSender sender, List<String> args) {
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.list", true)) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have the permission to list anchors!");
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse Anchor List ]====");
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
|
@ -85,6 +95,8 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||
|
||||
if (filterObject.getPage() > totalPages) {
|
||||
filterObject.setPage(totalPages);
|
||||
} else if (filterObject.getPage() < 1) {
|
||||
filterObject.setPage(1);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
|
||||
|
@ -98,11 +110,19 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||
this.showList(sender, args);
|
||||
return;
|
||||
}
|
||||
if (args.size() == 2) {
|
||||
if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!");
|
||||
if (args.size() == 1 && (this.getPageAndFilter(args).getPage() != 1 || args.get(0).equals("1"))) {
|
||||
this.showList(sender, args);
|
||||
return;
|
||||
}
|
||||
if (args.size() == 2 && args.get(1).equalsIgnoreCase("-d")) {
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.delete", true)) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have the permission to delete anchors!");
|
||||
} else {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "deleted!");
|
||||
if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!");
|
||||
} else {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "deleted!");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -111,13 +131,17 @@ public class AnchorCommand extends PaginatedCoreCommand<String> {
|
|||
sender.sendMessage("You must be a player to create Anchors.");
|
||||
return;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!");
|
||||
} else {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "created!");
|
||||
}
|
||||
|
||||
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.create", true)) {
|
||||
sender.sendMessage(ChatColor.RED + "You don't have the permission to create anchors!");
|
||||
} else {
|
||||
Player player = (Player) sender;
|
||||
if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!");
|
||||
} else {
|
||||
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "created!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
|
|||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import com.onarandombox.MultiverseCore.utils.PlayerFinder;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -37,7 +38,7 @@ public class CheckCommand extends MultiverseCommand {
|
|||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Player p = this.plugin.getServer().getPlayer(args.get(0));
|
||||
Player p = PlayerFinder.get(args.get(0), sender);
|
||||
if (p == null) {
|
||||
sender.sendMessage("Could not find player " + ChatColor.GREEN + args.get(0));
|
||||
sender.sendMessage("Are they online?");
|
||||
|
@ -45,18 +46,13 @@ public class CheckCommand extends MultiverseCommand {
|
|||
}
|
||||
MVDestination dest = this.plugin.getDestFactory().getDestination(args.get(1));
|
||||
if (dest instanceof InvalidDestination) {
|
||||
sender.sendMessage("You asked if '" + args.get(0) + "' could go to " + ChatColor.GREEN + args.get(0) + ChatColor.WHITE + ",");
|
||||
sender.sendMessage(String.format("You asked if '%s' could go to %s%s%s,",
|
||||
args.get(0), ChatColor.GREEN, args.get(0), ChatColor.WHITE));
|
||||
sender.sendMessage("but I couldn't find a Destination of that name? Did you type it correctly?");
|
||||
return;
|
||||
}
|
||||
|
||||
MVPermissions perms = this.plugin.getMVPerms();
|
||||
if (perms.canEnterDestination(p, dest)) {
|
||||
sender.sendMessage(ChatColor.GREEN + args.get(0) + ChatColor.WHITE + " can travel to " + ChatColor.GREEN + args.get(1));
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.AQUA + args.get(0) + ChatColor.RED + " CANNOT travel to " + ChatColor.AQUA + args.get(1));
|
||||
sender.sendMessage("Please turn debug mode to 3 then watch the console to find out why!");
|
||||
sender.sendMessage("Use: " + ChatColor.GREEN + "/mv debug 3");
|
||||
}
|
||||
perms.tellMeWhyICantDoThis(sender, p, dest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
|
||||
/**
|
||||
* Creates a clone of a world.
|
||||
*/
|
||||
public class CloneCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
|
||||
public CloneCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Clone World");
|
||||
this.setCommandUsage("/mv clone" + ChatColor.GREEN + " {TARGET} {NAME}" + ChatColor.GOLD + " -g [GENERATOR[:ID]]");
|
||||
this.setArgRange(2, 4); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
this.addKey("mvclone");
|
||||
this.addKey("mvcl");
|
||||
this.addKey("mv cl");
|
||||
this.addKey("mv clone");
|
||||
this.addCommandExample("/mv clone " + ChatColor.GOLD + "world" + ChatColor.GREEN + " world_backup");
|
||||
this.addCommandExample("/mv clone " + ChatColor.GOLD + "skyblock_pristine" + ChatColor.GREEN + " skyblock");
|
||||
this.setPermission("multiverse.core.clone", "Clones a world.", PermissionDefault.OP);
|
||||
this.worldManager = this.plugin.getMVWorldManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
String oldName = args.get(0);
|
||||
if (!this.worldManager.hasUnloadedWorld(oldName, true)) {
|
||||
// If no world was found, we can't clone.
|
||||
sender.sendMessage("Sorry, Multiverse doesn't know about world " + oldName + ", so we can't clone it!");
|
||||
sender.sendMessage("Check the " + ChatColor.GREEN + "/mv list" + ChatColor.WHITE + " command to verify it is listed.");
|
||||
return;
|
||||
}
|
||||
if (this.plugin.getMVWorldManager().cloneWorld(oldName, args.get(1))) {
|
||||
sender.sendMessage(ChatColor.GREEN + "World cloned!");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "World could NOT be cloned!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,12 +8,12 @@
|
|||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.enums.ConfigProperty;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Allows you to set Global MV Variables.
|
||||
|
@ -28,7 +28,6 @@ public class ConfigCommand extends MultiverseCommand {
|
|||
this.addKey("mvconfig");
|
||||
this.addKey("mv conf");
|
||||
this.addKey("mvconf");
|
||||
this.addCommandExample("All values: " + ConfigProperty.getAllValues());
|
||||
this.addCommandExample("/mv config show");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
|
||||
|
@ -38,55 +37,31 @@ public class ConfigCommand extends MultiverseCommand {
|
|||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() <= 1) {
|
||||
String[] allProps = ConfigProperty.getAllValues().split(" ");
|
||||
String currentvals = "";
|
||||
for (String prop : allProps) {
|
||||
currentvals += ChatColor.GREEN;
|
||||
currentvals += prop;
|
||||
currentvals += ChatColor.WHITE;
|
||||
currentvals += " = ";
|
||||
currentvals += ChatColor.GOLD;
|
||||
currentvals += this.plugin.getMVConfiguration().get(prop, "NOT SET");
|
||||
currentvals += ChatColor.WHITE;
|
||||
currentvals += ", ";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Map<String, Object> serializedConfig = this.plugin.getMVConfig().serialize();
|
||||
for (Map.Entry<String, Object> entry : serializedConfig.entrySet()) {
|
||||
builder.append(ChatColor.GREEN);
|
||||
builder.append(entry.getKey());
|
||||
builder.append(ChatColor.WHITE).append(" = ").append(ChatColor.GOLD);
|
||||
builder.append(entry.getValue().toString());
|
||||
builder.append(ChatColor.WHITE).append(", ");
|
||||
}
|
||||
sender.sendMessage(currentvals.substring(0, currentvals.length() - 2));
|
||||
String message = builder.toString();
|
||||
message = message.substring(0, message.length() - 2);
|
||||
sender.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
if (!this.plugin.getMVConfig().setConfigProperty(args.get(0).toLowerCase(), args.get(1))) {
|
||||
sender.sendMessage(String.format("%sSetting '%s' to '%s' failed!", ChatColor.RED, args.get(0).toLowerCase(), args.get(1)));
|
||||
return;
|
||||
}
|
||||
|
||||
// special rule
|
||||
if (args.get(0).equalsIgnoreCase("firstspawnworld")) {
|
||||
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), args.get(1));
|
||||
// Don't forget to set the world!
|
||||
this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
|
||||
} else if (args.get(0).equalsIgnoreCase("messagecooldown") || args.get(0).equalsIgnoreCase("teleportcooldown")
|
||||
|| args.get(0).equalsIgnoreCase("debug")) {
|
||||
try {
|
||||
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), Integer.parseInt(args.get(1)));
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE + " must be an integer!");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ConfigProperty property = null;
|
||||
try {
|
||||
property = ConfigProperty.valueOf(args.get(0).toLowerCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA
|
||||
+ args.get(0) + ChatColor.WHITE + " you can't set " + ChatColor.AQUA + args.get(0));
|
||||
sender.sendMessage(ChatColor.GREEN + "Valid values are:");
|
||||
sender.sendMessage(ConfigProperty.getAllValues());
|
||||
return;
|
||||
}
|
||||
|
||||
if (property != null) {
|
||||
try {
|
||||
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), Boolean.parseBoolean(args.get(1)));
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE + " must be true or false!");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (this.plugin.saveMVConfigs()) {
|
||||
sender.sendMessage(ChatColor.GREEN + "SUCCESS!" + ChatColor.WHITE + " Values were updated successfully!");
|
||||
this.plugin.loadConfigs();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ConfirmCommand extends MultiverseCommand {
|
|||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
this.plugin.getCommandHandler().confirmQueuedCommand(sender);
|
||||
this.plugin.getCommandQueueManager().runQueuedCommand(sender);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ package com.onarandombox.MultiverseCore.commands;
|
|||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
@ -61,9 +60,9 @@ public class CoordCommand extends MultiverseCommand {
|
|||
DecimalFormat df = new DecimalFormat();
|
||||
df.setMinimumFractionDigits(0);
|
||||
df.setMaximumFractionDigits(2);
|
||||
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + LocationManipulation.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())));
|
||||
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + plugin.getLocationManipulation().strCoords(p.getLocation()));
|
||||
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + plugin.getLocationManipulation().getDirection(p.getLocation()));
|
||||
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + world.getBlockAt(p.getLocation()).getType());
|
||||
} else {
|
||||
sender.sendMessage("This command needs to be used from a Player.");
|
||||
}
|
||||
|
|
|
@ -12,11 +12,14 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
|||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -28,8 +31,9 @@ public class CreateCommand extends MultiverseCommand {
|
|||
public CreateCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Create World");
|
||||
this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]] [-n]");
|
||||
this.setArgRange(2, 7); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
this.setCommandUsage(String.format("/mv create %s{NAME} {ENV} %s-s [SEED] -g [GENERATOR[:ID]] -t [WORLDTYPE] [-n] -a [true|false]",
|
||||
ChatColor.GREEN, ChatColor.GOLD));
|
||||
this.setArgRange(2, 11); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
this.addKey("mvcreate");
|
||||
this.addKey("mvc");
|
||||
this.addKey("mv create");
|
||||
|
@ -37,43 +41,91 @@ public class CreateCommand extends MultiverseCommand {
|
|||
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 + " end");
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "flatroom" + ChatColor.GREEN + " normal" + ChatColor.AQUA + " -t flat");
|
||||
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");
|
||||
this.worldManager = this.plugin.getMVWorldManager();
|
||||
}
|
||||
|
||||
|
||||
private String trimWorldName(String userInput) {
|
||||
// Removes relative paths.
|
||||
return userInput.replaceAll("^[./\\\\]+", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
String worldName = args.get(0);
|
||||
String worldName = trimWorldName(args.get(0));
|
||||
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
|
||||
String env = args.get(1);
|
||||
String seed = CommandHandler.getFlag("-s", args);
|
||||
String generator = CommandHandler.getFlag("-g", args);
|
||||
boolean allowStructures = true;
|
||||
String structureString = CommandHandler.getFlag("-a", args);
|
||||
if (structureString != null) {
|
||||
allowStructures = Boolean.parseBoolean(structureString);
|
||||
}
|
||||
String typeString = CommandHandler.getFlag("-t", args);
|
||||
boolean useSpawnAdjust = true;
|
||||
for (String s : args) {
|
||||
if (s.equalsIgnoreCase("-n")) {
|
||||
useSpawnAdjust = false;
|
||||
}
|
||||
}
|
||||
if (worldFile.exists() || this.worldManager.isMVWorld(worldName)) {
|
||||
|
||||
// Make sure the world name doesn't contain the words 'plugins' and '.dat'
|
||||
if(worldName.contains("plugins")||worldName.contains(".dat")){
|
||||
sender.sendMessage(ChatColor.RED + "Multiverse cannot create a world that contains 'plugins' or '.dat'");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.worldManager.isMVWorld(worldName)) {
|
||||
sender.sendMessage(ChatColor.RED + "Multiverse cannot create " + ChatColor.GOLD + ChatColor.UNDERLINE
|
||||
+ "another" + ChatColor.RESET + ChatColor.RED + " world named " + worldName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldFile.exists()) {
|
||||
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;
|
||||
}
|
||||
|
||||
Environment environment = this.plugin.getEnvFromString(env);
|
||||
Environment environment = EnvironmentCommand.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
// If they didn't specify a type, default to NORMAL
|
||||
if (typeString == null) {
|
||||
typeString = "NORMAL";
|
||||
}
|
||||
WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString);
|
||||
if (type == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid World Type.");
|
||||
EnvironmentCommand.showWorldTypes(sender);
|
||||
return;
|
||||
}
|
||||
// Determine if the generator is valid. #918
|
||||
if (generator != null) {
|
||||
List<String> genarray = new ArrayList<String>(Arrays.asList(generator.split(":")));
|
||||
if (genarray.size() < 2) {
|
||||
// If there was only one arg specified, pad with another empty one.
|
||||
genarray.add("");
|
||||
}
|
||||
if (this.worldManager.getChunkGenerator(genarray.get(0), genarray.get(1), "test") == null) {
|
||||
// We have an invalid generator.
|
||||
sender.sendMessage("Invalid generator! '" + generator + "'. " + ChatColor.RED + "Aborting world creation.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'...");
|
||||
|
||||
if (this.worldManager.addWorld(worldName, environment, seed, generator, useSpawnAdjust)) {
|
||||
if (this.worldManager.addWorld(worldName, environment, seed, type, allowStructures, generator, useSpawnAdjust)) {
|
||||
Command.broadcastCommandMessage(sender, "Complete!");
|
||||
} else {
|
||||
Command.broadcastCommandMessage(sender, "FAILED.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -23,7 +24,7 @@ public class DebugCommand extends MultiverseCommand {
|
|||
public DebugCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Turn Debug on/off?");
|
||||
this.setCommandUsage("/mv debug" + ChatColor.GOLD + " [1|2|3|off]");
|
||||
this.setCommandUsage("/mv debug" + ChatColor.GOLD + " [1|2|3|off|silent]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv debug");
|
||||
this.addKey("mv d");
|
||||
|
@ -36,30 +37,31 @@ public class DebugCommand extends MultiverseCommand {
|
|||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() == 1) {
|
||||
if (args.get(0).equalsIgnoreCase("off")) {
|
||||
MultiverseCore.GlobalDebug = 0;
|
||||
plugin.getMVConfig().setGlobalDebug(0);
|
||||
} else {
|
||||
try {
|
||||
int debugLevel = Integer.parseInt(args.get(0));
|
||||
if (debugLevel > 3 || debugLevel < 0) {
|
||||
throw new NumberFormatException();
|
||||
}
|
||||
MultiverseCore.GlobalDebug = debugLevel;
|
||||
plugin.getMVConfig().setGlobalDebug(debugLevel);
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Error" + ChatColor.WHITE
|
||||
+ " setting debug level. Please use a number 0-3 " + ChatColor.AQUA + "(3 being many many messages!)");
|
||||
}
|
||||
|
||||
}
|
||||
plugin.saveMVConfigs();
|
||||
}
|
||||
this.displayDebugMode(sender);
|
||||
}
|
||||
|
||||
private void displayDebugMode(CommandSender sender) {
|
||||
if (MultiverseCore.GlobalDebug == 0) {
|
||||
final int debugLevel = plugin.getMVConfig().getGlobalDebug();
|
||||
if (debugLevel == 0) {
|
||||
sender.sendMessage("Multiverse Debug mode is " + ChatColor.RED + "OFF");
|
||||
} else {
|
||||
sender.sendMessage("Multiverse Debug mode is " + ChatColor.GREEN + MultiverseCore.GlobalDebug);
|
||||
this.plugin.log(Level.FINE, "Multiverse Debug ENABLED");
|
||||
sender.sendMessage("Multiverse Debug mode is " + ChatColor.GREEN + debugLevel);
|
||||
Logging.fine("Multiverse Debug ENABLED");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -27,15 +29,32 @@ public class DeleteCommand extends MultiverseCommand {
|
|||
this.setArgRange(1, 1);
|
||||
this.addKey("mvdelete");
|
||||
this.addKey("mv delete");
|
||||
this.addCommandExample("/mv create " + ChatColor.GOLD + "MyWorld");
|
||||
this.addCommandExample("/mv delete " + ChatColor.GOLD + "MyWorld");
|
||||
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!");
|
||||
String worldName = args.get(0);
|
||||
|
||||
this.plugin.getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||
sender,
|
||||
deleteRunnable(sender, worldName),
|
||||
String.format("Are you sure you want to delete world '%s'? You cannot undo this action.", worldName)
|
||||
));
|
||||
}
|
||||
|
||||
private Runnable deleteRunnable(@NotNull CommandSender sender,
|
||||
@NotNull String worldName) {
|
||||
|
||||
return () -> {
|
||||
sender.sendMessage(String.format("Deleting world '%s'...", worldName));
|
||||
if (this.plugin.getMVWorldManager().deleteWorld(worldName)) {
|
||||
sender.sendMessage(String.format("%sWorld %s was deleted!", ChatColor.GREEN, worldName));
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(String.format("%sThere was an issue deleting '%s'! Please check console for errors.",
|
||||
ChatColor.RED, worldName));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ package com.onarandombox.MultiverseCore.commands;
|
|||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
|
@ -26,10 +28,11 @@ public class EnvironmentCommand extends MultiverseCommand {
|
|||
this.setArgRange(0, 0);
|
||||
this.addKey("mvenv");
|
||||
this.addKey("mv env");
|
||||
this.addKey("mv type");
|
||||
this.addKey("mv environment");
|
||||
this.addKey("mv environments");
|
||||
this.addCommandExample("/mv env");
|
||||
this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
|
||||
this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,9 +46,73 @@ public class EnvironmentCommand extends MultiverseCommand {
|
|||
sender.sendMessage(ChatColor.RED + "NETHER");
|
||||
sender.sendMessage(ChatColor.AQUA + "END");
|
||||
}
|
||||
/**
|
||||
* Shows all valid known world types to a {@link CommandSender}.
|
||||
*
|
||||
* @param sender The {@link CommandSender}.
|
||||
*/
|
||||
public static void showWorldTypes(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Valid World Types are:");
|
||||
sender.sendMessage(String.format("%sNORMAL%s, %sFLAT, %sLARGEBIOMES %sor %sVERSION_1_1",
|
||||
ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, ChatColor.RED, ChatColor.WHITE, ChatColor.GOLD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
EnvironmentCommand.showWorldTypes(sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link String} into a {@link WorldType}.
|
||||
*
|
||||
* @param type The WorldType as a {@link String}
|
||||
* @return The WorldType as a {@link WorldType}
|
||||
*/
|
||||
public static WorldType getWorldTypeFromString(String type) {
|
||||
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
|
||||
if (type.equalsIgnoreCase("normal")) {
|
||||
type = "NORMAL";
|
||||
} else if (type.equalsIgnoreCase("flat")) {
|
||||
type = "FLAT";
|
||||
} else if (type.equalsIgnoreCase("largebiomes")) {
|
||||
type = "LARGE_BIOMES";
|
||||
} else if (type.equalsIgnoreCase("amplified")) {
|
||||
type = "AMPLIFIED";
|
||||
}
|
||||
try {
|
||||
// Now that we've converted a potentially unfriendly value
|
||||
// to a friendly one, get it from the ENUM!
|
||||
return WorldType.valueOf(type);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link String} into an {@link org.bukkit.World.Environment}.
|
||||
*
|
||||
* @param env The environment as {@link String}
|
||||
* @return The environment as {@link org.bukkit.World.Environment}
|
||||
*/
|
||||
public static World.Environment getEnvFromString(String env) {
|
||||
env = env.toUpperCase();
|
||||
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
|
||||
if (env.equalsIgnoreCase("HELL") || env.equalsIgnoreCase("NETHER"))
|
||||
env = "NETHER";
|
||||
|
||||
if (env.equalsIgnoreCase("END") || env.equalsIgnoreCase("THEEND") || env.equalsIgnoreCase("STARWARS"))
|
||||
env = "THE_END";
|
||||
|
||||
if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD"))
|
||||
env = "NORMAL";
|
||||
|
||||
try {
|
||||
// Now that we've converted a potentially unfriendly value
|
||||
// to a friendly one, get it from the ENUM!
|
||||
return World.Environment.valueOf(env);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Allows management of Anchor Destinations.
|
||||
*/
|
||||
public class GameruleCommand extends MultiverseCommand {
|
||||
|
||||
public GameruleCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Set a Minecraft Game Rule for a World.");
|
||||
this.setCommandUsage("/mv gamerule " + ChatColor.GREEN + "{RULE} {VALUE}" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setArgRange(2, 3);
|
||||
this.addKey("mv gamerule");
|
||||
this.addKey("mv rule");
|
||||
this.addKey("mvgamerule");
|
||||
this.addKey("mvrule");
|
||||
this.addCommandExample("/mv gamerule " + ChatColor.GREEN + "doMobLoot false");
|
||||
this.addCommandExample("/mvrule " + ChatColor.GREEN + "keepInventory true " + ChatColor.RED + "world_nether");
|
||||
this.setPermission("multiverse.core.gamerule.set", "Allows a player to set a gamerule.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// We NEED a world from the command line
|
||||
final Player p;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
} else {
|
||||
p = null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
final GameRule gameRule = GameRule.getByName(args.get(0));
|
||||
final String value = args.get(1);
|
||||
final World world;
|
||||
if (args.size() == 2) {
|
||||
world = p.getWorld();
|
||||
} else {
|
||||
world = Bukkit.getWorld(args.get(2));
|
||||
if (world == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " World " + ChatColor.AQUA + args.get(2)
|
||||
+ ChatColor.WHITE + " does not exist.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gameRule == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Failure! " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE
|
||||
+ " is not a valid gamerule.");
|
||||
} else {
|
||||
if (gameRule.getType() == Boolean.class) {
|
||||
boolean booleanValue;
|
||||
if (value.equalsIgnoreCase("true")) {
|
||||
booleanValue = true;
|
||||
} else if (value.equalsIgnoreCase("false")) {
|
||||
booleanValue = false;
|
||||
} else {
|
||||
sender.sendMessage(getErrorMessage(gameRule.getName(), value) + "it can only be set to true or false.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!world.setGameRule(gameRule, booleanValue)) {
|
||||
sender.sendMessage(getErrorMessage(gameRule.getName(), value) + "something went wrong.");
|
||||
return;
|
||||
}
|
||||
} else if (gameRule.getType() == Integer.class) {
|
||||
try {
|
||||
if (!world.setGameRule(gameRule, Integer.parseInt(value))) {
|
||||
throw new NumberFormatException();
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(getErrorMessage(gameRule.getName(), value) + "it can only be set to a positive integer.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " Gamerule " + ChatColor.AQUA + gameRule.getName()
|
||||
+ ChatColor.WHITE + " isn't supported yet, please let us know about it.");
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Gamerule " + ChatColor.AQUA + gameRule.getName()
|
||||
+ ChatColor.WHITE + " was set to " + ChatColor.GREEN + value + ChatColor.WHITE + ".");
|
||||
}
|
||||
}
|
||||
|
||||
private String getErrorMessage(String gameRule, String value) {
|
||||
return ChatColor.RED + "Failure!" + ChatColor.WHITE + " Gamerule " + ChatColor.AQUA + gameRule
|
||||
+ ChatColor.WHITE + " could not be set to " + ChatColor.RED + value + ChatColor.WHITE + ", ";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.display.ColorAlternator;
|
||||
import com.onarandombox.MultiverseCore.display.ContentDisplay;
|
||||
import com.onarandombox.MultiverseCore.display.settings.MapDisplaySettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Allows management of Anchor Destinations.
|
||||
*/
|
||||
public class GamerulesCommand extends MultiverseCommand {
|
||||
|
||||
public GamerulesCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("List the Minecraft Game Rules for a World.");
|
||||
this.setCommandUsage("/mv gamerules" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv gamerules");
|
||||
this.addKey("mv rules");
|
||||
this.addKey("mvgamerules");
|
||||
this.addKey("mvrules");
|
||||
this.addCommandExample("/mv gamerules");
|
||||
this.addCommandExample("/mvrules " + ChatColor.RED + "world_nether");
|
||||
this.setPermission("multiverse.core.gamerule.list", "Allows a player to list gamerules.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// We NEED a world from the command line
|
||||
final Player p;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
} else {
|
||||
p = null;
|
||||
}
|
||||
|
||||
if (args.size() == 0 && p == null) {
|
||||
sender.sendMessage("From the command line, WORLD is required.");
|
||||
sender.sendMessage(this.getCommandDesc());
|
||||
sender.sendMessage(this.getCommandUsage());
|
||||
sender.sendMessage("Nothing changed.");
|
||||
return;
|
||||
}
|
||||
|
||||
final World world;
|
||||
if (args.size() == 0) {
|
||||
world = p.getWorld();
|
||||
} else {
|
||||
world = Bukkit.getWorld(args.get(0));
|
||||
if (world == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " World " + ChatColor.AQUA + args.get(0)
|
||||
+ ChatColor.WHITE + " does not exist.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ContentDisplay.forContent(getGameRuleMap(world))
|
||||
.header("=== Gamerules for %s%s%s ===", ChatColor.AQUA, world.getName(), ChatColor.WHITE)
|
||||
.colorTool(ColorAlternator.with(ChatColor.GREEN, ChatColor.GOLD))
|
||||
.setting(MapDisplaySettings.OPERATOR, ": ")
|
||||
.show(sender);
|
||||
}
|
||||
|
||||
private Map<String, Object> getGameRuleMap(World world) {
|
||||
Map<String, Object> gameRuleMap = new HashMap<>();
|
||||
for (GameRule<?> rule : GameRule.values()) {
|
||||
Object value = world.getGameRuleValue(rule);
|
||||
if (value == null) {
|
||||
gameRuleMap.put(rule.getName(), "null");
|
||||
continue;
|
||||
}
|
||||
gameRuleMap.put(rule.getName(), value);
|
||||
}
|
||||
return gameRuleMap;
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -15,7 +16,6 @@ import org.bukkit.plugin.Plugin;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Returns a list of loaded generator plugins.
|
||||
|
@ -37,7 +37,7 @@ public class GeneratorCommand extends MultiverseCommand {
|
|||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
this.plugin.log(Level.INFO, "PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
|
||||
Logging.info("PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
|
||||
Plugin[] plugins = this.plugin.getServer().getPluginManager().getPlugins();
|
||||
List<String> generators = new ArrayList<String>();
|
||||
for (Plugin p : plugins) {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
// TODO maybe remove this comment...?
|
||||
// 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 com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -42,24 +40,16 @@ public class HelpCommand extends PaginatedCoreCommand<Command> {
|
|||
|
||||
@Override
|
||||
protected List<Command> getFilteredItems(List<Command> availableItems, String filter) {
|
||||
String expression = "(?i).*" + cleanFilter(filter) + ".*";
|
||||
List<Command> filtered = new ArrayList<Command>();
|
||||
|
||||
for (Command c : availableItems) {
|
||||
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
|
||||
if (stitchThisString(c.getKeyStrings()).matches(expression)
|
||||
|| c.getCommandName().matches(expression)
|
||||
|| c.getCommandDesc().matches(expression)
|
||||
|| c.getCommandUsage().matches(expression)
|
||||
|| c.getCommandExamples().stream().anyMatch(eg -> eg.matches(expression))) {
|
||||
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);
|
||||
} else {
|
||||
for (String example : c.getCommandExamples()) {
|
||||
if (example.matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
|
|
|
@ -9,7 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
|
|||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldNameChecker;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
|
@ -18,8 +18,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -32,75 +30,43 @@ public class ImportCommand extends MultiverseCommand {
|
|||
public ImportCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Import World");
|
||||
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + " -g [GENERATOR[:ID]] [-n]");
|
||||
this.setArgRange(1, 3);
|
||||
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -g [GENERATOR[:ID]] [-n]");
|
||||
this.setArgRange(1, 5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
this.addKey("mvimport");
|
||||
this.addKey("mvim");
|
||||
this.addKey("mv import");
|
||||
this.addCommandExample("/mv import " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal");
|
||||
this.addCommandExample("/mv import " + ChatColor.GOLD + "hell_world" + ChatColor.GREEN + " nether");
|
||||
this.addCommandExample("To import a world that uses a generator, you'll need the generator:");
|
||||
this.addCommandExample("/mv import " + ChatColor.GOLD + "CleanRoom" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " CleanRoomGenerator");
|
||||
this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.OP);
|
||||
this.worldManager = this.plugin.getMVWorldManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* A very basic check to see if a folder has a level.dat file.
|
||||
* If it does, we can safely assume it's a world folder.
|
||||
*
|
||||
* @param worldFolder The File that may be a world.
|
||||
* @return True if it looks like a world, false if not.
|
||||
*/
|
||||
private boolean checkIfIsWorld(File worldFolder) {
|
||||
if (worldFolder.isDirectory()) {
|
||||
File[] files = worldFolder.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File file, String name) {
|
||||
return name.equalsIgnoreCase("level.dat");
|
||||
}
|
||||
});
|
||||
if (files != null && files.length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getPotentialWorlds() {
|
||||
File worldFolder = this.plugin.getServer().getWorldContainer();
|
||||
if (worldFolder == null) {
|
||||
return "";
|
||||
}
|
||||
File[] files = worldFolder.listFiles();
|
||||
String worldList = "";
|
||||
Collection<MultiverseWorld> worlds = this.worldManager.getMVWorlds();
|
||||
List<String> worldStrings = new ArrayList<String>();
|
||||
for (MultiverseWorld world : worlds) {
|
||||
worldStrings.add(world.getName());
|
||||
}
|
||||
for (String world : this.worldManager.getUnloadedWorlds()) {
|
||||
worldStrings.add(world);
|
||||
}
|
||||
private String getPotentialWorldStrings() {
|
||||
final Collection<String> potentialWorlds = this.worldManager.getPotentialWorlds();
|
||||
StringBuilder worldList = new StringBuilder();
|
||||
ChatColor currColor = ChatColor.WHITE;
|
||||
for (File file : files) {
|
||||
if (file.isDirectory() && checkIfIsWorld(file) && !worldStrings.contains(file.getName())) {
|
||||
worldList += currColor + file.getName() + " ";
|
||||
if (currColor == ChatColor.WHITE) {
|
||||
currColor = ChatColor.YELLOW;
|
||||
} else {
|
||||
currColor = ChatColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
for (String world : potentialWorlds) {
|
||||
worldList.append(currColor).append(world).append(' ');
|
||||
currColor = currColor == ChatColor.WHITE ? ChatColor.YELLOW : ChatColor.WHITE;
|
||||
}
|
||||
return worldList;
|
||||
|
||||
return worldList.toString();
|
||||
}
|
||||
|
||||
private String trimWorldName(String userInput) {
|
||||
// Removes relative paths.
|
||||
return userInput.replaceAll("^[./\\\\]+", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
String worldName = args.get(0);
|
||||
String worldName = trimWorldName(args.get(0));
|
||||
|
||||
if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
|
||||
String worldList = this.getPotentialWorlds();
|
||||
String worldList = this.getPotentialWorldStrings();
|
||||
if (worldList.length() > 2) {
|
||||
sender.sendMessage(ChatColor.AQUA + "====[ These look like worlds ]====");
|
||||
sender.sendMessage(worldList);
|
||||
|
@ -111,10 +77,16 @@ public class ImportCommand extends MultiverseCommand {
|
|||
}
|
||||
// Since we made an exception for the list, we have to make sure they have at least 2 params:
|
||||
// Note the exception is --list, which is covered above.
|
||||
if (args.size() == 1) {
|
||||
if (args.size() == 1 || worldName.length() < 1) {
|
||||
this.showHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the world name doesn't contain the words 'plugins' and '.dat'
|
||||
if(worldName.contains("plugins")||worldName.contains(".dat")){
|
||||
sender.sendMessage(ChatColor.RED + "Multiverse cannot create a world that contains 'plugins' or '.dat'");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure we don't already know about this world.
|
||||
if (this.worldManager.isMVWorld(worldName)) {
|
||||
|
@ -134,28 +106,32 @@ public class ImportCommand extends MultiverseCommand {
|
|||
}
|
||||
|
||||
String env = args.get(1);
|
||||
Environment environment = this.plugin.getEnvFromString(env);
|
||||
Environment environment = EnvironmentCommand.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldFile.exists() && env != null) {
|
||||
Command.broadcastCommandMessage(sender, "Starting import of world '" + worldName + "'...");
|
||||
if (this.worldManager.addWorld(worldName, environment, null, generator, useSpawnAdjust))
|
||||
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Complete!");
|
||||
else
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!");
|
||||
if (!worldFile.exists()) {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
String worldList = this.getPotentialWorldStrings();
|
||||
sender.sendMessage("That world folder does not exist. These look like worlds to me:");
|
||||
sender.sendMessage(worldList);
|
||||
} else if (!WorldNameChecker.isValidWorldFolder(worldFile)) {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
sender.sendMessage(String.format("'%s' does not appear to be a world. It is lacking a .dat file.",
|
||||
worldName));
|
||||
} else if (env == null) {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
sender.sendMessage("That world environment did not exist.");
|
||||
sender.sendMessage("For a list of available world types, type: " + ChatColor.AQUA + "/mvenv");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
String worldList = this.getPotentialWorlds();
|
||||
sender.sendMessage("That world folder does not exist. These look like worlds to me:");
|
||||
sender.sendMessage(worldList);
|
||||
Command.broadcastCommandMessage(sender, String.format("Starting import of world '%s'...", worldName));
|
||||
if (this.worldManager.addWorld(worldName, environment, null, null, null, generator, useSpawnAdjust))
|
||||
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Complete!");
|
||||
else
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
|||
import com.onarandombox.MultiverseCore.utils.FancyColorScheme;
|
||||
import com.onarandombox.MultiverseCore.utils.FancyHeader;
|
||||
import com.onarandombox.MultiverseCore.utils.FancyMessage;
|
||||
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -62,9 +61,13 @@ public class InfoCommand extends MultiverseCommand {
|
|||
return;
|
||||
}
|
||||
} else if (args.size() == 1) {
|
||||
if (this.worldManager.getMVWorld(args.get(0)) != null) {
|
||||
if (this.worldManager.isMVWorld(args.get(0))) {
|
||||
// then we have a world!
|
||||
worldName = args.get(0);
|
||||
} else if (this.worldManager.getUnloadedWorlds().contains(args.get(0))) {
|
||||
sender.sendMessage("That world exists, but it is unloaded!");
|
||||
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, args.get(0)));
|
||||
return;
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
|
@ -72,7 +75,8 @@ public class InfoCommand extends MultiverseCommand {
|
|||
try {
|
||||
pageNum = Integer.parseInt(args.get(0)) - 1;
|
||||
} catch (NumberFormatException e) {
|
||||
pageNum = 0;
|
||||
sender.sendMessage("That world does not exist.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
|
||||
|
@ -94,8 +98,11 @@ public class InfoCommand extends MultiverseCommand {
|
|||
p = (Player) sender;
|
||||
}
|
||||
showPage(pageNum, sender, this.buildEntireCommand(this.worldManager.getMVWorld(worldName), p));
|
||||
} else if (this.worldManager.getUnloadedWorlds().contains(worldName)) {
|
||||
sender.sendMessage("That world exists, but it is unloaded!");
|
||||
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, worldName));
|
||||
} else if (this.plugin.getServer().getWorld(worldName) != null) {
|
||||
sender.sendMessage("That world exists, but multiverse does not know about it!");
|
||||
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");
|
||||
}
|
||||
|
@ -108,15 +115,24 @@ public class InfoCommand extends MultiverseCommand {
|
|||
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 UID: ", world.getCBWorld().getUID().toString(), colors));
|
||||
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
|
||||
message.add(new FancyMessage("Game Mode: ", world.getGameMode().toString(), colors));
|
||||
message.add(new FancyMessage("Difficulty: ", world.getDifficulty().toString(), colors));
|
||||
|
||||
//message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors));
|
||||
Location spawn = world.getSpawnLocation();
|
||||
message.add(new FancyMessage("Spawn Location: ", LocationManipulation.strCoords(spawn), colors));
|
||||
message.add(new FancyMessage("World Scale: ", world.getScaling() + "", colors));
|
||||
message.add(new FancyMessage("Spawn Location: ", plugin.getLocationManipulation().strCoords(spawn), colors));
|
||||
message.add(new FancyMessage("World Scale: ", String.valueOf(world.getScaling()), colors));
|
||||
message.add(new FancyMessage("World Seed: ", String.valueOf(world.getSeed()), colors));
|
||||
if (world.getPrice() > 0) {
|
||||
message.add(new FancyMessage("Price to enter this world: ",
|
||||
this.plugin.getBank().getFormattedAmount(p, world.getPrice(), world.getCurrency()), colors));
|
||||
plugin.getEconomist().formatPrice(world.getPrice(), world.getCurrency()),
|
||||
colors));
|
||||
} else if (world.getPrice() < 0) {
|
||||
message.add(new FancyMessage("Reward for entering this world: ",
|
||||
plugin.getEconomist().formatPrice(-world.getPrice(), world.getCurrency()),
|
||||
colors));
|
||||
} else {
|
||||
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
|
||||
}
|
||||
|
@ -135,7 +151,9 @@ public class InfoCommand extends MultiverseCommand {
|
|||
// Page 2
|
||||
message = new ArrayList<FancyText>();
|
||||
message.add(new FancyHeader("More World Settings", colors));
|
||||
message.add(new FancyMessage("Difficulty: ", world.getDifficulty().toString(), colors));
|
||||
message.add(new FancyMessage("World Type: ", world.getWorldType().toString(), colors));
|
||||
message.add(new FancyMessage("Generator: ", world.getGenerator(), colors));
|
||||
message.add(new FancyMessage("Structures: ", world.getCBWorld().canGenerateStructures() + "", colors));
|
||||
message.add(new FancyMessage("Weather: ", world.isWeatherEnabled() + "", colors));
|
||||
message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
|
||||
message.add(new FancyMessage("Keep spawn in memory: ", world.isKeepingSpawnInMemory() + "", colors));
|
||||
|
@ -165,8 +183,8 @@ public class InfoCommand extends MultiverseCommand {
|
|||
message.add(new FancyHeader("Animal Settings", colors));
|
||||
message.add(new FancyMessage("Multiverse Setting: ", world.canAnimalsSpawn() + "", colors));
|
||||
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
|
||||
if (world.getMonsterList().size() > 0) {
|
||||
if (world.canMonstersSpawn()) {
|
||||
if (world.getAnimalList().size() > 0) {
|
||||
if (world.canAnimalsSpawn()) {
|
||||
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT "
|
||||
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
|
||||
} else {
|
||||
|
@ -180,7 +198,7 @@ public class InfoCommand extends MultiverseCommand {
|
|||
return worldInfo;
|
||||
}
|
||||
|
||||
private String toCommaSeperated(List<String> list) {
|
||||
private static String toCommaSeperated(List<String> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
|
@ -206,7 +224,7 @@ public class InfoCommand extends MultiverseCommand {
|
|||
return positive ? ChatColor.GREEN : ChatColor.RED;
|
||||
}
|
||||
|
||||
private void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
|
||||
private static 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;
|
||||
|
|
|
@ -9,120 +9,111 @@ package com.onarandombox.MultiverseCore.commands;
|
|||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.display.ColorAlternator;
|
||||
import com.onarandombox.MultiverseCore.display.ContentDisplay;
|
||||
import com.onarandombox.MultiverseCore.display.ContentFilter;
|
||||
import com.onarandombox.MultiverseCore.display.DisplayHandlers;
|
||||
import com.onarandombox.MultiverseCore.display.settings.PagedDisplaySettings;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Displays a listing of all worlds that a player can enter.
|
||||
*/
|
||||
public class ListCommand extends PaginatedCoreCommand<String> {
|
||||
public class ListCommand extends MultiverseCommand {
|
||||
|
||||
public ListCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("World Listing");
|
||||
this.setCommandUsage("/mv list");
|
||||
this.setCommandUsage("/mv list [filter] [page]");
|
||||
this.setArgRange(0, 2);
|
||||
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);
|
||||
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
}
|
||||
|
||||
private List<String> getFancyWorldList(Player p) {
|
||||
List<String> worldList = new ArrayList<String>();
|
||||
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
|
||||
|
||||
if (p != null && (!this.plugin.getMVPerms().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.THE_END) {
|
||||
color = ChatColor.AQUA;
|
||||
}
|
||||
String outputCache = world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment();
|
||||
if (world.isHidden()) {
|
||||
if (p == null || p.hasPermission("multiverse.core.modify")) {
|
||||
// Prefix hidden worlds with an "[H]"
|
||||
worldList.add(ChatColor.GRAY + "[H]" + outputCache);
|
||||
}
|
||||
} else {
|
||||
worldList.add(outputCache);
|
||||
}
|
||||
}
|
||||
for (String name : this.plugin.getMVWorldManager().getUnloadedWorlds()) {
|
||||
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.access." + name, true)) {
|
||||
worldList.add(ChatColor.GRAY + name + " - UNLOADED");
|
||||
}
|
||||
}
|
||||
return worldList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getFilteredItems(List<String> availableItems, String filter) {
|
||||
List<String> filtered = new ArrayList<String>();
|
||||
|
||||
for (String s : availableItems) {
|
||||
if (s.matches("(?i).*" + filter + ".*")) {
|
||||
filtered.add(s);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getItemText(String item) {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse World List ]====");
|
||||
Player p = null;
|
||||
if (sender instanceof Player) {
|
||||
p = (Player) sender;
|
||||
}
|
||||
ContentFilter filter = ContentFilter.DEFAULT;
|
||||
int page = 1;
|
||||
|
||||
|
||||
FilterObject filterObject = this.getPageAndFilter(args);
|
||||
|
||||
List<String> availableWorlds = new ArrayList<String>(this.getFancyWorldList(p));
|
||||
if (filterObject.getFilter().length() > 0) {
|
||||
availableWorlds = this.getFilteredItems(availableWorlds, filterObject.getFilter());
|
||||
if (availableWorlds.size() == 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
|
||||
+ "No worlds matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
|
||||
return;
|
||||
// Either page or filter.
|
||||
if (args.size() == 1) {
|
||||
try {
|
||||
page = Integer.parseInt(args.get(0));
|
||||
} catch (NumberFormatException ignore) {
|
||||
filter = new ContentFilter(args.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
for (String c : availableWorlds) {
|
||||
sender.sendMessage(c);
|
||||
// Filter then page.
|
||||
if (args.size() == 2) {
|
||||
filter = new ContentFilter(args.get(0));
|
||||
try {
|
||||
page = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException ignore) {
|
||||
sender.sendMessage(ChatColor.RED + args.get(1) + " is not valid number!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.itemsPerPage + 0.0));
|
||||
ContentDisplay.forContent(getListContents(sender))
|
||||
.header("%s====[ Multiverse World List ]====", ChatColor.GOLD)
|
||||
.displayHandler(DisplayHandlers.PAGE_LIST)
|
||||
.colorTool(ColorAlternator.with(ChatColor.AQUA, ChatColor.GOLD))
|
||||
.filter(filter)
|
||||
.setting(PagedDisplaySettings.SHOW_PAGE, page)
|
||||
.show(sender);
|
||||
}
|
||||
|
||||
if (filterObject.getPage() > totalPages) {
|
||||
filterObject.setPage(totalPages);
|
||||
private Collection<String> getListContents(@NotNull CommandSender sender) {
|
||||
Player player = (sender instanceof Player) ? (Player) sender : null;
|
||||
|
||||
List<String> worldList = this.plugin.getMVWorldManager().getMVWorlds().stream()
|
||||
.filter(world -> player == null || plugin.getMVPerms().canEnterWorld(player, world))
|
||||
.filter(world -> canSeeWorld(player, world))
|
||||
.map(world -> hiddenText(world) + world.getColoredWorldString() + " - " + parseColouredEnvironment(world.getEnvironment()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
this.plugin.getMVWorldManager().getUnloadedWorlds().stream()
|
||||
.filter(world -> plugin.getMVPerms().hasPermission(sender, "multiverse.access." + world, true))
|
||||
.map(world -> ChatColor.GRAY + world + " - UNLOADED")
|
||||
.forEach(worldList::add);
|
||||
|
||||
return worldList;
|
||||
}
|
||||
|
||||
private boolean canSeeWorld(Player player, MultiverseWorld world) {
|
||||
return !world.isHidden()
|
||||
|| player == null
|
||||
|| this.plugin.getMVPerms().hasPermission(player, "multiverse.core.modify", true);
|
||||
}
|
||||
|
||||
private String hiddenText(MultiverseWorld world) {
|
||||
return (world.isHidden()) ? String.format("%s[H] ", ChatColor.GRAY) : "";
|
||||
}
|
||||
|
||||
private String parseColouredEnvironment(World.Environment env) {
|
||||
ChatColor color = ChatColor.GOLD;
|
||||
switch (env) {
|
||||
case NETHER:
|
||||
color = ChatColor.RED;
|
||||
break;
|
||||
case NORMAL:
|
||||
color = ChatColor.GREEN;
|
||||
break;
|
||||
case THE_END:
|
||||
color = ChatColor.AQUA;
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
|
||||
|
||||
this.showPage(filterObject.getPage(), sender, availableWorlds);
|
||||
return color + env.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,13 +77,17 @@ public class ModifyAddCommand extends MultiverseCommand {
|
|||
|
||||
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");
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: https://goo.gl/OMGwzx");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO fix this
|
||||
if (world.addToVariable(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA
|
||||
+ value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
|
||||
if (!plugin.saveWorldConfig()) {
|
||||
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(value + " could not be added to " + property);
|
||||
}
|
||||
|
|
|
@ -72,13 +72,17 @@ public class ModifyClearCommand extends MultiverseCommand {
|
|||
|
||||
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");
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: https://goo.gl/q1h01S");
|
||||
return;
|
||||
}
|
||||
// TODO fix this
|
||||
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.");
|
||||
if (!plugin.saveWorldConfig()) {
|
||||
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property
|
||||
+ ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
|
||||
|
|
|
@ -78,12 +78,16 @@ public class ModifyRemoveCommand extends MultiverseCommand {
|
|||
|
||||
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");
|
||||
sender.sendMessage("Please visit our Github Wiki for more information: https://goo.gl/OMGwzx");
|
||||
return;
|
||||
}
|
||||
// TODO fix this
|
||||
if (world.removeFromVariable(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE
|
||||
+ " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
|
||||
if (!plugin.saveWorldConfig()) {
|
||||
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY
|
||||
+ value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
|
||||
|
|
|
@ -102,22 +102,24 @@ public class ModifySetCommand extends MultiverseCommand {
|
|||
return;
|
||||
}
|
||||
|
||||
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
|
||||
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !EnglishChatColor.isValidAliasColor(value)) {
|
||||
sender.sendMessage(value + " is not a valid color. Please pick one of the following:");
|
||||
sender.sendMessage(EnglishChatColor.getAllColors());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (world.setProperty(property, value, sender)) {
|
||||
if (world.setPropertyValue(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property
|
||||
+ ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
|
||||
if (!plugin.saveWorldConfig()) {
|
||||
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(world.getProperty(property, Object.class).getHelp());
|
||||
sender.sendMessage(ChatColor.RED + world.getPropertyHelp(property));
|
||||
}
|
||||
} catch (PropertyDoesNotExistException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry, You can't set: '" + ChatColor.GRAY + property + ChatColor.RED + "'");
|
||||
// TODO: Display the list
|
||||
sender.sendMessage(ChatColor.GOLD + "For a full list of thingys, see our wiki.");
|
||||
sender.sendMessage("Valid world-properties: " + world.getAllPropertyNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -24,9 +24,9 @@ public abstract class MultiverseCommand extends Command {
|
|||
*/
|
||||
protected MultiverseCore plugin;
|
||||
/**
|
||||
* The reference to {@link MVMessaging}.
|
||||
* The reference to {@link MultiverseMessaging}.
|
||||
*/
|
||||
protected MVMessaging messaging;
|
||||
protected MultiverseMessaging messaging;
|
||||
|
||||
public MultiverseCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
|
|
@ -13,12 +13,14 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* A generic paginated command.
|
||||
* @param <T> The type of items on the page.
|
||||
*/
|
||||
public abstract class PaginatedCommand<T> extends Command {
|
||||
private final Pattern REGEX_SPECIAL_CHARS = Pattern.compile("[.+*?\\[^\\]$(){}=!<>|:-\\\\]");
|
||||
private static final int DEFAULT_ITEMS_PER_PAGE = 9;
|
||||
/**
|
||||
* The number of items per page.
|
||||
|
@ -40,12 +42,23 @@ public abstract class PaginatedCommand<T> extends Command {
|
|||
|
||||
/**
|
||||
* Gets filtered items.
|
||||
*
|
||||
* @param availableItems All available items.
|
||||
* @param filter The filter-{@link String}.
|
||||
* @return A list of items that match the filter.
|
||||
*/
|
||||
protected abstract List<T> getFilteredItems(List<T> availableItems, String filter);
|
||||
|
||||
/**
|
||||
* Escape regex special characters from filter
|
||||
*
|
||||
* @param filter The filter-{@link String}.
|
||||
* @return String with regex characters escaped
|
||||
*/
|
||||
protected String cleanFilter(String filter) {
|
||||
return REGEX_SPECIAL_CHARS.matcher(filter).replaceAll("\\\\$0");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a single string from a list of strings.
|
||||
*
|
||||
|
|
|
@ -10,7 +10,7 @@ package com.onarandombox.MultiverseCore.commands;
|
|||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.PurgeWorlds;
|
||||
import com.onarandombox.MultiverseCore.api.WorldPurger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -65,7 +65,7 @@ public class PurgeCommand extends MultiverseCommand {
|
|||
}
|
||||
|
||||
if (!worldName.equalsIgnoreCase("all") && !this.worldManager.isMVWorld(worldName)) {
|
||||
((MultiverseCore) this.plugin).showNotMVWorldMessage(sender, worldName);
|
||||
this.plugin.showNotMVWorldMessage(sender, worldName);
|
||||
sender.sendMessage("It cannot be purged.");
|
||||
return;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class PurgeCommand extends MultiverseCommand {
|
|||
worldsToRemoveEntitiesFrom.add(this.worldManager.getMVWorld(worldName));
|
||||
}
|
||||
|
||||
PurgeWorlds purger = this.worldManager.getWorldPurger();
|
||||
WorldPurger purger = this.worldManager.getTheWorldPurger();
|
||||
ArrayList<String> thingsToKill = new ArrayList<String>();
|
||||
if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
|
||||
thingsToKill.add(deathName.toUpperCase());
|
||||
|
@ -86,7 +86,7 @@ public class PurgeCommand extends MultiverseCommand {
|
|||
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
|
||||
}
|
||||
for (MultiverseWorld w : worldsToRemoveEntitiesFrom) {
|
||||
purger.purgeWorld(sender, w, thingsToKill, false, false);
|
||||
purger.purgeWorld(w, thingsToKill, false, false, sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -23,8 +25,8 @@ public class RegenCommand extends MultiverseCommand {
|
|||
public RegenCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Regenerates a World");
|
||||
this.setCommandUsage("/mv regen" + ChatColor.GREEN + " {WORLD}" + ChatColor.GOLD + " [-s [SEED]]");
|
||||
this.setArgRange(1, 3);
|
||||
this.setCommandUsage("/mv regen" + ChatColor.GREEN + " {WORLD}" + ChatColor.GOLD + " [-s [SEED]] [--keep-gamerules]");
|
||||
this.setArgRange(1, 4);
|
||||
this.addKey("mvregen");
|
||||
this.addKey("mv regen");
|
||||
this.addCommandExample("You can use the -s with no args to get a new seed:");
|
||||
|
@ -37,17 +39,34 @@ public class RegenCommand extends MultiverseCommand {
|
|||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Boolean useseed = (!(args.size() == 1));
|
||||
Boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s"));
|
||||
String seed = (args.size() == 3) ? args.get(2) : "";
|
||||
String worldName = args.get(0);
|
||||
boolean useseed = CommandHandler.hasFlag("-s", args);
|
||||
String seedflag = CommandHandler.getFlag("-s", args);
|
||||
boolean keepGamerules = CommandHandler.hasFlag("--keep-gamerules", args);
|
||||
|
||||
Class<?>[] paramTypes = {String.class, Boolean.class, Boolean.class, String.class};
|
||||
List<Object> objectArgs = new ArrayList<Object>();
|
||||
objectArgs.add(args.get(0));
|
||||
objectArgs.add(useseed);
|
||||
objectArgs.add(randomseed);
|
||||
objectArgs.add(seed);
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvregen", "regenWorld", objectArgs,
|
||||
paramTypes, ChatColor.GREEN + "World Regenerated!", ChatColor.RED + "World could NOT be regenerated!");
|
||||
boolean randomseed = seedflag == null || seedflag.isEmpty() || seedflag.equalsIgnoreCase("--keep-gamerules");
|
||||
String seed = randomseed ? "" : seedflag;
|
||||
|
||||
this.plugin.getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||
sender,
|
||||
doWorldRegen(sender, worldName, useseed, randomseed, seed, keepGamerules),
|
||||
String.format("Are you sure you want to regen '%s'? You cannot undo this action.", worldName)
|
||||
));
|
||||
}
|
||||
|
||||
private Runnable doWorldRegen(@NotNull CommandSender sender,
|
||||
@NotNull String worldName,
|
||||
boolean useSeed,
|
||||
boolean randomSeed,
|
||||
@NotNull String seed,
|
||||
boolean keepGamerules) {
|
||||
|
||||
return () -> {
|
||||
if (this.plugin.getMVWorldManager().regenWorld(worldName, useSeed, randomSeed, seed, keepGamerules)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "World Regenerated!");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.RED + "World could NOT be regenerated!");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public class ReloadCommand extends MultiverseCommand {
|
|||
this.setCommandUsage("/mv reload");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mvreload");
|
||||
this.addKey("mvr");
|
||||
this.addKey("mv reload");
|
||||
this.addCommandExample("/mv reload");
|
||||
this.setPermission("multiverse.core.reload", "Reloads worlds.yml and config.yml.", PermissionDefault.OP);
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* States who is in what world.
|
||||
*/
|
||||
public class ScriptCommand extends MultiverseCommand {
|
||||
|
||||
public ScriptCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Runs a script.");
|
||||
this.setCommandUsage("/mv script" + ChatColor.GOLD + " {script} [target]");
|
||||
this.setArgRange(1, 2);
|
||||
this.addKey("mv script");
|
||||
this.addKey("mvscript");
|
||||
this.addCommandExample(String.format("/mv script %sscript.txt", ChatColor.GOLD));
|
||||
this.addCommandExample(String.format("/mv script %stest.txt %ssomeplayer", ChatColor.GOLD, ChatColor.GREEN));
|
||||
this.setPermission("multiverse.core.script", "Runs a script.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (plugin.getScriptAPI() == null) {
|
||||
sender.sendMessage("Buscript failed to load while the server was starting. Scripts cannot be run.");
|
||||
return;
|
||||
}
|
||||
File file = new File(plugin.getScriptAPI().getScriptFolder(), args.get(0));
|
||||
if (!file.exists()) {
|
||||
sender.sendMessage("That script file does not exist in the Multiverse-Core scripts directory!");
|
||||
return;
|
||||
}
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
String target = null;
|
||||
if (args.size() == 2) {
|
||||
target = args.get(1);
|
||||
}
|
||||
plugin.getScriptAPI().executeScript(file, target, player);
|
||||
sender.sendMessage(String.format("Script '%s%s%s' finished!", ChatColor.GOLD, file.getName(), ChatColor.WHITE));
|
||||
}
|
||||
}
|
|
@ -8,9 +8,8 @@
|
|||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -19,6 +18,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
/**
|
||||
* Sets the spawn for a world.
|
||||
|
@ -28,8 +28,9 @@ public class SetSpawnCommand extends MultiverseCommand {
|
|||
super(plugin);
|
||||
this.setName("Set World Spawn");
|
||||
this.setCommandUsage("/mv setspawn");
|
||||
this.setArgRange(0, 0);
|
||||
this.setArgRange(0, 6);
|
||||
this.addKey("mvsetspawn");
|
||||
this.addKey("mvsets");
|
||||
this.addKey("mvss");
|
||||
this.addKey("mv set spawn");
|
||||
this.addKey("mv setspawn");
|
||||
|
@ -38,40 +39,110 @@ public class SetSpawnCommand extends MultiverseCommand {
|
|||
this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches the user's command depending on the number of parameters
|
||||
* @param sender The player who executes the command, may be console as well.
|
||||
* @param args Command line parameters
|
||||
*/
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
setWorldSpawn(sender);
|
||||
if (args.isEmpty()) {
|
||||
setWorldSpawn(sender);
|
||||
} else if (args.size() == 4) {
|
||||
setWorldSpawn(sender, args.get(0), args.get(1), args.get(2), args.get(3));
|
||||
} else if (args.size() == 6) {
|
||||
setWorldSpawn(sender, args.get(0), args.get(1), args.get(2), args.get(3), args.get(4), args.get(5));
|
||||
} else {
|
||||
sender.sendMessage("Use no arguments for your current location, or world/x/y/z, or world/x/y/z/yaw/pitch!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the actual spawn-setting-work.
|
||||
*
|
||||
* @param sender The {@link CommandSender} that's setting the spawn.
|
||||
* Set the world spawn when no parameters are given
|
||||
* @param sender The {@link CommandSender} who executes the command.
|
||||
* Everything not a {@link Player}, e.g. console, gets rejected, as we can't get coordinates from there.
|
||||
*/
|
||||
protected void setWorldSpawn(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
Location l = p.getLocation();
|
||||
World w = p.getWorld();
|
||||
MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName());
|
||||
if (foundWorld != null) {
|
||||
foundWorld.setSpawnLocation(p.getLocation());
|
||||
BlockSafety bs = new BlockSafety();
|
||||
if (!bs.playerCanSpawnHereSafely(p.getLocation()) && foundWorld.getAdjustSpawn()) {
|
||||
sender.sendMessage("It looks like that location would normally be unsafe. But I trust you.");
|
||||
sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world.");
|
||||
sender.sendMessage("If you want this turned back on just do:");
|
||||
sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias());
|
||||
foundWorld.setAdjustSpawn(false);
|
||||
}
|
||||
sender.sendMessage("Spawn was set to: " + LocationManipulation.strCoords(p.getLocation()));
|
||||
} else {
|
||||
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");
|
||||
}
|
||||
|
||||
setWorldSpawn(sender, w, l);
|
||||
} else {
|
||||
sender.sendMessage("You cannot use this command from the console.");
|
||||
sender.sendMessage("You need to give coordinates to use this command from the console!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the world spawn when 4 parameters are given
|
||||
* @param sender The {@link CommandSender} who executes the command
|
||||
* @param world The world to set the spawn in
|
||||
* @param x X-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
|
||||
* @param y Y-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
|
||||
* @param z Z-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
|
||||
*/
|
||||
protected void setWorldSpawn(CommandSender sender, String world, String x, String y, String z) {
|
||||
setWorldSpawn(sender, world, x, y, z, "0", "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the world spawn when 6 parameters are given
|
||||
* @param sender The {@link CommandSender} who executes the command
|
||||
* @param world The world to set the spawn in
|
||||
* @param x X-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
|
||||
* @param y Y-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
|
||||
* @param z Z-coordinate to set the spawn to (as a {@link String} as it's from the command line, gets parsed into a double)
|
||||
* @param yaw Yaw a newly spawned player should look at (as a {@link String} as it's from the command line, gets parsed into a float)
|
||||
* @param pitch Pitch a newly spawned player should look at (as a {@link String} as it's from the command line, gets parsed into a float)
|
||||
*/
|
||||
protected void setWorldSpawn(CommandSender sender, String world, String x, String y, String z, String yaw, String pitch) {
|
||||
double dx, dy, dz;
|
||||
float fpitch, fyaw;
|
||||
World bukkitWorld = Bukkit.getWorld(world);
|
||||
if (bukkitWorld == null) {
|
||||
sender.sendMessage("World " + world + " is unknown!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
dx = Double.parseDouble(x);
|
||||
dy = Double.parseDouble(y);
|
||||
dz = Double.parseDouble(z);
|
||||
fpitch = Float.parseFloat(pitch);
|
||||
fyaw = Float.parseFloat(yaw);
|
||||
} catch (NumberFormatException ex) {
|
||||
sender.sendMessage("All coordinates must be numeric");
|
||||
return;
|
||||
}
|
||||
Location l = new Location(bukkitWorld, dx, dy, dz, fyaw, fpitch);
|
||||
setWorldSpawn(sender, bukkitWorld, l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the actual spawn-setting-work.
|
||||
*
|
||||
* @param sender The {@link CommandSender} that's setting the spawn.
|
||||
* @param w The {@link World} to set the spawn in
|
||||
* @param l The {@link Location} to set the spawn to
|
||||
*/
|
||||
private void setWorldSpawn(CommandSender sender, World w, Location l) {
|
||||
MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName());
|
||||
if (foundWorld != null) {
|
||||
foundWorld.setSpawnLocation(l);
|
||||
BlockSafety bs = this.plugin.getBlockSafety();
|
||||
if (!bs.playerCanSpawnHereSafely(l) && foundWorld.getAdjustSpawn()) {
|
||||
sender.sendMessage("It looks like that location would normally be unsafe. But I trust you.");
|
||||
sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world.");
|
||||
sender.sendMessage("If you want this turned back on just do:");
|
||||
sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias());
|
||||
foundWorld.setAdjustSpawn(false);
|
||||
}
|
||||
sender.sendMessage("Spawn was set to: " + plugin.getLocationManipulation().strCoords(l));
|
||||
if (!plugin.saveWorldConfig()) {
|
||||
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
|
||||
}
|
||||
} else {
|
||||
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Enables debug-information.
|
||||
*/
|
||||
public class SilentCommand extends MultiverseCommand {
|
||||
|
||||
public SilentCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Turn silent mode on/off?");
|
||||
this.setCommandUsage("/mv silent" + ChatColor.GOLD + " [true|false|on|off]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv silent");
|
||||
this.addKey("mvsilent");
|
||||
this.addCommandExample("/mv silent " + ChatColor.GOLD + "true");
|
||||
this.setPermission("multiverse.core.silent", "Reduces the amount of startup messages.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() == 1) {
|
||||
if (args.get(0).equalsIgnoreCase("on")) {
|
||||
args.set(0, "true");
|
||||
}
|
||||
plugin.getMVConfig().setSilentStart(Boolean.valueOf(args.get(0)));
|
||||
plugin.saveMVConfigs();
|
||||
}
|
||||
this.displaySilentMode(sender);
|
||||
}
|
||||
|
||||
private void displaySilentMode(CommandSender sender) {
|
||||
if (plugin.getMVConfig().getSilentStart()) {
|
||||
sender.sendMessage("Multiverse Silent Start mode is " + ChatColor.GREEN + "ON");
|
||||
} else {
|
||||
sender.sendMessage("Multiverse Silent Start mode is " + ChatColor.RED + "OFF");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore.commands;
|
|||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.PlayerFinder;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -50,7 +51,7 @@ public class SpawnCommand extends MultiverseCommand {
|
|||
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));
|
||||
Player target = PlayerFinder.get(args.get(0), sender);
|
||||
if (target != null) {
|
||||
target.sendMessage("Teleporting to this world's spawn...");
|
||||
spawnAccurately(target);
|
||||
|
@ -85,6 +86,6 @@ public class SpawnCommand extends MultiverseCommand {
|
|||
} else {
|
||||
spawnLocation = player.getWorld().getSpawnLocation();
|
||||
}
|
||||
this.plugin.getTeleporter().safelyTeleport(player, player, spawnLocation, false);
|
||||
this.plugin.getSafeTTeleporter().safelyTeleport(player, player, spawnLocation, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
import org.getspout.spoutapi.gui.GenericPopup;
|
||||
import org.getspout.spoutapi.gui.PopupScreen;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Edit a world with spout.
|
||||
*/
|
||||
public class SpoutCommand extends MultiverseCommand {
|
||||
|
||||
public SpoutCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Edit World with Spout");
|
||||
this.setCommandUsage("/mv spout");
|
||||
this.setArgRange(0, 0);
|
||||
this.addKey("mv spout");
|
||||
this.setPermission("multiverse.core.spout", "Edit a world with spout.", PermissionDefault.OP);
|
||||
this.addCommandExample("/mv spout");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.RED + "This command must be run as a player!");
|
||||
return;
|
||||
}
|
||||
if (plugin.getSpout() == null) {
|
||||
sender.sendMessage(ChatColor.RED + "You need spout installed on this server to use it with Multiverse!");
|
||||
return;
|
||||
}
|
||||
SpoutPlayer p = (SpoutPlayer) sender;
|
||||
if (!p.isSpoutCraftEnabled()) {
|
||||
sender.sendMessage(ChatColor.RED + p.getName() + "You need to be using the Spoutcraft client to run this command!");
|
||||
return;
|
||||
}
|
||||
PopupScreen pop = new GenericPopup();
|
||||
GenericButton button = new GenericButton("Fish");
|
||||
// TODO maybe use constants for these
|
||||
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
button.setX(50);
|
||||
button.setY(50);
|
||||
button.setWidth(100);
|
||||
button.setHeight(40);
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
pop.attachWidget(this.plugin, button);
|
||||
sender.sendMessage(ChatColor.GREEN + "YAY!");
|
||||
p.getMainScreen().attachPopupScreen(pop);
|
||||
}
|
||||
}
|
|
@ -7,15 +7,19 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.Teleporter;
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
|
||||
import com.onarandombox.MultiverseCore.destination.CustomTeleporterDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
|
||||
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.WorldDestination;
|
||||
import com.onarandombox.MultiverseCore.enums.TeleportResult;
|
||||
import com.onarandombox.MultiverseCore.event.MVTeleportEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.utils.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.utils.PlayerFinder;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -26,7 +30,6 @@ import org.bukkit.permissions.PermissionDefault;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Used to teleport players.
|
||||
|
@ -39,11 +42,11 @@ public class TeleportCommand extends MultiverseCommand {
|
|||
Permission menu = new Permission("multiverse.teleport.*", "Allows you to display the teleport menu.", PermissionDefault.OP);
|
||||
|
||||
this.setName("Teleport");
|
||||
this.setCommandUsage("/mv tp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}");
|
||||
this.setCommandUsage("/mv tp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {DESTINATION}");
|
||||
this.setArgRange(1, 2);
|
||||
this.addKey("mvtp");
|
||||
this.addKey("mv tp");
|
||||
this.playerTeleporter = new SafeTTeleporter(this.plugin);
|
||||
this.playerTeleporter = this.plugin.getSafeTTeleporter();
|
||||
this.setPermission(menu);
|
||||
}
|
||||
|
||||
|
@ -51,17 +54,13 @@ public class TeleportCommand extends MultiverseCommand {
|
|||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
CommandSender teleporter = sender;
|
||||
Player teleportee = null;
|
||||
if (sender instanceof Player) {
|
||||
teleporter = (Player) sender;
|
||||
}
|
||||
|
||||
String destinationName;
|
||||
|
||||
if (args.size() == 2) {
|
||||
teleportee = this.plugin.getServer().getPlayer(args.get(0));
|
||||
teleportee = PlayerFinder.get(args.get(0), sender);
|
||||
if (teleportee == null) {
|
||||
this.messaging.sendMessage(sender, String.format("Sorry, I couldn't find player: %s%s",
|
||||
ChatColor.GOLD, args.get(0)), false);
|
||||
|
@ -77,27 +76,14 @@ public class TeleportCommand extends MultiverseCommand {
|
|||
}
|
||||
teleportee = (Player) sender;
|
||||
}
|
||||
// Special case for cannons:
|
||||
if (destinationName.matches("(?i)cannon-[\\d]+(\\.[\\d]+)?")) {
|
||||
String[] cannonSpeed = destinationName.split("-");
|
||||
try {
|
||||
double speed = Double.parseDouble(cannonSpeed[1]);
|
||||
destinationName = "ca:" + teleportee.getWorld().getName() + ":" + teleportee.getLocation().getX()
|
||||
+ "," + teleportee.getLocation().getY() + "," + teleportee.getLocation().getZ() + ":"
|
||||
+ teleportee.getLocation().getPitch() + ":" + teleportee.getLocation().getYaw() + ":" + speed;
|
||||
} catch (Exception e) {
|
||||
destinationName = "i:invalid";
|
||||
}
|
||||
|
||||
}
|
||||
DestinationFactory df = this.plugin.getDestFactory();
|
||||
MVDestination d = df.getDestination(destinationName);
|
||||
|
||||
MVDestination d = df.getPlayerAwareDestination(teleportee, destinationName);
|
||||
|
||||
MVTeleportEvent teleportEvent = new MVTeleportEvent(d, teleportee, teleporter, true);
|
||||
this.plugin.getServer().getPluginManager().callEvent(teleportEvent);
|
||||
if (teleportEvent.isCancelled()) {
|
||||
this.plugin.log(Level.FINE, "Someone else cancelled the MVTeleport Event!!!");
|
||||
Logging.fine("Someone else cancelled the MVTeleport Event!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -111,7 +97,7 @@ public class TeleportCommand extends MultiverseCommand {
|
|||
return;
|
||||
}
|
||||
|
||||
if (MultiverseCore.EnforceAccess && teleporter != null && !this.plugin.getMVPerms().canEnterDestination(teleporter, d)) {
|
||||
if (plugin.getMVConfig().getEnforceAccess() && teleporter != null && !this.plugin.getMVPerms().canEnterDestination(teleporter, d)) {
|
||||
if (teleportee.equals(teleporter)) {
|
||||
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
||||
} else {
|
||||
|
@ -161,27 +147,33 @@ public class TeleportCommand extends MultiverseCommand {
|
|||
this.messaging.sendMessage(teleporter, "Sorry Boss, I tried everything, but just couldn't teleport ya there!", false);
|
||||
return;
|
||||
}
|
||||
TeleportResult result = this.playerTeleporter.safelyTeleport(teleporter, teleportee, d);
|
||||
Teleporter teleportObject = (d instanceof CustomTeleporterDestination) ?
|
||||
((CustomTeleporterDestination)d).getTeleporter() : this.playerTeleporter;
|
||||
TeleportResult result = teleportObject.teleport(teleporter, teleportee, d);
|
||||
if (result == TeleportResult.FAIL_UNSAFE) {
|
||||
this.plugin.log(Level.FINE, "Could not teleport " + teleportee.getName() + " to " + LocationManipulation.strCoordsRaw(d.getLocation(teleportee)));
|
||||
this.plugin.log(Level.FINE, "Queueing Command");
|
||||
Class<?>[] paramTypes = { CommandSender.class, Player.class, Location.class };
|
||||
List<Object> items = new ArrayList<Object>();
|
||||
items.add(teleporter);
|
||||
items.add(teleportee);
|
||||
items.add(d.getLocation(teleportee));
|
||||
Logging.fine("Could not teleport " + teleportee.getName()
|
||||
+ " to " + plugin.getLocationManipulation().strCoordsRaw(d.getLocation(teleportee)));
|
||||
|
||||
String player = "you";
|
||||
if (!teleportee.equals(teleporter)) {
|
||||
player = teleportee.getName();
|
||||
}
|
||||
String message = String.format("%sMultiverse %sdid not teleport %s%s%sto %s%s%sbecause it was unsafe.",
|
||||
ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, player, ChatColor.WHITE, ChatColor.DARK_AQUA, d.getName(), ChatColor.WHITE);
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items,
|
||||
paramTypes, message, "Would you like to try anyway?", "", "", UNSAFE_TELEPORT_EXPIRE_DELAY);
|
||||
|
||||
this.plugin.getCommandQueueManager().addToQueue(new QueuedCommand(
|
||||
sender,
|
||||
doUnsafeTeleport(teleporter, teleportee, d.getLocation(teleportee)),
|
||||
String.format("%sMultiverse %sdid not teleport %s%s %sto %s%s %sbecause it was unsafe. Would you like to try anyway?",
|
||||
ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, player, ChatColor.WHITE, ChatColor.DARK_AQUA, d.getName(), ChatColor.WHITE),
|
||||
UNSAFE_TELEPORT_EXPIRE_DELAY
|
||||
));
|
||||
}
|
||||
// else: Player was teleported successfully (or the tp event was fired I should say)
|
||||
}
|
||||
|
||||
private Runnable doUnsafeTeleport(CommandSender teleporter, Player player, Location location) {
|
||||
return () -> this.plugin.getSafeTTeleporter().safelyTeleport(teleporter, player, location, false);
|
||||
}
|
||||
|
||||
private boolean checkSendPermissions(CommandSender teleporter, Player teleportee, MVDestination destination) {
|
||||
if (teleporter.equals(teleportee)) {
|
||||
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.self." + destination.getIdentifier(), true)) {
|
||||
|
|
|
@ -7,103 +7,219 @@
|
|||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteService;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceFactory;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceType;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortener;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerFactory;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerType;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Dumps version info to the console.
|
||||
*/
|
||||
public class VersionCommand extends MultiverseCommand {
|
||||
private static final URLShortener SHORTENER = URLShortenerFactory.getService(URLShortenerType.BITLY);
|
||||
|
||||
public VersionCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Multiverse Version");
|
||||
this.setCommandUsage("/mv version " + ChatColor.GOLD + "-[pb]");
|
||||
this.setArgRange(0, 1);
|
||||
this.setCommandUsage("/mv version " + ChatColor.GOLD + "[-b|-h|-p] [--include-plugin-list]");
|
||||
this.setArgRange(0, 2);
|
||||
this.addKey("mv version");
|
||||
this.addKey("mvver");
|
||||
this.addKey("mvv");
|
||||
this.addKey("mvversion");
|
||||
this.setPermission("multiverse.core.version",
|
||||
"Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
|
||||
this.setPermission(
|
||||
"multiverse.core.version",
|
||||
"Dumps version info to the console, optionally to pastebin.com with -b, to hastebin.com using -h, or to paste.gg with -p.",
|
||||
PermissionDefault.OP)
|
||||
;
|
||||
}
|
||||
|
||||
private String getLegacyString() {
|
||||
return "[Multiverse-Core] Multiverse-Core Version: " + this.plugin.getDescription().getVersion() + '\n'
|
||||
+ "[Multiverse-Core] Bukkit Version: " + this.plugin.getServer().getVersion() + '\n'
|
||||
+ "[Multiverse-Core] Loaded Worlds: " + this.plugin.getMVWorldManager().getMVWorlds() + '\n'
|
||||
+ "[Multiverse-Core] Multiverse Plugins Loaded: " + this.plugin.getPluginCount() + '\n'
|
||||
+"[Multiverse-Core] Economy being used: " + plugin.getEconomist().getEconomyName() + '\n'
|
||||
+ "[Multiverse-Core] Permissions Plugin: " + this.plugin.getMVPerms().getType() + '\n'
|
||||
+ "[Multiverse-Core] Dumping Config Values: (version " + this.plugin.getMVConfig().getVersion() + ")" + '\n'
|
||||
+ "[Multiverse-Core] enforceaccess: " + plugin.getMVConfig().getEnforceAccess() + '\n'
|
||||
+ "[Multiverse-Core] prefixchat: " + plugin.getMVConfig().getPrefixChat() + '\n'
|
||||
+ "[Multiverse-Core] prefixchatformat: " + plugin.getMVConfig().getPrefixChatFormat() + '\n'
|
||||
+ "[Multiverse-Core] useasyncchat: " + plugin.getMVConfig().getUseAsyncChat() + '\n'
|
||||
+ "[Multiverse-Core] teleportintercept: " + plugin.getMVConfig().getTeleportIntercept() + '\n'
|
||||
+ "[Multiverse-Core] firstspawnoverride: " + plugin.getMVConfig().getFirstSpawnOverride() + '\n'
|
||||
+ "[Multiverse-Core] displaypermerrors: " + plugin.getMVConfig().getDisplayPermErrors() + '\n'
|
||||
+ "[Multiverse-Core] enablebuscript: " + plugin.getMVConfig().getEnableBuscript() + '\n'
|
||||
+ "[Multiverse-Core] globaldebug: " + plugin.getMVConfig().getGlobalDebug() + '\n'
|
||||
+ "[Multiverse-Core] silentstart: " + plugin.getMVConfig().getSilentStart() + '\n'
|
||||
+ "[Multiverse-Core] messagecooldown: " + plugin.getMessaging().getCooldown() + '\n'
|
||||
+ "[Multiverse-Core] version: " + plugin.getMVConfig().getVersion() + '\n'
|
||||
+ "[Multiverse-Core] firstspawnworld: " + plugin.getMVConfig().getFirstSpawnWorld() + '\n'
|
||||
+ "[Multiverse-Core] teleportcooldown: " + plugin.getMVConfig().getTeleportCooldown() + '\n'
|
||||
+ "[Multiverse-Core] defaultportalsearch: " + plugin.getMVConfig().isUsingDefaultPortalSearch() + '\n'
|
||||
+ "[Multiverse-Core] portalsearchradius: " + plugin.getMVConfig().getPortalSearchRadius() + '\n'
|
||||
+ "[Multiverse-Core] autopurge: " + plugin.getMVConfig().isAutoPurgeEnabled() + '\n'
|
||||
+ "[Multiverse-Core] Special Code: FRN002" + '\n';
|
||||
}
|
||||
|
||||
private String getMarkdownString() {
|
||||
return "# Multiverse-Core" + '\n'
|
||||
+ "## Overview" + '\n'
|
||||
+ "| Name | Value |" + '\n'
|
||||
+ "| --- | --- |" + '\n'
|
||||
+ "| Multiverse-Core Version | `" + this.plugin.getDescription().getVersion() + "` |" + '\n'
|
||||
+ "| Bukkit Version | `" + this.plugin.getServer().getVersion() + "` |" + '\n'
|
||||
+ "| Loaded Worlds | `" + this.plugin.getMVWorldManager().getMVWorlds() + "` |" + '\n'
|
||||
+ "| Multiverse Plugins Loaded | `" + this.plugin.getPluginCount() + "` |" + '\n'
|
||||
+ "| Economy being used | `" + plugin.getEconomist().getEconomyName() + "` |" + '\n'
|
||||
+ "| Permissions Plugin | `" + this.plugin.getMVPerms().getType() + "` |" + '\n'
|
||||
+ "## Parsed Config" + '\n'
|
||||
+ "These are what Multiverse thought the in-memory values of the config were." + "\n\n"
|
||||
+ "| Config Key | Value |" + '\n'
|
||||
+ "| --- | --- |" + '\n'
|
||||
+ "| version | `" + this.plugin.getMVConfig().getVersion() + "` |" + '\n'
|
||||
+ "| messagecooldown | `" + plugin.getMessaging().getCooldown() + "` |" + '\n'
|
||||
+ "| teleportcooldown | `" + plugin.getMVConfig().getTeleportCooldown() + "` |" + '\n'
|
||||
+ "| worldnameprefix | `" + plugin.getMVConfig().getPrefixChat() + "` |" + '\n'
|
||||
+ "| worldnameprefixFormat | `" + plugin.getMVConfig().getPrefixChatFormat() + "` |" + '\n'
|
||||
+ "| enforceaccess | `" + plugin.getMVConfig().getEnforceAccess() + "` |" + '\n'
|
||||
+ "| displaypermerrors | `" + plugin.getMVConfig().getDisplayPermErrors() + "` |" + '\n'
|
||||
+ "| teleportintercept | `" + plugin.getMVConfig().getTeleportIntercept() + "` |" + '\n'
|
||||
+ "| firstspawnoverride | `" + plugin.getMVConfig().getFirstSpawnOverride() + "` |" + '\n'
|
||||
+ "| firstspawnworld | `" + plugin.getMVConfig().getFirstSpawnWorld() + "` |" + '\n'
|
||||
+ "| debug | `" + plugin.getMVConfig().getGlobalDebug() + "` |" + '\n';
|
||||
}
|
||||
|
||||
private void addVersionInfoToEvent(MVVersionEvent event) {
|
||||
// add the legacy version info
|
||||
event.appendVersionInfo(this.getLegacyString());
|
||||
|
||||
// add the legacy file, but as markdown so it's readable
|
||||
// TODO Readd this in 5.0.0
|
||||
// event.putDetailedVersionInfo("version.md", this.getMarkdownString());
|
||||
|
||||
// add config.yml
|
||||
File configFile = new File(this.plugin.getDataFolder(), "config.yml");
|
||||
event.putDetailedVersionInfo("multiverse-core/config.yml", configFile);
|
||||
|
||||
// add worlds.yml
|
||||
File worldsFile = new File(this.plugin.getDataFolder(), "worlds.yml");
|
||||
event.putDetailedVersionInfo("multiverse-core/worlds.yml", worldsFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
public void runCommand(final CommandSender sender, final 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.");
|
||||
}
|
||||
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("[Multiverse-Core] Multiverse-Core Version: ").append(this.plugin.getDescription().getVersion()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Bukkit Version: ").append(this.plugin.getServer().getVersion()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Loaded Worlds: ").append(this.plugin.getMVWorldManager().getMVWorlds().size()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Multiverse Plugins Loaded: ").append(this.plugin.getPluginCount()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Economy being used: ").append(this.plugin.getBank().getEconUsed()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Permissions Plugin: ").append(this.plugin.getMVPerms().getType()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Dumping Config Values: (version ")
|
||||
.append(this.plugin.getMVConfiguration().getDouble("version", -1)).append(")").append('\n');
|
||||
buffer.append("[Multiverse-Core] messagecooldown: ").append(this.plugin.getMessaging().getCooldown()).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportcooldown: ").append("Not yet IMPLEMENTED").append('\n');
|
||||
buffer.append("[Multiverse-Core] worldnameprefix: ").append(MultiverseCore.PrefixChat).append('\n');
|
||||
buffer.append("[Multiverse-Core] enforceaccess: ").append(MultiverseCore.EnforceAccess).append('\n');
|
||||
buffer.append("[Multiverse-Core] displaypermerrors: ").append(MultiverseCore.DisplayPermErrors).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportintercept: ").append(MultiverseCore.TeleportIntercept).append('\n');
|
||||
buffer.append("[Multiverse-Core] firstspawnoverride: ").append(MultiverseCore.FirstSpawnOverride).append('\n');
|
||||
buffer.append("[Multiverse-Core] firstspawnworld: ").append(this.plugin.getMVConfiguration().getString("firstspawnworld", "NOT SET")).append('\n');
|
||||
buffer.append("[Multiverse-Core] debug: ").append(MultiverseCore.GlobalDebug).append('\n');
|
||||
buffer.append("[Multiverse-Core] Special Code: FRN002").append('\n');
|
||||
MVVersionEvent versionEvent = new MVVersionEvent();
|
||||
|
||||
MVVersionEvent versionEvent = new MVVersionEvent(buffer.toString());
|
||||
this.addVersionInfoToEvent(versionEvent);
|
||||
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
|
||||
|
||||
if (CommandHandler.hasFlag("--include-plugin-list", args)) {
|
||||
versionEvent.appendVersionInfo('\n' + "Plugins: " + getPluginList());
|
||||
versionEvent.putDetailedVersionInfo("plugins.txt", "Plugins: " + getPluginList());
|
||||
}
|
||||
|
||||
final String versionInfo = versionEvent.getVersionInfo();
|
||||
versionEvent.putDetailedVersionInfo("version.txt", versionInfo);
|
||||
|
||||
final Map<String, String> files = versionEvent.getDetailedVersionInfo();
|
||||
|
||||
// log to console
|
||||
String data = versionEvent.getVersionInfo();
|
||||
String[] lines = data.split("\n");
|
||||
String[] lines = versionInfo.split("\\r?\\n");
|
||||
for (String line : lines) {
|
||||
this.plugin.log(Level.INFO, line);
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
String pasteUrl = "";
|
||||
if (args.get(0).equalsIgnoreCase("-p")) {
|
||||
pasteUrl = postToService(PasteServiceType.PASTIE, true, data); // private post to pastie
|
||||
} else if (args.get(0).equalsIgnoreCase("-b")) {
|
||||
pasteUrl = postToService(PasteServiceType.PASTEBIN, true, data); // private post to pastie
|
||||
} else {
|
||||
return;
|
||||
if (!line.isEmpty()) {
|
||||
this.plugin.getServer().getLogger().info(line);
|
||||
}
|
||||
|
||||
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
|
||||
this.plugin.log(Level.INFO, "Version info dumped here: " + pasteUrl);
|
||||
}
|
||||
|
||||
BukkitRunnable logPoster = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.size() > 0) {
|
||||
String pasteUrl;
|
||||
if (CommandHandler.hasFlag("-b", args)) {
|
||||
// private post to pastebin
|
||||
pasteUrl = postToService(PasteServiceType.PASTEBIN, true, versionInfo, files);
|
||||
} else if (CommandHandler.hasFlag("-g", args)) {
|
||||
// private post to github
|
||||
pasteUrl = postToService(PasteServiceType.GITHUB, true, versionInfo, files);
|
||||
} else if (CommandHandler.hasFlag("-h", args)) {
|
||||
// private post to hastebin
|
||||
pasteUrl = postToService(PasteServiceType.HASTEBIN, true, versionInfo, files);
|
||||
} else if (CommandHandler.hasFlag("-p", args)) {
|
||||
// private post to paste.gg
|
||||
pasteUrl = postToService(PasteServiceType.PASTEGG, true, versionInfo, files);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(sender instanceof ConsoleCommandSender)) {
|
||||
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
|
||||
}
|
||||
Logging.info("Version info dumped here: %s", pasteUrl);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Run the log posting operation asynchronously, since we don't know how long it will take.
|
||||
logPoster.runTaskAsynchronously(this.plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the current contents of this.pasteBinBuffer to a web service.
|
||||
*
|
||||
* @param type Service type to send to
|
||||
* @param isPrivate Should the paste be marked as private.
|
||||
* @param type Service type to send paste data to.
|
||||
* @param isPrivate Should the paste be marked as private.
|
||||
* @param pasteData Legacy string only data to post to a service.
|
||||
* @param pasteFiles Map of filenames/contents of debug info.
|
||||
* @return URL of visible paste
|
||||
*/
|
||||
private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData) {
|
||||
private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData, Map<String, String> pasteFiles) {
|
||||
PasteService ps = PasteServiceFactory.getService(type, isPrivate);
|
||||
|
||||
try {
|
||||
return ps.postData(ps.encodeData(pasteData), ps.getPostURL());
|
||||
String result;
|
||||
if (ps.supportsMultiFile()) {
|
||||
result = ps.postData(pasteFiles);
|
||||
} else {
|
||||
result = ps.postData(pasteData);
|
||||
}
|
||||
|
||||
if (SHORTENER != null) return SHORTENER.shorten(result);
|
||||
return result;
|
||||
} catch (PasteFailedException e) {
|
||||
System.out.print(e);
|
||||
return "Error posting to service";
|
||||
e.printStackTrace();
|
||||
return "Error posting to service.";
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return "That service isn't supported yet.";
|
||||
}
|
||||
}
|
||||
|
||||
private String getPluginList() {
|
||||
return StringUtils.join(plugin.getServer().getPluginManager().getPlugins(), ", ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -28,11 +29,14 @@ public class WhoCommand extends MultiverseCommand {
|
|||
public WhoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Who?");
|
||||
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
|
||||
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD|--all]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv who");
|
||||
this.addKey("mvw");
|
||||
this.addKey("mvwho");
|
||||
this.addCommandExample("/mv who");
|
||||
this.addCommandExample(String.format("/mv who %s--all", ChatColor.GREEN));
|
||||
this.addCommandExample(String.format("/mv who %smyworld", ChatColor.GOLD));
|
||||
this.setPermission("multiverse.core.list.who", "States who is in what world.", PermissionDefault.OP);
|
||||
this.worldManager = this.plugin.getMVWorldManager();
|
||||
}
|
||||
|
@ -48,57 +52,67 @@ public class WhoCommand extends MultiverseCommand {
|
|||
showAll = false;
|
||||
}
|
||||
|
||||
List<MultiverseWorld> worlds = new ArrayList<MultiverseWorld>();
|
||||
final Collection onlinePlayers = plugin.getServer().getOnlinePlayers();
|
||||
final Collection<Player> visiblePlayers = new HashSet<Player>(onlinePlayers.size());
|
||||
for (final Object player : onlinePlayers) {
|
||||
if (player instanceof Player && (p == null || p.canSee((Player) player))) {
|
||||
visiblePlayers.add((Player) player);
|
||||
}
|
||||
}
|
||||
|
||||
if (args.size() > 0) {
|
||||
MultiverseWorld world = this.worldManager.getMVWorld(args.get(0));
|
||||
if (args.size() == 1) {
|
||||
if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
|
||||
showAll = true;
|
||||
worlds = new ArrayList<MultiverseWorld>(this.worldManager.getMVWorlds());
|
||||
} else if (world != null) {
|
||||
if (!world.isHidden()) {
|
||||
worlds.add(world);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "World does not exist");
|
||||
// single world mode
|
||||
MultiverseWorld world = this.worldManager.getMVWorld(args.get(0));
|
||||
if (world == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That world does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.plugin.getMVPerms().canEnterWorld(p, world)) {
|
||||
sender.sendMessage(ChatColor.RED + "You aren't allowed to access to this world!");
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(String.format("%s--- Players in %s%s ---", ChatColor.AQUA,
|
||||
world.getColoredWorldString(), ChatColor.AQUA));
|
||||
sender.sendMessage(this.buildPlayerString(world, p, visiblePlayers));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
worlds = new ArrayList<MultiverseWorld>(this.worldManager.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" + worlds.get(0).getColoredWorldString() + ChatColor.AQUA + " ---");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.AQUA + "--- There are players in ---");
|
||||
}
|
||||
|
||||
for (MultiverseWorld world : worlds) {
|
||||
if (!(this.worldManager.isMVWorld(world.getName()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p != null && (!this.plugin.getMVPerms().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.getDisplayName() + " " + ChatColor.WHITE;
|
||||
// multiworld mode
|
||||
sender.sendMessage(ChatColor.AQUA + "--- Worlds and their players --- "
|
||||
+ visiblePlayers.size() + "/" + plugin.getServer().getMaxPlayers());
|
||||
boolean shownOne = false;
|
||||
for (MultiverseWorld world : this.worldManager.getMVWorlds()) {
|
||||
if (this.plugin.getMVPerms().canEnterWorld(p, world)) { // only show world if the player can access it
|
||||
if (showAll || !world.getCBWorld().getPlayers().isEmpty()) { // either show all or show if the world is not empty
|
||||
sender.sendMessage(String.format("%s%s - %s", world.getColoredWorldString(), ChatColor.WHITE, buildPlayerString(world, p, visiblePlayers)));
|
||||
shownOne = true;
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(world.getColoredWorldString() + ChatColor.WHITE + " - " + result);
|
||||
}
|
||||
if (!shownOne) {
|
||||
sender.sendMessage("No worlds found.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private static String buildPlayerString(MultiverseWorld world, Player viewer, final Collection<Player> visiblePlayers) {
|
||||
// Retrieve the players in this world
|
||||
List<Player> players = world.getCBWorld().getPlayers();
|
||||
StringBuilder playerBuilder = new StringBuilder();
|
||||
for (Player player : players) {
|
||||
// If the viewer is the console or the viewier is allowed to see the player, show them.
|
||||
// Make sure we're also ONLY showing online players.
|
||||
// Since we already checked visible players, we'll just make sure who we're about to show is in that.
|
||||
if (visiblePlayers.contains(player))
|
||||
playerBuilder.append(player.getDisplayName()).append(", ");
|
||||
}
|
||||
String bString = playerBuilder.toString();
|
||||
return (bString.length() == 0) ? "No players found." : bString.substring(0, bString.length() - 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2020. *
|
||||
* 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.commandtools.queue;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.block.data.type.CommandBlock;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* <p>Manages the queuing of dangerous commands that require {@code /mv confirm} before executing.</p>
|
||||
*
|
||||
* <p>Each sender can only have one command in queue at any given time. When a queued command is added
|
||||
* for a sender that already has a command in queue, it will replace the old queued command.</p>
|
||||
*/
|
||||
public class CommandQueueManager {
|
||||
|
||||
private static final long TICKS_PER_SECOND = 20;
|
||||
private static final DummyCommandBlockSender COMMAND_BLOCK = new DummyCommandBlockSender();
|
||||
|
||||
private final MultiverseCore plugin;
|
||||
private final Map<CommandSender, QueuedCommand> queuedCommandMap;
|
||||
|
||||
public CommandQueueManager(@NotNull MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
this.queuedCommandMap = new WeakHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a {@link QueuedCommand} into queue.
|
||||
*
|
||||
* @param queuedCommand The queued command to add.
|
||||
*/
|
||||
public void addToQueue(QueuedCommand queuedCommand) {
|
||||
CommandSender targetSender = parseSender(queuedCommand.getSender());
|
||||
|
||||
// Since only one command is stored in queue per sender, we remove the old one.
|
||||
this.removeFromQueue(targetSender);
|
||||
|
||||
Logging.finer("Add new command to queue for sender %s.", targetSender);
|
||||
this.queuedCommandMap.put(targetSender, queuedCommand);
|
||||
queuedCommand.setExpireTask(runExpireLater(queuedCommand));
|
||||
|
||||
queuedCommand.getSender().sendMessage(queuedCommand.getPrompt());
|
||||
queuedCommand.getSender().sendMessage(String.format("Run %s/mv confirm %sto continue. This will expire in %s seconds.",
|
||||
ChatColor.GREEN, ChatColor.WHITE, queuedCommand.getValidDuration()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Expire task that removes a {@link QueuedCommand} from queue after valid duration defined.
|
||||
*
|
||||
* @param queuedCommand Command to run the expire task on.
|
||||
* @return The expire {@link BukkitTask}.
|
||||
*/
|
||||
@NotNull
|
||||
private BukkitTask runExpireLater(@NotNull QueuedCommand queuedCommand) {
|
||||
return Bukkit.getScheduler().runTaskLater(
|
||||
this.plugin,
|
||||
expireRunnable(queuedCommand),
|
||||
queuedCommand.getValidDuration() * TICKS_PER_SECOND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runnable responsible for expiring the queued command.
|
||||
*
|
||||
* @param queuedCommand Command to create the expire task on.
|
||||
* @return The expire runnable.
|
||||
*/
|
||||
@NotNull
|
||||
private Runnable expireRunnable(@NotNull QueuedCommand queuedCommand) {
|
||||
return () -> {
|
||||
CommandSender targetSender = parseSender(queuedCommand.getSender());
|
||||
QueuedCommand matchingQueuedCommand = this.queuedCommandMap.get(targetSender);
|
||||
if (!queuedCommand.equals(matchingQueuedCommand) || queuedCommand.getExpireTask().isCancelled()) {
|
||||
// To be safe, but this shouldn't happen since we cancel old commands before add new once.
|
||||
Logging.finer("This is an old queue command already.");
|
||||
return;
|
||||
}
|
||||
queuedCommand.getSender().sendMessage("Your queued command has expired.");
|
||||
this.queuedCommandMap.remove(queuedCommand.getSender());
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the command in queue for the given sender, if any.
|
||||
*
|
||||
* @param sender {@link CommandSender} that confirmed the command.
|
||||
* @return True if queued command ran successfully, else false.
|
||||
*/
|
||||
public boolean runQueuedCommand(@NotNull CommandSender sender) {
|
||||
CommandSender targetSender = parseSender(sender);
|
||||
QueuedCommand queuedCommand = this.queuedCommandMap.get(targetSender);
|
||||
if (queuedCommand == null) {
|
||||
sender.sendMessage(ChatColor.RED + "You do not have any commands in queue.");
|
||||
return false;
|
||||
}
|
||||
Logging.finer("Running queued command...");
|
||||
queuedCommand.getAction().run();
|
||||
return removeFromQueue(targetSender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Since only one command is stored in queue per sender, we remove the old one.
|
||||
*
|
||||
* @param sender The {@link CommandSender} that executed the command.
|
||||
* @return True if queue command is removed from sender successfully, else false.
|
||||
*/
|
||||
public boolean removeFromQueue(@NotNull CommandSender sender) {
|
||||
CommandSender targetSender = parseSender(sender);
|
||||
QueuedCommand previousCommand = this.queuedCommandMap.remove(targetSender);
|
||||
if (previousCommand == null) {
|
||||
Logging.finer("No queue command to remove for sender %s.", targetSender.getName());
|
||||
return false;
|
||||
}
|
||||
previousCommand.getExpireTask().cancel();
|
||||
Logging.finer("Removed queue command for sender %s.", targetSender.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* To allow all CommandBlocks to be a common sender with use of {@link DummyCommandBlockSender}.
|
||||
* So confirm command can be used for a queued command on another command block.
|
||||
*
|
||||
* @param sender The sender to parse.
|
||||
* @return The sender, or if its a command block, a {@link DummyCommandBlockSender}.
|
||||
*/
|
||||
@NotNull
|
||||
private CommandSender parseSender(@NotNull CommandSender sender) {
|
||||
Logging.fine(sender.getClass().getName());
|
||||
if (isCommandBlock(sender)) {
|
||||
Logging.finer("Is command block.");
|
||||
return COMMAND_BLOCK;
|
||||
}
|
||||
return sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the sender is a command block.
|
||||
*
|
||||
* @param sender The sender to check.
|
||||
* @return True if sender is a command block, else false.
|
||||
*/
|
||||
private boolean isCommandBlock(@NotNull CommandSender sender) {
|
||||
return sender instanceof BlockCommandSender
|
||||
&& ((BlockCommandSender) sender).getBlock().getBlockData() instanceof CommandBlock;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.onarandombox.MultiverseCore.commandtools.queue;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Used by {@link CommandQueueManager}, so different commands block can be recognised as one.
|
||||
*/
|
||||
class DummyCommandBlockSender implements CommandSender {
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String message) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String[] messages) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Server getServer() {
|
||||
return Bukkit.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getName() {
|
||||
return "DummyCommandBlockSender";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NotNull String name) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NotNull Permission perm) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NotNull String name) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NotNull Permission perm) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttachment(@NotNull PermissionAttachment attachment) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculatePermissions() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2020. *
|
||||
* 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.commandtools.queue;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a single command used in {@link CommandQueueManager} for confirming before running potentially
|
||||
* dangerous action.
|
||||
*/
|
||||
public class QueuedCommand {
|
||||
|
||||
private static final String DEFAULT_PROMPT_MESSAGE = "The command you are trying to run is deemed dangerous.";
|
||||
private static final int DEFAULT_VALID_TIME = 10;
|
||||
|
||||
private final CommandSender sender;
|
||||
private final Runnable action;
|
||||
private final String prompt;
|
||||
private final int validDuration;
|
||||
private BukkitTask expireTask;
|
||||
|
||||
public QueuedCommand(CommandSender sender, Runnable action) {
|
||||
this(sender, action, DEFAULT_PROMPT_MESSAGE, DEFAULT_VALID_TIME);
|
||||
}
|
||||
|
||||
public QueuedCommand(CommandSender sender, Runnable action, String prompt) {
|
||||
this(sender, action, prompt, DEFAULT_VALID_TIME);
|
||||
}
|
||||
|
||||
public QueuedCommand(CommandSender sender, Runnable action, int validDuration) {
|
||||
this(sender, action, DEFAULT_PROMPT_MESSAGE, validDuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new queue command, to be registered at {@link CommandQueueManager#addToQueue(QueuedCommand)}.
|
||||
*
|
||||
* @param sender The sender that ran the command needed for confirmation.
|
||||
* @param action The logic to execute upon confirming.
|
||||
* @param prompt Question to ask sender to confirm.
|
||||
* @param validDuration Duration in which the command is valid for confirm in seconds.
|
||||
*/
|
||||
public QueuedCommand(CommandSender sender, Runnable action, String prompt, int validDuration) {
|
||||
this.sender = sender;
|
||||
this.action = action;
|
||||
this.prompt = prompt;
|
||||
this.validDuration = validDuration;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
CommandSender getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
String getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
||||
int getValidDuration() {
|
||||
return validDuration;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
Runnable getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
BukkitTask getExpireTask() {
|
||||
return expireTask;
|
||||
}
|
||||
|
||||
void setExpireTask(@NotNull BukkitTask expireTask) {
|
||||
if (this.expireTask != null) {
|
||||
throw new IllegalStateException("This queue command already has an expire task. You can't register twice!");
|
||||
}
|
||||
this.expireTask = expireTask;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Manager queuing of dangerous commands in need of confirmation.
|
||||
*/
|
||||
package com.onarandombox.MultiverseCore.commandtools.queue;
|
|
@ -1,115 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
|
||||
* 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.configuration;
|
||||
|
||||
/**
|
||||
* A {@link String} config-property that will NOT be saved to the config.
|
||||
*/
|
||||
public class ActiveStringConfigProperty implements MVActiveConfigProperty<String> {
|
||||
private String name;
|
||||
private String value;
|
||||
private String method;
|
||||
private String help;
|
||||
|
||||
public ActiveStringConfigProperty(String name, String defaultValue, String help) {
|
||||
this.name = name;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.parseValue(defaultValue);
|
||||
}
|
||||
|
||||
public ActiveStringConfigProperty(String name, String defaultValue, String help, String method) {
|
||||
this(name, defaultValue, help);
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setMethod(String methodName) {
|
||||
this.method = methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getPropertyClass() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.setValue(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(String value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link Boolean} config-property.
|
||||
*/
|
||||
public class BooleanConfigProperty implements MVActiveConfigProperty<Boolean> {
|
||||
private String name;
|
||||
private Boolean value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
private String method;
|
||||
|
||||
public BooleanConfigProperty(ConfigurationSection section, String name, Boolean defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public BooleanConfigProperty(ConfigurationSection section, String name, Boolean defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.setValue(this.section.getBoolean(this.configNode, defaultValue));
|
||||
}
|
||||
|
||||
public BooleanConfigProperty(ConfigurationSection section, String name, Boolean defaultValue, String configNode, String help, String method) {
|
||||
this(section, name, defaultValue, configNode, help);
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Boolean getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(Boolean value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode, this.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
if (value.toLowerCase().equals("true") || value.toLowerCase().equals("false")) {
|
||||
this.setValue(Boolean.parseBoolean(value));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public void setMethod(String methodName) {
|
||||
this.method = methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class of the object we're looking at.
|
||||
*
|
||||
* @return the class of the object we're looking at.
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getPropertyClass() {
|
||||
return Boolean.class;
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link EnglishChatColor} config-property.
|
||||
*/
|
||||
public class ColorConfigProperty implements MVConfigProperty<EnglishChatColor> {
|
||||
private String name;
|
||||
private EnglishChatColor value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
|
||||
public ColorConfigProperty(ConfigurationSection section, String name, EnglishChatColor defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public ColorConfigProperty(ConfigurationSection section, String name, EnglishChatColor defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.parseValue(this.section.getString(this.configNode, defaultValue.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public EnglishChatColor getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(EnglishChatColor value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode, this.value.getText());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
EnglishChatColor color = EnglishChatColor.fromString(value);
|
||||
if (color == null) {
|
||||
return false;
|
||||
}
|
||||
this.setValue(color);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
|
@ -1,292 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
|
||||
* 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.configuration;
|
||||
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/** A factory to create config properties for a given world. */
|
||||
public class ConfigPropertyFactory {
|
||||
private ConfigurationSection section;
|
||||
|
||||
public ConfigPropertyFactory(ConfigurationSection section) {
|
||||
this.section = section;
|
||||
}
|
||||
|
||||
// Booleans
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public BooleanConfigProperty getNewProperty(String name, boolean defaultValue, String help) {
|
||||
return new BooleanConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public BooleanConfigProperty getNewProperty(String name, boolean defaultValue, String node, String help) {
|
||||
return new BooleanConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ActiveBooleanConfigProperty
|
||||
*
|
||||
* This property will execute 'method' after it has been successfully set.
|
||||
*
|
||||
* @param name The name of this ConifgProperty
|
||||
* @param defaultValue The default value.
|
||||
* @param help What string is shown for help.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param method The method that should be executed.
|
||||
* @return The ActiveStringConfigProperty
|
||||
*/
|
||||
public BooleanConfigProperty getNewProperty(String name, boolean defaultValue, String help, String node, String method) {
|
||||
return new BooleanConfigProperty(this.section, name, defaultValue, help, node, method);
|
||||
}
|
||||
|
||||
// Integers
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public IntegerConfigProperty getNewProperty(String name, int defaultValue, String help) {
|
||||
return new IntegerConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public IntegerConfigProperty getNewProperty(String name, int defaultValue, String node, String help) {
|
||||
return new IntegerConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
// Doubles
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public DoubleConfigProperty getNewProperty(String name, double defaultValue, String help) {
|
||||
return new DoubleConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public DoubleConfigProperty getNewProperty(String name, double defaultValue, String node, String help) {
|
||||
return new DoubleConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @param method The name of the method that's used to set this property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public DoubleConfigProperty getNewProperty(String name, double defaultValue, String node, String help, String method) {
|
||||
return new DoubleConfigProperty(this.section, name, defaultValue, node, help, method);
|
||||
}
|
||||
|
||||
// Strings
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public StringConfigProperty getNewProperty(String name, String defaultValue, String help) {
|
||||
return new StringConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public StringConfigProperty getNewProperty(String name, String defaultValue, String node, String help) {
|
||||
return new StringConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
// Colors
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public ColorConfigProperty getNewProperty(String name, EnglishChatColor defaultValue, String help) {
|
||||
return new ColorConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public ColorConfigProperty getNewProperty(String name, EnglishChatColor defaultValue, String node, String help) {
|
||||
return new ColorConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
// Difficulty
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public DifficultyConfigProperty getNewProperty(String name, Difficulty defaultValue, String help) {
|
||||
return new DifficultyConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public DifficultyConfigProperty getNewProperty(String name, Difficulty defaultValue, String node, String help) {
|
||||
return new DifficultyConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
// GameMode
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public GameModeConfigProperty getNewProperty(String name, GameMode defaultValue, String help) {
|
||||
return new GameModeConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public GameModeConfigProperty getNewProperty(String name, GameMode defaultValue, String node, String help) {
|
||||
return new GameModeConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
// GameMode
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public LocationConfigProperty getNewProperty(String name, Location defaultValue, String help) {
|
||||
return new LocationConfigProperty(this.section, name, defaultValue, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public LocationConfigProperty getNewProperty(String name, Location defaultValue, String node, String help) {
|
||||
return new LocationConfigProperty(this.section, name, defaultValue, node, help);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ConfigProperty.
|
||||
*
|
||||
* @param name The name of this ConfigProperty.
|
||||
* @param defaultValue The default-value.
|
||||
* @param node The name of the configuration-node this ConfigProperty will be stored as.
|
||||
* @param help The text that's displayed when a user failed to set the property.
|
||||
* @param method The name of the method that's used to set this property.
|
||||
* @return The ConfigProperty.
|
||||
*/
|
||||
public LocationConfigProperty getNewProperty(String name, Location defaultValue, String node, String help, String method) {
|
||||
return new LocationConfigProperty(this.section, name, defaultValue, node, help, method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ActiveStringConfigProperty
|
||||
*
|
||||
* This property will execute 'method' after it has been successfully set.
|
||||
* This string will NOT be saved to the config file.
|
||||
*
|
||||
* @param name The name of this ConifgProperty
|
||||
* @param defaultValue The default value.
|
||||
* @param help What string is shown for help.
|
||||
* @param method The method that should be executed.
|
||||
* @param saveToConfig Should the variable save to the config?
|
||||
* @return The ActiveStringConfigProperty
|
||||
*/
|
||||
public ActiveStringConfigProperty getNewProperty(String name, String defaultValue, String help, String method, boolean saveToConfig) {
|
||||
return new ActiveStringConfigProperty(name, defaultValue, help, method);
|
||||
}
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link Difficulty} config-property.
|
||||
*/
|
||||
public class DifficultyConfigProperty implements MVActiveConfigProperty<Difficulty> {
|
||||
private String name;
|
||||
private Difficulty value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
|
||||
public DifficultyConfigProperty(ConfigurationSection section, String name, Difficulty defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public DifficultyConfigProperty(ConfigurationSection section, String name, Difficulty defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.parseValue(this.section.getString(this.configNode, defaultValue.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Difficulty getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(Difficulty value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode, this.value.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
try {
|
||||
return this.setValue(Difficulty.getByValue(Integer.parseInt(value)));
|
||||
} catch (NumberFormatException nfe) {
|
||||
try {
|
||||
return this.setValue(Difficulty.valueOf(value.toUpperCase()));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return "setActualDifficulty";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public void setMethod(String methodName) {
|
||||
// Unused here. This will only ever be setDifficulty.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getPropertyClass() {
|
||||
return Difficulty.class;
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link Double} config-property.
|
||||
*/
|
||||
public class DoubleConfigProperty implements MVActiveConfigProperty<Double> {
|
||||
private String name;
|
||||
private Double value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
private String method;
|
||||
|
||||
public DoubleConfigProperty(ConfigurationSection section, String name, Double defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public DoubleConfigProperty(ConfigurationSection section, String name, Double defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.setValue(this.section.getDouble(this.configNode, defaultValue));
|
||||
}
|
||||
|
||||
public DoubleConfigProperty(ConfigurationSection section, String name, Double defaultValue, String configNode, String help, String method) {
|
||||
this(section, name, defaultValue, configNode, help);
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Double getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(Double value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode, this.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
try {
|
||||
this.setValue(Double.parseDouble(value));
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public void setMethod(String methodName) {
|
||||
this.method = methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class of the object we're looking at.
|
||||
*
|
||||
* @return the class of the object we're looking at.
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getPropertyClass() {
|
||||
return Double.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.onarandombox.MultiverseCore.utils.MaterialConverter;
|
||||
import me.main__.util.SerializationConfig.Property;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
|
||||
import me.main__.util.SerializationConfig.Serializor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Entryfee-settings.
|
||||
*/
|
||||
@SerializableAs("MVEntryFee")
|
||||
public class EntryFee extends SerializationConfig {
|
||||
@Property
|
||||
private double amount;
|
||||
@Property(serializor = EntryFeeCurrencySerializor.class)
|
||||
@Nullable
|
||||
private Material currency;
|
||||
|
||||
private final Material DISABLED_MATERIAL = Material.AIR;
|
||||
|
||||
public EntryFee() {
|
||||
super();
|
||||
}
|
||||
|
||||
public EntryFee(Map<String, Object> values) {
|
||||
super(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void setDefaults() {
|
||||
amount = 0D;
|
||||
currency = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount
|
||||
*/
|
||||
public double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currency
|
||||
*/
|
||||
@Nullable
|
||||
public Material getCurrency() {
|
||||
if (currency == null || currency.equals(DISABLED_MATERIAL)) {
|
||||
return null;
|
||||
}
|
||||
return currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount.
|
||||
* @param amount The new value.
|
||||
*/
|
||||
public void setAmount(double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currency.
|
||||
* @param currency The new value.
|
||||
*/
|
||||
public void setCurrency(@Nullable Material currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public static final class EntryFeeCurrencySerializor implements Serializor<Material, Object> {
|
||||
@Override
|
||||
public String serialize(Material material) {
|
||||
return material.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material deserialize(Object o, Class<Material> aClass) {
|
||||
return MaterialConverter.convertTypeString(o.toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link GameMode} config-property.
|
||||
*/
|
||||
public class GameModeConfigProperty implements MVActiveConfigProperty<GameMode> {
|
||||
private String name;
|
||||
private GameMode value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
|
||||
public GameModeConfigProperty(ConfigurationSection section, String name, GameMode defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public GameModeConfigProperty(ConfigurationSection section, String name, GameMode defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.parseValue(this.section.getString(this.configNode, defaultValue.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public GameMode getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(GameMode value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode, this.value.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
try {
|
||||
return this.setValue(GameMode.getByValue(Integer.parseInt(value)));
|
||||
} catch (NumberFormatException nfe) {
|
||||
try {
|
||||
return this.setValue(GameMode.valueOf(value.toUpperCase()));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return "setActualGameMode";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public void setMethod(String methodName) {
|
||||
// Not required. Gamemode will only ever be one.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getPropertyClass() {
|
||||
return GameMode.class;
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link Integer} config-property.
|
||||
*/
|
||||
public class IntegerConfigProperty implements MVConfigProperty<Integer> {
|
||||
private String name;
|
||||
private Integer value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
|
||||
public IntegerConfigProperty(ConfigurationSection section, String name, Integer defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public IntegerConfigProperty(ConfigurationSection section, String name, Integer defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.setValue(this.section.getInt(this.configNode, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(Integer value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode, this.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
try {
|
||||
this.setValue(Integer.parseInt(value));
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* A {@link Location} config-property.
|
||||
*/
|
||||
public class LocationConfigProperty implements MVActiveConfigProperty<Location> {
|
||||
private String name;
|
||||
private Location value;
|
||||
private String configNode;
|
||||
private ConfigurationSection section;
|
||||
private String help;
|
||||
private String method;
|
||||
|
||||
public LocationConfigProperty(ConfigurationSection section, String name, Location defaultValue, String help) {
|
||||
this(section, name, defaultValue, name, help);
|
||||
}
|
||||
|
||||
public LocationConfigProperty(ConfigurationSection section, String name, Location defaultValue, String configNode, String help) {
|
||||
this.name = name;
|
||||
this.configNode = configNode;
|
||||
this.section = section;
|
||||
this.help = help;
|
||||
this.value = defaultValue;
|
||||
this.setValue(this.getLocationFromConfig(defaultValue));
|
||||
}
|
||||
|
||||
public LocationConfigProperty(ConfigurationSection section, String name, Location defaultValue, String configNode, String help, String method) {
|
||||
this(section, name, defaultValue, configNode, help);
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean parseValue(String value) {
|
||||
Location parsed = LocationManipulation.stringToLocation(value);
|
||||
return this.setValue(parsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getConfigNode() {
|
||||
return this.configNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return this.help;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(Location value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
this.value = value;
|
||||
this.section.set(configNode + ".x", this.value.getX());
|
||||
this.section.set(configNode + ".y", this.value.getY());
|
||||
this.section.set(configNode + ".z", this.value.getZ());
|
||||
this.section.set(configNode + ".pitch", this.value.getPitch());
|
||||
this.section.set(configNode + ".yaw", this.value.getYaw());
|
||||
this.section.set(configNode + ".world", this.value.getWorld().getName());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Location getLocationFromConfig(Location defaultValue) {
|
||||
double x = this.section.getDouble(this.configNode + ".x", defaultValue.getX());
|
||||
double y = this.section.getDouble(this.configNode + ".y", defaultValue.getY());
|
||||
double z = this.section.getDouble(this.configNode + ".z", defaultValue.getZ());
|
||||
double pitch = this.section.getDouble(this.configNode + ".pitch", defaultValue.getPitch());
|
||||
double yaw = this.section.getDouble(this.configNode + ".yaw", defaultValue.getYaw());
|
||||
String w = this.section.getString(this.configNode + ".world", defaultValue.getWorld().getName());
|
||||
Location found = LocationManipulation.stringToLocation(w + ":" + x + "," + y + "," + z + ":" + yaw + ":" + pitch);
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return LocationManipulation.strCoordsRaw(this.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
@Override
|
||||
public void setMethod(String methodName) {
|
||||
this.method = methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class of the object we're looking at.
|
||||
*
|
||||
* @return the class of the object we're looking at.
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getPropertyClass() {
|
||||
return Location.class;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
|
||||
* 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.configuration;
|
||||
|
||||
/**
|
||||
* An "active" {@link MVConfigProperty} that uses the specified method to be "actually" set.
|
||||
* @param <T> The type of the config-property.
|
||||
* @see MVConfigProperty
|
||||
*/
|
||||
public interface MVActiveConfigProperty<T> extends MVConfigProperty<T> {
|
||||
/**
|
||||
* Gets the method that will be executed.
|
||||
*
|
||||
* @return The name of the method in MVWorld to be called.
|
||||
*/
|
||||
String getMethod();
|
||||
|
||||
/**
|
||||
* Sets the method that will be executed.
|
||||
*
|
||||
* @param methodName The name of the method in MVWorld to be called.
|
||||
*/
|
||||
void setMethod(String methodName);
|
||||
|
||||
/**
|
||||
* Returns the class of the object we're looking at.
|
||||
* @return the class of the object we're looking at.
|
||||
*/
|
||||
Class<?> getPropertyClass();
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.LoggablePlugin;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/*
|
||||
* This is a mess, so I'm just going to suppress all warnings here.
|
||||
* BEGIN CHECKSTYLE-SUPPRESSION: ALL
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated This isn't used any more, is it?
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class MVConfigMigrator {
|
||||
|
||||
public List<String> createdDefaults = new ArrayList<String>();
|
||||
|
||||
public abstract boolean migrate(String name, File folder);
|
||||
|
||||
protected final void migrateListItem(Configuration newConfig, Configuration oldConfig, String key, String oldProperty, String newProperty) {
|
||||
List<String> list = Arrays.asList(oldConfig.getString("worlds." + key + oldProperty).split(","));
|
||||
if (list.size() > 0) {
|
||||
if (list.get(0).length() == 0) {
|
||||
list = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
newConfig.setProperty("worlds." + key + newProperty, list);
|
||||
}
|
||||
|
||||
protected final File detectMultiverseFolders(File folder, LoggablePlugin mvPlugin) {
|
||||
File oldFolder = null;
|
||||
mvPlugin.log(Level.INFO, "Starting Multiverse Configuration Migrator(MVCM)!");
|
||||
// They still have MV 1 installed! Good!
|
||||
if (mvPlugin.getServer().getPluginManager().getPlugin("MultiVerse") != null) {
|
||||
mvPlugin.log(Level.INFO, "Found MultiVerse 1. Starting Config Migration...");
|
||||
Plugin plugin = mvPlugin.getServer().getPluginManager().getPlugin("MultiVerse");
|
||||
oldFolder = plugin.getDataFolder();
|
||||
} else {
|
||||
// They didn't have MV 1 enabled... let's try and find the folder...
|
||||
File[] folders = folder.getParentFile().listFiles();
|
||||
List<File> folderList = Arrays.asList(folders);
|
||||
for (File f : folderList) {
|
||||
if (f.getName().equalsIgnoreCase("MultiVerse")) {
|
||||
mvPlugin.log(Level.INFO, "Found the MultiVerse 1 config folder. Starting Config Migration...");
|
||||
oldFolder = f;
|
||||
}
|
||||
}
|
||||
if (oldFolder == null) {
|
||||
mvPlugin.log(Level.INFO, "Did not find the MV1 Folder. If you did not have MultiVerse 1 installed and this is the FIRST time you're running MV2, this message is GOOD. ");
|
||||
mvPlugin.log(Level.INFO, "If you did, your configs were **NOT** migrated! Go Here: INSERTURLFORHELP");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return oldFolder;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* END CHECKSTYLE-SUPPRESSION: ALL
|
||||
*/
|
|
@ -1,67 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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.configuration;
|
||||
|
||||
/**
|
||||
* A generic config-property.
|
||||
*
|
||||
* @param <T> The type of the config-property.
|
||||
*/
|
||||
public interface MVConfigProperty<T> {
|
||||
/**
|
||||
* Gets the name of this property.
|
||||
*
|
||||
* @return The name of this property.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the value of this property.
|
||||
*
|
||||
* @return The value of this property.
|
||||
*/
|
||||
T getValue();
|
||||
|
||||
/**
|
||||
* Gets the string representation of this value.
|
||||
*
|
||||
* @return The value of this property as a string.
|
||||
*/
|
||||
String toString();
|
||||
|
||||
/**
|
||||
* Gets the help string for this.
|
||||
*
|
||||
* @return The value of this property as a string.
|
||||
*/
|
||||
String getHelp();
|
||||
|
||||
/**
|
||||
* Sets the value of this property.
|
||||
*
|
||||
* @param value The T representation of this value.
|
||||
* @return True the value was successfully set.
|
||||
*/
|
||||
boolean setValue(T value);
|
||||
|
||||
/**
|
||||
* This parseValue should be used with strings.
|
||||
*
|
||||
* @param value The string representation of the value to set.
|
||||
*
|
||||
* @return True if the value was set, false if not.
|
||||
*/
|
||||
boolean parseValue(String value);
|
||||
|
||||
/**
|
||||
* Gets the name of the config-node that this {@link MVConfigProperty} is saved as.
|
||||
*
|
||||
* @return The name of the config-node that this {@link MVConfigProperty} is saved as.
|
||||
*/
|
||||
String getConfigNode();
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
|
||||
/**
|
||||
* Just like a regular {@link Location}, however {@code world} is usually {@code null}
|
||||
* or just a weak reference and it implements {@link ConfigurationSerializable}.
|
||||
*/
|
||||
@SerializableAs("MVSpawnLocation")
|
||||
public class SpawnLocation extends Location implements ConfigurationSerializable {
|
||||
private Reference<World> worldRef;
|
||||
|
||||
public SpawnLocation(double x, double y, double z) {
|
||||
super(null, x, y, z);
|
||||
}
|
||||
|
||||
public SpawnLocation(double x, double y, double z, float yaw, float pitch) {
|
||||
super(null, x, y, z, yaw, pitch);
|
||||
}
|
||||
|
||||
public SpawnLocation(Location loc) {
|
||||
this(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return (this.worldRef != null) ? this.worldRef.get() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setWorld(World world) {
|
||||
this.worldRef = new WeakReference<World>(world);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Chunk getChunk() {
|
||||
if ((this.worldRef != null) && (this.worldRef.get() != null))
|
||||
return this.worldRef.get().getChunkAt(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
if ((this.worldRef != null) && (this.worldRef.get() != null))
|
||||
return this.worldRef.get().getBlockAt(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
Map<String, Object> serialized = new HashMap<String, Object>(5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
|
||||
serialized.put("x", this.getX());
|
||||
serialized.put("y", this.getY());
|
||||
serialized.put("z", this.getZ());
|
||||
serialized.put("pitch", this.getPitch());
|
||||
serialized.put("yaw", this.getYaw());
|
||||
return serialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let Bukkit be able to deserialize this.
|
||||
* @param args The map.
|
||||
* @return The deserialized object.
|
||||
*/
|
||||
public static SpawnLocation deserialize(Map<String, Object> args) {
|
||||
double x = ((Number) args.get("x")).doubleValue();
|
||||
double y = ((Number) args.get("y")).doubleValue();
|
||||
double z = ((Number) args.get("z")).doubleValue();
|
||||
float pitch = ((Number) args.get("pitch")).floatValue();
|
||||
float yaw = ((Number) args.get("yaw")).floatValue();
|
||||
return new SpawnLocation(x, y, z, yaw, pitch);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import me.main__.util.SerializationConfig.Property;
|
||||
import me.main__.util.SerializationConfig.SerializationConfig;
|
||||
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
|
||||
/**
|
||||
* Spawning-Settings.
|
||||
*/
|
||||
@SerializableAs("MVSpawnSettings")
|
||||
public class SpawnSettings extends SerializationConfig {
|
||||
@Property
|
||||
private SubSpawnSettings animals;
|
||||
@Property
|
||||
private SubSpawnSettings monsters;
|
||||
|
||||
public SpawnSettings() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SpawnSettings(Map<String, Object> values) {
|
||||
super(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDefaults() {
|
||||
animals = new SubSpawnSettings();
|
||||
monsters = new SubSpawnSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the animal-settings
|
||||
*/
|
||||
public SubSpawnSettings getAnimalSettings() {
|
||||
return animals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the monster-settings
|
||||
*/
|
||||
public SubSpawnSettings getMonsterSettings() {
|
||||
return monsters;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue