Compare commits

...
872 Commits
Author SHA1 Message Date
benwoo1110 3072699aca Fix wildcard imports. 2021-02-09 15:15:23 +08:00
benwoo1110 d33176add5 Update to latest 1.16.5-R0.1-SNAPSHOT dependency.
This will break support for 1.14 and below.

* Add minidev json dependency.
* Remove use of travel agent.
2021-02-08 17:37:14 +08:00
benwoo1110 2c98fc7d90 Merge branch 'main' into 5.0.0 2021-02-08 17:08:06 +08:00
nicegamer7 89fd700e32 Merge pull request #2489 from benwoo1110/world-UID
Adds world UID and generator details to /mvinfo command
2021-01-17 12:36:27 -05:00
benwoo1110 035f3644ad Merge branch 'main' into 5.0.0 2021-01-08 18:19:29 +08:00
Ben Woo 001a6000f8 Merge pull request #2515 from Multiverse/update_bstats
Update bStats Metrics Class
2020-12-20 12:10:52 +08:00
Kermina Awad bf61069fed update bStats Metrics class 2020-12-19 22:17:04 -05:00
Ben Woo d93def8b5b Merge pull request #2503 from Multiverse/getplayerexact
Use getPlayerExact in favour of getPlayer.
2020-12-14 10:28:58 +08:00
nicegamer7 540394e266 Merge pull request #2505 from benwoo1110/logging
Update to all use static logging.
2020-12-12 09:58:19 -05:00
benwoo1110 425b1c80cc Update to all use static logging. 2020-12-12 10:49:49 +08:00
Kermina Awad 47ae6f5378 use getPlayerExact instead of getPlayer 2020-12-11 12:48:19 -05:00
Alexander Krantz ed80083fe8 Fix null location when teleporting to own playerbed destination. (#2487)
* Fix teleporting to a the calling player's bed

* Change name to my-bed to prevent collisions with player names

* Re-add old player bed for backwards compatibility

* Remove second bed destination name

* Give constant more sensible name
2020-11-27 12:58:11 +08:00
Ben Woo d041e0a8d1 Merge pull request #2490 from benwoo1110/fix-tags
Update issue template with new tags.
2020-11-25 11:44:16 +08:00
benwoo1110 de85be5832 Update issue template with new tags. 2020-11-25 11:41:57 +08:00
Ben Woo 81d59d8bf5 Update issue template to use paste.gg (#2450)
* Update issue template to use paste.gg

* Update to show paste.gg as link
2020-10-27 11:56:18 -04:00
Jeremy Wood 0c2d2f4e0a One more test for the webhook... 2020-10-08 02:38:34 -04:00
Jeremy Wood 3d9108fb48 Minor change to test webhooks on new base branch. 2020-10-08 02:35:30 -04:00
Jeremy Wood f41337f8a8 Bumped version to 5.0.0-SNAPSHOT for development of next major version. 2020-10-08 02:24:07 -04:00
Jeremy Wood 25c616bc32 Bumped version to 4.2.3-SNAPSHOT for continued development. 2020-10-08 02:21:13 -04:00
Jeremy Wood 148187025a Release version 4.2.2. 2020-10-08 00:38:58 -04:00
Jeremy Wood 115b0dc078 Dump full version output in multifile pastes. 2020-10-07 23:52:43 -04:00
Jeremy Wood 78bf6ba3bf Merge pull request #2442 from Multiverse/version_command_typo
Correct a Typo in VersionCommand
2020-10-07 23:33:13 -04:00
Kermina Awad e31c391af4 correct a typo in VersionCommand 2020-10-07 23:15:21 -04:00
Jeremy Wood 6ed4be9a64 Move back to '\n' line separators in version command. 2020-10-07 23:12:50 -04:00
Jeremy Wood d626e7e4b1 Merge pull request #2429 from benwoo1110/green-warning
More noticable warning for deprecated event
2020-10-07 22:41:54 -04:00
Jeremy Wood e7dd4fee51 Merge pull request #2430 from benwoo1110/clone-cleanup
Remove uneeded variables from clone method
2020-10-07 22:41:01 -04:00
Ben Woo 146075de69 Loads unloaded world before deleting (#2431)
* Loads unload world before deleting

Fixes issue where unloaded worlds can't be deleted.

* Missing commit line smh
2020-10-07 22:38:45 -04:00
Jeremy Wood 9fce6c54f6 Merge pull request #2435 from Multiverse/webpaste
Fix Double Prefix when Logging Version Info
2020-10-07 22:37:22 -04:00
Ben Woo f189eb3b7e Fix issue template label (#2437)
* Fix issue template label

* Remove "type: " from label
2020-10-07 22:32:32 -04:00
benwoo1110 ed77cacb1a Adds generator detail to /mvinfo command 2020-10-07 21:00:40 +08:00
Kermina Awad 2d4fe301cf fix double prefix when logging version info 2020-10-06 16:26:20 -04:00
Jeremy Wood e5fe1fe565 Bump version to 4.2.2-SNAPSHOT for continued development. 2020-10-06 15:46:37 -04:00
Jeremy Wood 83010f1a28 Release version 4.2.1. 2020-10-06 15:08:13 -04:00
Jeremy Wood 864e50e38c Add TestingMode util. 2020-10-06 15:07:56 -04:00
Jeremy Wood 0a99258f3e Bump version to 4.2.1-SNAPSHOT for continued development. 2020-10-06 15:01:42 -04:00
benwoo1110 cfae997de4 Adds world UID to /mvinfo command 2020-10-07 00:39:08 +08:00
benwoo1110 b345baf20e Remove uneeded variables from clone method 2020-10-06 21:12:18 +08:00
benwoo1110 d532052c7b More noticable warning for deprecated event
Add green color to the warning
2020-10-06 20:47:41 +08:00
Jeremy Wood 1c02fb4387 Release version 4.2.0. 2020-10-06 01:45:11 -04:00
Jeremy Wood 2a99649e1e Merge pull request #2426 from Multiverse/webpaste
Make it Easier to Upload Files with the Version Event
2020-10-06 01:24:33 -04:00
Kermina Awad 994bf922af make it easier to upload files with the version event 2020-10-06 00:47:33 -04:00
Ben Wooandwben1110 36094e2bea Disallow world names with spaces (#2393)
* Disallowed world names with spaces

* Fixed wildcard imports

* Use Pattern regex check for worldname validation

Co-authored-by: wben1110 (desktop) <unconfigured@null.spigotmc.org>
2020-10-05 23:58:18 -04:00
Jeremy Wood 6243b41956 Merge pull request #2421 from benwoo1110/issue-tag
Added auto label and config.yml to issue template
2020-10-05 21:02:06 -04:00
benwoo1110 32170cc089 Added auto label and config.yml to issue template 2020-10-05 16:39:16 +08:00
Jeremy Wood c1a3d48944 Merge pull request #2420 from benwoo1110/plugin.yml-update
Updated plugin.yml commands and some missing alias
2020-10-05 01:34:31 -04:00
nicegamer7 75855826e7 Cleanup webpaste code (#2411) 2020-10-05 01:25:15 -04:00
Jeremy Wood d35363b10c Merge pull request #2103 from blubberdiblub/make-saved-anchors-locale-insensitive
Ensure anchors are saved in a machine-readable way
2020-10-05 00:36:19 -04:00
Jeremy Wood ad1b733498 Merge pull request #2379 from rti/master
load cloned world with doLoad() instead of addWorld() (fixes #2378)
2020-10-05 00:29:25 -04:00
benwoo1110 9159dfbb7d Updated plugin.yml commands and some missing alias 2020-10-05 00:28:48 +08:00
Robert Timm b8acd339b3 load cloned world with doLoad() instead of addWorld() (fixes #2378) 2020-10-02 10:01:54 +02:00
nicegamer7 51e035eb3e Update GameMode command and increase Java support. (#2279)
* update gamerule command

* fix NPE in gamerules command and remove deprecated method

* catch buscript initialization errors

* update gamerule command to be more descriptive

* undo GameruleCommand style changes

* update legacy version reporting to include all config options

* use LF line ending for files being pasted to the web

* avoid duplicate code
2020-09-22 15:02:03 -04:00
Jeremy Wood 2fd8e3edc3 Merge pull request #2406 from Jadiction/patch-1
A, not an :P
2020-09-15 15:06:16 -04:00
Jad faf20ee36e A, not an :P 2020-09-10 18:09:58 -05:00
benwoo1110andwben1110 e1494808f3 Fixed inability to clone due to unable to copy session.lock (#2392)
* Added ability to exclude files when copying folders

* Remove wildcard imports

* Added unit testing for ignoring files as well

Co-authored-by: wben1110 (desktop) <unconfigured@null.spigotmc.org>
2020-08-27 08:47:57 -04:00
benwoo1110 05cf052204 Add GitHub issue templates (#2385)
* Added issue templates

* Fixed a typo

* Added more details to template

Added dev build link

Need to enter `/server` output

Declaration that issue is reproducible with only mv plugins

* Added capitalization to issue title
2020-08-26 13:34:37 -04:00
Jeremy Wood 242f05fc77 Merge pull request #2288 from Multiverse/webpaste
Rework Webpaste Package
2020-07-28 20:50:08 -04:00
Jeremy Wood dd29fcc1dd Merge pull request #2315 from Multiverse/another_metric_fix
Don't Report Generator Settings
2020-07-28 20:41:07 -04:00
Kermina Awad d5013546d1 don't report generator settings 2020-06-29 11:40:01 -04:00
Kermina Awad 058c0837f0 bring multi-file pastes to parity with single file pastes 2020-06-14 16:04:58 -04:00
Kermina Awad e01c646562 add paste.gg paste service 2020-06-14 16:04:17 -04:00
Jeremy Wood 3afca50930 Merge pull request #2289 from Multiverse/ammed_bstats
Correct Metric Reports
2020-06-13 18:52:43 -04:00
Kermina Awad 94ca18e95c correct some metrics 2020-06-13 14:20:36 -04:00
Kermina Awad 707eae92a8 improve javadocs, also, no need to make implementations public 2020-06-13 10:36:30 -04:00
Kermina Awad b4a4519876 no need for protected access modifier 2020-06-13 10:36:25 -04:00
Kermina Awad 4f41b7aa6e rework webpaste package 2020-06-13 10:36:21 -04:00
Kermina Awad b9267a3dfc update version command description 2020-06-13 10:36:16 -04:00
Kermina Awad a53c4214f0 add extra space for readability 2020-06-13 10:36:08 -04:00
Kermina Awad 343695e23e add notice as to why pasting to GitHub is disabled 2020-06-13 10:36:04 -04:00
Kermina Awad e17e9c8ce9 rename GithubPasteService as GitHubPasteService 2020-06-13 10:36:00 -04:00
Kermina Awad 676c3a2e3d make pasting more system agnostic 2020-06-13 10:35:58 -04:00
Kermina Awad e821611744 fix pasting to hastebin 2020-06-13 10:35:55 -04:00
Kermina Awad d69c492577 cleanup GitHub and Pastebin paste services 2020-06-13 10:35:53 -04:00
Kermina Awad eb91eefc80 fix BitlyURLShortener 2020-06-13 10:35:49 -04:00
Kermina Awad f570c81366 update version command 2020-06-13 10:35:47 -04:00
Jeremy Wood b3f23278b1 Yay for tests that use method names in strings. -.- 2020-06-13 02:01:41 -04:00
Jeremy Wood 3fa2bfa7cf Merge pull request #2280 from Multiverse/bstats
Fixes #2252, implements #1918.
2020-06-13 01:20:29 -04:00
Jeremy Wood 582d6bef1a Readd world count metric as multiline chart (for future use). 2020-06-13 01:17:00 -04:00
Jeremy Wood 04c65cc59e Cleanup new metrics implementation. (#2286)
* Refactor metrics initialization into its own class.

* Simplify the creation of metrics.

* Clean up new metrics.

* Refactor out duplicate metrics code.
2020-06-13 00:51:18 -04:00
Kermina Awad 268c4982c3 update metric implementations 2020-06-12 23:50:17 -04:00
Kermina Awad 8983a0c024 add vault as softdepend 2020-06-07 19:31:51 -04:00
Kermina Awad 1cbe901e4d lead dev should be the first author listed 2020-06-06 13:38:03 -04:00
Kermina Awad 4894abd1f1 switch to bStats 2020-06-06 13:36:53 -04:00
nicegamer7 1fac13247f Fix Travis Builds for Pull Requests (#2208)
* fix travis

* I don't think we need this

* we don't use circleci anymore
2020-05-06 13:07:48 -04:00
Jeremy Wood 59cfacf007 Merge pull request #2227 from A248/patch-1
Fix NPE for invalid world argument in gamerule cmd
2020-05-05 21:19:42 -04:00
Jeremy Wood 5f916fbf27 Merge pull request #2242 from wellnesscookie/master
Fixes alias not clearing after cloning the world
2020-05-05 21:14:12 -04:00
wellnesscookie c70e254dbf Fixes alias not clearing after cloning the world
This will rather set an alias to an empty string which will automatically be resulted in alias being as same as the name of the cloned world.
Previously, it was not working as intended and kept the alias of the oldWorld.
2020-04-30 20:43:11 +02:00
A248 9d42a05759 Fix NPE for invalid world argument in gamerule cmd
Stumbled upon an NPE when using /mv gamerule. I realised it was because I had specified a nonexistent world. This will fix it.
2020-04-16 18:31:23 -04:00
Niels Boehm 46f8453b5b Ensure archors are saved in a machine-readable way
`locationToString()` is primarily used by the AnchorManager to persist
anchors to disk (the other use is for logging).

In a locale that uses periods as decimal separator, this works fine and
the anchors can be loaded when the server restarts.

However, in a locale that doesn't use periods (but commas, for instance)
this produces an `anchors.yml` that cannot be parsed when loaded.

Tying the string formatting in `locationToString()` to an English locale
makes it behave as expected, regardless of the external locale setting.
2019-09-23 14:54:35 +02:00
Jeremy Wood b4b0940918 Added additional configuration option to disable the donation messages. 2019-08-26 13:47:54 -04:00
Jeremy Wood 22ad7214b0 Made the donation messages at startup hidden with silent start. 2019-08-26 13:47:26 -04:00
Jeremy Wood 1ba693ffd5 Bumped version to 4.1.1-SNAPSHOT for continued development. 2019-08-23 15:38:51 -04:00
Jeremy Wood 6ee0d8a05e Release version 4.1.0. 2019-08-23 15:28:06 -04:00
Jeremy Wood d3ff2922fd World cloning should work once again! Resolves #1978. 2019-08-23 15:27:45 -04:00
Jeremy Wood 5e2824abeb Prevent importing worlds without .dat file. Fixes #1917. 2019-08-15 21:15:45 -04:00
Jeremy Wood 926e23bf19 Removed super dated toString in plugin main class. 2019-08-02 21:49:11 -04:00
Jeremy Wood 841598232c Added --include-plugin-list to mv version command. 2019-07-31 00:25:34 -04:00
Jeremy Wood 540b6abcab Now using CommandHandler 11! 2019-07-30 23:48:32 -04:00
Jeremy Wood 38d5917915 Added debug mode change event. 2019-07-30 23:03:51 -04:00
Jeremy Wood da6bd20b42 Bumped version to 4.1.0-SNAPSHOT for incoming features. 2019-07-30 22:10:48 -04:00
Jeremy Wood 8859fa78fd Bumped core protocol to 24. 2019-07-30 22:09:14 -04:00
Jeremy Wood 4de6b9ce47 Bumped version to 4.0.2-SNAPSHOT for continued development. 2019-07-30 21:50:37 -04:00
Jeremy Wood f595f4cdb9 Release version 4.0.1. 2019-07-23 21:47:40 -04:00
Jeremy Wood 1581e1e009 Make TravelAgent warning message a debug message. 2019-07-23 21:47:13 -04:00
Jeremy Wood 7cb9bd4bc2 Added message acknowledging deprecated event. 2019-07-23 21:46:23 -04:00
Jeremy Wood 32e72bb355 Bump version to 4.0.1 for continued development. 2019-06-25 13:34:08 -04:00
Jeremy Wood 950402a144 Release version 4.0.0. 2019-06-25 13:33:20 -04:00
Jeremy Wood f598551d9c Merge pull request #2019 from Brokkonaut/master
Phantoms are monsters
2019-06-16 23:57:30 -04:00
Brokkonaut c3f08318d4 Phantoms are monsters 2019-06-17 05:48:02 +02:00
Jeremy Wood f0343b08b5 Merge pull request #2001 from Brokkonaut/fix-javadocs-setcurrency
Fix javadocs: setCurrency(Material) instead of setCurrency(int)
2019-06-04 12:04:14 -04:00
Jeremy Wood 20a1fcb9f5 Bump protocol version to 23. 2019-06-04 10:08:35 -04:00
Jeremy Wood 253ede1c9a Wrap the travel agent in an adapter. 2019-06-04 10:08:11 -04:00
Jeremy Wood d4454703e4 Bumped version to 4.0.0-SNAPSHOT for 1.14 updates. 2019-06-04 09:15:34 -04:00
Jeremy Wood 9737b62813 Bump version to 3.0.0 for release. 2019-06-04 09:11:01 -04:00
Brokkonaut 06bd1a838f Fix javadocs: it is now setCurrency(Material) instead of setCurrency(int) 2019-05-21 19:15:14 +02:00
BaronyCraft 4343167240 allow coord arguments to setspawn command (#1975)
* allow coord arguments to setspawn command

* Implement PR changes as requested
2019-03-14 20:20:49 -04:00
Jeremy Wood 7762aca019 Removed commons-io as compile dependency to fix weird pom issues. 2019-02-02 00:53:51 -05:00
Jeremy Wood 6ebc1188e8 Removed unnecessary json dependency. 2019-01-31 22:09:09 -05:00
Jeremy Wood 8b358b0955 Don't send mvv url response to console twice when run from console. 2019-01-31 22:03:11 -05:00
Jeremy Wood b201b09719 Added a theoretically working Hastebin option for mvv output. 2019-01-31 22:02:13 -05:00
Jeremy Wood 4c9d108f08 Disabled github paste service. 2019-01-31 21:31:39 -05:00
Jeremy Wood 564a7d3684 Removed pastie paste service. 2019-01-31 21:26:12 -05:00
Jeremy Wood d832e9e6d9 Updated vault dependency to 1.7. 2019-01-31 21:21:50 -05:00
Jeremy Wood aa574b6236 Cleaned up the pom a bit and fixed some dependency shading issues. 2019-01-31 21:19:23 -05:00
Jeremy Wood d7894eb847 Fix another NPE in MaterialConverter. 2019-01-30 10:11:43 -05:00
Jeremy Wood 5e067fa72d Fixes NPE in MaterialConverter. 2019-01-30 08:53:40 -05:00
Jeremy Wood b1bf68a0ad Wtf... why was this still here. 2019-01-30 01:02:55 -05:00
Jeremy Wood 89a8f24b14 Welcome to fully semantic versioning with 3.0.0-SNAPSHOT. 2019-01-30 00:38:44 -05:00
Jeremy Wood 43ecdc913a Add null type annotations to MaterialConverter. 2019-01-30 00:19:26 -05:00
Jeremy Wood 0f14ee557d Make Bukkit dependency scope provided. 2019-01-30 00:14:16 -05:00
Jeremy Wood 9b88d1d491 Updated logging library to 1.1.1. 2019-01-29 23:54:58 -05:00
Jeremy Wood 606a3fa3ce Added MaterialConverter util class for type id conversions. 2019-01-29 23:46:40 -05:00
Jeremy Wood a7cace0fdc Fixed potential NPE. 2019-01-28 19:43:13 -05:00
Jeremy Wood ae314108a3 Removed deprecated MVConfigProperty and MVActiveConfigProperty. 2019-01-27 21:34:26 -05:00
Brokkonaut d0180f05d5 Option to disable the automatic purge of entities (#1933) 2019-01-25 13:16:29 -05:00
Jeremy Wood 07df8d0d09 Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2019-01-24 21:23:24 -05:00
Jeremy Wood 4552f70f7e Shade in id converter. 2019-01-24 21:22:56 -05:00
Jeremy Wood a6912c3cb5 Added api-version: 1.13 to plugin.yml.
Should fix #1958
2019-01-24 09:28:03 -05:00
Jeremy Wood 4bdeacfd05 Updated testing dependencies and maven plugins. 2019-01-24 01:00:42 -05:00
Jeremy Wood 01f549f408 Updated Multiverse-Core for Bukkit 1.13.2. 2019-01-23 23:50:47 -05:00
Jeremy Wood f7bbb5029b Bumped protocol to 22. 2019-01-23 22:29:49 -05:00
Jeremy Wood 658b5219c3 Bumped version to 2.7.0-SNAPSHOT. 2019-01-23 22:29:12 -05:00
Jeremy Wood fb505ab161 Bumped version to 2.6.1-SNAPSHOT for continued development. 2018-07-23 14:16:29 -04:00
Jeremy Wood 284b3179ad Version 2.6.0 release. 2018-07-23 14:15:44 -04:00
Jeremy Wood 532ffacf5a Added relativity options to ExactDestination. Implements #1892. 2018-02-22 18:11:12 -05:00
Jeremy Wood 2b4d386eb2 Removed unnecessary for #1836. 2017-07-13 15:47:43 -04:00
Jeremy Wood bc20ecbe60 Hotfix for #1836. 2017-07-12 22:58:33 -04:00
Jeremy Wood 4878395460 Bumped protocol version to 21 for upcoming addition of Kotlin lib. 2017-07-09 18:54:49 -04:00
Jeremy Wood 467ec809b5 Bump version to 2.6.0-SNAPSHOT for significant incoming changes. 2017-07-09 18:53:50 -04:00
Jeremy Wood ceb6850670 Bump version to 2.5.1. 2017-07-09 11:36:23 -04:00
Jeremy Wood 63abf33414 Config travis and circle for Java 8. Resolves #1834 2017-07-09 11:30:45 -04:00
Jeremy Wood bcd7fcaee7 Build for Java 8. Might fix Travis and Circle... 2017-07-09 09:36:39 -04:00
Jeremy Wood d18581828d Exclude old Bukkit from SerializationConfig. 2017-07-09 09:36:02 -04:00
Jeremy Wood 54209e1535 Testing new webhook 2017-06-17 01:03:22 -04:00
Jeremy Wood 2ed59a866f Updated to Buscript 2.0.
This reduces the size of the plugin jar by over ONE MEGABYTE!!
2017-06-16 22:08:51 -04:00
Jeremy Wood 41b3096600 Now building against MC 1.12. 2017-06-16 21:55:09 -04:00
Jeremy Wood 42adfa8175 Bumped version to 2.5.1-SNAPSHOT for continued development. 2017-06-01 21:07:56 -04:00
Jeremy Wood 12bcf71028 Updated to 2.5.0 for release. 2017-06-01 20:25:04 -04:00
Jeremy Wood a826d0b2ff Build against spigot-api 1.11.2-R0.1-SNAPSHOT. 2017-06-01 20:20:10 -04:00
Jeremy Wood 59cab8a417 Remove relative paths from potentially imported worlds. 2017-04-05 16:07:31 -04:00
RezzedUp da6a62b984 Remove relative paths from potentially imported worlds.
Before, relative paths that left the server's root directory were
accepted. Now, the world name has all relative-path components trimmed
off.
2017-04-05 00:44:00 -05:00
Jeremy Wood 806c5909c4 Updated plugin.yml. Can't believe I haven't done this sooner. 2017-02-11 00:07:28 -05:00
Eric Stokes c00847f173 If we're gonna use TravisCI it should at least use JDK7 now. 2016-11-19 21:35:54 -07:00
Eric Stokes 626e5d3e4b Added the autogenerated dependency-reduced-pom.xml to the .gitignore 2016-11-19 18:43:49 -07:00
Eric Stokes f5e8a9c2e8 Fixed deprecated assertTrue call in TestInstanceCreator 2016-11-19 15:44:07 -07:00
Eric Stokes 3364709e53 Fixed deprecated use (since it's going away in 1.11)
* MultiverseCore constructor shouldn't be deprecated, it just needed a fix.
* Removed TestPluginLoader, it should have been mocked anyway.
* New constructor takes a JavaPluginLoader instad of a PluginLoader, so
  we'll have to mock.

You can't win, Java. If you make it `final`, I shall become more powerful
than you can possibly imagine.
2016-11-19 15:43:44 -07:00
Eric Stokes 67d172fd08 Removed redundantThrows checkstyle rule, it's gone in 6.2+
See: checkstyle/checkstyle#473
2016-11-19 14:30:04 -07:00
Eric Stokes f3a420d85c Added additional properties to the test checks for world properties 2016-11-19 14:18:12 -07:00
rlf aba1f05c5b Misc documentation fixes from @rlf 2016-11-19 14:17:26 -07:00
rlf 8fdc0ad3da Fixed failing tests (thanks @rlf)
* This is the test fixing portion of PR#1746
* This fixes using a HashMap and relying on the order of the values.
2016-11-19 13:51:11 -07:00
Eric Stokes 3db57ee1d9 Move to Java 7 (Maybe java 8 soon...)
* Also bump CH to v10, which uses Java 7
* Probably don't use this build, I have to test it first...
2016-11-19 13:02:19 -07:00
httpdop b3841adcc1 Update dependencies and versions 2016-11-06 11:14:10 +01:00
Liam 0b0b3c0088 Updated Vault repo
New vault repo is here: http://nexus.hc.to/content/repositories/pub_releases
2016-10-26 23:49:30 +01:00
Jeremy Wood a64a8d9605 Perhaps the id was important? 2016-05-03 10:58:30 -04:00
Jeremy Wood 0a0d3ba527 Added snapshot repo to distro management. 2016-05-03 10:48:06 -04:00
Jeremy Wood a351fbb345 Moving to new version numbers - 2.5.0-SNAPSHOT 2016-05-03 10:45:32 -04:00
Eric Stokes 46359cfbfe Fixes #1678 anchor list doesn't obey enforceaccess 2016-03-12 15:51:16 -07:00
Eric Stokes f52004cb76 Removed deprecated use of scheduleAsyncDelayedTask 2016-03-12 15:10:27 -07:00
Eric Stokes 0e3848874a Added support for version command to upload to gist.github.com 2016-03-12 15:10:07 -07:00
Eric Stokes 71ba31a0f4 Fixed spacing of spigotmc repo in POM 2016-03-12 13:00:29 -07:00
Eric Stokes 7b1e77340b Removed deprecated use of loadConfiguration
The new method properly uses the Reader class and resolves the reason
for deprecation, the lack of encoding support.
2016-03-12 13:00:05 -07:00
Eric Stokes bebd4742b9 Fixed shortened links pointing to wiki pages that didn't exist anymore 2016-03-06 21:01:44 -07:00
Eric Stokes b933027523 #1672 Fixed typo that made animal lists behave like monster lists 2016-03-06 21:01:16 -07:00
Eric Stokes bd1d852393 #1671 Fixed lists changing not forcing validation of the elements 2016-03-06 20:59:18 -07:00
Eric Stokes 648365f336 #1671 Fixed incorrect WorldPropertyValidator type 2016-03-06 20:56:04 -07:00
Jeremy Wood 12b6a69146 Use latest spigot-api. Also switched to compile scope... 2016-03-02 11:33:39 -05:00
Jeremy Wood cd312c3ab9 Updated used version of MC stats. 2016-02-29 20:04:26 -05:00
Jeremy Wood d2d243caec Deny import of "plugins" and "logs" folder as a world. Should fix #1655 2016-02-15 10:40:07 -05:00
Jeremy Wood 865434d1b1 Don't accept null worlds from the server. Addresses #1649. 2016-02-04 09:39:30 -05:00
Romarjosh Villamor 0858e324dd Added Spigot Dependency and repository 2016-01-30 04:01:53 -08:00
Jeremy Wood 618986e216 Parse difficulty safely. Fixes #1634. 2015-12-17 09:16:18 -05:00
Jeremy Wood cc3dfe9fd4 Bumped protocol version to 20. 2015-10-28 20:12:25 -04:00
Jeremy Wood 6ee8466ac0 Updated Vault dependency to VaultAPI 1.5.
May break backwards compatibility with old Vault (Probably pre 1.4)
2015-10-28 20:10:03 -04:00
Jeremy Wood 3b7dd21440 Added Economist methods to get and set balances. 2015-10-28 20:02:39 -04:00
JBYoshi 528dc25fcb Update cloneWorld().
- Make it actually work.
- Support for unloaded worlds - saves memory!
- The Thread code seems unnecessary since the main thread just waits for it to finish, so I'm removing it.
- Added cloneWorld(String, String).
- Deprecate the old cloneWorld() method.
Closes #1436
Closes #1491

Due to some limitations, I have to temporarily load the old world in
order to properly clone. However, **no chunks are loaded during this
process.**
2015-10-27 22:06:56 -04:00
Jeremy Wood 762d8e3ebb Added possible fix for dependency issues on build. 2015-10-23 12:36:54 -04:00
Simon Rigby ef251c256d Merge pull request #1618 from Multiverse/Fix-Travis-Codehaus
Fix Travis-CI failing for Codehaus Dependencies
2015-10-23 17:16:30 +01:00
Simon Rigby da3015c72c Fix Travis-CI failing for Codehaus Dependencies 2015-10-23 17:11:59 +01:00
Jeremy Wood 601f457e6f Removed mcstats.org repo since it appears to be offline. 2015-09-22 08:50:27 -04:00
Jeremy Wood ec805f38d7 Updated protocol version to 19. 2015-09-22 08:40:18 -04:00
Jeremy Wood 61710369f4 Minor tweaks to new economy system. 2015-07-14 15:47:20 -04:00
Liam 4824d53fab Merge pull request #1593 from TWSSYesterday/Update#1
Changing words
2015-07-14 20:26:57 +01:00
Liam 65cc817573 Changing words
mc-region-fixer instead of chunkster because it's the only one that works of the two.
2015-07-14 20:24:18 +01:00
Jeremy Wood 9bb7dd6e5d Removed AllPay dependency and implemented the new MVEconomist which is used to delegate all economy matters of importance to Multiverse. 2015-07-14 15:00:33 -04:00
Jeremy Wood fadb3280e3 Updated testing framework to work with bukkit changes. 2015-07-14 14:50:47 -04:00
Jeremy Wood b64dfa34af Updated Who command for bukkit changes. 2015-07-14 13:44:44 -04:00
Jeremy Wood 584a81fac6 Updated Bukkit dependency to 1.8.7-R0.1-SNAPSHOT. 2015-07-14 11:40:58 -04:00
Jeremy Wood 4233e4f8b4 Don't try to handle events for worlds we don't own in MVPortalListener. Fixes #1589. 2015-07-13 12:16:36 -04:00
Jeremy Wood 28da4aac2f Allows a valid location to be set. Fixes #1579.
Credit to tuskiomi for discovering this issue.
2015-06-10 13:46:38 -04:00
Jeremy Wood c37dd803c8 Fixed up commons-io dependencies. 2014-08-21 13:14:14 -04:00
TWSSYesterday 27abb55006 Fix
Fixed.
2014-06-17 12:19:39 +01:00
TWSSYesterday c607aa1c47 Colouring added as well as general grammar cleanup
Rephrased some messages, and added colour when there is no world folder found.
2014-06-17 12:12:52 +01:00
Jeremy Wood 79f8f6bd55 Merge pull request #1437 from jflory7/patch-1
Corrected command example to proper command
2014-05-20 15:34:08 -04:00
Justin F. 1446dd936a Corrected command example to proper command
Tiny usage error here – I noticed it on my server and figured I'd make a pull request for this minor error. :)
2014-05-16 23:17:33 -04:00
Jeremy Wood 8664f56eeb Now correctly handles portalForm for end and nether portals! Fixes #1394. 2014-03-18 12:41:15 -04:00
Jeremy Wood 1c2514d5db keepSpawnInMemory will use fallback value in more scenarios. Fixes #1392. 2014-03-18 10:07:24 -04:00
Jeremy Wood 34c8b7cf0b Possibly fixed the pvp/difficulty property issue! 2014-02-26 17:01:48 -05:00
Jeremy Wood 63af4370b5 Now using CommandHandler version 8. 2014-02-20 10:07:16 -05:00
Jeremy Wood 832e0f6497 Once again managing teleportation into MV worlds from non-MV worlds. Fixes #1385. 2014-02-19 16:58:48 -05:00
Jeremy Wood b198942742 Merge pull request #1384 from antiroot/patch-1
Added missing space in log output for Teleport command
2014-02-18 15:06:30 -05:00
antiroot b60250287e Update TeleportCommand.java
Missing spaces in log output for TeleportResult.FAIL_UNSAFE case
2014-02-18 10:41:48 -06:00
Jeremy Wood 86ba242f33 Added entryfee.amount alias and possibly corrected alias currency. Should fix #1201. 2014-02-08 13:29:19 -05:00
Jeremy Wood 0639d39d5a Now including the correct metrics package for shading. Fixes #1376. 2014-02-07 10:49:45 -05:00
Jeremy Wood ee745f8a55 Updated vault. 2014-02-06 22:22:18 -05:00
Jeremy Wood 243fc8bc20 Updated metrics. 2014-02-06 22:22:06 -05:00
Jeremy Wood 807730805c Updated bukkit version. 2014-02-06 22:20:13 -05:00
Jeremy Wood c8abdf00b5 Merge pull request #1021 from Multiverse/custom-teleporters
Custom teleporters.
2014-02-06 22:16:29 -05:00
Jeremy Wood 21aaf4a03e Non-default worlds will now no longer initially load their spawn chunks if keepSpawnInMemory is false. Fixes #1079 2014-02-06 13:12:14 -05:00
Jeremy Wood 8ea639eba8 Removed deprecated UpdateChecker. 2014-02-05 16:39:14 -05:00
Eric Stokes a7e6fd1412 Update Travis CI to use openjdk6 to build, since the Oracle one is gone. 2013-12-14 11:40:11 +04:30
Jeremy Wood 636b8289f6 Made creating amplified worlds a little more intuitive. 2013-12-10 15:14:36 -05:00
main() 79290eed0d Merge pull request #1230 from main--/ryantheleach-playerbeds
Closes #1070.
2013-06-15 03:25:16 -07:00
Jeremy Wood 9f927605da Now actually allows world names with periods. 2013-05-27 14:35:32 -04:00
Jeremy Wood e69b5a6b17 Merge pull request #1205 from bloodmc/master
Added World Load/Unload Event listeners to support Forge in MCPC.
2013-05-24 09:25:03 -07:00
bloodshot cbe6c2c901 Added World Load/Unload Event listeners to support Forge.
* Added extra check to WorldManager.doLoad to check parent folder when
loading worlds. This is required by Forge since the world container is not
MC root but the overworld root.
2013-05-24 11:47:02 -04:00
main() 875685b705 Merge pull request #1150 from DerFlash/prefixchat
added config option to change the format for prefixchat
2013-04-29 11:58:28 -07:00
Björn Teichmann ad6f0d1b62 added config option to change the format for prefixchat 2013-04-08 09:47:29 +02:00
main() 4a66a2f5bb If the debug level is >= 1: stacktrace 2013-03-18 18:02:55 +01:00
main() a8040abd52 "Not MV's fault"-Message for getChunkGenerator()
If a plugin, for whatever weird reason, gets loaded and enabled correctly,
but just getDefaultWorldGenerator() throws, people might think it's MV's
fault. Not anymore.
2013-03-18 17:27:03 +01:00
Jeremy Wood 72a14719ac Now using apache commons for file operations. Hopefully we will get more success with deleting and copying stuff. May fix Inventories test failures. 2013-03-11 15:35:05 -04:00
main() 2b827a1fae Style fixes. 2013-03-02 13:13:24 +01:00
main() e45520c43b Update checkstyle. 2013-03-02 13:13:09 +01:00
main() 0fb33d12d6 Now mocking plugin.getLogger() in the tests.
Fixes the test issues with AllPay.
2013-03-02 12:31:31 +01:00
main() ebe44ed99e Fixed the GenericBank imports 2013-03-02 12:24:05 +01:00
Jeremy Wood 23ba7fe73b Updated to AllPay 13. 2013-02-26 09:49:38 -05:00
Jeremy Wood 4efa97ee0e Removing deprecated getMVConfiguration() method because I suspect it could be related to some issues. 2013-02-20 13:56:24 -05:00
Ryan Leach ce80fc190d Inital extra bed commit with back-compatibility
Needs review and permissions advice before continuing.

line ending derp

---

Modified by @main--:
 * formatting fixed
 * removed changes to travis.yml and gitattributes
 * improved code style
2013-02-15 18:34:58 +01:00
Jeremy Wood 8bfe3a5473 Don't try to set search radius when portal travel agent is null. Fixes #1072. 2013-02-04 15:15:52 -05:00
Jeremy Wood 07a38e3e58 Should fix issue where gamemode/flight change on /reload of server due to permission issues. 2013-01-02 13:20:52 -05:00
Jeremy Wood 360c63fad9 Updated to AllPay 11 2013-01-02 11:44:38 -05:00
Jeremy Wood 2a5edc4f91 Added argument check to setBlockSafety. 2012-12-27 16:02:46 -05:00
main() dba21cadaf Custom teleporters. 2012-12-26 20:09:09 +01:00
main() fa9191dd8f The message now CLEARLY states that it's not Multiverse's fault. 2012-12-22 15:26:20 +01:00
main() 4043d5abcb Getting the generator is now wrapped in a try block.
The Bukkit API calls a plugin method. If that method throws exceptions, they fall through right into our face and then Bukkit blames us. Not good.
Thanks andrewkm for mentioning this.
2012-12-22 00:53:03 +01:00
Jeremy Wood eff56f74da Changed the default portal search radius back to match vanilla's 128 instead of 16. 2012-12-21 10:14:45 -05:00
Jeremy Wood d97a9bccde Now building against Vault 1.2.20 which is hosted on our own repo now. 2012-12-13 08:50:32 -05:00
Jeremy Wood 55741b524d Added bats to animals for the time being. Fixes #996 2012-12-10 23:27:55 -05:00
Jeremy Wood 186d3f15a4 Woo, Travis.ci! 2012-12-10 12:04:26 -08:00
Jeremy Wood 841f6f05df Added "/mv gamerule" and "/mv gamerules" for setting and listing game rules per world. Fixes #987. 2012-12-03 15:05:58 -05:00
Jeremy Wood ebc2a516bb Added world property 'allowFlight' to disable flying per world. Does not have an override permission yet. Adds #440. 2012-12-03 11:59:01 -05:00
Jeremy Wood 9e029ad6ae Maps can now be made for non default worlds! Fixes #972 2012-11-30 13:08:15 -05:00
main() b2135a8f42 Added world seed to the info command.
Fixes #627.
2012-11-28 14:39:07 +01:00
Jeremy Wood 8cbffd1cee Now building against Bukkit 1.4.5-R0.2 2012-11-27 15:59:24 -05:00
Jeremy Wood ff22077adf New worlds now use the correct scale. Fixes #979. 2012-11-27 14:09:33 -05:00
Jeremy Wood 60c0a1ab92 Fixed world spawns not keeping pitch + yaw. Fixes #976 2012-11-23 12:30:11 -05:00
Jeremy Wood 58eeecbcb8 Fixed issue where Multiverse always checks block safety to fix world spawns on startup/reload. 2012-11-23 11:49:14 -05:00
Jeremy Wood 876456b932 Fixed up some migration issues caused by WorldProperties refactor. Fixes #968. 2012-11-19 14:05:07 -05:00
Jeremy Wood 18db50ca56 MVWorld now throws IllegalStateException when it cannot obtain a world reference. This should help pinpoint the source of sometimes cryptic exceptions elsewhere. 2012-11-15 13:49:11 -05:00
Jeremy Wood cce1ccc967 Now caches the world properties before unloading the world in order to prevent NPE on unload then load. Really fixes #947. 2012-11-15 09:30:19 -05:00
Jeremy Wood e5537dd8f1 "mv regen" now respects world type! 2012-11-14 20:55:12 -05:00
Jeremy Wood 0c7ba2ae67 Fixed tests for entity purger changes. 2012-11-14 15:52:21 -05:00
Jeremy Wood bbfc672582 Improved world purger debug. 2012-11-14 15:19:09 -05:00
Jeremy Wood a65dc4966b Now removes projectiles shot by the entities removed by the purger. Should fix #958. 2012-11-14 15:11:55 -05:00
Jeremy Wood 4780f87278 Now uses world UUID to retrieve world reference. 2012-11-14 14:24:10 -05:00
Jeremy Wood b11d911e4a Newly created END worlds will now use a scale of 16. This will result in people ending up invariably closer to the end island when teleporting in while using MV-NetherPortals. 2012-11-14 13:58:08 -05:00
Jeremy Wood 155aad8bf2 Multiverse now uses it's own portal search radius by default (16 blocks instead of bukkit's 128). 2 new configuration options added to adjust this behaviour. 2012-11-14 13:52:37 -05:00
Jeremy Wood 6e1d4ef961 Block safety debugging moved to finest level. 2012-11-14 12:52:33 -05:00
Jeremy Wood cfa5a04e3a Fixes #960 2012-11-14 09:08:04 -05:00
Jeremy Wood 7d1c47c2fc Shifted world properties to its own class WorldProperties so we can now only initialize an MVWorld if there is a 'more solid' world reference. Let's hope this works! Should fix #947 2012-11-13 17:30:35 -05:00
Jeremy Wood 957c55955d Now using SerializationConfig 1.7 2012-11-13 13:39:22 -05:00
main() 0226ab9609 Style again. 2012-11-06 17:52:29 +01:00
Jeremy Wood b888561d98 Added package-private method for setting MVWorld plugin and name. Fixes #923. 2012-11-05 13:08:37 -05:00
Jeremy Wood f210851294 Changed how we deal with CB world reference. Partially fixes #923. 2012-11-05 13:02:03 -05:00
main() 73e394d5ec Style. 2012-11-05 16:40:06 +01:00
Jeremy Wood 63f8811b67 Fixed #942. 2012-11-05 09:05:11 -05:00
Jeremy Wood d01ce71343 Fixed #935. 2012-10-31 08:31:07 -04:00
Jeremy Wood fe00aae7e3 Fixes #934 - Vault dependency issue. 2012-10-30 08:45:05 -04:00
Jeremy Wood d4347d0cff Fixed incorrect log level. 2012-10-25 15:48:28 -03:00
Jeremy Wood b033d59b8a Optimized some log messages and change some Level.INFO messages to Level.CONFIG for the new silent start mode. Fixes #697. 2012-10-25 14:36:44 -04:00
Jeremy Wood aedbfd7bab Added command "mv silent [on|off]" for enabling silent startup mode. 2012-10-25 14:35:22 -04:00
Jeremy Wood b93822502e Reverted debug command. 2012-10-25 14:02:01 -04:00
Jeremy Wood f053f0546b Now using Logging 1.0.9! 2012-10-25 13:56:57 -04:00
Jeremy Wood af3b3d0fab Added ability to set debug level to -1 to disable common startup messages. 2012-10-25 10:43:57 -04:00
Jeremy Wood b1fa677330 Now using Logging 1.0.8 2012-10-25 10:35:27 -04:00
main() 9691a0f978 Merge pull request #931 from ammaraskar/limit
Add player limit per world. Closes #727.
2012-10-25 02:11:29 -07:00
Ammar Askar 0b1a387003 Add player limit per world. Addresses #727 2012-10-25 14:02:27 +05:00
Jeremy Wood 4ce503f55e Cow using EnumSet for maximum performance!!!! 2012-10-23 14:26:09 -04:00
main() 74947a7efd Fixed all other style warnings 2012-10-23 16:58:16 +02:00
main() 85cd71cb8a Fixed high priority style warnings 2012-10-23 16:49:08 +02:00
Jeremy Wood 3ad7d86f74 Deprecated DebugLog. 2012-10-22 17:40:39 -04:00
Jeremy Wood ac9194ec87 Now building with SerializationConfig 1.6c, finally fixes weird config exception messages. 2012-10-22 17:35:06 -04:00
main() 96e8208f3d Merge branch 'ammaraskar_folder' 2012-10-22 19:08:15 +02:00
Ammar Askar 895360ce8b Only delete world folder contents on mv regen, fixes #767 2012-10-22 19:06:19 +02:00
main() 59e34ef353 Merge pull request #925 from ammaraskar/entities
Add golems to animals fixes #891
2012-10-22 08:39:44 -07:00
Ammar Askar 11e556c099 Add golems to animals fixes #891 2012-10-22 20:34:01 +05:00
main() a9579a6594 Merge pull request #922 from ammaraskar/spawn
Added configurable animal and monster ticks per spawn setting. Fixes #519
2012-10-22 04:12:42 -07:00
Ammar Askar 5a1fe2a9e5 Added configurable animal and monster ticks per spawn setting. Fixes #519 2012-10-22 13:20:09 +05:00
Eric Stokes 1c5c792cf3 A broadcast is not needed if we're not doing anything 2012-10-21 18:57:54 -06:00
Eric Stokes dbe9494dbf Fixed Bed Spawns
This fixes #652 and fixes #916
This also fixes some other issues with NullPointerExceptions when trying to teleport to a bed if it was invalid.
2012-10-21 18:49:48 -06:00
Jeremy Wood b116effa2b Using HashSet instead of ArrayList for better contains() efficiency. 2012-10-21 17:55:41 -04:00
Jeremy Wood d361ceb45b Increased efficiency/safety of recent /mv who changes. 2012-10-21 17:49:51 -04:00
Eric Stokes 35709f5389 Tell user when creating a duplicate world
Fixes #921
2012-10-21 14:49:56 -06:00
Eric Stokes b45a4cf20a Fix NPCs Showing up in mv who
This fixes #501. FINALLY!

If anyone wants NPCs back, open a ticket, and I'll add a flag, but this is now the default behavior.
2012-10-21 14:22:12 -06:00
Eric Stokes 009ceeeede Fixed #918, Update to RB
Also added a test for #918, I probably need one more (to test that generators DO work) but I just tested that ingame this time.
2012-10-21 13:38:36 -06:00
Jeremy Wood 19fb9df5cf Added online player count / max players to /mv who header 2012-10-21 00:39:13 -04:00
Jeremy Wood 0829df01aa Readded the accidently removed shading of AllPay! 2012-10-20 20:55:56 -04:00
Jeremy Wood 78ac068a3f Fixed world's not charging correctly. Fixes #893. Fixes #777. Possibly fixes #723. That's a 3fer, good buddy. 2012-10-20 20:49:15 -04:00
Jeremy Wood 57da3df860 Added in Vault as the prefered method for checking economy stuff. Will defer to AllPay for item based world costs. 2012-10-20 20:43:58 -04:00
Jeremy Wood 74241e3d9c Updated protocol to 18 for Vault. 2012-10-20 20:12:42 -04:00
Jeremy Wood 6a4921d7d1 MVWorld.toString() now outputs JSON data. 2012-10-20 12:44:50 -04:00
Jeremy Wood 271e5f339e Version command now outputs world information instead of juts count. 2012-10-20 12:44:29 -04:00
Eric Stokes ec89db1bed Update MCSTATS to 1.2-SNAPSHOT
1.0-SNAPSHOT is gone from the repo :(
2012-10-19 23:35:48 -06:00
Jeremy Wood 7346cbe48c Actually enables debug logging when enabled via command. 2012-10-19 15:11:02 -04:00
Jeremy Wood ac3049f3ab Now properly enables debug logging on startup if debug logging should be enabled. 2012-10-19 15:10:36 -04:00
Jeremy Wood e82db95bbc Now using Logging 1.0.6! 2012-10-19 15:10:02 -04:00
Jeremy Wood 0d0f167396 Stopped trying to replace the old DebugLog. 2012-10-18 21:39:43 -04:00
Jeremy Wood b35a0325b8 Now using Logging 1.0.4 2012-10-18 21:19:33 -04:00
Jeremy Wood 3572d3fbe7 Now using Logging 1.0.3! 2012-10-18 15:17:52 -04:00
Jeremy Wood 7304269866 Upgraded to testificated Logging 1.0.2! 2012-10-18 14:46:25 -04:00
Jeremy Wood d7535b0551 replaced logging with com.dumptruckman.minecraft:Logging lib. 2012-10-17 14:23:00 -04:00
main() 0437a4bd92 Why is/was this "Multiverse-Adventure"... 2012-10-17 14:26:40 +02:00
main() d881908ecc Made entity listener use the world purger's logic
This should fix #872 and most other spawning issues.
2012-09-20 20:01:55 +02:00
Jeremy Wood 3715bc8bc5 Should now detect Async chat availability for even better backwards compatibility. 2012-09-05 20:53:59 -04:00
main() a9f00a46f5 Fixed #859
The WhoCommand was handling invisible players incorrectly
2012-08-26 14:47:01 +02:00
Jeremy Wood d9a7275682 Stop checking for null worlds. 2012-08-21 15:06:55 -04:00
Jeremy Wood 80f6a0159c Now using ConcurrentHashMap instead of ReentrantLock for caching player world. 2012-08-21 15:06:33 -04:00
Jeremy Wood f2e1053b88 Now using ConcurrentHashMap instead of locks for worlds Map. 2012-08-21 14:54:49 -04:00
Jeremy Wood e975968637 MVWorld properties now volatile instead of using thread lock. 2012-08-21 14:25:11 -04:00
Jeremy Wood a778d353c4 Config now volatile instead of using thread lock. 2012-08-21 14:19:05 -04:00
Jeremy Wood d40e67b47d Config properties now volatile instead of using thread lock. 2012-08-21 14:17:24 -04:00
Jeremy Wood 9196973d1c Fixed NPE in world loading.. Thanks Grimlock257 for spotting this. 2012-08-21 13:20:13 -04:00
Jeremy Wood 242d20884c Now building against Bukkit 1.3.1-R2.1-SNAPSHOT 2012-08-21 09:16:28 -04:00
main() b909af873d Should fix #847
(NPE in the GeneratorPlotter for worlds with a null generator)
2012-08-20 10:22:39 +02:00
main() e6f7ba5ac9 Fixed the tests 2012-08-18 15:17:17 +02:00
main() 4ecb28b3bb Less duplicate code ... I think. 2012-08-18 15:13:09 +02:00
main() d0ea4168bc Style! 2012-08-18 14:54:18 +02:00
main() fd9464ced1 More anchor permissions (as suggested in #831) 2012-08-18 14:45:15 +02:00
Jeremy Wood 49eb93af2e Once again prints debug mode output to the console 2012-08-15 11:33:16 -04:00
Jeremy Wood 9274570fa4 Added config option for setting whether or not to use async chat. (Default true (uses async)) 2012-08-15 09:27:52 -04:00
Jeremy Wood 319a701a16 Modifying world values now persists again! (When the hell did this break???) 2012-08-14 15:00:08 -04:00
Jeremy Wood 807c8d0f2c Debug setting saves to config now. 2012-08-13 13:52:25 -04:00
Jeremy Wood 29d97274fe Stopped being dumb and denying bukkit of it's precious invisible constraints for ConfigurationSerializable. Fixes #827. 2012-08-13 13:51:42 -04:00
Jeremy Wood eb1dc502cd Now using ReentrantLock instead of synchronized blocks. Should help debug lag issue. 2012-08-11 23:21:58 -04:00
Jeremy Wood 622fb19c4a Using logging instead of System.out... 2012-08-09 09:18:06 -04:00
Jeremy Wood 5705b5b6a0 Added missing import... 2012-08-09 09:15:07 -04:00
main() 1d1a2213c1 Merge branch 'metrics' 2012-08-09 13:43:07 +02:00
Jeremy Wood 4dd3df26a5 Now building against Bukkit-1.3.1-R1.0 2012-08-08 10:56:22 -04:00
main() 39293482d2 Removed duplicate maven source plugin 2012-08-06 18:44:42 +02:00
main() 9813e5f531 MBot's ?internalerror is useful but this is better 2012-08-06 18:41:02 +02:00
main() 48adbec011 dat style
CheckStyle is merciless!
2012-08-06 15:34:01 +02:00
main() a9a5d7467a Fixed world regeneration 2012-08-06 15:17:14 +02:00
main() b8a0891c4c Fixed again... 2012-08-06 12:06:50 +02:00
main() 53567d4646 Hopefully fixed the tests 2012-08-06 11:54:54 +02:00
main() 3395f3d7c7 We shouldn't try to load deleted worlds 2012-08-06 11:29:54 +02:00
Jeremy Wood e197091bb2 Added better support for large biomes. 2012-08-05 15:40:58 -04:00
Jeremy Wood ede0395d39 Mapping the known world of players for Async chat event. 2012-08-05 14:58:24 -04:00
Jeremy Wood 17963964c7 Minor test update. 2012-08-05 14:53:41 -04:00
Jeremy Wood bb0e2e4a2d Tests now using AsyncPlayerChatEvent. 2012-08-05 00:28:00 -04:00
Jeremy Wood ce4e608cf4 MultiverseCoreConfiguration.setDefaults() now protected as it should be. 2012-08-05 00:27:33 -04:00
Jeremy Wood 944f961ee5 Removed synchronization from setDefaults() due to how SerializationConfig operates. 2012-08-05 00:26:55 -04:00
Jeremy Wood 5335e73707 Now using AsyncPlayerChatEvent... let's hope for the best! 2012-08-05 00:11:39 -04:00
Jeremy Wood d05e2b500f Synchronized world properties required by Async chat event. 2012-08-05 00:11:13 -04:00
Jeremy Wood b2f3b74062 Synchronized all access to worlds map in WorldManager. 2012-08-05 00:00:46 -04:00
Jeremy Wood 16e42f6469 Finalized some object in MultiverseCore to help with thread-safe migration. 2012-08-04 23:51:43 -04:00
Jeremy Wood a31dc83635 Synchronized getting/setting of mv config object. 2012-08-04 23:50:01 -04:00
Jeremy Wood 7b99130bfa Synchronized config values to be used in new Async chat event. 2012-08-04 23:43:09 -04:00
Matt H f57468126a Added '/mv clone' command to clone a world. 2012-08-04 14:29:13 -06:00
Jeremy Wood d17fee6b7c Now building against Bukkit 1.3.1-R0.1-SNAPSHOT. 2012-08-03 13:29:55 -04:00
Jeremy Wood 1a943e42a9 Added maven source and javadoc plugins. 2012-08-03 13:28:32 -04:00
Jeremy Wood 2b80ca80ae Bumped protocol from 16 to 17. 2012-07-25 22:10:06 -04:00
Jeremy Wood 24e26bb7d7 Added buscript Javascript library. 2012-07-25 22:09:28 -04:00
Jeremy Wood 6133cf6bdf Bumped protocol from 15 to 16 2012-07-19 21:10:51 -04:00
Jeremy Wood 085c7a1ccc Migrated Multiverse-Adventure's copyFolder() into core. 2012-07-19 21:08:39 -04:00
main() dd0b2137d6 Changes... 2012-07-12 17:34:25 +02:00
main() 8a4ba2a66c Metrics! 2012-07-12 17:24:23 +02:00
Jeremy Wood 3e7841afc9 Don't bother checking economy stuff if it doesn't even cost to enter. 2012-07-03 16:25:56 -04:00
Jeremy Wood 1427671a8c Bumped version to 2.5... this should have been done a while ago. 2012-07-03 15:49:38 -04:00
Jeremy Wood a15317e21d Removed many instances of String.format in favor of higher performance inline concatenation. We should prune many more of these as well. 2012-07-03 15:48:57 -04:00
main() b10a37f232 Added compatibility check to MultiversePlugin 2012-06-26 20:11:24 +02:00
main() 144de09423 Added the abstract class MultiversePlugin. 2012-06-26 17:29:34 +02:00
main() a60e4e06e1 DebugLog: No more duplicates and you can now modify the log-tag. 2012-06-26 17:26:10 +02:00
Jeremy Wood 9eccf93b66 Probably fixes #707. 2012-06-20 10:18:52 -03:00
main() 220f6a31de Should fix #738. 2012-06-16 10:27:27 +02:00
main() 8cb4f22467 Improved EnglishChatColor and added the "style" world-property.
Closes #732.
2012-06-13 15:58:17 +02:00
Jeremy Wood a2a2594f5a Properly closed debug.log for unit tests by calling onDisable(). 2012-06-12 12:51:36 -04:00
Jeremy Wood 87df407743 You can once again set animals/monsters via /mvm set. 2012-06-07 17:08:47 -04:00
Jeremy Wood cf007f091a Stop creating a new map every time we want property aliases. 2012-06-07 15:44:32 -04:00
Jeremy Wood 680c35e0dc Moved migration debug message to correct location. 2012-06-07 14:52:28 -04:00
Jeremy Wood 1a385c21d7 Removed leftover debug message. 2012-06-07 14:51:43 -04:00
Jeremy Wood cced74d4b0 Suppress stacktraces thrown when migrating worlds.yml. Fixes #700. 2012-06-07 14:50:37 -04:00
Jeremy Wood 1db555581b DebugLog now extends Logger. 2012-06-07 13:26:22 -04:00
Jeremy Wood 63e0c028d9 Slightly improved debugging for worlds migration. 2012-06-07 12:55:32 -04:00
main() ee82dc213f Merge pull request #691 from heisan213/patch-1
Prevent NPE when teleporting to a world not made by MV.
2012-05-22 11:14:30 -07:00
heisan213 d2c09b9d33 Prevent NPE when teleporting to a world not made by MV. 2012-05-22 19:25:32 +03:00
main() 21a3eeacc8 That's the way it should be. 2012-05-03 16:20:59 +02:00
main() 48768b5d6c Now all properties are settable ingame. (bugfix) 2012-05-02 16:25:40 +02:00
main() 96294c092c Wrong default value... 2012-05-01 19:10:51 +02:00
main() 9a3fde2f13 Saving keepSpawnInMemory to config file 2012-05-01 19:08:07 +02:00
main() 6520a31938 Fixed spawnlocation migration 2012-05-01 18:52:05 +02:00
main() f1779c9e68 Shame on me. -.- 2012-05-01 18:46:47 +02:00
main() 9cc35d7b12 public 2012-05-01 18:08:51 +02:00
main() 02347e05d8 Fixed UOE when temporarily saving the NullLocation to the config 2012-05-01 17:43:05 +02:00
main() a4196a901a Fixed spawn location loading 2012-05-01 17:00:05 +02:00
main() 9b2dd0d6c9 Forgot some values, fixed allowweather migration 2012-05-01 16:49:40 +02:00
Jeremy Wood 0efb28be19 Properly close all input/output streams! 2012-05-01 10:47:20 -04:00
main() 5d9941d073 Why is 'null' deserialized to "null" instead of null!? 2012-05-01 15:31:10 +02:00
main() 82cfbaba4e Fixed NPE in migrateWorldConfigs() 2012-05-01 12:48:45 +02:00
main() 9868c66cdb Added migrators. Needs testing. 2012-05-01 12:42:48 +02:00
main() 3a32857683 MethodLength deserves only a warning and why should we count empty lines!? 2012-05-01 12:42:01 +02:00
main() d7a3e1839e Should fix environment, seed and generator-issues. 2012-05-01 12:23:04 +02:00
main() 1496d940bf Merge pull request #547 from Multiverse/mvworld-plus-serializationconfig-equals-awesome
MVWorld + SerializationConfig = Awesome
2012-04-30 13:54:37 -07:00
Jeremy Wood bd57ec19d2 Now building against Bukkit 1.2.5-R1.0 2012-04-18 14:58:05 -03:00
Jeremy Wood da54f9769b Stop giving up immediately on the first failed file deletion and continue deleting files recursively. 2012-04-06 14:54:48 -04:00
Jeremy Wood 2e4b814d6d Added one extra tidbit of logging for GameMode enforcement. 2012-04-03 12:00:02 -04:00
Eric Stokes 3f93fb3648 Add new param to the PTPE, Don't die if we don't find or can't access bukkit.yml 2012-03-18 17:26:24 -06:00
main() 176e729a87 Ignoring TestWorldCreation.
TestInstanceCreator.tearDown() doesn't remove 'fish.world' correctly from the worlds.yml (fixed in mvworld-plus-serializationconfig-equals-awesome)
*cough* @FernFerret *cough*
2012-03-17 12:32:55 +01:00
main() 62f79e7592 Disabled Spout support because we aren't using it 2012-03-17 12:27:50 +01:00
main() f60f770b98 Fixed #578
Another iPhone-commit...
2012-03-16 07:33:35 +01:00
Eric Stokes 3c434d18e3 Bump AllPay Version 2012-03-13 22:24:49 -06:00
Eric Stokes c9b52c81a6 Add some neat debug to Permissions 2012-03-12 20:58:58 -06:00
Eric Stokes 5be6ea2766 Use the fromstring in entity type 2012-03-10 10:29:44 -07:00
main() 98f5e1e4ee This IS fixed! 2012-03-10 17:41:53 +01:00
main() de6fc6481e Merge branch 'master' into mvworld-plus-serializationconfig-equals-awesome
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java
2012-03-10 14:03:04 +01:00
main() dcc6b828a8 Unused imports. 2012-03-10 13:59:04 +01:00
Eric Stokes 7da91f7875 Fix NPE with players and purging, Update AP and CH 2012-03-10 00:32:26 -07:00
Eric Stokes d84f930a54 Fix purging removing the player entity
...and lots of other bad stuff...
2012-03-09 23:45:10 -07:00
main() bdd5e8bd91 Now shortening the URL in /mvv using bit.ly! 2012-03-08 17:59:25 +01:00
main() d1280a9031 Some fixes + added tests. 2012-03-07 19:59:20 +01:00
main() 08b8f01c44 Bugfix: We shouldn't check access-perms if enforceaccess is off! 2012-03-04 20:38:26 +01:00
main() fd227960b9 Now correctly saving worlds 2012-03-04 20:21:42 +01:00
main() 0efc0b965b Fixed removeWorldFromConfig(String). 2012-03-04 19:53:40 +01:00
main() bbe134bd1a Dots in world-names are now possible! :D 2012-03-04 19:36:14 +01:00
main() 91f7debb08 MVWorld + SerializationConfig = Awesome
Yes, I did it.
2012-03-04 16:08:09 +01:00
main() 871a601e37 General cleanup. 2012-03-03 17:07:07 +01:00
main() bd7ad20b7b Fixed the tests.
Why is this option even on by default...
2012-03-02 21:22:12 +01:00
main() 873d878252 Build fixed. Bukkit, I hate breaking changes!
However, this is not tested *at all*. Try it if you're brave enough ^^
2012-03-01 16:55:37 +01:00
main() 8c63cac4c5 I'm walking...
(Yes, I'm doing this on my iPhone)
Should fix #530.
2012-03-01 13:12:09 +01:00
main() 283913010f Now using SerializationConfig v1.3 2012-02-26 16:45:23 +01:00
main() 109582335b Missing javadoc. 2012-02-25 14:59:33 +01:00
main() 3f09fbd710 Fixed the world-purger using the names from the new EntiyType-enum.
Closes #478.
Should fix #482.
Poor sheep.
2012-02-25 14:48:36 +01:00
main() ccb96ead10 Nasty bugs are nasty. 2012-02-25 13:11:21 +01:00
Eric Stokes 5c48899d92 Add initial support for enforcing access better 2012-02-23 20:15:10 -07:00
Eric Stokes 5f5d7084fa Add **much** better mv check command 2012-02-22 20:22:37 -07:00
Eric Stokes 7b9c26d40a Cleanup logging a bit, state when core is allowing players to access 2012-02-21 17:45:29 -07:00
Eric Stokes 0c96da48f9 Allow Spawner eggs to override settings 2012-02-21 16:58:36 -07:00
Eric Stokes fbbe031b2c Fix for method deprecations in R5 2012-02-21 05:25:59 -07:00
main() 868ac57a4a Removed TODOs in deprecated classes. There's nothing left to be done there. 2012-02-06 19:25:34 +01:00
main() 7c21a114db Fixed a bug in the info-command.
Information about the player's current world was shown when he entered an invalid world-name.
2012-02-06 17:19:51 +01:00
main() e7573d3bd7 Rewrote the who-command. Fixes #467. 2012-02-06 17:19:50 +01:00
main() 772d5a222d Unused import... 2012-02-06 17:19:44 +01:00
Eric Stokes 9eaca3e093 Bump to 2.4 2012-02-05 21:57:31 -07:00
Eric Stokes 2eb61af76f Remove Structures and Types from import
Fixes #466
2012-02-05 20:32:09 -07:00
Eric Stokes ad9d4e41ff Remove EGG, that's for chickens, silly. 2012-02-05 00:10:36 -07:00
Eric Stokes 6a2e0e5810 Fix Portals being blocked in End
This Fixes #463
This is caused by a bug in Bukkit/Bukkit@b2364780cb see line 38 of EntityCreatePortalEvent
2012-02-04 23:46:40 -07:00
Eric Stokes a9c6582487 Fix bypass perms. Fixes #443
I had a typo and didn't add the parent perms :(

Sorry about this big breakage... should be fixed.
2012-02-04 18:06:50 -07:00
Eric Stokes b66028e0e0 Lots of cleanup prepping for 2.3AB 2012-02-04 17:40:12 -07:00
Eric Stokes 3ac4e55dc2 Minor bug fixed preparing for 2.3
Fix chatPrefix -> chatprefix
Fix portalcooldown -> teleportcooldown
Fix made teleportcooldown show up in the config
Add New warnings to the default.
2012-02-04 10:14:58 -07:00
Eric Stokes 950991ff1b Removed old checks, cleanup poop
Add in the deprecated config method to not break other plugins
Fix handling of unloaded worlds in info and list
2012-02-04 09:10:56 -07:00
main() a1b07065b2 Merge branch 'master' of github.com:Multiverse/Multiverse-Core into config-changes
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
	src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java
	src/main/java/com/onarandombox/MultiverseCore/commands/ConfigCommand.java
	src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java
	src/main/resources/defaults/config.yml
2012-02-04 15:19:37 +01:00
main() a1075224d3 Fixed config... 2012-02-04 14:22:55 +01:00
Eric Stokes d707a9f9a8 Made config command more hardcoded, but work. 2012-02-04 00:18:48 -07:00
Eric Stokes 90b04aa798 Add migrater for new configs, remove default, it's autogenned now 2012-02-03 23:36:17 -07:00
main() 5d1532e811 Updated build instructions in README (goodbye, submodules!) 2012-02-02 17:25:53 +01:00
main() 443d62580b CommandHandler is now mavenized, we can delete the submodule! 2012-02-02 17:20:46 +01:00
Eric Stokes 541819ea8f Move to shaded CH, this will break all MV plugins 2012-02-01 21:44:15 -07:00
Eric Stokes b09ea0e66a Add shading relocation so we don't conflict anymore! 2012-02-01 19:37:33 -07:00
Eric Stokes 8272e121f4 Update to allpay 6 2012-02-01 19:13:47 -07:00
main() 5d2534f497 Goodbye economy-dependencies! 2012-02-01 18:07:27 -07:00
main() 1e7eef90f9 Now using AllPay as maven-dependency, not as git-submodule. 2012-02-01 17:13:59 +01:00
main() 44df567936 Now using SerializationConfig. 2012-02-01 16:28:23 +01:00
main() d595cb9a31 Added SerializationConfig-dependency, including it with the shade-plugin. 2012-01-31 20:49:55 +01:00
Eric Stokes e8a72d19e1 Fix checkstyle violations 2012-01-29 15:56:57 -07:00
Eric Stokes dde3b63fb9 Fix non-active properties not saving.
Fixes #409
2012-01-29 15:40:16 -07:00
Eric Stokes 87d4d4e1f4 Allow generate-structures to be used per world 2012-01-29 12:41:48 -07:00
Eric Stokes 7aca740296 Fix javadocs in PortalTypeConfigProperty 2012-01-29 12:37:40 -07:00
Eric Stokes 6c9bc6951f Many small fixes.
- Update to 1.1-R2
 - Fix the '--list' not working with the import
 - Fix typo in new portalform catcher
 - Fix 'the_end' not working on import/create
2012-01-29 12:11:41 -07:00
Eric Stokes 74726b44ab Mid commit on adding portal prevention 2012-01-29 09:33:56 -07:00
Eric Stokes 18a57bf975 Allow eggs to spawn monsters 2012-01-28 08:27:57 -07:00
main() b2578b1736 "No newline at end of file" deserves more than only an information. 2012-01-28 15:48:46 +01:00
main() eec765bc48 Merge branch 'util-refactoring' 2012-01-28 15:41:58 +01:00
main() 060c0b1b44 (Re)designed PurgeWorlds/WorldPurger for extension. 2012-01-28 15:06:45 +01:00
Eric Stokes ba90228586 Fix anchors pages not being accessable
Fixes #434
2012-01-27 22:24:50 -07:00
main() 8017172f0e ...
-.-
RAGE!
2012-01-26 19:00:31 +01:00
main() b4ea5e9299 Change in SafeTTeleporter: We can SET the BlockSafety! 2012-01-26 18:56:54 +01:00
main() 59f2c8b62e (Re)designed SafeTTeleporter for extension. 2012-01-26 18:55:09 +01:00
main() 9a28158e5f Merge branch 'master' of github.com:Multiverse/Multiverse-Core into util-refactoring 2012-01-26 18:28:29 +01:00
Eric Stokes 4d97453881 Add the rest of the required items for the new events 2012-01-25 18:14:46 -07:00
Eric Stokes 8488f9db3c Remove the MVVersionRequestEvent, Update pom
I've had enough of our repo being fussy. Just adding the bukkit repos too.
We'll get the proxy stuff working eventually...
2012-01-25 17:13:30 -07:00
main() 51586c7dd5 More tests :D 2012-01-25 21:03:09 +01:00
Eric Stokes 7b74384a8e Fix compatibility with new tests.
Note: @main-- the new tests are balls slow for doing location generation. Like, they take 1s per check, which made the old one run for 16x16x9 seconds (making the test run take about 38.4 minutes)

For now, I've added a special case for nullterrains, which uses the new -n param to skip checking.
2012-01-24 20:32:39 -07:00
main() 33afa4d0d7 Now using the new listeners from ecb97fd5c1 2012-01-24 19:18:03 -07:00
main() 0980e0a201 Merge branch 'master' of github.com:Multiverse/Multiverse-Core into new-tests
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
2012-01-23 19:05:21 +01:00
main() c7d35f13f4 _Never_ System.out.println() exceptions! 2012-01-23 17:43:21 +01:00
main() eebc5c6e62 Mocking is better than implementing mock-classes.
(déjà vu ... ;) )
2012-01-23 16:02:44 +01:00
Eric Stokes ecb97fd5c1 Migrate to the new event system 2012-01-22 21:44:43 -07:00
Eric Stokes bf76b77cf6 Add New api methods, Write location format better
Closes #411
2012-01-22 14:21:18 -07:00
Eric Stokes 21571bf54b Made MockBlock compatible with latest 1.1 builds 2012-01-22 14:20:45 -07:00
Eric Stokes 7b8f73f0af Bump Allpay version.
This adds EconXP support.
2012-01-16 19:45:29 -07:00
Eric Stokes 9313ff82ae Bump protocol to 11, since we changed the api classes 2012-01-15 14:17:51 -07:00
Eric Stokes c22acd6dd1 Fix arg range errors, add examples of WorldType. 2012-01-15 13:29:35 -07:00
Eric Stokes 0f3fd89228 Add new WorldTypes to Multiverse
This closed #394
2012-01-15 13:15:08 -07:00
Eric Stokes 7f93eedbac Spout fixed mentioned issue!
Commit it was fixed in:
https://github.com/SpoutDev/SpoutPlugin/commit/1157e6b6422ae156dd692f38e895ae0c5c5570a2

Build it was fixed in:
http://ci.spout.org/job/SpoutPlugin/681/
2012-01-14 13:57:31 -07:00
Eric Stokes b2457f38b1 Bump version to 2.3 2012-01-13 18:48:16 -07:00
Eric Stokes 04366dd50e Fix Properties not loading properly
Closes #397
This also fixes Active Properties not saving properly
2012-01-13 17:49:22 -07:00
main() dc0121509a Fixed shouldWeKillThisCreature() in MVEntityListener. 2012-01-12 19:01:10 +01:00
main() 8bab4ae606 Merge branch 'master' of github.com:Multiverse/Multiverse-Core into new-tests 2012-01-11 16:44:59 +01:00
Eric Stokes 91c9e175d0 Add setActualDifficulty; Fixes #382
I also changed the difficulty properties to use setActualDifficulty.
2012-01-10 19:29:55 -07:00
main() a1299239a2 Added more checks 2012-01-07 21:26:51 +01:00
main() 7cdb52e740 Yay for colored messages! 2012-01-07 21:26:23 +01:00
main() e2d6652ef1 One single missing char that kept breaking everything.
It took me half an hour to find this -.-
RAGE!
2012-01-07 17:13:00 +01:00
main() 814725a2ba Merge branch 'master' of github.com:Multiverse/Multiverse-Core into new-tests
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
2012-01-07 16:10:18 +01:00
main() da6e6145f2 (Re)designed MVMessaging for extension. 2012-01-07 16:05:16 +01:00
main() ee715b13b0 (Re)designed LocationManipulation for extension. 2012-01-07 16:02:23 +01:00
Tim Ekl b006a458db Make syncMobs() public and Javadoc it 2012-01-06 20:53:38 -05:00
main() a18611fb76 (Re)designed BlockSafety for extension. 2012-01-06 21:11:51 +01:00
main() 1af30dad1d Added collection-support for sendMessages in MVMessaging. 2012-01-06 18:00:34 +01:00
Eric Stokes 79c06b5c42 Fix null worlds blowing up player money; Closes #373 2012-01-05 22:16:34 -07:00
main() 6861021c7a C'mon, avoiding bad style can't be that hard! 2012-01-05 11:49:01 +01:00
Eric Stokes 5435fca6b3 Fix pvp and a few other active settings 2012-01-04 23:00:40 -07:00
Eric Stokes 53c801bb81 Move to ActiveConfig Properties.
This still needs some cleanup, but works well.

I'd like some users to test (and comment here) on the following
commands:
mvm set pvp true/false (can't test this by myself)

Everything else looks good. All tests pass. Think this one (due to the
active properties) fixes #322
2012-01-04 21:46:19 -07:00
main() bb0b26e03c Another huge commit. Style once again, hopefully for the last time.
And we're now using CheckStyle-suppression-comments, thanks @lithium3141.
2012-01-04 13:17:10 +01:00
Eric Stokes 10d849dc51 Add time, remove global gamemode, see below:
- Add Time as a settable (but not stored) function proptery.
 - Add Function properties (They're called tempStringConfigProperties until I make them more generic. deal with it :P)
 - Remove the globalgamemode setting, since it's already covered with the new perms.

When I move TempStringConfigProperty to a seperate superclass (ActiveConfigProperty) we won't have the issue of things getting set anymore, as ActiveConfigProperties will change an active setting (gamemode for example) **when** they're set, not after some cleanup function gets run. Hell. Yes.

Off to bed... I promised this commit to someone which is why it's a lil' sloppy. Sorry :( Will fix tomorrow!
2012-01-03 21:01:51 -07:00
main() b69403e00c I knew it... 2012-01-03 16:30:23 +01:00
main() 120009c6b4 Let's go ahead and see if everything explodes. 2012-01-03 16:26:26 +01:00
main() 940dfa4a7e Removed unused PermissionTools in MVEntityListener 2012-01-03 15:06:47 +01:00
main() b7d3ae039c Improved the MVPlayerListener (style). 2012-01-03 15:03:28 +01:00
main() 5b056388a0 Style-fixes... They're driving me mad... 2012-01-03 15:01:44 +01:00
main() 9d16b7c445 Whitespace is allowed when arrays are initialized. 2012-01-03 15:00:39 +01:00
main() cf21793262 package-info.java 2012-01-03 13:41:49 +01:00
main() 632e926098 Added missing copyright-notice 2012-01-02 11:54:29 +01:00
main() aaa1d18865 Added MultiverseCoreListener. 2012-01-02 11:42:10 +01:00
Eric Stokes 851c6de3eb Prettied upthe buffer, added missing values 2012-01-01 15:06:51 -07:00
Eric Stokes 9963e6f29f Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2012-01-01 13:56:33 -07:00
Eric Stokes d31ee6a5b8 Implement MVMessaging in the Teleport command 2012-01-01 13:56:20 -07:00
main() a5650f1f35 New "/mv version"-system. 2012-01-01 21:10:51 +01:00
main() 426a3bf252 I forgot to put that back in... 2012-01-01 21:09:52 +01:00
Eric Stokes 736eff06ea Add Messaging! (finally) 2012-01-01 12:56:36 -07:00
main() ac5f249164 Fixing the next bunch of CheckStyle-warnings.
I just pushed this without checking it, could somebody please review this commit?
2012-01-01 20:38:37 +01:00
Eric Stokes 0841362c26 Remove * imports. 2012-01-01 11:24:19 -07:00
Eric Stokes e344b0860d Changed priorities of the listeners to not cancel events too soon.
- Add the MVPortal Adjust Listener (lowest)
 - Change the PlayerListener to (High)
Remember that the priories are really just order, so if PlayerListener
was set to lowest, and cancelled the event, no one else would see it.

These changes are required for the fix that i'm finishing up for NPs
and SPs
2012-01-01 11:24:19 -07:00
main() c0d029c71d Fixed tests (I forgot that in 07247a1afd) 2012-01-01 17:32:32 +01:00
main() 07247a1afd ImportCommand now checks if the world was successfully imported.
Fixes #359
2012-01-01 17:28:44 +01:00
main() 47e052d180 Style-fixes. Tons of them. I was too lazy to pack them into different commits. 2012-01-01 17:22:05 +01:00
main() da0bed3b5e Added missing javadoc in the configuration-package. 2011-12-31 20:49:17 +01:00
main() c9b409844f Fixed redundant modifiers in MVWorldManager
... and changed Boolean to boolean
2011-12-31 20:40:28 +01:00
main() 2c392a53e6 Added missing javadoc for MVPlugin 2011-12-31 20:39:10 +01:00
main() f18d457a83 Added javadoc for FancyText 2011-12-31 20:38:53 +01:00
main() 6f884c9308 Style-fixes in MultiverseCore.
Oh, and String.format is better than string concatenation.
2011-12-31 20:30:09 +01:00
main() a45bfa4dc3 Nobody needs that anymore. 2011-12-31 20:29:20 +01:00
main() 1529f3e6dc Lines too long... -.- 2011-12-31 19:57:22 +01:00
main() d48927787b Fixed MagicNumberCheck in MVWorld 2011-12-31 19:56:53 +01:00
main() 9173a15eb9 Started work on tons of new tests 2011-12-31 18:34:04 +01:00
main() 76629ebd25 Now you can't set "respawnworld" to invalid values. 2011-12-31 18:32:58 +01:00
main() 659301a808 MVWorld wants a toString()! :P 2011-12-31 18:32:58 +01:00
Rusty Burchfield 408c09541a Add build instructions to README; Fix double-slash 2011-12-31 10:28:14 -07:00
Eric Stokes 29ddb5e5c1 Hmm apparently Beer helps with coding, but not version control... 2011-12-30 20:15:57 -07:00
Eric Stokes 4429bdcf8e Not sure how this stuff got left out... 2011-12-30 20:15:31 -07:00
Eric Stokes 9f12f6362b Bump config, Add workaround for spout issue.
Closes #355, Closes #149, Closes #349

This adds a new config var: firstspawnoverride that defaults to true.
You should disable this if you don't want mv to do your spawning (if
you have Spout, a warning will print and it will be disabled
automatically. The firstspawn feature will NOT work with spout at this
time.) When the spout bug is fixed, someone should open an issue. I
will not be monitoring this :)
2011-12-30 20:14:44 -07:00
Eric Stokes 9fa29bcde7 Minor Fix: Don't warn when players join the server. That's normal :) 2011-12-29 19:05:10 -07:00
Eric Stokes 346f1591ef Fix OPs/multiverse.* always having gamemode bypass.
I've added a separate namespace:
mv.bypass.gamemode.[*|X]
where X is a world name.

If a player has the * one, they ignore game mode changes GLOBALLY.

This perm defaults to FALSE, meaning OPS will NOT get it by default.
2011-12-29 18:55:24 -07:00
Eric Stokes 749ea12b4a Change warnings to fine/finer, ref #338 (and other issues) 2011-12-25 08:53:42 -07:00
Tim Ekl 20ad724e5a Merge branch 'plugin-smackdown'
Closes #328
2011-12-22 22:01:38 -06:00
Tim Ekl 8f44a8e77a Remove redundant TeleportIntercept check 2011-12-22 09:50:06 -06:00
Tim Ekl 8345c83afd Add config value (teleportintercept)
New config value sets whether to attempt to block non-permissible
teleport attempts initiated from other plugins. Previous behavior
was new config value `false` - MV would not intercept these outside
teleports. New default configured value is `true` - MV will intercept
(and possibly block) other plugins' teleports.
2011-12-21 23:34:35 -06:00
Tim Ekl 6761be6952 Intercept other plugins' teleports properly
This commit will eventually provide a fix for #328, when it gets merged
2011-12-21 23:20:58 -06:00
Tim Ekl 2879c2a96e Add bonus log messages for teleport permissions 2011-12-21 22:44:26 -06:00
dumptruckman a092dd8760 Added permission check with permissions "multiverse.gamemode.ignore.NAME" and of course "multiverse.gamemode.ignore.*" 2011-12-20 07:54:14 -05:00
dumptruckman 4246149bf2 Added checking for gamemode restriction bypass before trying to change gamemode
removed unreachable statement.
2011-12-20 07:54:10 -05:00
dumptruckman c2ad331ca5 added playerCanIgnoreGameModeRestriction() to be checked before changing game modes. 2011-12-20 07:52:33 -05:00
Eric Stokes fc24062f66 Add firstworldspawn, safe spawn disabling, fix a few neat bugs. 2011-12-19 20:03:36 -07:00
main() 8164f484dd Why is an if() without braces bad style!? Seriously!? 2011-12-19 20:53:38 +01:00
main() 2721419324 Added MVWorldDeleteEvent. 2011-12-19 20:48:14 +01:00
Tim Ekl 251b66a8d0 Additional null check; fix signportals issue 17 2011-12-18 21:16:13 -05:00
Tim Ekl fdb8c862f9 Merge branch 'perm-errors'
Closes #286
2011-12-18 15:37:06 -05:00
Tim Ekl 3d518f2e8e Update CommandHandler 2011-12-18 01:29:52 -05:00
Tim Ekl 9cfc75b7db Mark anchor destinations valid if they pass location checks
This commit closes portals bug #92
2011-12-17 14:27:58 -05:00
Tim Ekl 528b448450 Condense color alternation on generator lists; closes #318 2011-12-17 13:32:34 -05:00
Tim Ekl 48f8e033b6 Add a null check around some block safety checks 2011-12-16 00:41:57 -05:00
Tim Ekl 761c3b95d9 Implement support for CommandHandler's optional error displays
This commit relates to #286 and will eventually close it when it gets
merged
2011-12-15 23:19:14 -05:00
Tim Ekl ac229bfcd6 Update CommandHandler lib to v5; relates to #286 2011-12-15 23:07:14 -05:00
Tim Ekl 1894a2e4e7 Set up config support for suppressing perms errors; relates to #286 2011-12-15 22:57:54 -05:00
main() 327f0ce7c4 Pulled some methods up into the Core-interface
(amended, sorry)
2011-12-12 20:59:00 +01:00
main() 5ae12022d1 Lots of javadoc-fixes 2011-12-12 20:48:55 +01:00
main() 18ccb32bfe Javadoc-fixes + added missing @Overrides + fixed one name hiding in MVWorld 2011-12-12 20:09:21 +01:00
main() d7303f1289 Making the constructor private broke MVA...
Thanks to Jenkins for immediately reporting that!
2011-12-12 19:26:00 +01:00
main() cab8aaf040 JavadocStyleCheck: First sentence should end with a period.
Yes, one character can be that important. *sigh*
2011-12-12 17:40:33 +01:00
main() ca21047859 Fixed HideUtilityClassConstructorCheck 2011-12-12 17:26:17 +01:00
main() ae27a34bb0 Empty catch blocks are okay. 2011-12-12 17:22:47 +01:00
main() 90305a4379 Changed ITEMS_PER_PAGE to itemsPerPage since it's not a constant. 2011-12-12 17:15:23 +01:00
main() 033df2f407 Inline conditionals are awesome! 2011-12-12 17:14:54 +01:00
main() b2b1f91f38 Fixed warnings about RedundantModifierCheck. 2011-12-12 17:07:38 +01:00
main() 947235fa72 Parameters are allowed to hide fields. 2011-12-12 16:58:19 +01:00
main() 329ded9615 CheckStyle for Eclipse! :D 2011-12-12 16:57:44 +01:00
main() 86cfa9d98f Fixed another bunch of CheckStyle-warnings (VisibilityModifierCheck)
This time because of default visibility instead of private.

We need a better way for these global config variables in MultiverseCore.java
2011-12-12 16:45:54 +01:00
main() 1bdca7e615 TODO-Comments are a nice information, but no big deal.
CheckStyle, stop erroring about them!
2011-12-12 16:39:01 +01:00
main() 36c33fba14 We don't need javadoc for private stuff and constructors 2011-12-12 16:33:29 +01:00
main() 71794e0164 No @author tags! 2011-12-12 16:31:04 +01:00
main() 3b784b64c0 CheckStyle-warnings about AvoidStarImport should now be fixed! 2011-12-12 16:25:10 +01:00
Tim Ekl 06f3bb4f63 Remove remnants of old Pneumaticsystem repo; add distro information 2011-12-11 21:09:58 -05:00
Eric Stokes 7685af770c Add b to build # 2011-12-11 15:03:29 -07:00
Eric Stokes 80510a778b Add the onarandombox repo back! Yay! 2011-12-11 13:08:30 -07:00
Eric Stokes d7c1b8b0e2 Fix AIOOB. Fixes #303
Fixed an AIOOB when players had the list perm, but not perm to view any
world.
2011-12-11 12:02:01 -07:00
Eric Stokes bf0b70cbcd Let's try a png rather than a psd. 2011-12-11 11:44:36 -07:00
Eric Stokes 1fa79af412 Add 2 new logos 2011-12-11 11:42:35 -07:00
Eric Stokes 42f5d28b77 Add a properly sized logo. 2011-12-11 11:11:49 -07:00
Eric Stokes a5cfb81cc4 Add the logo to the config. 2011-12-11 10:54:45 -07:00
main() 4b53a8dfea Mocking is better than implementing Mock-classes 2011-12-11 13:33:50 +01:00
main() 32ccfe3458 General test-cleanups 2011-12-11 13:33:49 +01:00
Eric Stokes fe71006542 Keep the docs directory. 2011-12-10 22:38:40 -07:00
Eric Stokes 8a337fbf2a Add Doxygen files. 2011-12-10 22:33:59 -07:00
Eric Stokes ff514f8663 Testing Git Build Hook 2011-12-10 18:37:54 -07:00
Eric Stokes 97d905cf51 Add initial check style plugin. Default settings. 2011-12-10 17:44:11 -07:00
Eric Stokes ddc2850632 Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2011-12-10 14:15:27 -07:00
Eric Stokes ea6b020850 Add test for Failure to select a valid command 2011-12-10 14:15:18 -07:00
main() d40ae35505 The config was awesome, but now it's REALLY AWESOME.
Java generics might be weak, but they can avoid permanent casting, resulting in better code :D
2011-12-10 21:04:34 +01:00
main() c9cd2a0f5c Prevented properties from getting null if they were invalid in worlds.yml 2011-12-10 21:03:38 +01:00
main() c0ae0e3eea Javadoc wants <p>, not <p/> 2011-12-10 11:21:26 +01:00
main() 0b2233cf7b We have to use the WorldContainer in the CreateCommand, too.
(This should have been changed in af439b678e)
2011-12-10 11:04:29 +01:00
Eric Stokes d8cb6497f0 Display the spawn location when changing it. Closes #295.
I'm closing this issue and "moving" the rest of it, the ability to
import/create a world without using the checker to Issue #300
2011-12-10 00:53:02 -07:00
Eric Stokes e5d468f03f Fix properties not reporting when the value was wrong, but the key was. 2011-12-10 00:41:28 -07:00
Eric Stokes a33d1420ba Add game mode test.
This test should pass, but alas it fails :(
2011-12-10 00:36:40 -07:00
Eric Stokes 70f03e80bc Update the POM to use parallelized tests.
Don't try and run our cool classes.
2011-12-09 19:58:11 -07:00
main() f091a32174 Now saving mob exceptions correctly. Fixes #287 2011-12-09 16:53:50 +01:00
Tim Ekl ff8b9eb3b7 Remove onarandombox repo; fix the build version number replacement 2011-12-09 10:04:46 -05:00
fernferret 08736cca16 Time for bed. Too many mistakes. Fixed the Core Pom (again) 2011-12-09 01:00:49 -07:00
fernferret 10a4ec1c0b Add WorldContainer to tests, they pass again. Yay! 2011-12-09 00:39:57 -07:00
fernferret 5159fe7a17 Add new repo to the POM. 2011-12-09 00:06:34 -07:00
Eric Stokes fe52040b48 Merge pull request #298 from 4am/master
Fixed Importing from a world container directory which is not the default
2011-12-08 19:35:32 -08:00
4am af439b678e Changed runCommand to look in world container directory (defined in bukkit.yml) instead of in the server folder when attempting to load world files. 2011-12-08 19:19:17 -05:00
Tim Ekl 77ced857ea Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2011-12-08 18:25:38 -05:00
Tim Ekl 24efbf2ea9 Remove UNKNOWN version number from pom.xml 2011-12-08 18:25:05 -05:00
main() 5b17df65e9 Removed unused imports 2011-12-08 19:59:20 +01:00
main() 8b721886f5 Yes, the MVConfigMigrator is old and uses deprecated stuff. 2011-12-08 19:59:10 +01:00
main() dbf109f051 Raw types are evil. 2011-12-08 19:17:55 +01:00
main() 56e4e493b1 Fixed all javadoc warnings and some typos. 2011-12-08 19:08:07 +01:00
Tim Ekl 8916f0dbbc Combine JUnit dependencies 2011-12-07 00:16:42 -05:00
Eric Stokes 3a5bc6adda Actually fixed #294 2011-12-06 18:40:09 -07:00
Eric Stokes f6e49bd8eb Fix pitch/yaw switched for mvss on reload 2011-12-06 18:14:34 -07:00
Eric Stokes 15ce10671e Fix colors bleeding into the next name, Fixes #285 2011-12-02 18:19:26 -07:00
Eric Stokes a0ab24a132 Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2011-11-30 19:38:58 -07:00
Eric Stokes ee75392a9e Fix anchor direction, Fixes #283 2011-11-30 19:38:35 -07:00
Tim Ekl 6fd7c84276 Fix Javadoc on PasteService interface 2011-11-30 11:44:18 -05:00
Tim Ekl df5bfdde80 Allow posting to pastie.org or pastebin.com (pastie.org is the new default); closes #277 2011-11-29 20:55:13 -07:00
Tim Ekl 8e74945b7e Add null check for files returned in world check; closes #278 2011-11-29 20:14:11 -05:00
Eric Stokes 5d2a1e478c Fix Anchors not being saved proplery, Fix safe spawn disabling, closes #207, Remove server.properties code, that bukkit bug is gone, closes #275 2011-11-28 00:08:39 -07:00
Eric Stokes e110b1f6a5 Add anchors 2011-11-27 18:50:42 -07:00
Eric Stokes 803eb84f3f Commit paginated changes, Add PermissionsTools 2011-11-27 01:42:18 -07:00
Eric Stokes 562de0f002 Fix tp perms to take into account teleporter and teleportee. This may eat your server 2011-11-26 19:38:57 -07:00
Eric Stokes 156e7ce373 Fix tests, and caught NPE 2011-11-26 17:42:58 -07:00
Eric Stokes 939a2e8b1f Add paginated commands, Closes #203, Add folder suggestions when your import fails 2011-11-26 17:24:17 -07:00
Eric Stokes 792d2ce5e6 Remove PaginatedCommand 2011-11-26 15:20:08 -07:00
Eric Stokes 03424165a4 Fix world.dat being adjusted every time, Fixes #268 2011-11-26 15:00:52 -07:00
Eric Stokes f2a65b4fd9 Fix bedrespawn not being checked. Fixes #240 2011-11-26 13:01:45 -07:00
Eric Stokes 6afbd1d13d Bump API version to 8, Remove junk, Update CommandHandler (Closes #267) 2011-11-26 12:33:12 -07:00
Eric Stokes d2a5898e53 Fix seeds (Closes #266), Allow Regeneration of map (Closes #202)
Fixed long seeds not loading properly (this happened with the new
config), Add Regenning of worlds. This works for the same seed, but new
seeds are still in the works.
2011-11-26 11:28:44 -07:00
main() fa0c843f39 Improved (or broke) tests. 2011-11-26 12:07:28 +01:00
main() 459aad2d2b Fixed NPE when there was no worlds-section in bukkit.yml 2011-11-26 12:07:28 +01:00
Eric Stokes 0fa8f4e824 Force default worlds to be imported, Closes #265 2011-11-26 01:49:46 -07:00
Eric Stokes 82eff21dbf Revert earlier changes about using the repo, fix awesome unload bug. Now you can't unload defaultly loaded worlds 2011-11-26 00:35:07 -07:00
Eric Stokes 6bf9d1c9bb Add Help to the Import Command 2011-11-25 22:59:06 -07:00
Eric Stokes 71bfd2a1ad Remove submodules in favor of deployments 2011-11-25 22:45:27 -07:00
Eric Stokes 4b2152a05c Add new world delete method (Closes #260), Remove world from unloaded list when it's removed from the configs 2011-11-25 19:29:00 -07:00
Eric Stokes 6a80c8c1de Merge branch 'fixed-tests' Closes #261
Tested, and the tests all pass!
2011-11-25 18:17:32 -07:00
Eric Stokes c4dd2e3005 Much needed code re-format 2011-11-25 18:13:14 -07:00
Eric Stokes 4006e53243 Fix formatting with pullrequest, remove dragon, to @Rigby90's point, this will be bad for 3rd party addons. 2011-11-25 18:07:46 -07:00
Eric Stokes f894859df9 Fix the pastebin.com poster (Bad API request bug) 2011-11-25 17:44:52 -07:00
sthycb c9a33350ac Added Support for EnderDragon purging now Supports Dragon or EnderDragon as the keyword (No changes needed to this file if this functionality is not desired) Ie: With the old code player must enter the correct "enderdragon" entering "dragon" on any other invalid keyword will report "0 - mobs purged". NOTE: This change would break for a player has a mod that has an entity called "Dragon". 2011-11-25 17:23:31 -07:00
Eric Stokes 0c847eefdf Add more fixes that I broke when fixing #255 2011-11-25 16:57:01 -07:00
Eric Stokes 9710501a03 Fix lots of bad things with #255 2011-11-25 16:56:36 -07:00
main() 11fe1aee10 Fixed the tests. Closes #252 2011-11-25 18:02:41 +01:00
Eric Stokes 3e3990eba4 Add WorldPropertyChang event Fixes #255, reduce the search radius until we can find a better place in the end. 2011-11-24 18:41:09 -07:00
Tim Ekl 06f53a0b47 Fix NPE on incorrect world chat color & correct in config 2011-11-23 20:02:06 -06:00
Eric Stokes 9a7c6202cc Add bedrespawn as a per-world property. Fixes #192. Fixes #221. 2011-11-22 21:52:18 -07:00
Eric Stokes 5d932060ee Removed deprecated items, Add autoload (Fixes #241) 2011-11-22 21:01:00 -07:00
Eric Stokes 8803374126 Fix colors not persisting through reloads 2011-11-22 19:50:52 -07:00
Eric Stokes 3c424c1c33 Fix aliases not working when setting 2011-11-22 19:41:56 -07:00
Eric Stokes 9f8e1689f6 Fix silly list mistake in worlds, fix gamemode not switching, fix a bunch of npes 2011-11-22 19:27:03 -07:00
Eric Stokes 2717a7bbee Attempted fix for npe on worldmanager 2011-11-22 00:14:54 -07:00
Eric Stokes 29bc8bfbfc Fix massive NPEs for real, Don't comment out tests, use @Ignore, Thanks @main-- 2011-11-21 22:44:36 -07:00
Eric Stokes af428a236d Merge with betterproperties 2011-11-21 21:56:34 -07:00
Eric Stokes 25be687762 Fix NPE 2011-11-21 21:55:28 -07:00
Eric Stokes d6b5fb9a25 Update for MC 1.0.0 2011-11-21 21:07:20 -07:00
Eric Stokes e818b1ee73 Merge with test branch 2011-11-06 10:00:44 -07:00
Eric Stokes 92db828e3a Merge branch 'master' into better-properties 2011-11-05 12:08:10 -06:00
Tim Ekl 61bed8e72d Merge pull request #229 from Multiverse/broadcasts
Broadcast-Messages
2011-11-03 08:22:02 -07:00
Eric Stokes f774d861c2 Fix typos 2011-10-23 11:01:42 -06:00
Eric Stokes 65b375edeb Added item specific help to config properties. 2011-10-23 10:47:46 -06:00
Eric Stokes b19799f764 Cleanup old variables 2011-10-22 17:45:03 -06:00
Eric Stokes 2e41d149fe Done converting MVWorld, now needs testing 2011-10-22 17:38:00 -06:00
Eric Stokes c576d5a3a2 Add the new style of saving/loading world properties.
All properties have been converted, but are not all implemented yet. I'm just committing because it's been several hours... o.O
2011-10-22 14:16:00 -06:00
Eric Stokes 6b95be4ca5 Add new interface, and a new paginated command, both shells 2011-10-22 11:01:05 -06:00
Eric Stokes 1712b175d8 Add autoheal and adjustSpawn as per-world properties 2011-10-22 11:00:32 -06:00
Eric Stokes 46db76a6cc Add new test stuff 2011-10-21 18:37:18 -06:00
Eric Stokes 0e708a1f51 Move utils to a different package, add skylands to import test 2011-10-21 18:03:34 -06:00
Eric Stokes 65369b6a4b refactor rests even more 2011-10-21 17:48:28 -06:00
Eric Stokes ab311dd8d9 Reorged the tests, LOTS OF CLEANUP 2011-10-20 18:36:33 -06:00
Eric Stokes 2b2a406cce Merge branch 'master' into test 2011-10-20 17:31:39 -06:00
Eric Stokes 3ad1bfad2b Woohoo! All tests passgsgs 2011-10-20 17:30:29 -06:00
Eric Stokes b028811d36 Merge branch 'master' into test 2011-10-20 16:44:02 -06:00
main() 6a6b29923d Bump version to 2.2 2011-10-19 19:59:03 +02:00
main() 0581415ae5 Added broadcast-messages (Closes #197) 2011-10-19 19:48:43 +02:00
Eric Stokes d473ac3f78 Bump API to v7 for 2.1 release 2011-10-18 20:48:23 -06:00
Eric Stokes 093e01d865 Change priority to Low, so MV can fix portal locations 2011-10-18 18:13:22 -06:00
Eric Stokes 2d7626684f Fix initial configs not loading properly 2011-10-18 16:45:55 -06:00
Eric Stokes 698671c700 Fix spawn not loading from config. Closes #195 2011-10-17 20:51:51 -06:00
Eric Stokes 0d06fb8a0d Reload the config after save for the initial creation 2011-10-17 19:09:22 -06:00
Eric Stokes 6e6c40bd3b Cannon destinations are basically exact destinations, don't perform the safety check. 2011-10-17 18:06:16 -06:00
Eric Stokes 4067d0cd28 Detect bad worlds and tell the user to use chunkster 2011-10-16 13:59:13 -06:00
Eric Stokes 5b19404c13 Clean up some comments. 2011-10-16 13:53:23 -06:00
Eric Stokes e6f81b01d6 Move the enforce access flag to canEnterWorld so other plugins don't have to check it also, Add "mv conf show" 2011-10-16 13:38:05 -06:00
Eric Stokes 25d9231d30 Check all parent perms if the player's normal perm wasn't found. Closes #174
I consider this a workaround. At the moment, when we add a node AND
recalc the permissions, until the perms plugin reloads, when MV asks
the API if a player has a perm, it reports that they do NOT. For the
moment, we're going to check all of this node's parents to see if the
user has those. It stops when if finds a true or there are no more
parents.
2011-10-16 11:06:40 -06:00
Eric Stokes 3284670153 Fix Difficulty and GameMode not reloading properly. Closes #190 2011-10-16 10:14:02 -06:00
Eric Stokes ea920c1252 Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2011-10-16 09:56:47 -06:00
Eric Stokes 987e2eff51 Reorder the loading of fakepvp so it doesn't override regular pvp. 2011-10-16 09:41:47 -06:00
main() 67c165ff25 Fixed #191 (WorldManager.deleteWorld()). 2011-10-16 17:36:18 +02:00
main() e7aa563352 Revert "Fix startup error on Windows."
This reverts commit 01bed7cc4b.
Because that commit CAUSED a startup error instead of fixing one.
2011-10-16 15:29:09 +02:00
Eric Stokes 56926dc14c State when a perm has been found in debug, Fix The TeleportCommand not obeying enforce access 2011-10-16 02:06:18 -06:00
Eric Stokes 2d0eb7e7bb If enforceaccess == false, show all players all worlds (unless they're hidden) also for mv who 2011-10-16 00:38:49 -06:00
Eric Stokes 54e7bc454a If enforceaccess == false, show all players all worlds (unless they're hidden) 2011-10-16 00:34:40 -06:00
Eric Stokes 01bed7cc4b Fix startup error on Windows.
Psh who uses Windows anyways :P
2011-10-16 00:01:09 -06:00
Eric Stokes 728002ecce Still not working :/ Need to simulate worlds now... 2011-10-15 12:38:34 -06:00
Eric Stokes e45ae8f9dc Much farther with testing. Keep testing... 2011-10-15 12:23:13 -06:00
main() 5d11e27eb0 Fixed javadoc of the WorldManager. 2011-10-15 17:24:12 +02:00
Rigby fbc5c6f0d2 Removed Doxygen stuff as it is no longer required.
Added the ability to generate a Source JAR and pass to Artifactory.
2011-10-15 15:33:03 +01:00
Eric Stokes edb999578a Seperated MockWorld tests 2011-10-15 08:20:29 -06:00
fernferret d1f51acb1c Add Broken tests 2011-10-15 09:47:07 -04:00
fernferret b867df7315 Add main-- to the authors 2011-10-14 15:12:44 -04:00
fernferret a8068a5669 Protocol Bump to v6 2011-10-13 21:39:17 -04:00
fernferret ab17064006 Route all teleports through the SafeTTeleporter
There are still some access caveats. When you request that a player be
tp'd to you, there's currently not a good way to tell the teleport
event that… So we either get full control of all plugins and limited
control to override it, or unlimited control to override and no access
to other plugins' access to teleport players to potentially restricted
locations…

This will break the latest other Plugin builds.
2011-10-13 21:38:44 -04:00
fernferret d3c1538083 Fix config.yml overwriting worlds.yml, Fix invalid spawn locations 2011-10-13 16:37:53 -04:00
fernferret b2ef10a699 Revamp config to simpler 2.4 format 2011-10-12 21:50:03 -04:00
fernferret fba3f71238 Fix invalid values in /mv config, Closes #178 2011-10-12 17:04:21 -04:00
fernferret af3dcf049d Remove outdated values from config.yml, Fix Configs and reloading, Closes #186 2011-10-12 16:50:04 -04:00
fernferret a30222bec7 Show whether or not gamemode is being enforced, Fix enum Config Property 2011-10-11 22:51:30 -04:00
fernferret 86af11b662 Fixes for hidden worlds displaying as null 2011-10-11 21:57:35 -04:00
fernferret 750adcf376 Fix color checking, fix price reporting failure on successful set 2011-10-11 17:01:56 -04:00
fernferret c200d43f51 Bunch of NPE fixes 2011-10-11 16:45:47 -04:00
fernferret f4093cbe51 Implement new config items 2011-10-10 21:37:58 -04:00
fernferret 4366b16a74 Start using the new config 2011-10-10 20:40:31 -04:00
fernferret cfdd1ac38c Remove naming conflict with bukkit 2011-10-10 20:12:22 -04:00
fernferret 3e10f18079 Add a bunch of examples, add loadworld to the plugin.yml 2011-10-10 13:02:29 -06:00
fernferret c7c73e7094 Implement Check Command 2011-10-10 12:28:02 -06:00
fernferret c7e5816b2e Add better debug for world access 2011-10-10 11:57:45 -06:00
fernferret 50a89b7b1a Update Config.yml, implement enforceaccess
Cache enforceaccess and enforcegamemodes, as both of these get accessed
a lot.
2011-10-10 11:49:53 -06:00
fernferret 1aad872333 Start adding the Config Command 2011-10-10 11:31:22 -06:00
fernferret 73b42b5430 Merge branch 'master' of https://github.com/Multiverse/Multiverse-Core 2011-10-10 09:36:36 -06:00
fernferret e93fec45ac Much needed code reformat 2011-10-10 09:34:04 -06:00
Eric Stokes 23933c4706 Correct some javadoc 2011-10-10 07:50:03 -06:00
Eric Stokes 9e14daac1f Implement getMvWorld 2011-10-09 21:03:05 -06:00
Eric Stokes aa079b2920 Add Colored string to the alias, remove Double, use double 2011-10-09 20:26:23 -06:00
Eric Stokes bac24e1c97 Use the MultiverseWorld instead of MVWorld 2011-10-09 20:10:59 -06:00
Eric Stokes c72f602045 Fix MVINFO NPE, Fix NPE on startup with addWorld, Remove deprecated methods 2011-10-09 18:25:42 -06:00
Eric Stokes c22a8a9d18 Implement new world creation methods 2011-10-09 18:11:36 -06:00
Eric Stokes 2759d75125 Finalize API v5 2011-10-09 16:36:05 -06:00
Eric Stokes 980381194b Continue updating API. Fix squids not being monitored, Closes #181 2011-10-09 15:38:18 -06:00
Eric Stokes 8370a72776 Add hunger API, bump protocol to 5 2011-10-09 11:48:09 -06:00
Eric Stokes e0f9344d20 Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2011-10-09 11:43:13 -06:00
Eric Stokes 3fde98049f Add a bunch more to the API 2011-10-09 11:31:50 -06:00
main() 40c04a1f4e Made removePlayersFromWorld() visible from the API and moved the javadoc 2011-10-09 19:27:40 +02:00
Eric Stokes 5386aadbb7 Add new api items for hiding worlds, Move the severe perms error to a level 2 log 2011-10-09 08:51:29 -06:00
Eric Stokes 5e0903086e Display API version, fix difficulty enums missing 2011-10-08 14:59:47 -06:00
Eric Stokes ff47610424 Bump protocol to 4 2011-10-08 14:29:44 -06:00
Eric Stokes 84e178d12e Bump API to version 3 2011-10-08 12:38:54 -06:00
Eric Stokes f2a263f86c Merge WorldManager Changes to keep the API happy 2011-10-08 12:38:23 -06:00
Eric Stokes 3c750104a5 rename some methods in the WorldManagerAPI 2011-10-08 12:36:57 -06:00
main() f69c85e6b0 Added loadWorld(String name) to the WorldManager and made it accessible with a command
Added some "'" around log-messages
2011-10-08 12:28:27 -06:00
Eric Stokes 6e4de79bfb Add WorldManager API, API is now level 2 2011-10-08 11:57:50 -06:00
Eric Stokes 2d112edee5 Start writing the Core API 2011-10-08 11:42:35 -06:00
Eric Stokes 4a634e8418 Final backwards compatability checks 2011-10-08 10:57:48 -06:00
Eric Stokes e31f2c79ac Fix breakages with SignPortals 2011-10-08 10:14:52 -06:00
Eric Stokes cc3889b166 Increment v to 2.1, start adding dummy files 2011-10-08 08:22:19 -06:00
Eric Stokes 7bbdac9012 Move a bunch of classes into utils 2011-10-07 18:47:39 -06:00
Eric Stokes d04a42ee92 Move utils package inside multiversecore 2011-10-07 18:26:40 -06:00
Eric Stokes fa80b66ac2 Pull changes from master 2011-10-07 18:22:54 -06:00
Eric Stokes ae19604eab Add difficulty to the info command 2011-10-03 19:59:29 -06:00
Eric Stokes 6e7daf4e85 And this is why we need unit tests... 2011-10-03 19:40:21 -06:00
Eric Stokes 86d3628b1c Actually save the difficulty 2011-10-03 19:24:38 -06:00
Rigby 9be14a2a0c You just can't get the right staff these days... 2011-10-04 01:28:42 +01:00
Eric Stokes 091c5a9621 Move GameMode check to onPlayerChangeWorld, fix difficulty case settings 2011-10-03 17:43:57 -06:00
Eric Stokes c566ead9ef Add multiworld difficulty 2011-10-02 21:18:25 -06:00
Eric Stokes d97bbfb1b1 Fixed Hunger/Food setting Closes #119 2011-09-28 19:56:41 -06:00
Eric Stokes ea6e94d99d Fix Signportals not going anywhere 2011-09-28 19:34:00 -06:00
Eric Stokes f0ae8cbb8e Ensure that the world players are going to is not null 2011-09-28 17:02:21 -06:00
Eric Stokes 1a6e93f0df Add aditional checks for onPlayerPortal 2011-09-28 16:28:09 -06:00
Eric Stokes 8fe128ec0f Add more api items 2011-09-26 20:21:39 -06:00
Eric Stokes f3cd433e80 Remove ALL perms3 refs 2011-09-25 12:11:42 -06:00
Eric Stokes 0964f461eb Remove Permissions 3 support 2011-09-25 12:02:28 -06:00
Eric Stokes fa409ac4f5 Remove fakePvp from the API 2011-09-25 11:05:48 -06:00
Eric Stokes 3753256611 Move destinations to their own package 2011-09-25 10:46:07 -06:00
Eric Stokes b378b0cf79 Update World API's comments to reflect new API changes 2011-09-25 10:43:22 -06:00
Eric Stokes e5646bbbfd Remove silly nullable reference 2011-09-25 10:41:43 -06:00
Eric Stokes 66538ccd02 Moved API around, added more docs 2011-09-25 10:40:23 -06:00
Eric Stokes d63c043368 New code format 2011-09-25 09:14:17 -06:00
Eric Stokes 65dce752d4 Don't set the hunger, only cancel the events 2011-09-22 19:47:14 -06:00
Eric Stokes 268b272f4d Implement Hunger. Untested 2011-09-21 22:15:16 -06:00
Eric Stokes eb0b83c507 Add getHunger api. No implementation yet 2011-09-21 19:26:02 -06:00
Eric Stokes f009ad6dd6 Merge branch 'master' into development 2011-09-21 17:50:16 -06:00
Eric Stokes 6b543a793a Add BedDestination 2011-09-21 17:45:10 -06:00
Rigby 05de5055ab Lets try this. 2011-09-21 19:16:25 +01:00
Rigby 688ea7a1d3 Merge branch 'master' of github.com:Herocraft/Multiverse-Core 2011-09-21 18:43:18 +01:00
Rigby fc02efd90f Added Doxygen... hopefully we'll have pretty JavaDocs. 2011-09-21 18:42:44 +01:00
Eric Stokes 6039009e3f Merge branch 'master' into development 2011-09-18 13:53:36 -06:00
Eric Stokes a9cb378eab Fixed the from worlds being the to worlds. 2011-09-18 13:51:28 -06:00
Eric Stokes fcfa45717c Fix Change Gamemode with NetherPortals, Fix NetherPortals allowing you entry to worlds you shouldn't be able to access. 2011-09-18 13:22:48 -06:00
Eric Stokes 9333f70add Working on messaging 2011-09-18 13:04:37 -06:00
Eric Stokes 30704338e6 Require spawn permission if you're using mvtp to go back to spawn (Thanks Verrier!) 2011-09-18 12:31:41 -06:00
Eric Stokes 17a519f961 Add the teleport permissions to the teleport command... oops 2011-09-18 11:45:06 -06:00
Eric Stokes 74aba9d6e8 Refactor so a Teleporter can be a CommandSender 2011-09-18 10:03:59 -06:00
Eric Stokes 43fcbc9af9 Add new messaging stuff 2011-09-18 09:48:46 -06:00
Eric Stokes fa3e0d6186 Check for console, Closes #118 2011-09-18 09:48:23 -06:00
Eric Stokes 20ce518d33 Added Copyright notice and remove trailing whitespace. 2011-09-17 12:59:37 -06:00
Eric Stokes f9481db5a6 Document WorldManager.java 2011-09-17 12:55:28 -06:00
Eric Stokes 1b42a25ccb Only set the velocity if a player did successfully teleport. Issue #72 2011-09-17 11:12:02 -06:00
Eric Stokes e3edcb88df Remove JDK 6 dependency 2011-09-17 10:05:01 -06:00
Eric Stokes bef22ba534 Add Per-Destination perms, Closes #61 2011-09-17 09:59:38 -06:00
Eric Stokes 10d6a7e1dc Add Documentation to MVDestination 2011-09-17 08:27:10 -06:00
Eric Stokes b39098a592 Move Mode to page 1: Closes #111, Fix nether imports not defaulting to 8: Closes #103. 2011-09-17 07:35:39 -06:00
Eric Stokes a2c6dad243 Remove my silly printlines 2011-09-16 19:18:36 -06:00
Eric Stokes b76da91013 Merge branch 'master' of github.com:Herocraft/Multiverse-Core 2011-09-16 18:35:22 -06:00
Eric Stokes e7f97a8ae7 Add new debugging 2011-09-16 18:35:17 -06:00
Rigby e792c338aa Fern's FAULT. 2011-09-16 11:19:52 +01:00
Rigby 133810550f Allow the per world Game Modes to not be enforced. 2011-09-16 10:11:30 +01:00
Eric Stokes 97168043ff Fix && should be ||, Allow Creative mode, Set all players in a world to a specific mode when it's changed 2011-09-14 20:06:03 -06:00
Tim Ekl 40c4ce0a37 Merge branch 'master' into gamemodes 2011-09-14 19:11:47 -04:00
Eric Stokes 318564ccf2 Add new CH and CH checks 2011-09-13 20:13:27 -06:00
Eric Stokes 9c1a9769b2 Update to new AllPay version 2011-09-13 19:54:06 -06:00
Eric Stokes 89ea09fba2 Minor changes
Update CommandHandler
Fix typo in Debug
Version now posts as a Multiverse user
2011-09-11 17:37:32 -06:00
Rigby 9384f96549 Getting ready for 1.8 GameModes.
This setup will allow different worlds to be setup under different gamemodes, it handles per player modes during teleportation to and from Worlds.
2011-09-09 12:25:21 +01:00
Rigby 69b143ada6 Believe this should be a set :). 2011-09-09 12:16:54 +01:00
Jeff Wardian a97b6f80d2 Fixed ArrayIndexOutofBounds on translateTempSpawn() 2011-09-02 16:26:36 -07:00
Eric Stokes ad47ce7d1b Add Bed Respawns back in! Thanks @Vaht 2011-09-01 19:18:56 -06:00
Eric Stokes d09d340e0f Fix "There are players in <Java Object>" 2011-08-31 21:05:53 -06:00
Eric Stokes 751ed5a8e8 Check for null creature types. Closes #83 2011-08-29 17:03:59 -06:00
Eric Stokes a0667d49b8 Fix our Custom PTA not obeying useSafeTeleporter 2011-08-25 19:42:52 -06:00
Eric Stokes 8c45d0b76a Exact destinations now don't use the safeTeleport check. Add API hook to allow this to be configurable per destination. 2011-08-25 19:31:46 -06:00
Eric Stokes 319567eb67 Fix the console spewing many many errors. Sorry. 2011-08-24 20:01:50 -06:00
Eric Stokes 7a38806134 Remove Additional Private Deprecations, Must keep methods until Portals 2.1 is out. 2011-08-24 19:05:20 -06:00
Eric Stokes b6755a1047 Return the Permission if it was created, or the old one if it existed. 2011-08-24 18:49:13 -06:00
Eric Stokes 69360a49ec Move World Functions to a new WorldManager. 2011-08-24 17:25:30 -06:00
Eric Stokes 3876c0f47f Remove prints. 2011-08-24 16:38:08 -06:00
Eric Stokes 5fe8f76c34 Add MVTeleportEvent back in. 2011-08-23 16:48:11 -06:00
Eric Stokes e556261e84 Small changes to BlockSafety for MVPortals, Remove hard spout dependency for real this time. Thanks @lithium3141 2011-08-22 19:53:00 -06:00
Eric Stokes 8d09c19988 Add the MVTravelAgent to Core since NetherPortals, Portals _and_ SignPortals use it. 2011-08-22 17:58:54 -06:00
Eric Stokes 4fd0150945 Add ability to query all generator plugins via /mv generators 2011-08-21 16:57:17 -06:00
Eric Stokes f96f3151f9 Allow you to set debug in the config. 2011-08-21 14:30:12 -06:00
Eric Stokes 047e0d8001 Remove hard Spout dependency. Sorry. Thanks Fetch! 2011-08-21 12:10:18 -06:00
Eric Stokes 5f88247810 More fixes to the new World Destinations that support pitch and yaw. 2011-08-21 11:38:01 -06:00
Eric Stokes d12725ca0e Deprecate 2 location methods in favor of using MVDestination instead of Location to preserver velocity. 2011-08-21 10:32:07 -06:00
Eric Stokes dc9f2fc360 Use DisplayName in mvwho Closes #62 2011-08-21 08:36:43 -06:00
Eric Stokes 2c865aa0ff Allow our own spawns to be more accurate, including decimal precision on XYZ and Pitch/Yaw.
We still set the spawn in the bukkit worlds to the inaccurate setting.
No migrator is included for this change, just do /mvss in game.
2011-08-21 08:34:07 -06:00
Eric Stokes f11f3dd88e Allow us to add permissions safely via the Permissions object. 2011-08-20 22:50:06 -06:00
Eric Stokes c503849107 Exposed getSafeLocation 2011-08-20 16:36:39 -06:00
Eric Stokes ce8b042919 Merge branch 'master' into development 2011-08-20 09:16:14 -06:00
Eric Stokes 92a762e5e4 Add MV Debug, Attempted fix for Portal teleportation fail, Water and Doors are now safe materials 2011-08-20 09:07:40 -06:00
Eric Stokes eb4f9700bc Made World Access by default OP. However, opfallback is still set to true by default 2011-08-19 16:48:55 -06:00
Eric Stokes 49e3a42550 Give an easy way of using cannons without portals
Behold: /mvtp cannon-2
2011-08-17 16:49:24 -06:00
Eric Stokes 1ab56096f8 Increment AllPay to 1.0.3 2011-08-16 18:32:05 -06:00
Eric Stokes afc388637f Update AllPay, Hopefully fix the BOSEcon bug 2011-08-16 18:02:43 -06:00
Eric Stokes 93fab486ff Add iCo 6 Support, update to AllPay 1.0.1 2011-08-15 20:53:16 -06:00
Eric Stokes e36210b99a Add spout tests 2011-08-13 14:58:43 -06:00
Eric Stokes f6299c60a0 Fix scale named scaling (thanks krinsdeath) 2011-08-11 18:28:45 -06:00
Eric Stokes 06bc0dea02 Fix not being able to set world scaling. (Thanks krinsdeath) Add pitch to mvcoord, add missing variables to mvinfo 2011-08-11 18:20:35 -06:00
Eric Stokes 11ce604938 Fix NPE when a world was not known by MV Thanks Rockstar04! 2011-08-10 19:35:48 -06:00
210 changed files with 21198 additions and 4209 deletions

No files matched your search

+5
View File
@@ -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!
+56
View File
@@ -0,0 +1,56 @@
---
name: ❓ Help!
about: Encountered a problem with Multiverse-Core? Not sure how to fix it?
title: ''
labels: 'Type: Assistance'
assignees: ''
---
<!-- Multiverse-Core help guide
Don't write inside the arrows as they will be hidden when you post your issue.
Get latest build from: http://ci.onarandombox.com/view/Multiverse/
If you need help other submodules of Multiverse, go to their respective git repo:
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues
Or come join our Discord server to get help sooner: https://discord.gg/NZtfKky
If you're happy to wait (or you were sent here from Discord), read on:
1. Check the Usage and FAQ pages to see if it answers your queries:
https://github.com/Multiverse/Multiverse-Core/wiki/Basics
https://github.com/Multiverse/Multiverse-Core/wiki/FAQ
2. Fill out the template.
This will help us understand what problem you've encountered and help us
find a solution.
3. When linking files, do not attach them to the post!
Copy and paste any logs into https://gist.github.com/ or other similar service.
4. Delete this line and all above lines before posting your issue! -->
### Information
* **Server version:** <!-- Insert output of `/version` command -->
* **Full output of `/mv version -p`:** <!-- Replace this with the command output's https://paste.gg/ link -->
* **Server log:** <!-- Upload `logs/latest.log` to https://gist.github.com/ -->
### Help request
**Problem**
<!-- What problem did you encounter? -->
**What I have tried**
<!-- What have you tried so far? -->
**Screenshots**
<!-- If relevant, include any screenshots here. -->
+59
View File
@@ -0,0 +1,59 @@
---
name: 🐛 Report a Bug
about: Report a Multiverse-Core bug. Only use this if you're 100% sure it's something wrong with Multiverse-Core - otherwise, try "Help!".
title: ''
labels: 'Bug: Unconfirmed'
assignees: ''
---
<!-- Multiverse-Core bug reporting guide
Don't put anything inside this block, as it won't be included in the issue.
Get latest build from: http://ci.onarandombox.com/view/Multiverse/
If you are having issues with other submodules of Multiverse, go to their respective git repo:
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues
If you are reporting a bug, please follow the following steps:
1. Fill out the template in full.
Run the commands in the console. Don't just put "latest" as a version,
or we will ignore it.
2. When linking files, do not attach them to the post!
Copy and paste any logs into https://gist.github.com/, then paste a
link to them in the relevant parts of the template.
**DO NOT drag files into this box!**
3. Make sure not to write between the arrows, as anything there will be
hidden.
4. Delete this line and all above lines before posting your issue! -->
### Information
* **Server version:** <!-- Insert output of `/version` command -->
* **Full output of `/mv version -p`:** <!-- Replace this with the command output's https://paste.gg/ link -->
* **Server log:** <!-- Upload `logs/latest.log` to https://gist.github.com/ -->
### Details
I was **`<able / not 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.
**Description**
<!-- Replace this with a brief summary of the bug. -->
**Steps to reproduce**
<!-- Replace this with exactly what you did to cause the bug. -->
**Expected behavior**
<!-- Replace this with what you expected to happen. -->
**Screenshots**
<!-- Replace this with screenshots, if necessary. -->
@@ -0,0 +1,54 @@
---
name: 💡 Request a Feature
about: Suggest a feature you want to see in Multiverse-Core!
title: ''
labels: 'Type: Idea'
assignees: ''
---
<!-- Multiverse-Core feature request guide
Fill out the template. Don't write inside the arrows as they will be hidden
when you post your issue.
Get latest build from: http://ci.onarandombox.com/view/Multiverse/
If you are look for other submodules of Multiverse, go to their respective git repo:
Multiverse-Portals: https://github.com/Multiverse/Multiverse-Portals/issues
Multiverse-NetherPortals: https://github.com/Multiverse/Multiverse-NetherPortals/issues
Multiverse-Inventories: https://github.com/Multiverse/Multiverse-Inventories/issues
Multiverse-SignPortals: https://github.com/Multiverse/Multiverse-SignPortals/issues
Not sure if your feature fits in Multiverse-Core? Feel free to ask on our Discord
server: https://discord.gg/NZtfKky
If you have a feature suggestion for Multiverse-Core, read the following tips:
1. Fill out the template.
This will help us understand what you're requesting and why you want us
to add it.
2. Keep it simple.
Make sure it's easy to understand what you're requesting. A good way is
to keep it to one request per GitHub issue, as we can then easily track
feature requests.
3. Check whether it has already been asked or added.
You can search the issue tracker to see if your feature has already been
requested at https://github.com/Multiverse/Multiverse-Core/issues.
4. Ask yourself: "Does this belong in Multiverse-Core?"
There are lots of features that we reject because most servers won't
need or use them. If your feature is very specific or already exists in
another plugin, it might not be a good fit for Multiverse-Core.
5. Delete this line and all above lines before posting your issue! -->
### Feature request
**Feature description**
<!-- What feature are you suggesting? -->
**How the feature is useful**
<!-- How is the feature useful to players, server owners and/or developers? -->
+13 -1
View File
@@ -2,6 +2,7 @@
/.classpath
/.project
/.settings
/.checkstyle
# netbeans
/nbproject
@@ -11,6 +12,7 @@
# maven
/target
dependency-reduced-pom.xml
# vim
.*.sw[a-p]
@@ -30,4 +32,14 @@
*.iml
*.ipr
*.iws
.idea/
.idea/
# Fern's utils
uploadtoserver.sh
# Testing files:
debug.log
# Doxygen
/docs/html
debug.txt
-7
View File
@@ -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
+6
View File
@@ -0,0 +1,6 @@
language: java
jdk:
- oraclejdk8
notifications:
email: false
dist: trusty
+12 -1
View File
@@ -1,5 +1,16 @@
Building
========
Simply build the source with maven:
$ mvn install
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:
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.
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.
+1813
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+141
View File
@@ -0,0 +1,141 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Multiverse 2 Copyright (c) the Multiverse Team 2011. ~
~ Multiverse 2 is licensed under the BSD License. ~
~ For more information please check the README.md file included ~
~ with this project. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!-- Future reference: valid severity values are 'ignore', 'info', 'warning', 'error' -->
<module name="Checker">
<module name="JavadocPackage">
<property name="allowLegacy" value="true"/>
</module>
<module name="NewlineAtEndOfFile" />
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline">
<property name="message" value="Line has trailing spaces."/>
<property name="format" value="\s+$"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
</module>
<module name="TreeWalker">
<!-- Make suppression possible -->
<module name="FileContentsHolder"/>
<!-- Actual checks -->
<module name="LineLength">
<property name="max" value="160"/>
<property name="severity" value="warning"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="package"/><!-- We don't need javadoc for private methods -->
<property name="tokens" value="METHOD_DEF"/><!-- We don't need javadoc for constructors -->
</module>
<module name="JavadocType"/>
<module name="JavadocVariable">
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
</module>
<module name="JavadocStyle"/>
<module name="WriteTag">
<property name="tag" value="@author"/>
<property name="tagFormat" value="\S"/>
<property name="severity" value="ignore"/>
<property name="tagSeverity" value="warning"/>
</module>
<module name="ConstantName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
<property name="excludes" value="com.onarandombox.MultiverseCore.utils,com.onarandombox.MultiverseCore.configuration,com.onarandombox.MultiverseCore.commands,com.onarandombox.MultiverseCore.destination"/>
</module>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<module name="MethodLength">
<property name="severity" value="warning"/>
<property name="countEmpty" value="false"/>
</module>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter">
<property name="severity" value="warning"/>
</module>
<module name="WhitespaceAround">
<property name="severity" value="warning"/>
</module>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Don't like errors for `final` missing
<module name="DesignForExtension"/>
<module name="FinalClass"/>
-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>
<module name="ArrayTypeStyle"/>
<!-- Don't like errors for `final` missing
<module name="FinalParameters"/>
-->
<module name="TodoComment">
<property name="severity" value="info"/>
</module>
<module name="UpperEll"/>
<module name="Indentation"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
</module>
</module>
View File
Whitespace-only changes.
Submodule lib/allpay deleted from b6b450e8b6.
+390 -151
View File
@@ -1,160 +1,399 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.onarandombox.multiversecore</groupId>
<artifactId>Multiverse-Core</artifactId>
<version>2.0</version>
<name>Multiverse-Core</name>
<description>World Management Plugin</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>UNKNOWN</project.build.number>
</properties>
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>5.0.0-SNAPSHOT</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>
<project.bitly-access-token>bitly-access-token</project.bitly-access-token>
</properties>
<repositories>
<repository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/artifactory/repo</url>
</repository>
</repositories>
<repositories>
<!-- Spigot -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>onarandombox</id>
<url>http://repo.onarandombox.com/content/groups/public</url>
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>minebench-repo</id>
<url>https://repo.minebench.de/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
</repositories>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- Build Helper - Additional Source Folders -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-wsdl-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/lib/allpay/src</source>
<source>${project.basedir}/lib/commandhandler/src</source>
<source>${project.basedir}/lib/commandhandler/lib/ShellParser/src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.3.8</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}-${project.build.number}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<!-- Jar Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifestEntries>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Bukkit Dependency -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Bukkit Dependency -->
<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>
<!-- Start of Economy Dependencies -->
<dependency>
<groupId>cosine.boseconomy</groupId>
<artifactId>BOSEconomy</artifactId>
<version>0.6.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<ciManagement>
<system>jenkins</system>
<url>http://ci.onarandombox.com</url>
</ciManagement>
<dependency>
<groupId>fr.crafter.tickleman.RealShop</groupId>
<artifactId>RealShop</artifactId>
<version>0.63</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- 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>
<profile>
<id>bitly</id>
<activation>
<property>
<name>env.BITLY_ACCESS_TOKEN</name>
</property>
</activation>
<properties>
<project.bitly-access-token>${env.BITLY_ACCESS_TOKEN}</project.bitly-access-token>
</properties>
</profile>
</profiles>
<dependency>
<groupId>com.iConomy</groupId>
<artifactId>iConomy</artifactId>
<version>5.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>replace-bitly-access-token</id>
<phase>generate-sources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<basedir>${project.build.sourceDirectory}</basedir>
<includes>
<include>com/onarandombox/MultiverseCore/utils/webpaste/BitlyURLShortener.java</include>
</includes>
<replacements>
<replacement>
<token>bitly-access-token</token>
<value>${project.bitly-access-token}</value>
</replacement>
</replacements>
</configuration>
</execution>
<execution>
<id>replace-maven-version-number</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<basedir>${project.build.directory}/classes</basedir>
<includes>
<include>plugin.yml</include>
</includes>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}-b${project.build.number}</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>
<!-- Jar Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestEntries>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</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>3.0.0-M3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<enableRulesSummary>true</enableRulesSummary>
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<failOnError>false</failOnError>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>me.main__.util</pattern>
<shadedPattern>com.onarandombox.serializationconfig</shadedPattern>
</relocation>
<relocation>
<pattern>com.pneumaticraft.commandhandler</pattern>
<shadedPattern>com.onarandombox.commandhandler</shadedPattern>
</relocation>
<relocation>
<pattern>buscript</pattern>
<shadedPattern>com.onarandombox.buscript</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.onarandombox.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>com.dumptruckman.minecraft.util.Logging</pattern>
<shadedPattern>com.onarandombox.MultiverseCore.utils.CoreLogging</shadedPattern>
</relocation>
<relocation>
<pattern>com.dumptruckman.minecraft.util.DebugLog</pattern>
<shadedPattern>com.onarandombox.MultiverseCore.utils.DebugFileLogger</shadedPattern>
</relocation>
<relocation>
<pattern>org.codehaus.jettison</pattern>
<shadedPattern>com.onarandombox.jettison</shadedPattern>
</relocation>
<relocation>
<pattern>de.themoep.idconverter</pattern>
<shadedPattern>com.onarandombox.idconverter</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>se.eris</groupId>
<artifactId>notnull-instrumenter-maven-plugin</artifactId>
<version>0.6.8</version>
<executions>
<execution>
<goals>
<goal>instrument</goal>
<goal>tests-instrument</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependency>
<groupId>com.nijiko.coelho.iConomy</groupId>
<artifactId>iConomy</artifactId>
<version>4.65</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- SerializationConfig Dependency -->
<dependency>
<groupId>me.main__.util</groupId>
<artifactId>SerializationConfig</artifactId>
<version>1.7</version>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- End of SerializationConfig Dependency -->
<!-- Start of Economy Dependency -->
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<!-- End of Economy Dependency -->
<!-- Start of CommandHandler Dependency -->
<dependency>
<groupId>com.pneumaticraft.commandhandler</groupId>
<artifactId>CommandHandler</artifactId>
<version>11</version>
</dependency>
<!-- End of CommandHandler Dependency -->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.dumptruckman.minecraft</groupId>
<artifactId>buscript</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.8</version>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.dumptruckman.minecraft</groupId>
<artifactId>Logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>de.themoep.idconverter</groupId>
<artifactId>mappings</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.earth2me.essentials</groupId>
<artifactId>Essentials</artifactId>
<version>2.4.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of Economy Dependencies -->
<!-- Start of Permissions Dependencies -->
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>3.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<!-- End of Permissions Dependencies -->
</dependencies>
<!-- Start of Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.0</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<version>2.0.0</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.0</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/content/repositories/multiverse</url>
</repository>
<snapshotRepository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/content/repositories/multiverse-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
@@ -1,11 +0,0 @@
package com.onarandombox.MultiverseCore;
import java.util.logging.Level;
import org.bukkit.Server;
public interface LoggablePlugin {
public void log(Level level, String msg);
public Server getServer();
}
@@ -1,176 +0,0 @@
package com.onarandombox.MultiverseCore;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.utils.MVDestination;
import com.pneumaticraft.commandhandler.PermissionsInterface;
public class MVPermissions implements PermissionsInterface {
private MultiverseCore plugin;
private PermissionHandler permissions = null;
/**
* Constructor FTW
*
* @param plugin Pass along the Core Plugin.
*/
public MVPermissions(MultiverseCore plugin) {
this.plugin = plugin;
// We have to see if permissions was loaded before MV was
if (this.plugin.getServer().getPluginManager().getPlugin("Permissions") != null) {
this.setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
this.plugin.log(Level.INFO, "- Attached to Permissions");
}
}
/**
* Check if a Player can teleport to the Destination world from there current world.
*
* @param p
* @param w
* @return
*/
public Boolean canTravelFromWorld(Player p, MVWorld w) {
List<String> blackList = w.getWorldBlacklist();
boolean returnValue = true;
for (String s : blackList) {
if (s.equalsIgnoreCase(p.getWorld().getName())) {
returnValue = false;
break;
}
}
return returnValue;
}
public boolean canTravelFromLocation(Player teleporter, Location location) {
if (!this.plugin.isMVWorld(location.getWorld().getName())) {
return false;
}
return canTravelFromWorld(teleporter, this.plugin.getMVWorld(location.getWorld().getName()));
}
/**
* Check if the Player has the permissions to enter this world.
*
* @param p
* @param w
* @return
*/
public Boolean canEnterWorld(Player p, MVWorld w) {
return this.hasPermission(p, "multiverse.access." + w.getName(), false);
}
public Boolean canEnterLocation(Player p, Location l) {
if (l == null) {
return false;
}
String worldName = l.getWorld().getName();
if (!this.plugin.isMVWorld(worldName)) {
return false;
}
return this.hasPermission(p, "multiverse.access." + worldName, false);
}
public Boolean canEnterDestination(Player p, MVDestination d) {
if (d == null || d.getLocation(p) == null) {
return false;
}
String worldName = d.getLocation(p).getWorld().getName();
if (!this.plugin.isMVWorld(worldName)) {
return false;
}
if(!canEnterLocation(p, d.getLocation(p))) {
return false;
}
return this.hasPermission(p, d.getRequiredPermission(), false);
}
public void setPermissions(PermissionHandler handler) {
this.permissions = handler;
}
public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) {
if (!(sender instanceof Player)) {
return true;
}
// NO one can access a null permission (mainly used for destinations):w
if(node == null) {
return false;
}
// Everyone can access an empty permission
// Currently used for the PlayerDestination
if(node.equals("")) {
return true;
}
Player player = (Player) sender;
boolean opFallback = this.plugin.getConfig().getBoolean("opfallback", true);
if (this.permissions != null && this.permissions.has(player, node)) {
// If Permissions is enabled we check against them.
// this.plugin.log(Level.WARNING, "Allowed by P3/P2 ");
return true;
} else if (sender.hasPermission(node)) {
// If Now check the bukkit permissions
// this.plugin.log(Level.WARNING, "Allowed by BukkitPerms");
return true;
} else if (player.isOp() && opFallback) {
// If Player is Op we always let them use it if they have the fallback enabled!
// this.plugin.log(Level.WARNING, "Allowed by OP");
return true;
}
// If the Player doesn't have Permissions and isn't an Op then
// we return true if OP is not required, otherwise we return false
// This allows us to act as a default permission guidance
// If they have the op fallback disabled, NO commands will work without a permissions plugin.
return !isOpRequired && opFallback;
}
public String getType() {
String opsfallback = "";
if(this.plugin.getConfig().getBoolean("opfallback", true)) {
opsfallback = " WITH OPs.txt fallback";
}
if (this.permissions != null) {
return "Permissions " + this.plugin.getServer().getPluginManager().getPlugin("Permissions").getDescription().getVersion() + opsfallback;
}
return "Bukkit Permissions" + opsfallback;
}
public boolean hasAnyPermission(CommandSender sender, List<String> nodes, boolean isOpRequired) {
for (String node : nodes) {
if (this.hasPermission(sender, node, isOpRequired)) {
return true;
}
}
return false;
}
@Override
public boolean hasAllPermission(CommandSender sender, List<String> nodes, boolean isOpRequired) {
for (String node : nodes) {
if (!this.hasPermission(sender, node, isOpRequired)) {
return false;
}
}
return true;
}
}
@@ -1,96 +0,0 @@
package com.onarandombox.MultiverseCore;
import java.util.Date;
import org.bukkit.entity.Player;
import org.bukkit.util.config.Configuration;
public class MVPlayerSession {
private Player player; // Player holder, may be unnecessary.
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
// private Location bedSpawn;
//
// // Beds are 2 blocks, thus we need to store both places
// private Location bedA;
// private Location bedB;
private Configuration config; // Configuration file to find out Cooldown Timers.
public MVPlayerSession(Player player, Configuration config, MultiverseCore multiVerseCore) {
this.player = player;
this.config = config;
// this.bedSpawn = null;
}
/**
* Update the Teleport time.
*/
public void teleport() {
this.teleportLast = (new Date()).getTime();
}
/**
* Grab whether the cooldown on Portal use has expired or not.
*
* @return
*/
public boolean getTeleportable() {
Long time = (new Date()).getTime();
if ((time - this.teleportLast) > this.config.getInt("portalcooldown", 5000)) {
return true;
} else {
return false;
}
}
/**
* Send a Message to the Player as long as enough time has passed since the last message.
*
* @param msg
*/
public void message(String msg) {
Long time = (new Date()).getTime();
if ((time - this.messageLast) > this.config.getInt("messagecooldown", 2000)) {
this.player.sendMessage(msg);
this.messageLast = time;
}
}
// Commented out bed code, i'll get rid of it soon.
// --FF
// public void setRespawnLocation(Location location) {
// this.bedSpawn = location;
// }
// // This one simply spawns the player closer to the bed.
// public Location getBedRespawnLocation() {
// // There is a bedrespawn set
// if (this.bedSpawn != null) {
// if (!this.bs.playerCanSpawnHereSafely(this.bedSpawn) || !bedStillExists(this.bedSpawn)) {
// this.bedSpawn = null;
// return this.bedSpawn;
// }
// Location actualRespawn = this.bedSpawn;
// Location bedRespawn = new Location(actualRespawn.getWorld(), actualRespawn.getX(), actualRespawn.getY(), actualRespawn.getZ());
// bedRespawn.setY(bedRespawn.getY() - .25);
// return bedRespawn;
// }
// return null;
// }
//
// private boolean bedStillExists(Location bedSpawn) {
// //System.out.print("Dangers:");
// //this.bs.showDangers(bedSpawn);
// Location locationDown = new Location(bedSpawn.getWorld(), bedSpawn.getX(), bedSpawn.getY(), bedSpawn.getZ());
// locationDown.setY(locationDown.getY() - 1);
// if (locationDown.getBlock().getType() != Material.BED_BLOCK) {
// return false;
// }
// return true;
// }
}
@@ -1,7 +0,0 @@
package com.onarandombox.MultiverseCore;
public interface MVPlugin extends LoggablePlugin {
public String dumpVersionInfo(String buffer);
public MultiverseCore getCore();
public void setCore(MultiverseCore core);
}
@@ -1,216 +0,0 @@
package com.onarandombox.MultiverseCore;
import java.util.logging.Level;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import com.onarandombox.utils.BlockSafety;
public class MVTeleport {
MultiverseCore plugin;
BlockSafety bs = new BlockSafety();
public MVTeleport(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* This method will be specific to beds, and check on top of the bed then around it.
*
* @return
*/
public Location getSafeBedDestination(Location bedLocation) {
// System.out.print(bedLocation);
Location idealLocation = bedLocation;
idealLocation.setY(idealLocation.getY() + 1);
idealLocation.setX(idealLocation.getX() + .5);
idealLocation.setZ(idealLocation.getZ() + .5);
// System.out.print(idealLocation);
if (this.bs.playerCanSpawnHereSafely(idealLocation)) {
// System.out.print(idealLocation);
return bedLocation;
}
return null;
}
private Location getSafeLocation(Location l) {
// Check around the player first in a configurable radius:
// TODO: Make this configurable
Location safe = checkAboveAndBelowLocation(l, 6, 9);
if (safe != null) {
safe.setX(safe.getBlockX() + .5);
safe.setZ(safe.getBlockZ() + .5);
}
return safe;
}
private Location checkAboveAndBelowLocation(Location l, int tolerance, int radius) {
// Tolerance must be an even number:
if (tolerance % 2 != 0) {
tolerance += 1;
}
// We want half of it, so we can go up and down
tolerance /= 2;
// For now this will just do a straight up block.
Location locToCheck = l.clone();
// Check the main level
Location safe = this.checkAroundLocation(locToCheck, radius);
if (safe != null) {
return safe;
}
// We've already checked zero right above this.
int currentLevel = 1;
while (currentLevel <= tolerance) {
// Check above
locToCheck = l.clone();
locToCheck.add(0, currentLevel, 0);
safe = this.checkAroundLocation(locToCheck, radius);
if (safe != null) {
return safe;
}
// Check below
locToCheck = l.clone();
locToCheck.subtract(0, currentLevel, 0);
safe = this.checkAroundLocation(locToCheck, radius);
if (safe != null) {
return safe;
}
currentLevel++;
}
return null;
}
/**
* For my crappy algorithm, radius MUST be odd
*
* @param l
* @param radius
* @return
*/
private Location checkAroundLocation(Location l, int diameter) {
if (diameter % 2 == 0) {
diameter += 1;
}
Location checkLoc = l.clone();
// Start at 3, the min diameter around a block
int loopcounter = 3;
while (loopcounter <= diameter) {
boolean foundSafeArea = checkAroundSpecificDiameter(checkLoc, loopcounter);
// If a safe area was found:
if (foundSafeArea) {
// Return the checkLoc, it is the safe location.
return checkLoc;
}
// Otherwise, let's reset our location
checkLoc = l.clone();
// And increment the radius
loopcounter += 2;
}
return null;
}
private boolean checkAroundSpecificDiameter(Location checkLoc, int circle) {
// Adjust the circle to get how many blocks to step out.
// A radius of 3 makes the block step 1
// A radius of 5 makes the block step 2
// A radius of 7 makes the block step 3
// ...
int adjustedCircle = ((circle - 1) / 2);
checkLoc.add(adjustedCircle, 0, 0);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
// Now we go to the right that adjustedCircle many
for (int i = 0; i < adjustedCircle; i++) {
checkLoc.add(0, 0, 1);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then down adjustedCircle *2
for (int i = 0; i < adjustedCircle * 2; i++) {
checkLoc.add(-1, 0, 0);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then left adjustedCircle *2
for (int i = 0; i < adjustedCircle * 2; i++) {
checkLoc.add(0, 0, -1);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then up Then left adjustedCircle *2
for (int i = 0; i < adjustedCircle * 2; i++) {
checkLoc.add(1, 0, 0);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then finish up by doing adjustedCircle - 1
for (int i = 0; i < adjustedCircle - 1; i++) {
checkLoc.add(0, 0, 1);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
return false;
}
public boolean safelyTeleport(Entity e, Location l) {
if (this.bs.playerCanSpawnHereSafely(l)) {
e.teleport(l);
//this.plugin.log(Level.WARNING, "The first location you gave me was safe.");
return true;
}
if(e instanceof Minecart) {
Minecart m = (Minecart)e;
if(!this.bs.canSpawnCartSafely(m)) {
return false;
}
}
else if(e instanceof Vehicle) {
Vehicle v = (Vehicle)e;
if(!this.bs.canSpawnVehicleSafely(v)) {
return false;
}
}
Location safeLocation = this.getSafeLocation(l);
if (safeLocation != null) {
// Add offset to account for a vehicle on dry land!
if (!this.bs.isEntitiyOnTrack(e, safeLocation)) {
safeLocation.setY(safeLocation.getBlockY() + .5);
}
e.teleport(safeLocation);
//this.plugin.log(Level.WARNING, "Had to look for a bit, but I found a safe place for ya!");
return true;
}
if (e instanceof Player) {
Player p = (Player) e;
p.sendMessage("No safe locations found!");
}
else if (e.getPassenger() instanceof Player) {
Player p = (Player) e.getPassenger();
p.sendMessage("No safe locations found!");
}
this.plugin.log(Level.WARNING, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
return false;
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,366 @@
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 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 = true;
prefixchatformat = "[%world%]%chat%";
teleportintercept = true;
firstspawnoverride = true;
displaypermerrors = true;
globaldebug = 0;
messagecooldown = 5000;
teleportcooldown = 1000;
this.version = 2.9;
silentstart = false;
defaultportalsearch = false;
portalsearchradius = 128;
autopurge = true;
idonotwanttodonate = false;
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
}
/**
* {@inheritDoc}
*/
@Override
public boolean setConfigProperty(String property, String value) {
try {
return this.setProperty(property, value, true);
} catch (NoSuchPropertyException e) {
return false;
}
}
// And here we go:
/**
* {@inheritDoc}
*/
@Override
public boolean getEnforceAccess() {
return this.enforceaccess;
}
/**
* {@inheritDoc}
*/
@Override
public void setEnforceAccess(boolean enforceAccess) {
this.enforceaccess = enforceAccess;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getPrefixChat() {
return this.prefixchat;
}
/**
* {@inheritDoc}
*/
@Override
public void setPrefixChat(boolean prefixChat) {
this.prefixchat = prefixChat;
}
/**
* {@inheritDoc}
*/
@Override
public String getPrefixChatFormat() {
return this.prefixchatformat;
}
/**
* {@inheritDoc}
*/
@Override
public void setPrefixChatFormat(String prefixChatFormat) {
this.prefixchatformat = prefixChatFormat;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getTeleportIntercept() {
return this.teleportintercept;
}
/**
* {@inheritDoc}
*/
@Override
public void setTeleportIntercept(boolean teleportIntercept) {
this.teleportintercept = teleportIntercept;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getFirstSpawnOverride() {
return this.firstspawnoverride;
}
/**
* {@inheritDoc}
*/
@Override
public void setFirstSpawnOverride(boolean firstSpawnOverride) {
this.firstspawnoverride = firstSpawnOverride;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getDisplayPermErrors() {
return this.displaypermerrors;
}
/**
* {@inheritDoc}
*/
@Override
public void setDisplayPermErrors(boolean displayPermErrors) {
this.displaypermerrors = displayPermErrors;
}
/**
* {@inheritDoc}
*/
@Override
public int getGlobalDebug() {
return this.globaldebug;
}
/**
* {@inheritDoc}
*/
@Override
public void setGlobalDebug(int globalDebug) {
this.globaldebug = globalDebug;
Logging.setDebugLevel(globalDebug);
Bukkit.getPluginManager().callEvent(new MVDebugModeEvent(globalDebug));
}
/**
* {@inheritDoc}
*/
@Override
public 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);
}
@@ -0,0 +1,217 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import buscript.Buscript;
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
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.entity.Player;
/**
* Multiverse 2 Core API
* <p>
* This API contains a bunch of useful things you can get out of Multiverse in general!
*/
public interface Core {
/**
* Returns the Vault handler used by Multiverse. The returned object will have all methods necessary for
* interfacing with Vault.
*
* @return the Vault handler for Multiverse.
* @deprecated we are now using {@link #getEconomist()} for all economy needs.
*/
@Deprecated
VaultHandler getVaultHandler();
/**
* Retrieves Multiverse's friendly economist. The economist can be used for dealing with economies without
* worrying about any of the messy details.
*
* @return the economy manager for Multiverse.
*/
MVEconomist getEconomist();
/**
* Reloads the Multiverse Configuration files:
* worlds.yml and config.yml.
*/
void loadConfigs();
/**
* Gets the Multiverse message system. This allows you to send messages
* to users at specified intervals.
*
* @return The loaded {@link MultiverseMessaging}.
*/
MultiverseMessaging getMessaging();
/**
* Gets the {@link MVPlayerSession} for the given player.
* This will also create a player session if one does not exist
* for a player.
*
* @param player The player's session to grab.
*
* @return The corresponding {@link MVPlayerSession}.
*/
MVPlayerSession getPlayerSession(Player player);
/**
* Multiverse uses an advanced permissions setup, this object
* simplifies getting/setting permissions.
*
* @return A non-null {@link MVPermissions}.
*/
MVPermissions getMVPerms();
/**
* Multiverse uses {@link CommandHandler} to make adding and using commands
* a piece of cake.
*
* @return A non-null {@link CommandHandler}.
*/
CommandHandler getCommandHandler();
/**
* Gets the factory class responsible for loading many different destinations
* on demand.
*
* @return A valid {@link DestinationFactory}.
*/
DestinationFactory getDestFactory();
/**
* Gets the primary class responsible for managing Multiverse Worlds.
*
* @return {@link MVWorldManager}.
*/
MVWorldManager getMVWorldManager();
/**
* Saves all configs.
*
* @return Whether the config was successfully saved
*/
boolean saveMVConfigs();
/**
* Gets the {@link AnchorManager}.
*
* @return The {@link AnchorManager}
*/
AnchorManager getAnchorManager();
/**
* Used by queued commands to regenerate a world on a delay.
*
* @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)} instead.
*/
@Deprecated
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed);
/**
* Decrements the number of plugins that have specifically hooked into core.
*/
void decrementPluginCount();
/**
* Increments the number of plugins that have specifically hooked into core.
*/
void incrementPluginCount();
/**
* Returns the number of plugins that have specifically hooked into core.
*
* @return The number if plugins that have hooked into core.
*/
int getPluginCount();
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @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,20 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
/**
* A fancy text.
*/
public interface FancyText {
/**
* Gets the {@link String}-representation of this {@link FancyText}.
*
* @return The {@link String}-representation of this {@link FancyText}.
*/
String getFancyText();
}
@@ -0,0 +1,99 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
/**
* Used to manipulate locations.
*/
public interface LocationManipulation {
/**
* Convert a Location into a Colon separated string to allow us to store it in text.
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding String2Loc function is {@link #stringToLocation}
*
* @param location The Location to save.
* @return The location as a string in this format: WORLD:x,y,z:yaw:pitch
*/
String locationToString(Location location);
/**
* This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
*
* @param l The location to round to the block location
* @return A rounded location.
*/
Location getBlockLocation(Location l);
/**
* Returns a new location from a given string. The format is as follows:
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding Location2String function is {@link #stringToLocation}
*
* @param locationString The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
* @return A new location defined by the string or null if the string was invalid.
*/
Location stringToLocation(String locationString);
/**
* Returns a colored string with the coords.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoords(Location l);
/**
* Converts a location to a printable readable formatted string including pitch/yaw.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoordsRaw(Location l);
/**
* Return the NESW Direction a Location is facing.
*
* @param location The {@link Location}
* @return The NESW Direction
*/
String getDirection(Location location);
/**
* Returns the float yaw position for the given cardinal direction.
*
* @param orientation The cardinal direction
* @return The yaw
*/
float getYaw(String orientation);
/**
* Returns a speed float from a given vector.
*
* @param v The {@link Vector}
* @return The speed
*/
float getSpeed(Vector v);
/**
* Returns a translated vector from the given direction.
*
* @param v The old {@link Vector}
* @param direction The new direction
* @return The translated {@link Vector}
*/
Vector getTranslatedVector(Vector v, String direction);
/**
* Returns the next Location that a {@link Vehicle} is traveling at.
*
* @param v The {@link Vehicle}
* @return The {@link Location}
*/
Location getNextBlock(Vehicle v);
}
@@ -0,0 +1,36 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
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.
*
* @deprecated Replaced by {@link Logging}.
* */
@Deprecated
public interface LoggablePlugin {
/**
* Logs a message at the specified level.
*
* @param level The Log-{@link Level}.
* @param msg The message to log.
*/
void log(Level level, String msg);
/**
* Gets the server instance that this plugin is attached to.
*
* @return A {@link Server} instance.
*/
Server getServer();
}
@@ -0,0 +1,141 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A destination API for Multiverse
* Any plugin can add these to MV and when they are, any action that uses them (portals, MVTP, etc.) can use them!
*/
public interface MVDestination {
/**
* Returns the identifier or prefix that is required for this destination.
* <p>
* Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
* Please check the wiki when adding a custom destination!
*
* @return The identifier or prefix that is required for this destination.
*/
String getIdentifier();
/**
* Allows you to determine if a Destination is valid for the type it thinks it is.
* <p>
* An example of this would be the exact destination. A valid string would be: e:0,0,0 where an invalid one would
* be e:1:2:3. The first string would return true the second would return false. This is simply a convenience
* method
* and does not even NEED to be called, but it's highly recommended if you're teleporting, but it's mainly for
* Multiverse Internal use.
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*
* @return True if the destination is valid, false if not.
*/
boolean isThisType(JavaPlugin plugin, String destination);
/**
* 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
* minecarts can be teleported.
* <p>
* Do not forget to use {@link #getVelocity()} as destinations can use this too!
*
* @param entity The entity to be teleported.
*
* @return The location of the entity.
*/
Location getLocation(Entity entity);
/**
* Returns the velocity vector for this destination.
* <p>
* Plugins wishing to fully support MVDestinations MUST implement this.
*
* @return A vector representing the speed/direction the player should travel when arriving
*/
Vector getVelocity();
/**
* Sets the destination string.
* <p>
* This should be used when you want to tell this destination object about a change in where it should take people.
* The destination param should be match the result from {@link #getIdentifier()}. A valid example would be that if
* {@link #getIdentifier()} returned "ow" our destination string could be "ow:TownCenter" but could not be
* "p:HomePortal"
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*/
void setDestination(JavaPlugin plugin, String destination);
/**
* Returns true if the destination is valid and players will be taken to it.
* <p>
* Even if destinations are in the correct format (p:MyPortal) MyPortal may not exist, and therefore this would
* return false.
*
* @return True if the destination is valid; false if not.
*/
boolean isValid();
/**
* Gives you a general friendly description of the type of destination.
* <p>
* For example, the PlayerDestination sets this to "Player". You can use this to show where a player will be taken.
*
* @return A friendly string description of the type of destination.
*/
String getType();
/**
* Gives you a specific name of the destination.
* <p>
* For example, the PlayerDestination sets this to The Player's Name.
*
* @return A friendly string stating the name of the destination.
*/
String getName();
/**
* Returns a string that can easily be saved in the config that contains all the details needed to rebuild this
* destination.
* <p>
* ex: e:0,0,0:50:50
*
* @return The savable config string.
*/
String toString();
/**
* Returns the permissions string required to go here.
* <p>
* ex: multiverse.access.world
* <p>
* NOTE: This is NOT the permission to use the teleport command.
*
* @return the permissions string required to go here.
*/
String getRequiredPermission();
/**
* Should the Multiverse SafeTeleporter be used?
* <p>
* If not, MV will blindly take people to the location specified.
*
* @return True if the SafeTeleporter will be used, false if not.
*/
boolean useSafeTeleporter();
}
@@ -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.api;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
/**
* This interface is implemented by every official Multiverse-plugin.
*/
public interface MVPlugin extends LoggablePlugin {
/**
* Adds This plugin's version information to the buffer and returns the new string.
*
* @param buffer The string that contains Core and all other MV plugins' versions.
*
* @return A modified buffer that contains this MVPlugin's version information.
*
* @deprecated This is now deprecated, nobody needs it any longer.
* All version info-dumping is now done with {@link MVVersionEvent}.
*/
@Deprecated
String dumpVersionInfo(String buffer);
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link com.onarandombox.MultiverseCore}.
*/
MultiverseCore getCore();
/**
* Sets the reference to MultiverseCore.
*
* @param core A valid {@link com.onarandombox.MultiverseCore}.
*/
void setCore(MultiverseCore core);
/**
* Allows Multiverse or a plugin to query another Multiverse plugin to see what version its protocol is. This
* number
* should change when something will break the code.
*
* @return The Integer protocol version.
*/
int getProtocolVersion();
}
@@ -0,0 +1,317 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.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;
import java.io.File;
import java.util.Collection;
import java.util.List;
/**
* Multiverse 2 World Manager API
* <p>
* This API contains all of the world managing
* functions that your heart desires!
*/
public interface MVWorldManager {
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator);
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator, boolean useSpawnAdjust);
/**
* Make a copy of a world.
*
* @param oldName Name of world to be copied
* @param newName Name of world to be created
* @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);
/**
* Remove the world from the Multiverse list, from the
* config if wanted, and deletes the folder.
*
* @param name The name of the world to remove
* @param removeConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeConfig);
/**
*
* @param name The name of the world to remove
* @param removeFromConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @param deleteWorldFolder If true the world folder will be completely deleted. If false
* only the contents of the world folder will be deleted
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeFromConfig, boolean deleteWorldFolder);
/**
* Unload a world from Multiverse.
*
* @param name Name of the world to unload
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name);
/**
* Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.
*
* @param name Name of the world to unload
* @param unloadBukkit True if Bukkit world should be unloaded
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name, boolean unloadBukkit);
/**
* Loads the world. Only use this if the world has been
* unloaded with {@link #unloadWorld(String)}.
*
* @param name The name of the world to load
* @return True if success, false if failure.
*/
boolean loadWorld(String name);
/**
* Removes all players from the specified world.
*
* @param name World to remove players from.
*/
void removePlayersFromWorld(String name);
/**
* Test if a given chunk generator is valid.
*
* @param generator The generator name.
* @param generatorID The generator id.
* @param worldName The worldName to use as the default.
* @return A {@link ChunkGenerator} or null
*/
ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName);
/**
* Returns a list of all the worlds Multiverse knows about.
*
* @return A list of {@link MultiverseWorld}.
*/
Collection<MultiverseWorld> getMVWorlds();
/**
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
* This will search name AND alias.
*
* @param name The name or alias of the world to get.
* @return A {@link MultiverseWorld} or null.
*/
MultiverseWorld getMVWorld(String name);
/**
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
*
* @param world The Bukkit world to check.
* @return A {@link MultiverseWorld} or null.
*/
MultiverseWorld getMVWorld(World world);
/**
* Checks to see if the given name is a valid {@link MultiverseWorld}.
*
* @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 world is a valid {@link MultiverseWorld}.
*
* @param world The Bukkit world to check.
* @return True if the world has been loaded into MV2, false if not.
*/
boolean isMVWorld(World world);
/**
* Load the Worlds &amp; Settings from the configuration file.
*
* @param forceLoad If set to true, this will perform a total
* reset and not just load new worlds.
*/
void loadWorlds(boolean forceLoad);
/**
* Loads the Worlds &amp; Settings for any worlds that bukkit loaded before us.
* <p>
* This way people will _always_ have some worlds in the list.
*/
void loadDefaultWorlds();
/**
* 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.
*
* @return A Multiverse world that players will spawn in or null if no MV world has been set.
*/
MultiverseWorld getSpawnWorld();
/**
* Gets the list of worlds in the config, but unloaded.
*
* @return A List of worlds as strings.
*/
List<String> getUnloadedWorlds();
/**
* This method populates an internal list and needs to be called after multiverse initialization.
*/
void getDefaultWorldGenerators();
/**
* Load the config from a file.
*
* @param file The file to load.
* @return A loaded configuration.
*/
FileConfiguration loadWorldConfig(File file);
/**
* Saves the world config to disk.
*
* @return True if success, false if fail.
*/
boolean saveWorldsConfig();
/**
* Remove the world from the Multiverse list and from the config.
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
boolean removeWorldFromConfig(String name);
/**
* Sets the initial spawn world for new players.
*
* @param world The World new players should spawn in.
*/
void setFirstSpawnWorld(String world);
/**
* Gets the world players should spawn in first.
*
* @return The {@link 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);
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);
}
@@ -0,0 +1,230 @@
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 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;
}
}
@@ -0,0 +1,674 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.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.
*/
public interface MultiverseWorld {
/**
* Returns the Bukkit world object that this world describes.
*
* @return A {@link World}
*/
World getCBWorld();
/**
* Gets the name of this world. The name cannot be changed.
* <p>
* Note for plugin developers: Usually {@link #getAlias()}
* is what you want to use instead of this method.
*
* @return The name of the world as a String.
*/
String getName();
/**
* Gets the type of this world. As of 1.2 this will be:
* FLAT, NORMAL or VERSION_1_1
* <p>
* This is <b>not</b> the generator.
*
* @return The Type of this world.
*/
WorldType getWorldType();
/**
* Gets the environment of this world.
*
* @return A {@link org.bukkit.World.Environment}.
*/
World.Environment getEnvironment();
/**
* Sets the environment of a world.
* <p>
* Note: This will ONLY take effect once the world is unloaded/reloaded.
*
* @param environment A {@link org.bukkit.World.Environment}.
*/
void setEnvironment(World.Environment environment);
/**
* Gets the difficulty of this world.
*
* @return The difficulty of this world.
*/
Difficulty getDifficulty();
/**
* Sets the difficulty of this world and returns true if success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. {@code PEACEFUL}
*
* @param difficulty The difficulty to set the world to as a string.
* @return True if success, false if the provided string
* could not be translated to a difficulty.
* @deprecated Use {@link #setDifficulty(Difficulty)} or, if you have to
* pass a string, use {@link #setPropertyValue(String, String)} instead.
*/
@Deprecated
boolean setDifficulty(String difficulty);
/**
* Sets the difficulty of this world and returns {@code true} on success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. PEACEFUL
*
* @param difficulty The new difficulty.
* @return True if success, false if the operation failed... for whatever reason.
*/
boolean setDifficulty(Difficulty difficulty);
/**
* Gets the world seed of this world.
*
* @return The Long version of the seed.
*/
long getSeed();
/**
* Sets the seed of this world.
*
* @param seed A Long that is the seed.
*/
void setSeed(long seed);
/**
* Gets the generator of this world.
*
* @return The name of the generator.
*/
String getGenerator();
/**
* Sets the generator of this world.
*
* @param generator The new generator's name.
*/
void setGenerator(String generator);
/**
* Gets the help-message for a property.
* @param property The name of the property.
* @return The help-message.
* @throws PropertyDoesNotExistException Thrown if the property was not found.
*/
String getPropertyHelp(String property) throws PropertyDoesNotExistException;
/**
* Gets a property as {@link String}.
*
* @param property The name of a world property to get.
* @return The string-representation of that property.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
String getPropertyValue(String property) throws PropertyDoesNotExistException;
/**
* Sets a property to a given value.
*
* @param property The name of a world property to set.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was set, false if not.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
/**
* Adds a value to the given property. The property must be a {@link 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.
* <p>
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
*
* @return The alias of the world as a String.
*/
String getAlias();
/**
* Sets the alias of the world.
*
* @param alias A string that is the new alias.
*/
void setAlias(String alias);
/**
* Gets the color that this world's name/alias will display as.
*
* @return The color of this world.
*/
ChatColor getColor();
/**
* Sets the color that this world's name/alias will display as.
*
* @param color A valid color name.
* @return True if the color was set, false if not.
*/
boolean setColor(String color);
/**
* Gets the style that this world's name/alias will display as.
*
* @return The style of this world. {@code null} for "normal" style.
*/
ChatColor getStyle();
/**
* Sets the style that this world's name/alias will display as.
*
* @param style A valid style name.
* @return True if the style was set, false if not.
*/
boolean setStyle(String style);
/**
* Tells you if someone entered a valid color.
*
* @param color A string that may translate to a color.
* @return True if it is a color, false if not.
*
* @deprecated This has been moved: {@link com.onarandombox.MultiverseCore.enums.EnglishChatColor#isValidAliasColor(String)}
*/
@Deprecated
boolean isValidAliasColor(String color);
/**
* Returns a very nicely colored string (using Alias and Color if they are set).
*
* @return A nicely colored string.
*/
String getColoredWorldString();
// animals&monster stuff
/**
* Gets whether or not animals are allowed to spawn in this world.
*
* @return True if ANY animal can, false if no animals can spawn.
*/
boolean canAnimalsSpawn();
/**
* Sets whether or not animals can spawn.
* If there are values in {@link #getAnimalList()} and this is false,
* those animals become the exceptions, and will spawn
*
* @param allowAnimalSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowAnimalSpawn(boolean allowAnimalSpawn);
/**
* Returns a list of animals. This list always negates the {@link #canAnimalsSpawn()} result.
*
* @return A list of animals that will spawn if {@link #canAnimalsSpawn()} is false.
*/
List<String> getAnimalList();
/**
* Gets whether or not monsters are allowed to spawn in this world.
*
* @return True if ANY monster can, false if no monsters can spawn.
*/
boolean canMonstersSpawn();
/**
* Sets whether or not monsters can spawn.
* If there are values in {@link #getMonsterList()} and this is false,
* those monsters become the exceptions, and will spawn
*
* @param allowMonsterSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowMonsterSpawn(boolean allowMonsterSpawn);
/**
* Returns a list of monsters. This list always negates the {@link #canMonstersSpawn()} result.
*
* @return A list of monsters that will spawn if {@link #canMonstersSpawn()} is false.
*/
List<String> getMonsterList();
// end of animal&monster stuff
/**
* Gets whether or not PVP is enabled in this world in some form (fake or not).
*
* @return True if players can take damage from other players.
*/
boolean isPVPEnabled();
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode.
*
* @param pvpMode True to enable PVP damage, false to disable it.
*/
void setPVPMode(boolean pvpMode);
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
*
* @return True if this world has fakepvp on
* @deprecated This is deprecated.
*/
@Deprecated
boolean getFakePVP();
/**
* Gets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @return True if the world will be hidden, false if not.
*/
boolean isHidden();
/**
* Sets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @param hidden Set
*/
void setHidden(boolean hidden);
/**
* Gets whether weather is enabled in this world.
*
* @return True if weather events will occur, false if not.
*/
boolean isWeatherEnabled();
/**
* Sets whether or not there will be weather events in a given world.
* If set to false, Multiverse will disable the weather in the world immediately.
*
* @param enableWeather True if weather events should occur in a world, false if not.
*/
void setEnableWeather(boolean enableWeather);
/**
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
*
* @return True if CraftBukkit is keeping spawn chunks in memory.
*/
boolean isKeepingSpawnInMemory();
/**
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
* If not, CraftBukkit will attempt to free memory when players have not used that world.
* This will not happen immediately.
*
* @param keepSpawnInMemory If true, CraftBukkit will keep the spawn chunks loaded in memory.
*/
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
/**
* Gets the spawn location of this world.
*
* @return The spawn location of this world.
*/
Location getSpawnLocation();
/**
* Sets the spawn location for a world.
*
* @param spawnLocation The spawn location for a world.
*/
void setSpawnLocation(Location spawnLocation);
/**
* Gets whether or not the hunger level of players will go down in a world.
*
* @return True if it will go down, false if it will remain steady.
*/
boolean getHunger();
/**
* Sets whether or not the hunger level of players will go down in a world.
*
* @param hungerEnabled True if hunger will go down, false to keep it at
* the level they entered a world with.
*/
void setHunger(boolean hungerEnabled);
/**
* Gets the GameMode of this world.
*
* @return The GameMode of this world.
*/
GameMode getGameMode();
/**
* Sets the game mode of this world.
*
* @param gameMode A valid game mode string (either
* an int ex. 0 or a string ex. creative).
* @return True if the game mode was successfully changed, false if not.
* @deprecated Use {@link #setGameMode(GameMode)} instead. If you have to
* pass a string, use {@link #setPropertyValue(String, String)}.
*/
@Deprecated
boolean setGameMode(String gameMode);
/**
* Sets the game mode of this world.
*
* @param gameMode The new {@link GameMode}.
* @return True if the game mode was successfully changed, false if not.
*/
boolean setGameMode(GameMode gameMode);
/**
* Gets the amount of currency it requires to enter this world.
*
* @return The amount it costs to enter this world.
*/
double getPrice();
/**
* Sets the price for entry to this world.
* You can think of this like an amount.
* The type can be set with {@link #setCurrency(Material)}
*
* @param price The Amount of money/item to enter the world.
*/
void setPrice(double price);
/**
* Gets the type of currency that will be used when users enter this world. A value of null indicates a non-item
* based currency is used.
*
* @return The type of currency that will be used when users enter this world.
*/
@Nullable
Material getCurrency();
/**
* Sets the type of item that will be required given the price is not 0.
* Use a value of null to specify a non-item based currency.
*
* @param item The Type of currency that will be used when users enter this world.
*/
void setCurrency(@Nullable Material item);
/**
* Gets the world players will respawn in if they die in this one.
*
* @return A world that exists on the server.
*/
World getRespawnToWorld();
/**
* Sets the world players will respawn in if they die in this one.
* Returns true upon success, false upon failure.
*
* @param respawnWorld The name of a world that exists on the server.
* @return True if respawnWorld existed, false if not.
*/
boolean setRespawnToWorld(String respawnWorld);
/**
* Gets the scaling value of this world.Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @return This world's non-negative, non-zero scale.
*/
double getScaling();
/**
* Sets the scale of this world. Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @param scaling A scaling value, cannot be negative or 0.
* @return Whether the scale was set successfully.
*/
boolean setScaling(double scaling);
/**
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @return True if the world should heal (default), false if not.
*/
boolean getAutoHeal();
/**
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @param heal True if the world will heal.
*/
void setAutoHeal(boolean heal);
/**
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @return True if Multiverse should adjust the spawn, false if not.
*/
boolean getAdjustSpawn();
/**
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @param adjust True if multiverse should adjust the spawn, false if not.
*/
void setAdjustSpawn(boolean adjust);
/**
* Gets whether or not Multiverse should auto-load this world.
*
* @return True if Multiverse should auto-load this world.
*/
boolean getAutoLoad();
/**
* Sets whether or not Multiverse should auto-load this world.
* <p>
* True is default.
*
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
*/
void setAutoLoad(boolean autoLoad);
/**
* Gets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
*
* @return True if players dying in this world should respawn at their bed.
*/
boolean getBedRespawn();
/**
* Sets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
* <p>
* True is default.
*
* @param autoLoad True if players dying in this world respawn at their bed.
*/
void setBedRespawn(boolean autoLoad);
/**
* Sets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
* @param limit The new limit
*/
void setPlayerLimit(int limit);
/**
* Gets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
* @return The player limit
*/
int getPlayerLimit();
/**
* Same as {@link #getTime()}, but returns a string.
* @return The time as a short string: 12:34pm
*/
String getTime();
/**
* Sets the current time in a world.
* <p>
* This method will take the following formats:
* 11:37am
* 4:30p
* day(morning), night, noon, midnight
*
* @param timeAsString The formatted time to set the world to.
* @return True if the time was set, false if not.
*/
boolean setTime(String timeAsString);
/**
* Sets The types of portals that are allowed in this world.
*
* @param type The type of portals allowed in this world.
*/
void allowPortalMaking(AllowedPortalType type);
/**
* Gets which type(s) of portals are allowed to be constructed in this world.
*
* @return The type of portals that are allowed.
*/
AllowedPortalType getAllowedPortals();
// properties that are not "getter+setter" style
/**
* Gets a list of all the worlds that players CANNOT travel to from this world,
* regardless of their access permissions.
*
* @return A List of world names.
*/
List<String> getWorldBlacklist();
/**
* Gets all the names of all properties that can be SET.
*
* @return All property names, with alternating colors.
*/
String getAllPropertyNames();
/**
* Whether or not players are allowed to fly in this world.
*
* @return True if players allowed to fly in this world.
*/
boolean getAllowFlight();
/**
* Sets whether or not players are allowed to fly in this world.
*
* @param allowFlight True to allow flight in this world.
*/
void setAllowFlight(final boolean allowFlight);
}
@@ -0,0 +1,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);
}
@@ -0,0 +1,5 @@
/**
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
* plugins when interacting with Multiverse.
*/
package com.onarandombox.MultiverseCore.api;
@@ -0,0 +1,162 @@
/******************************************************************************
* 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.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Allows management of Anchor Destinations.
*/
public class AnchorCommand extends PaginatedCoreCommand<String> {
public AnchorCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create, Delete and Manage Anchor Destinations.");
this.setCommandUsage("/mv anchor " + ChatColor.GREEN + "{name}" + ChatColor.GOLD + " [-d]");
this.setArgRange(0, 2);
this.addKey("mv anchor");
this.addKey("mv anchors");
this.addKey("mvanchor");
this.addKey("mvanchors");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething");
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.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
}
private List<String> getFancyAnchorList(Player p) {
List<String> anchorList = new ArrayList<String>();
ChatColor color = ChatColor.GREEN;
for (String anchor : this.plugin.getAnchorManager().getAnchors(p)) {
anchorList.add(color + anchor);
color = (color == ChatColor.GREEN) ? ChatColor.GOLD : ChatColor.GREEN;
}
return anchorList;
}
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) {
p = (Player) sender;
}
FilterObject filterObject = this.getPageAndFilter(args);
List<String> availableAnchors = new ArrayList<String>(this.getFancyAnchorList(p));
if (filterObject.getFilter().length() > 0) {
availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
if (availableAnchors.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
} else {
if (availableAnchors.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No anchors were defined.");
return;
}
}
if (!(sender instanceof Player)) {
for (String c : availableAnchors) {
sender.sendMessage(c);
}
return;
}
int totalPages = (int) Math.ceil(availableAnchors.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
} else if (filterObject.getPage() < 1) {
filterObject.setPage(1);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
this.showPage(filterObject.getPage(), sender, availableAnchors);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() == 0) {
this.showList(sender, args);
return;
}
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 {
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;
}
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to create Anchors.");
return;
}
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
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;
}
}
@@ -0,0 +1,57 @@
/******************************************************************************
* 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.api.MVDestination;
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
import com.onarandombox.MultiverseCore.utils.MVPermissions;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Checks to see if a player can go to a destination.
*/
public class CheckCommand extends MultiverseCommand {
public CheckCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Help you validate your multiverse settings");
this.setCommandUsage("/mv check " + ChatColor.GREEN + "{PLAYER} {DESTINATION}");
this.setArgRange(2, 2);
this.addKey("mv check");
this.addKey("mvcheck");
this.addCommandExample("/mv check " + ChatColor.GREEN + "fernferret " + ChatColor.LIGHT_PURPLE + "w:MyWorld");
this.addCommandExample("/mv check " + ChatColor.GREEN + "Rigby90 " + ChatColor.LIGHT_PURPLE + "p:MyPortal");
this.addCommandExample("/mv check " + ChatColor.GREEN + "lithium3141 " + ChatColor.LIGHT_PURPLE + "ow:WarpName");
this.setPermission("multiverse.core.debug", "Checks to see if a player can go to a destination. Prints debug if false.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = this.plugin.getServer().getPlayerExact(args.get(0));
if (p == null) {
sender.sendMessage("Could not find player " + ChatColor.GREEN + args.get(0));
sender.sendMessage("Are they online?");
return;
}
MVDestination dest = this.plugin.getDestFactory().getDestination(args.get(1));
if (dest instanceof InvalidDestination) {
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();
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!");
}
}
}
@@ -0,0 +1,72 @@
/******************************************************************************
* 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;
import java.util.Map;
/**
* Allows you to set Global MV Variables.
*/
public class ConfigCommand extends MultiverseCommand {
public ConfigCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Configuration");
this.setCommandUsage("/mv config " + ChatColor.GREEN + "{PROPERTY} {VALUE}");
this.setArgRange(1, 2);
this.addKey("mv config");
this.addKey("mvconfig");
this.addKey("mv conf");
this.addKey("mvconf");
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");
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() <= 1) {
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(", ");
}
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")) {
// Don't forget to set the world!
this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
}
if (this.plugin.saveMVConfigs()) {
sender.sendMessage(ChatColor.GREEN + "SUCCESS!" + ChatColor.WHITE + " Values were updated successfully!");
this.plugin.loadConfigs();
} else {
sender.sendMessage(ChatColor.RED + "FAIL!" + ChatColor.WHITE + " Check your console for details!");
}
}
}
@@ -1,12 +1,21 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Confirms actions.
*/
public class ConfirmCommand extends MultiverseCommand {
public ConfirmCommand(MultiverseCore plugin) {
@@ -17,8 +26,9 @@ public class ConfirmCommand extends MultiverseCommand {
this.setArgRange(0, 0);
this.addKey("mvconfirm");
this.addKey("mv confirm");
this.addCommandExample("/mv confirm");
this.setPermission("multiverse.core.confirm", "If you have not been prompted to use this, it will not do anything.", PermissionDefault.OP);
}
@Override
@@ -1,7 +1,15 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
@@ -9,13 +17,14 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.LocationManipulation;
import java.text.DecimalFormat;
import java.util.List;
/**
* Returns detailed information on the Players where abouts.
*/
public class CoordCommand extends MultiverseCommand {
private LocationManipulation locMan = new LocationManipulation();
private MVWorldManager worldManager;
public CoordCommand(MultiverseCore plugin) {
super(plugin);
@@ -25,7 +34,9 @@ public class CoordCommand extends MultiverseCommand {
this.addKey("mv coord");
this.addKey("mvcoord");
this.addKey("mvco");
this.addCommandExample("/mv coord");
this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
@@ -34,22 +45,24 @@ public class CoordCommand extends MultiverseCommand {
if (sender instanceof Player) {
Player p = (Player) sender;
World world = p.getWorld();
if(!this.plugin.isMVWorld(world.getName())) {
if (!this.worldManager.isMVWorld(world.getName())) {
this.plugin.showNotMVWorldMessage(sender, world.getName());
return;
}
MVWorld mvworld = this.plugin.getMVWorld(world.getName());
// TODO: Convert to fancy stuff
MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName());
p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + LocationManipulation.getDirection(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + Material.getMaterial(world.getBlockTypeIdAt(p.getLocation())));
DecimalFormat df = new DecimalFormat();
df.setMinimumFractionDigits(0);
df.setMaximumFractionDigits(2);
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.");
}
@@ -1,63 +1,120 @@
/******************************************************************************
* 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.io.File;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.CommandHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Creates a new world and loads it.
*/
public class CreateCommand extends MultiverseCommand {
private MVWorldManager worldManager;
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]]");
this.setArgRange(2, 6);
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");
this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP);
this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " skylands");
this.addCommandExample("/mv create " + ChatColor.GOLD + "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();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() % 2 != 0) {
sender.sendMessage("You must preface your SEED with -s OR your GENERATOR with -g. Type /mv for help");
return;
}
String worldName = args.get(0);
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 (new File(worldName).exists() || this.plugin.isMVWorld(worldName)) {
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;
}
sender.sendMessage(ChatColor.AQUA + "Starting world creation...");
if (this.plugin.addWorld(worldName, environment, seed, generator)) {
sender.sendMessage(ChatColor.GREEN + "Complete!");
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
// 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, type, allowStructures, generator, useSpawnAdjust)) {
Command.broadcastCommandMessage(sender, "Complete!");
} else {
Command.broadcastCommandMessage(sender, "FAILED.");
}
return;
}
}
@@ -0,0 +1,67 @@
/******************************************************************************
* 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.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
import java.util.logging.Level;
/**
* Enables debug-information.
*/
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|silent]");
this.setArgRange(0, 1);
this.addKey("mv debug");
this.addKey("mv d");
this.addKey("mvdebug");
this.addCommandExample("/mv debug " + ChatColor.GOLD + "2");
this.setPermission("multiverse.core.debug", "Spams the console a bunch.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() == 1) {
if (args.get(0).equalsIgnoreCase("off")) {
plugin.getMVConfig().setGlobalDebug(0);
} else {
try {
int debugLevel = Integer.parseInt(args.get(0));
if (debugLevel > 3 || debugLevel < 0) {
throw new NumberFormatException();
}
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) {
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 + debugLevel);
Logging.fine("Multiverse Debug ENABLED");
}
}
}
@@ -1,14 +1,23 @@
/******************************************************************************
* 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.ArrayList;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.ArrayList;
import java.util.List;
/**
* Deletes worlds.
*/
public class DeleteCommand extends MultiverseCommand {
public DeleteCommand(MultiverseCore plugin) {
@@ -18,13 +27,19 @@ public class DeleteCommand extends MultiverseCommand {
this.setArgRange(1, 1);
this.addKey("mvdelete");
this.addKey("mv delete");
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 };
String worldName = args.get(0);
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!");
this.plugin.getCommandHandler()
.queueCommand(sender, "mvdelete", "deleteWorld", objectArgs,
paramTypes, ChatColor.GREEN + "World '" + worldName + "' Deleted!",
ChatColor.RED + "World '" + worldName + "' could NOT be deleted!");
}
}
@@ -1,14 +1,24 @@
/******************************************************************************
* 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 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;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Lists valid known environments.
*/
public class EnvironmentCommand extends MultiverseCommand {
public EnvironmentCommand(MultiverseCore plugin) {
@@ -18,21 +28,91 @@ 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.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
this.addCommandExample("/mv env");
this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP);
}
/**
* Shows all valid known environments to a {@link CommandSender}.
*
* @param sender The {@link CommandSender}.
*/
public static void showEnvironments(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
sender.sendMessage(ChatColor.GREEN + "NORMAL");
sender.sendMessage(ChatColor.RED + "NETHER");
sender.sendMessage(ChatColor.AQUA + "SKYLANDS");
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,82 @@
/******************************************************************************
* 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 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;
}
}
final StringBuilder gameRules = new StringBuilder();
for (final String gameRule : world.getGameRules()) {
if (gameRules.length() != 0) {
gameRules.append(ChatColor.WHITE).append(", ");
}
gameRules.append(ChatColor.AQUA).append(gameRule).append(ChatColor.WHITE).append(": ");
gameRules.append(ChatColor.GREEN).append(world.getGameRuleValue(GameRule.getByName(gameRule)));
}
sender.sendMessage("=== Gamerules for " + ChatColor.AQUA + world.getName() + ChatColor.WHITE + " ===");
sender.sendMessage(gameRules.toString());
}
}
@@ -0,0 +1,60 @@
/******************************************************************************
* 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.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.List;
/**
* Returns a list of loaded generator plugins.
*/
public class GeneratorCommand extends MultiverseCommand {
public GeneratorCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Information");
this.setCommandUsage("/mv generators");
this.setArgRange(0, 0);
this.addKey("mv generators");
this.addKey("mvgenerators");
this.addKey("mv gens");
this.addKey("mvgens");
this.addCommandExample("/mv generators");
this.setPermission("multiverse.core.generator", "Returns a list of Loaded Generator Plugins.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
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) {
if (p.isEnabled() && p.getDefaultWorldGenerator("world", "") != null) {
generators.add(p.getDescription().getName());
}
}
sender.sendMessage(ChatColor.AQUA + "--- Loaded Generator Plugins ---");
String loadedGens = "";
boolean altColor = false;
for (String s : generators) {
loadedGens += (altColor ? ChatColor.YELLOW : ChatColor.WHITE) + s + " ";
altColor = !altColor;
}
if (loadedGens.length() == 0) {
loadedGens = ChatColor.RED + "No Generator Plugins found.";
}
sender.sendMessage(loadedGens);
}
}
@@ -1,19 +1,26 @@
// 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.
/******************************************************************************
* 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.ArrayList;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.Command;
import java.util.ArrayList;
import java.util.List;
public class HelpCommand extends MultiverseCommand {
private static final int CMDS_PER_PAGE = 7;
/**
* Displays a nice help menu.
*/
public class HelpCommand extends PaginatedCoreCommand<Command> {
public HelpCommand(MultiverseCore plugin) {
super(plugin);
@@ -26,42 +33,53 @@ public class HelpCommand extends MultiverseCommand {
this.addKey("mv help");
this.addKey("mvsearch");
this.addKey("mv search");
this.addCommandExample("/mv help ?");
this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE);
this.setItemsPerPage(7); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
@Override
protected List<Command> getFilteredItems(List<Command> availableItems, String filter) {
List<Command> filtered = new ArrayList<Command>();
for (Command c : availableItems) {
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandName().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandDesc().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandUsage().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else {
for (String example : c.getCommandExamples()) {
if (example.matches("(?i).*" + filter + ".*")) {
filtered.add(c);
break;
}
}
}
}
return filtered;
}
@Override
protected String getItemText(Command item) {
return ChatColor.AQUA + item.getCommandUsage();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
int page = 1;
String filter = "";
if (args.size() == 0)
{
filter = "";
page = 1;
} else if (args.size() == 1) {
try {
page = Integer.parseInt(args.get(0));
} catch (NumberFormatException ex) {
filter = args.get(0);
page = 1;
}
} else if (args.size() == 2) {
filter = args.get(0);
try {
page = Integer.parseInt(args.get(1));
} catch (NumberFormatException ex) {
page = 1;
}
}
FilterObject filterObject = this.getPageAndFilter(args);
List<Command> availableCommands = new ArrayList<Command>(this.plugin.getCommandHandler().getCommands(sender));
if (filter.length() > 0) {
availableCommands = this.getFilteredCommands(availableCommands, filter);
if (filterObject.getFilter().length() > 0) {
availableCommands = this.getFilteredItems(availableCommands, filterObject.getFilter());
if (availableCommands.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No commands matched your filter: " + ChatColor.AQUA + filter);
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No commands matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
}
@@ -74,55 +92,15 @@ public class HelpCommand extends MultiverseCommand {
return;
}
int totalPages = (int) Math.ceil(availableCommands.size() / (CMDS_PER_PAGE + 0.0));
int totalPages = (int) Math.ceil(availableCommands.size() / (this.itemsPerPage + 0.0));
if (page > totalPages) {
page = totalPages;
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
}
sender.sendMessage(ChatColor.AQUA + " Page " + page + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
this.showPage(page, sender, availableCommands);
this.showPage(filterObject.getPage(), sender, availableCommands);
}
private List<Command> getFilteredCommands(List<Command> availableCommands, String filter) {
List<Command> filtered = new ArrayList<Command>();
for (Command c : availableCommands) {
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandName().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandDesc().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
}else if (c.getCommandUsage().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
}
}
return filtered;
}
private String stitchThisString(List<String> list) {
String returnstr = "";
for (String s : list) {
returnstr += s + " ";
}
return returnstr;
}
private void showPage(int page, CommandSender sender, List<Command> cmds) {
int start = (page - 1) * CMDS_PER_PAGE;
int end = start + CMDS_PER_PAGE;
for (int i = start; i < end; i++) {
// For consistancy, print some extra lines if it's a player:
if (i < cmds.size()) {
sender.sendMessage(ChatColor.AQUA + cmds.get(i).getCommandUsage());
} else if (sender instanceof Player) {
sender.sendMessage(" ");
}
}
}
}
@@ -1,61 +1,171 @@
/******************************************************************************
* 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.io.File;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Imports a new world of the specified type.
*/
public class ImportCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ImportCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Import World");
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]");
this.setArgRange(2, 3);
this.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 static boolean checkIfIsWorld(File worldFolder) {
if (worldFolder.isDirectory()) {
File[] files = worldFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String name) {
return name.toLowerCase().endsWith(".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);
}
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;
}
}
}
return worldList;
}
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);
if (this.plugin.isMVWorld(worldName) && new File(worldName).exists()) {
sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");
String worldName = trimWorldName(args.get(0));
if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
String worldList = this.getPotentialWorlds();
if (worldList.length() > 2) {
sender.sendMessage(ChatColor.AQUA + "====[ These look like worlds ]====");
sender.sendMessage(worldList);
} else {
sender.sendMessage(ChatColor.RED + "No potential worlds found. Sorry!");
}
return;
}
// 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 || worldName.length() < 1) {
this.showHelp(sender);
return;
}
String generator = null;
if (args.size() == 3) {
generator = args.get(2);
// Make sure we don't already know about this world.
if (this.worldManager.isMVWorld(worldName)) {
sender.sendMessage(ChatColor.GREEN + "Multiverse" + ChatColor.WHITE
+ " already knows about '" + ChatColor.AQUA + worldName + ChatColor.WHITE + "'!");
return;
}
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
String generator = CommandHandler.getFlag("-g", args);
boolean useSpawnAdjust = true;
for (String s : args) {
if (s.equalsIgnoreCase("-n")) {
useSpawnAdjust = false;
}
}
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 (new File(worldName).exists() && env != null) {
sender.sendMessage(ChatColor.AQUA + "Starting world import...");
this.plugin.addWorld(worldName, environment, null, generator);
sender.sendMessage(ChatColor.GREEN + "Complete!");
return;
if (!worldFile.exists()) {
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);
} else if (!checkIfIsWorld(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 type did not exist.");
sender.sendMessage("For a list of available world types, type: /mvenv");
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.");
sender.sendMessage("That world folder does not exist...");
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!");
}
}
}
@@ -1,22 +1,36 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.FancyText;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
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 org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.FancyColorScheme;
import com.onarandombox.utils.FancyHeader;
import com.onarandombox.utils.FancyMessage;
import com.onarandombox.utils.FancyText;
import java.util.ArrayList;
import java.util.List;
// Will use when we can compile with JDK 6
//import com.sun.xml.internal.ws.util.StringUtils;
/**
* Returns detailed information about a world.
*/
public class InfoCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public InfoCommand(MultiverseCore plugin) {
super(plugin);
@@ -26,7 +40,10 @@ public class InfoCommand extends MultiverseCommand {
this.addKey("mvinfo");
this.addKey("mvi");
this.addKey("mv info");
this.addCommandExample("/mv info " + ChatColor.GOLD + "1");
this.addCommandExample("/mv info " + ChatColor.GOLD + "3");
this.setPermission("multiverse.core.info", "Returns detailed information on the world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
@@ -43,11 +60,14 @@ public class InfoCommand extends MultiverseCommand {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
}
else if (args.size() == 1) {
if (this.plugin.getMVWorld(args.get(0)) != null) {
} else if (args.size() == 1) {
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;
@@ -55,15 +75,15 @@ 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!");
return;
}
}
}
else if (args.size() == 2) {
} else if (args.size() == 2) {
worldName = args.get(0);
try {
pageNum = Integer.parseInt(args.get(1)) - 1;
@@ -72,35 +92,53 @@ public class InfoCommand extends MultiverseCommand {
}
}
if (this.plugin.isMVWorld(worldName)) {
showPage(pageNum, sender, this.buildEntireCommand(this.plugin.getMVWorld(worldName)));
if (this.worldManager.isMVWorld(worldName)) {
Player p = null;
if (sender instanceof Player) {
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");
}
}
private List<List<FancyText>> buildEntireCommand(MVWorld world) {
private List<List<FancyText>> buildEntireCommand(MultiverseWorld world, Player p) {
List<FancyText> message = new ArrayList<FancyText>();
List<List<FancyText>> worldInfo = new ArrayList<List<FancyText>>();
// Page 1
FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
message.add(new FancyHeader("General Info", colors));
message.add(new FancyMessage("World Name: ", world.getName(), colors));
message.add(new FancyMessage("World UID: ", world.getCBWorld().getUID().toString(), colors));
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
message.add(new FancyMessage("Seed: ", world.getCBWorld().getSeed() + "", colors));
Location spawn = world.getCBWorld().getSpawnLocation();
message.add(new FancyMessage("Spawn Location: ", "(" + spawn.getBlockX() + ", " + spawn.getBlockY() + ", " + spawn.getBlockZ() + ")", colors));
message.add(new FancyMessage("World Scale: ", world.getScaling().toString(), colors));
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: ", 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(world.getPrice(), world.getCurrency()), colors));
message.add(new FancyMessage("Price to enter this world: ",
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));
}
if (world.getRespawnToWorld() != null) {
MVWorld respawn = this.plugin.getMVWorld(world.getRespawnToWorld());
MultiverseWorld respawn = this.worldManager.getMVWorld(world.getRespawnToWorld());
if (respawn != null) {
message.add(new FancyMessage("Players will respawn in: ", respawn.getColoredWorldString(), colors));
} else {
@@ -112,55 +150,59 @@ public class InfoCommand extends MultiverseCommand {
worldInfo.add(message);
// Page 2
message = new ArrayList<FancyText>();
message.add(new FancyHeader("More World Settings", 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));
message.add(new FancyHeader("PVP Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.getPvp().toString(), colors));
message.add(new FancyMessage("Multiverse Setting: ", world.isPVPEnabled() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
message.add(new FancyMessage("Fake PVP Enabled: ", world.getFakePVP() + "", colors));
worldInfo.add(message);
// Page 3
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Monster Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.allowMonsterSpawning().toString(), colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canMonstersSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
if (MultiverseCore.MobsDisabledInDefaultWorld) {
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Monsters WILL NOT SPAWN IN THIS WORLD.", colors));
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Check your server log for more details.", colors));
}
if (world.getMonsterList().size() > 0) {
if (world.allowMonsterSpawning()) {
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT "
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
} else {
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
}
} else {
message.add(new FancyMessage("Monsters that CAN spawn: ", world.allowMonsterSpawning() ? "ALL" : "NONE", colors));
message.add(new FancyMessage("Monsters that CAN spawn: ", world.canMonstersSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
// Page 4
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Animal Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.allowAnimalSpawning().toString(), colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canAnimalsSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.allowMonsterSpawning()) {
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
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 {
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
}
} else {
message.add(new FancyMessage("Animals that CAN spawn: ", world.allowAnimalSpawning() ? "ALL" : "NONE", colors));
message.add(new FancyMessage("Animals that CAN spawn: ", world.canAnimalsSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
return worldInfo;
}
private String toCommaSeperated(List<String> list) {
if(list == null || list.size() == 0) {
private static String toCommaSeperated(List<String> list) {
if (list == null || list.size() == 0) {
return "";
}
if(list.size() == 1) {
if (list.size() == 1) {
return list.get(0);
}
String result = list.get(0);
@@ -172,11 +214,17 @@ public class InfoCommand extends MultiverseCommand {
return result;
}
/**
* Gets a "positive" or "negative" {@link ChatColor}.
*
* @param positive Whether this {@link ChatColor} should be "positive".
* @return The {@link ChatColor}.
*/
protected ChatColor getChatColor(boolean positive) {
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;
@@ -1,40 +1,45 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.ArrayList;
import java.util.List;
public class ListCommand extends MultiverseCommand {
/**
* Displays a listing of all worlds that a player can enter.
*/
public class ListCommand extends PaginatedCoreCommand<String> {
public ListCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Listing");
this.setCommandUsage("/mv list");
this.setArgRange(0, 0);
this.setCommandUsage("/mv list [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
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
private List<String> getFancyWorldList(Player p) {
List<String> worldList = new ArrayList<String>();
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
for (MVWorld world : this.plugin.getMVWorlds()) {
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
continue;
}
@@ -44,15 +49,82 @@ public class ListCommand extends MultiverseCommand {
color = ChatColor.RED;
} else if (env == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (env == Environment.SKYLANDS) {
} else if (env == Environment.THE_END) {
color = ChatColor.AQUA;
}
output += world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment() + " \n";
StringBuilder builder = new StringBuilder();
builder.append(world.getColoredWorldString()).append(ChatColor.WHITE);
builder.append(" - ").append(color).append(world.getEnvironment());
if (world.isHidden()) {
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.core.modify", true)) {
// Prefix hidden worlds with an "[H]"
worldList.add(ChatColor.GRAY + "[H]" + builder.toString());
}
} else {
worldList.add(builder.toString());
}
}
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);
}
}
String[] response = output.split("\n");
for (String msg : response) {
sender.sendMessage(msg);
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;
}
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;
}
}
if (!(sender instanceof Player)) {
for (String c : availableWorlds) {
sender.sendMessage(c);
}
return;
}
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
this.showPage(filterObject.getPage(), sender, availableWorlds);
}
}
@@ -0,0 +1,42 @@
/******************************************************************************
* 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.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Loads a world into Multiverse.
*/
public class LoadCommand extends MultiverseCommand {
public LoadCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Load World");
this.setCommandUsage("/mv load" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvload");
this.addKey("mv load");
this.addCommandExample("/mv load " + ChatColor.GREEN + "MyUnloadedWorld");
this.setPermission("multiverse.core.load", "Loads a world into Multiverse.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.getMVWorldManager().loadWorld(args.get(0))) {
Command.broadcastCommandMessage(sender, "Loaded world '" + args.get(0) + "'!");
} else {
sender.sendMessage("Error trying to load world '" + args.get(0) + "'!");
}
}
}
@@ -1,19 +1,31 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
// This will contain all the properties that support the ADD/REMOVE
// Anything not in here will only support the SET action
/**
* Used to modify various aspects of worlds.
*/
public class ModifyAddCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyAddCommand(MultiverseCore plugin) {
super(plugin);
@@ -24,7 +36,12 @@ public class ModifyAddCommand extends MultiverseCommand {
this.addKey("mvmadd");
this.addKey("mv modify add");
this.addKey("mvmodify add");
this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
@@ -43,14 +60,14 @@ public class ModifyAddCommand extends MultiverseCommand {
return;
}
MVWorld world;
MultiverseWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(2));
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
@@ -60,12 +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;
}
if (world.addToList(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
// 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);
}
@@ -1,16 +1,28 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Removes all values from a world-property.
*/
public class ModifyClearCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyClearCommand(MultiverseCore plugin) {
super(plugin);
@@ -21,7 +33,12 @@ public class ModifyClearCommand extends MultiverseCommand {
this.addKey("mvmclear");
this.addKey("mv modify clear");
this.addKey("mvmodify clear");
this.setPermission("multiverse.core.modify.clear", "Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.clear",
"Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
@@ -39,13 +56,13 @@ public class ModifyClearCommand extends MultiverseCommand {
return;
}
MVWorld world;
MultiverseWorld world;
String property = args.get(0);
if (args.size() == 1) {
world = this.plugin.getMVWorld(p.getWorld().getName());
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(1));
world = this.worldManager.getMVWorld(args.get(1));
}
if (world == null) {
@@ -55,14 +72,20 @@ 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.");
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.");
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property
+ ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
}
}
@@ -1,29 +1,27 @@
/******************************************************************************
* 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.HashMap;
import java.util.List;
import java.util.Map;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.MultiverseCore.enums.AddProperties;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
enum AddProperties {
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
}
enum Action {
Set, Add, Remove, Clear
}
// Color == Aliascolor
enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm
}
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Used to modify various aspects of worlds.
*/
public class ModifyCommand extends MultiverseCommand {
public ModifyCommand(MultiverseCore plugin) {
@@ -39,19 +37,24 @@ public class ModifyCommand extends MultiverseCommand {
children.put("multiverse.core.modify.modify", true);
children.put("multiverse.core.modify.clear", true);
children.put("multiverse.core.modify.remove", true);
Permission modify = new Permission("multiverse.core.modify", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP, children);
Permission modify = new Permission("multiverse.core.modify",
"Modify various aspects of worlds. It requires add/set/clear/remove. See the examples below", PermissionDefault.OP, children);
this.addCommandExample(ChatColor.AQUA + "/mv modify set ?");
this.addCommandExample(ChatColor.GREEN + "/mv modify add ?");
this.addCommandExample(ChatColor.BLUE + "/mv modify clear ?");
this.addCommandExample(ChatColor.RED + "/mv modify remove ?");
this.setPermission(modify);
}
/**
* Validates the specified action.
*
* @param action The {@link Action}.
* @param property The property.
* @return Whether this action is valid.
*/
protected static boolean validateAction(Action action, String property) {
if (action == Action.Set) {
try {
SetProperties.valueOf(property);
return true;
} catch (IllegalArgumentException e) {
return false;
}
} else {
if (action != Action.Set) {
try {
AddProperties.valueOf(property);
return true;
@@ -59,6 +62,7 @@ public class ModifyCommand extends MultiverseCommand {
return false;
}
}
return false;
}
@Override
@@ -1,16 +1,28 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Removes values from a world-property.
*/
public class ModifyRemoveCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyRemoveCommand(MultiverseCore plugin) {
super(plugin);
@@ -25,7 +37,12 @@ public class ModifyRemoveCommand extends MultiverseCommand {
this.addKey("mvmdelete");
this.addKey("mv modify delete");
this.addKey("mvmodify delete");
this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
@@ -44,14 +61,14 @@ public class ModifyRemoveCommand extends MultiverseCommand {
return;
}
MVWorld world;
MultiverseWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(2));
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
@@ -61,13 +78,19 @@ 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;
}
if (world.removeFromList(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
// 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);
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY
+ value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
}
}
@@ -1,31 +1,78 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Used to set world-properties.
*/
public class ModifySetCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifySetCommand(MultiverseCore plugin) {
super(plugin);
this.worldManager = this.plugin.getMVWorldManager();
this.setName("Modify a World (Set a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(2, 3);
this.setArgRange(1, 3);
this.addKey("mvm set");
this.addKey("mvmset");
this.addKey("mv modify set");
this.addKey("mvmodify set");
this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "mode " + ChatColor.RED + "creative");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "animals " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "monsters " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "alias " + ChatColor.RED + "MyWorld");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "color " + ChatColor.RED + "green");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "curr " + ChatColor.RED + "3");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "price " + ChatColor.RED + "5");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "scale " + ChatColor.RED + "1.2");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "memory " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "diff " + ChatColor.RED + "hard");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hunger " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hidden " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "pvp " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "heal " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "adjustspawn " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "spawn");
this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Special case for spawn:
if (args.size() == 1) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to set the" + ChatColor.GREEN + " spawn");
return;
}
if (args.get(0).equalsIgnoreCase("spawn")) {
SetSpawnCommand c = new SetSpawnCommand(this.plugin);
c.setWorldSpawn(sender);
} else {
sender.sendMessage("Spawn is the only param with no" + ChatColor.GREEN + " VALUE");
sender.sendMessage("Type " + ChatColor.GREEN + "/mv modify ?" + ChatColor.WHITE + " For help.");
}
return;
}
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
@@ -40,14 +87,14 @@ public class ModifySetCommand extends MultiverseCommand {
return;
}
MVWorld world;
MultiverseWorld world;
String value = args.get(1);
String property = args.get(0);
if (args.size() == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(2));
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
@@ -55,17 +102,24 @@ public class ModifySetCommand extends MultiverseCommand {
return;
}
if (!ModifyCommand.validateAction(Action.Set, property)) {
sender.sendMessage("Sorry, you can't SET " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/l54PH");
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;
}
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
} else if (world.setVariable(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
} else {
sender.sendMessage(ChatColor.RED + "There was an error setting " + ChatColor.GRAY + property);
try {
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(ChatColor.RED + world.getPropertyHelp(property));
}
} catch (PropertyDoesNotExistException e) {
sender.sendMessage(ChatColor.RED + "Sorry, You can't set: '" + ChatColor.GRAY + property + ChatColor.RED + "'");
sender.sendMessage("Valid world-properties: " + world.getAllPropertyNames());
}
}
}
@@ -1,18 +1,37 @@
/******************************************************************************
* 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.api.MultiverseMessaging;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.command.CommandSender;
import java.util.List;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.Command;
/**
* A generic Multiverse-command.
*/
public abstract class MultiverseCommand extends Command {
/**
* The reference to the core.
*/
protected MultiverseCore plugin;
/**
* The reference to {@link MultiverseMessaging}.
*/
protected MultiverseMessaging messaging;
public MultiverseCommand(MultiverseCore plugin) {
super(plugin);
this.plugin = plugin;
this.messaging = this.plugin.getMessaging();
}
@Override
@@ -0,0 +1,164 @@
/******************************************************************************
* 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.pneumaticraft.commandhandler.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* A generic paginated command.
* @param <T> The type of items on the page.
*/
public abstract class PaginatedCommand<T> extends Command {
private static final int DEFAULT_ITEMS_PER_PAGE = 9;
/**
* The number of items per page.
*/
protected int itemsPerPage = DEFAULT_ITEMS_PER_PAGE;
public PaginatedCommand(JavaPlugin plugin) {
super(plugin);
}
/**
* Set the number of items per page.
*
* @param items The new number of items per page.
*/
protected void setItemsPerPage(int items) {
itemsPerPage = items;
}
/**
* 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);
/**
* Constructs a single string from a list of strings.
*
* @param list The {@link List} of strings.
* @return A single {@link String}.
*/
protected String stitchThisString(List<String> list) {
StringBuilder builder = new StringBuilder();
for (String s : list) {
builder.append(s);
builder.append(' ');
}
return builder.toString();
}
/**
* Shows a page.
*
* @param page The number of the page to show.
* @param sender The {@link CommandSender} that wants to see the page.
* @param cmds The items that should be displayed on the page.
*/
protected void showPage(int page, CommandSender sender, List<T> cmds) {
// Ensure the page is at least 1.
page = (page <= 0) ? 1 : page;
int start = (page - 1) * itemsPerPage;
int end = start + itemsPerPage;
for (int i = start; i < end; i++) {
// For consistancy, print some extra lines if it's a player:
if (i < cmds.size()) {
sender.sendMessage(this.getItemText(cmds.get(i)));
} else if (sender instanceof Player) {
sender.sendMessage(" ");
}
}
}
/**
* Converts an item into a string.
*
* @param item The item.
* @return A {@link String}.
*/
protected abstract String getItemText(T item);
/**
* Constructs a {@link FilterObject} from a {@link List} of arguments.
*
* @param args The {@link List} of arguments.
* @return The {@link FilterObject}.
*/
protected FilterObject getPageAndFilter(List<String> args) {
int page = 1;
String filter = "";
if (args.size() == 0) {
filter = "";
page = 1;
} else if (args.size() == 1) {
try {
page = Integer.parseInt(args.get(0));
} catch (NumberFormatException ex) {
filter = args.get(0);
page = 1;
}
} else if (args.size() == 2) {
filter = args.get(0);
try {
page = Integer.parseInt(args.get(1));
} catch (NumberFormatException ex) {
page = 1;
}
}
return new FilterObject(page, filter);
}
/**
* "Key-Object" containing information about the page and the filter that were requested.
*/
protected class FilterObject {
private Integer page;
private String filter;
public FilterObject(Integer page, String filter) {
this.page = page;
this.filter = filter;
}
/**
* Gets the page.
* @return The page.
*/
public Integer getPage() {
return this.page;
}
/**
* Sets the page.
*
* @param page The new page.
*/
public void setPage(int page) {
this.page = page;
}
/**
* Gets the filter.
* @return The filter.
*/
public String getFilter() {
return this.filter;
}
}
}
@@ -0,0 +1,26 @@
/******************************************************************************
* 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;
/**
* A generic paginated Multiverse-command.
* @param <T> The type of items on the page.
*/
public abstract class PaginatedCoreCommand<T> extends PaginatedCommand<T> {
/**
* The reference to the core.
*/
protected MultiverseCore plugin;
public PaginatedCoreCommand(MultiverseCore plugin) {
super(plugin);
this.plugin = plugin;
}
}
@@ -1,19 +1,30 @@
/******************************************************************************
* 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.ArrayList;
import java.util.Collections;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.api.WorldPurger;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.PurgeWorlds;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Removes a type of mob from a world.
*/
public class PurgeCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public PurgeCommand(MultiverseCore plugin) {
super(plugin);
@@ -22,7 +33,14 @@ public class PurgeCommand extends MultiverseCommand {
this.setArgRange(1, 2);
this.addKey("mvpurge");
this.addKey("mv purge");
this.addCommandExample("/mv purge " + ChatColor.GREEN + "all");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "all " + ChatColor.GREEN + "all");
this.addCommandExample("/mv purge " + ChatColor.GREEN + "monsters");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "all " + ChatColor.GREEN + "animals");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "MyWorld " + ChatColor.GREEN + "squid");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "MyWorld_nether " + ChatColor.GREEN + "ghast");
this.setPermission("multiverse.core.purge", "Removed the specified type of mob from the specified world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
@@ -46,32 +64,29 @@ public class PurgeCommand extends MultiverseCommand {
deathName = args.get(1);
}
if (!worldName.equalsIgnoreCase("all") && !this.plugin.isMVWorld(worldName)) {
((MultiverseCore)this.plugin).showNotMVWorldMessage(sender, worldName);
if (!worldName.equalsIgnoreCase("all") && !this.worldManager.isMVWorld(worldName)) {
this.plugin.showNotMVWorldMessage(sender, worldName);
sender.sendMessage("It cannot be purged.");
return;
}
List<MVWorld> worldsToRemoveEntitiesFrom = new ArrayList<MVWorld>();
List<MultiverseWorld> worldsToRemoveEntitiesFrom = new ArrayList<MultiverseWorld>();
// Handle all case any user who names a world "all" should know better...
if (worldName.equalsIgnoreCase("all")) {
worldsToRemoveEntitiesFrom.addAll(this.plugin.getMVWorlds());
worldsToRemoveEntitiesFrom.addAll(this.worldManager.getMVWorlds());
} else {
worldsToRemoveEntitiesFrom.add(this.plugin.getMVWorld(worldName));
worldsToRemoveEntitiesFrom.add(this.worldManager.getMVWorld(worldName));
}
PurgeWorlds purger = this.plugin.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());
} else {
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
}
for (MVWorld w : worldsToRemoveEntitiesFrom) {
purger.purgeWorld(sender, w, thingsToKill, false, false);
for (MultiverseWorld w : worldsToRemoveEntitiesFrom) {
purger.purgeWorld(w, thingsToKill, false, false, sender);
}
return;
}
}
@@ -0,0 +1,53 @@
/******************************************************************************
* 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.ArrayList;
import java.util.List;
/**
* Regenerates a world.
*/
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.addKey("mvregen");
this.addKey("mv regen");
this.addCommandExample("You can use the -s with no args to get a new seed:");
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s");
this.addCommandExample("or specifiy a seed to get that one:");
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s" + ChatColor.AQUA + " gargamel");
this.setPermission("multiverse.core.regen", "Regenerates a world on your server. The previous state will be lost "
+ ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
}
@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) : "";
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!");
}
}
@@ -1,15 +1,24 @@
/******************************************************************************
* 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.ArrayList;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
import java.util.ArrayList;
import java.util.List;
/**
* Reloads worlds.yml and config.yml.
*/
public class ReloadCommand extends MultiverseCommand {
public ReloadCommand(MultiverseCore plugin) {
@@ -18,7 +27,9 @@ 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);
}
@@ -26,18 +37,21 @@ public class ReloadCommand extends MultiverseCommand {
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
this.plugin.loadConfigs();
this.plugin.loadWorlds(true);
// Create the event
this.plugin.getAnchorManager().loadAnchors();
this.plugin.getMVWorldManager().loadWorlds(true);
List<String> configsLoaded = new ArrayList<String>();
configsLoaded.add("Multiverse-Core - config.yml");
configsLoaded.add("Multiverse-Core - worlds.yml");
configsLoaded.add("Multiverse-Core - anchors.yml");
// Create the event
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
// Fire it off
this.plugin.getServer().getPluginManager().callEvent(configReload);
for(String s : configReload.getAllConfigsLoaded()) {
for (String s : configReload.getAllConfigsLoaded()) {
sender.sendMessage(s);
}
sender.sendMessage(ChatColor.GREEN + "Reload Complete!");
}
@@ -1,13 +1,22 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Unloads a world and removes it from the config.
*/
public class RemoveCommand extends MultiverseCommand {
public RemoveCommand(MultiverseCore plugin) {
@@ -17,12 +26,14 @@ public class RemoveCommand extends MultiverseCommand {
this.setArgRange(1, 1);
this.addKey("mvremove");
this.addKey("mv remove");
this.setPermission("multiverse.core.remove", "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.", PermissionDefault.OP);
this.addCommandExample("/mv remove " + ChatColor.GREEN + "MyWorld");
this.setPermission("multiverse.core.remove",
"Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.removeWorldFromConfig(args.get(0))) {
if (this.plugin.getMVWorldManager().removeWorldFromConfig(args.get(0))) {
sender.sendMessage("World removed from config!");
} else {
sender.sendMessage("Error trying to remove world from config!");
@@ -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));
}
}
@@ -1,40 +1,148 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.BlockSafety;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
import org.bukkit.Bukkit;
/**
* Sets the spawn for a world.
*/
public class SetSpawnCommand extends MultiverseCommand {
public SetSpawnCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Set World Spawn");
this.setCommandUsage("/mv setspawn");
this.setArgRange(0, 0);
this.setArgRange(0, 6);
this.addKey("mvsetspawn");
this.addKey("mvsets");
this.addKey("mvss");
this.addKey("mv set spawn");
this.addKey("mv setspawn");
this.addKey("mvset spawn");
this.addCommandExample("/mv set spawn");
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) {
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!");
}
}
/**
* 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();
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
p.sendMessage(w.getName() + " - Spawn set to X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
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");
}
}
}
@@ -1,13 +1,22 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Takes the player to the latest bed he's slept in.
*/
public class SleepCommand extends MultiverseCommand {
public SleepCommand(MultiverseCore plugin) {
@@ -29,13 +38,5 @@ public class SleepCommand extends MultiverseCommand {
if (p == null) {
return;
}
// MVPlayerSession session = this.plugin.getPlayerSession(p);
// if (session.getBedRespawnLocation() != null) {
// p.teleport(session.getBedRespawnLocation());
// } else {
// sender.sendMessage("Hmm this is awkward...");
// sender.sendMessage("Something is wrong with your bed.");
// sender.sendMessage("It has either been destroyed or obstructed.");
// }
}
}
@@ -1,20 +1,32 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Teleports a player to the spawn.
*/
public class SpawnCommand extends MultiverseCommand {
public SpawnCommand(MultiverseCore plugin) {
super(plugin);
Permission otherPerm = new Permission("multiverse.core.spawn.other", "Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
Permission otherPerm = new Permission("multiverse.core.spawn.other",
"Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
this.setName("Spawn");
this.setCommandUsage("/mv spawn" + ChatColor.GOLD + " [PLAYER]");
this.setArgRange(0, 1);
@@ -23,7 +35,7 @@ public class SpawnCommand extends MultiverseCommand {
this.addKey("mvs");
this.setPermission("multiverse.core.spawn.self", "Teleports you to the Spawn Point of the world you are in.", PermissionDefault.OP);
this.addAdditonalPermission(otherPerm);
}
@Override
@@ -34,14 +46,15 @@ public class SpawnCommand extends MultiverseCommand {
}
// If a persons name was passed in, you must be A. the console, or B have permissions
if (args.size() == 1) {
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.other", true)) {
if (player != null && !this.plugin.getMVPerms().hasPermission(player, "multiverse.core.spawn.other", true)) {
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.core.spawn.other)");
return;
}
Player target = this.plugin.getServer().getPlayer(args.get(0));
Player target = this.plugin.getServer().getPlayerExact(args.get(0));
if (target != null) {
target.sendMessage("Teleporting to this world's spawn...");
target.teleport(target.getWorld().getSpawnLocation());
spawnAccurately(target);
if (player != null) {
target.sendMessage("You were teleported by: " + ChatColor.YELLOW + player.getName());
} else {
@@ -51,16 +64,27 @@ public class SpawnCommand extends MultiverseCommand {
sender.sendMessage(args.get(0) + " is not logged on right now!");
}
} else {
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.self", true)) {
if (player != null && !this.plugin.getMVPerms().hasPermission(player, "multiverse.core.spawn.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.core.spawn.self)");
return;
}
if (player != null) {
player.sendMessage("Teleporting to this world's spawn...");
player.teleport(player.getWorld().getSpawnLocation());
spawnAccurately(player);
} else {
sender.sendMessage("From the console, you must provide a PLAYER.");
}
}
}
private void spawnAccurately(Player player) {
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(player.getWorld().getName());
Location spawnLocation;
if (world != null) {
spawnLocation = world.getSpawnLocation();
} else {
spawnLocation = player.getWorld().getSpawnLocation();
}
this.plugin.getSafeTTeleporter().safelyTeleport(player, player, spawnLocation, false);
}
}
@@ -1,118 +1,208 @@
/******************************************************************************
* 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.ArrayList;
import java.util.List;
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.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.api.SafeTTeleporter;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVTeleport;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.MVDestination;
import com.onarandombox.utils.DestinationFactory;
import com.onarandombox.utils.InvalidDestination;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
/**
* Used to teleport players.
*/
public class TeleportCommand extends MultiverseCommand {
private MVTeleport playerTeleporter;
private SafeTTeleporter playerTeleporter;
public TeleportCommand(MultiverseCore plugin) {
super(plugin);
Permission self = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP);
Permission other = new Permission("multiverse.core.tp.other", "Allows you to teleport others to other worlds.", PermissionDefault.OP);
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 MVTeleport(this.plugin);
// setPermission in some for is REQUIRED
this.setPermission(self);
this.addAdditonalPermission(other);
this.playerTeleporter = this.plugin.getSafeTTeleporter();
this.setPermission(menu);
}
private static final int UNSAFE_TELEPORT_EXPIRE_DELAY = 15;
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
Player teleporter = null;
CommandSender teleporter = sender;
Player teleportee = null;
if (sender instanceof Player) {
teleporter = (Player) sender;
}
String destinationName;
if (args.size() == 2) {
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.other", true)) {
sender.sendMessage("You don't have permission to teleport another player. (multiverse.core.tp.other)");
return;
}
teleportee = this.plugin.getServer().getPlayer(args.get(0));
teleportee = this.plugin.getServer().getPlayerExact(args.get(0));
if (teleportee == null) {
sender.sendMessage("Sorry, I couldn't find player: " + args.get(0));
this.messaging.sendMessage(sender, String.format("Sorry, I couldn't find player: %s%s",
ChatColor.GOLD, args.get(0)), false);
return;
}
destinationName = args.get(1);
} else {
destinationName = args.get(0);
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.core.tp.self)");
return;
}
if (!(sender instanceof Player)) {
sender.sendMessage("From the console, you must specifiy a player to teleport");
this.messaging.sendMessage(sender, String.format("From the console, you must specify a player to teleport"), false);
return;
}
teleporter = (Player) sender;
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.getDestinationFactory();// .parseDestination(worldName, (MultiverseCore) this.plugin);
}
DestinationFactory df = this.plugin.getDestFactory();
MVDestination d = df.getDestination(destinationName);
if (d != null && d instanceof InvalidDestination) {
sender.sendMessage("Multiverse does not know how to take you to: " + ChatColor.RED + destinationName);
MVTeleportEvent teleportEvent = new MVTeleportEvent(d, teleportee, teleporter, true);
this.plugin.getServer().getPluginManager().callEvent(teleportEvent);
if (teleportEvent.isCancelled()) {
Logging.fine("Someone else cancelled the MVTeleport Event!!!");
return;
}
if (teleporter != null && !this.plugin.getPermissions().canEnterDestination(teleporter, d)) {
if (d != null && d instanceof InvalidDestination) {
this.messaging.sendMessage(sender, String.format("Multiverse does not know how to take you to %s%s",
ChatColor.RED, destinationName), false);
return;
}
if (!this.checkSendPermissions(teleporter, teleportee, d)) {
return;
}
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 {
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD
+ teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
}
return;
} else if (teleporter != null && !this.plugin.getPermissions().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
} else if (teleporter != null && !this.plugin.getMVPerms().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
if (teleportee.equals(teleporter)) {
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + "THERE from " + ChatColor.GREEN + teleporter.getWorld().getName());
this.messaging.sendMessage(teleporter, String.format("DOH! Doesn't look like you can get to %s%s %sfrom where you are...",
ChatColor.GREEN, d.toString(), ChatColor.WHITE), false);
} else {
teleporter.sendMessage("DOH! Doesn't look like " + ChatColor.GREEN + teleporter.getWorld().getName() + " can get to " + ChatColor.RED + "THERE from where they are...");
this.messaging.sendMessage(teleporter, String.format("DOH! Doesn't look like %s%s %scan get to %sTHERE from where they are...",
ChatColor.GREEN, ((Player) teleporter).getWorld().getName(), ChatColor.WHITE, ChatColor.RED), false);
}
return;
}
Location l = d.getLocation(teleportee);
if (l == null) {
teleporter.sendMessage("Sorry Boss, I tried everything, but just couldn't teleport ya there!");
// Special check to verify if players are tryint to teleport to the same
// WORLDDestination as the world they're in, that they ALSO have multiverse.core.spawn.self
if (d instanceof WorldDestination) {
World w = d.getLocation(teleportee).getWorld();
if (teleportee.getWorld().equals(w)) {
if (teleporter.equals(teleportee)) {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.core.spawn.self", true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("Sorry you don't have permission to go to the world spawn!"),
String.format("%s (multiverse.core.spawn.self)",
ChatColor.RED) }, false);
return;
}
} else {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.core.spawn.other", true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("Sorry you don't have permission to send %s to the world spawn!",
teleportee.getDisplayName()),
String.format("%s (multiverse.core.spawn.other)",
ChatColor.RED) }, false);
return;
}
}
}
}
if (d.getLocation(teleportee) == null) {
this.messaging.sendMessage(teleporter, "Sorry Boss, I tried everything, but just couldn't teleport ya there!", false);
return;
}
if (!this.playerTeleporter.safelyTeleport(teleportee, l)) {
Class<?> paramTypes[] = { Player.class, Location.class };
Teleporter teleportObject = (d instanceof CustomTeleporterDestination) ?
((CustomTeleporterDestination)d).getTeleporter() : this.playerTeleporter;
TeleportResult result = teleportObject.teleport(teleporter, teleportee, d);
if (result == TeleportResult.FAIL_UNSAFE) {
Logging.fine("Could not teleport " + teleportee.getName()
+ " to " + plugin.getLocationManipulation().strCoordsRaw(d.getLocation(teleportee)));
Logging.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(l);
items.add(d.getLocation(teleportee));
String player = "you";
if (!teleportee.equals(teleporter)) {
player = teleportee.getName();
}
String message = ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " did not teleport " + ChatColor.AQUA + player + ChatColor.WHITE + " to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items, paramTypes, message, "Would you like to try anyway?", "", "", 15);
} else {
teleportee.setVelocity(d.getVelocity());
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);
}
// else: Player was teleported successfully (or the tp event was fired I should say)
}
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)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("%sYou don't have permission to teleport %syourself %sto a %s%s %sDestination",
ChatColor.WHITE, ChatColor.AQUA, ChatColor.WHITE, ChatColor.RED, destination.getType(), ChatColor.WHITE),
String.format("%s (multiverse.teleport.self.%s)",
ChatColor.RED, destination.getIdentifier()) }, false);
return false;
}
} else {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.other." + destination.getIdentifier(), true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("You don't have permission to teleport another player to a %s%s Destination.",
ChatColor.GREEN, destination.getType()),
String.format("%s(multiverse.teleport.other.%s)",
ChatColor.RED, destination.getIdentifier()) }, false);
return false;
}
}
return true;
}
}
@@ -1,13 +1,23 @@
/******************************************************************************
* 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 com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.List;
/**
* Unloads worlds from Multiverse.
*/
public class UnloadCommand extends MultiverseCommand {
public UnloadCommand(MultiverseCore plugin) {
@@ -17,15 +27,16 @@ public class UnloadCommand extends MultiverseCommand {
this.setArgRange(1, 1);
this.addKey("mvunload");
this.addKey("mv unload");
this.setPermission("multiverse.core.unload", "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
this.setPermission("multiverse.core.unload",
"Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.removeWorldFromList(args.get(0))) {
sender.sendMessage("World Unloaded!");
if (this.plugin.getMVWorldManager().unloadWorld(args.get(0))) {
Command.broadcastCommandMessage(sender, "Unloaded world '" + args.get(0) + "'!");
} else {
sender.sendMessage("Error trying to unload world!");
sender.sendMessage("Error trying to unload world '" + args.get(0) + "'!");
}
}
}
@@ -1,100 +1,221 @@
/******************************************************************************
* 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.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.List;
import java.util.logging.Level;
import 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 com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent;
import java.io.File;
import java.util.List;
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 + "-p");
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 pastebin.com with a -p.", 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.TRUE);
}
private String pasteBinBuffer = "";
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] 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.");
}
logAndAddToPasteBinBuffer("Multiverse-Core Version: " + this.plugin.getDescription().getVersion());
logAndAddToPasteBinBuffer("Bukkit Version: " + this.plugin.getServer().getVersion());
logAndAddToPasteBinBuffer("Loaded Worlds: " + this.plugin.getMVWorlds().size());
logAndAddToPasteBinBuffer("Multiverse Plugins Loaded: " + this.plugin.getPluginCount());
logAndAddToPasteBinBuffer("Economy being used: " + this.plugin.getBank().getEconUsed());
logAndAddToPasteBinBuffer("Permissions Plugin: " + this.plugin.getPermissions().getType());
logAndAddToPasteBinBuffer("Dumping Config Values: (version " + this.plugin.getConfig().getString("version", "NOT SET") + ")");
logAndAddToPasteBinBuffer("messagecooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
logAndAddToPasteBinBuffer("teleportcooldown: " + this.plugin.getConfig().getString("teleportcooldown", "NOT SET"));
logAndAddToPasteBinBuffer("worldnameprefix: " + this.plugin.getConfig().getString("worldnameprefix", "NOT SET"));
logAndAddToPasteBinBuffer("opfallback: " + this.plugin.getConfig().getString("opfallback", "NOT SET"));
logAndAddToPasteBinBuffer("disableautoheal: " + this.plugin.getConfig().getString("disableautoheal", "NOT SET"));
logAndAddToPasteBinBuffer("fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
logAndAddToPasteBinBuffer("Special Code: FRN001");
MVVersionRequestEvent versionEvent = new MVVersionRequestEvent(pasteBinBuffer);
MVVersionEvent versionEvent = new MVVersionEvent();
this.addVersionInfoToEvent(versionEvent);
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
pasteBinBuffer = versionEvent.getPasteBinBuffer();
if (args.size() == 1 && args.get(0).equalsIgnoreCase("-p")) {
String pasteBinUrl = postToPasteBin();
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteBinUrl);
this.plugin.log(Level.INFO, "Version info dumped here: " + pasteBinUrl);
if (CommandHandler.hasFlag("--include-plugin-list", args)) {
versionEvent.appendVersionInfo('\n' + "Plugins: " + getPluginList());
versionEvent.putDetailedVersionInfo("plugins.txt", "Plugins: " + getPluginList());
}
}
private void logAndAddToPasteBinBuffer(String string) {
this.pasteBinBuffer += "[Multiverse-Core] " + string + "\n";
this.plugin.log(Level.INFO, string);
}
final String versionInfo = versionEvent.getVersionInfo();
versionEvent.putDetailedVersionInfo("version.txt", versionInfo);
private String postToPasteBin() {
try {
String data = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("33ab32380506d99d872b69d35dc9d007", "UTF-8");
data += "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
data += "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(this.pasteBinBuffer, "UTF-8");
final Map<String, String> files = versionEvent.getDetailedVersionInfo();
URL url = new URL("http://pastebin.com/api/api_post.php");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String pasteBinUrl = "";
while ((line = rd.readLine()) != null) {
pasteBinUrl = line;
// log to console
String[] lines = versionInfo.split("\\r?\\n");
for (String line : lines) {
if (!line.isEmpty()) {
this.plugin.getServer().getLogger().info(line);
}
wr.close();
rd.close();
return pasteBinUrl;
} catch (Exception e) {
System.out.print(e);
return "Error Posting to pastebin.com";
}
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 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, Map<String, String> pasteFiles) {
PasteService ps = PasteServiceFactory.getService(type, isPrivate);
try {
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) {
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(), ", ");
}
}
@@ -1,27 +1,44 @@
/******************************************************************************
* 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.ArrayList;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
/**
* States who is in what world.
*/
public class WhoCommand extends MultiverseCommand {
private MVWorldManager worldManager;
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();
}
@Override
@@ -35,54 +52,67 @@ public class WhoCommand extends MultiverseCommand {
showAll = false;
}
List<MVWorld> worlds = new ArrayList<MVWorld>();
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) {
if (args.size() == 1) {
if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
showAll = true;
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
} else if (this.plugin.isMVWorld(args.get(0))) {
worlds.add(this.plugin.getMVWorld(args.get(0)));
} else {
sender.sendMessage(ChatColor.RED + "World does not exist");
// 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<MVWorld>(this.plugin.getMVWorlds());
}
if (worlds.size() == 0) {
sender.sendMessage("Multiverse does not know about any of your worlds :(");
} else if (worlds.size() == 1) {
sender.sendMessage(ChatColor.AQUA + "--- " + "Players in" + ChatColor.YELLOW + worlds.get(0) + ChatColor.AQUA + " ---");
} else {
sender.sendMessage(ChatColor.AQUA + "--- There are players in ---");
}
for (MVWorld world : worlds) {
if (!(this.plugin.isMVWorld(world.getName()))) {
continue;
}
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
continue;
}
List<Player> players = world.getCBWorld().getPlayers();
String result = "";
if (players.size() <= 0 && !showAll) {
continue;
}
if (players.size() <= 0) {
result = "Empty";
} else {
for (Player player : players) {
result += player.getName() + " ";
// 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,4 @@
/**
* This package contains all Commands.
*/
package com.onarandombox.MultiverseCore.commands;
@@ -1,50 +0,0 @@
package com.onarandombox.MultiverseCore.configuration;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
public class DefaultConfig {
public DefaultConfig(File folder, String name, MVConfigMigrator migrator) {
File actual = new File(folder, name);
if (actual.exists() && migrator.createdDefaults.contains(name)) {
actual.delete();
}
// If defaults have been created, and we're being called again, we should try to migrate
if (!actual.exists() && !migrator.migrate(name, folder)) {
InputStream defConfig = this.getClass().getResourceAsStream("/defaults/" + name);
if (defConfig != null) {
FileOutputStream newConfig = null;
try {
newConfig = new FileOutputStream(actual);
byte[] buf = new byte[8192];
int length = 0;
while ((length = defConfig.read(buf)) > 0) {
newConfig.write(buf, 0, length);
}
migrator.createdDefaults.add(name);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (defConfig != null)
defConfig.close();
} catch (Exception e) {
}
try {
if (newConfig != null)
newConfig.close();
} catch (Exception e) {
}
}
}
}
}
}
@@ -0,0 +1,84 @@
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;
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() {
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,54 +0,0 @@
package com.onarandombox.MultiverseCore.configuration;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
import com.onarandombox.MultiverseCore.LoggablePlugin;
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;
}
}
@@ -1,76 +0,0 @@
package com.onarandombox.MultiverseCore.configuration;
import java.io.File;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.util.config.Configuration;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class MVCoreConfigMigrator extends MVConfigMigrator {
private MultiverseCore core;
public MVCoreConfigMigrator(MultiverseCore core) {
this.core = core;
}
public boolean migrate(String name, File folder) {
File oldFolder = this.detectMultiverseFolders(folder, core);
if (name.equalsIgnoreCase("worlds.yml")) {
return this.migrateWorlds(name, oldFolder, folder);
}
if (name.equalsIgnoreCase("config.yml")) {
return this.migrateMainConfig(name, oldFolder, folder);
}
return true;
}
private boolean migrateWorlds(String name, File oldFolder, File newFolder) {
Configuration newConfig = new Configuration(new File(newFolder, "worlds.yml"));
this.core.log(Level.INFO, "Trying to migrate worlds.yml...");
Configuration oldConfig = new Configuration(new File(oldFolder, "Worlds.yml"));
oldConfig.load();
List<String> keys = oldConfig.getKeys("worlds");
if (keys == null) {
this.core.log(Level.SEVERE, "Migration FAILURE!");
return false;
}
for (String key : keys) {
newConfig.setProperty("worlds." + key + ".animals.spawn", oldConfig.getProperty("worlds." + key + ".animals"));
newConfig.setProperty("worlds." + key + ".monsters.spawn", oldConfig.getProperty("worlds." + key + ".mobs"));
newConfig.setProperty("worlds." + key + ".pvp", oldConfig.getProperty("worlds." + key + ".pvp"));
newConfig.setProperty("worlds." + key + ".alias.name", oldConfig.getProperty("worlds." + key + ".alias"));
newConfig.setProperty("worlds." + key + ".tempspawn", oldConfig.getProperty("worlds." + key + ".spawn"));
newConfig.setProperty("worlds." + key + ".entryfee.amount", oldConfig.getProperty("worlds." + key + ".price"));
newConfig.setProperty("worlds." + key + ".entryfee.currency", -1);
newConfig.setProperty("worlds." + key + ".environment", oldConfig.getProperty("worlds." + key + ".environment"));
// Have to convert CSLs to arrays
migrateListItem(newConfig, oldConfig, key, ".blockBlacklist", ".blockblacklist");
migrateListItem(newConfig, oldConfig, key, ".worldBlacklist", ".worldblacklist");
}
newConfig.save();
this.core.log(Level.INFO, "Migration SUCCESS!");
return true;
}
private boolean migrateMainConfig(String name, File oldFolder, File newFolder) {
Configuration newConfig = new Configuration(new File(newFolder, "config.yml"));
this.core.log(Level.INFO, "Migrating config.yml...");
Configuration oldConfig = new Configuration(new File(oldFolder, "MultiVerse.yml"));
oldConfig.load();
newConfig.setProperty("worldnameprefix", oldConfig.getProperty("prefix"));
newConfig.setProperty("messagecooldown", oldConfig.getProperty("alertcooldown"));
// Default values:
newConfig.setProperty("opfallback", true);
newConfig.setProperty("disableautoheal", false);
newConfig.setProperty("fakepvp", false);
newConfig.setProperty("bedrespawn", true);
newConfig.setProperty("version", 2.2);
newConfig.save();
return true;
}
}
@@ -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;
}
}
@@ -0,0 +1,76 @@
package com.onarandombox.MultiverseCore.configuration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import me.main__.util.SerializationConfig.Property;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.configuration.serialization.SerializableAs;
/**
* SpawnSubSettings.
*/
@SerializableAs("MVSpawnSubSettings")
public class SubSpawnSettings extends SerializationConfig {
@Property
private boolean spawn;
@Property
private int spawnrate;
@Property
private List<String> exceptions;
public SubSpawnSettings() {
super();
}
public SubSpawnSettings(Map<String, Object> values) {
super(values);
}
/**
* {@inheritDoc}
*/
@Override
public void setDefaults() {
spawn = true;
exceptions = new ArrayList<String>();
spawnrate = -1;
}
/**
* @return spawn
*/
public boolean doSpawn() {
return spawn;
}
/**
* @param spawn The new value.
*/
public void setSpawn(boolean spawn) {
this.spawn = spawn;
}
/**
* @return The exceptions
*/
public List<String> getExceptions() {
return exceptions;
}
/**
* @param rate The new spawn rate
*/
public void setSpawnRate(int rate) {
this.spawnrate = rate;
}
/**
* @return The spawn rate
*/
public int getSpawnRate() {
return this.spawnrate;
}
}
@@ -0,0 +1,27 @@
package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.Bukkit;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.event.MVWorldPropertyChangeEvent;
import me.main__.util.SerializationConfig.ChangeDeniedException;
import me.main__.util.SerializationConfig.ObjectUsingValidator;
/**
* Validates world-property-changes.
* @param <T> The type of the property that should be validated.
*/
public class WorldPropertyValidator<T> extends ObjectUsingValidator<T, MVWorld> {
/**
* {@inheritDoc}
*/
@Override
public T validateChange(String property, T newValue, T oldValue, MVWorld object) throws ChangeDeniedException {
MVWorldPropertyChangeEvent<T> event = new MVWorldPropertyChangeEvent<T>(object, null, property, newValue);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
throw new ChangeDeniedException();
return event.getTheNewValue();
}
}
@@ -0,0 +1,4 @@
/**
* This package contains the Multiverse-configuration.
*/
package com.onarandombox.MultiverseCore.configuration;
@@ -0,0 +1,148 @@
/******************************************************************************
* 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.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.util.Arrays;
import java.util.List;
/**
* An anchor-{@link MVDestination}.
*/
public class AnchorDestination implements MVDestination {
private boolean isValid;
private Location location;
private MultiverseCore plugin;
private String name;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "a";
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
this.plugin = (MultiverseCore) plugin;
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: a:name
if (!(parsed.size() == 2)) {
return false;
}
// If it's not an Anchor type
return parsed.get(0).equalsIgnoreCase("a");
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return this.location;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
this.plugin = (MultiverseCore) plugin;
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 2)) {
this.isValid = false;
return;
}
this.name = parsed.get(1);
this.location = this.plugin.getAnchorManager().getAnchorLocation(parsed.get(1));
if (this.location == null) {
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) {
this.isValid = false;
}
this.isValid = true;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Anchor";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Anchor: " + this.name;
}
@Override
public String toString() {
if (isValid) {
return "a:" + this.name;
}
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
// This is an ANCHOR destination, don't safely teleport here.
return false;
}
}
@@ -0,0 +1,141 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A bed-{@link MVDestination}.
*/
public class BedDestination implements MVDestination {
public static final String OWN_BED_STRING = "playerbed";
private String playername = "";
private boolean isValid;
private Location knownBedLoc;
private MultiverseCore plugin;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "b";
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
String[] split = destination.split(":");
boolean validFormat = split.length >= 1 && split.length <= 2 && split[0].equals(this.getIdentifier());
OfflinePlayer p = Bukkit.getOfflinePlayer(split[1]);
boolean validPlayer = p.getName() != null && !p.getName().equals(OWN_BED_STRING);
if (validFormat && validPlayer) this.playername = p.getName();
this.isValid = destination.equals("b:" + OWN_BED_STRING) || (validFormat && validPlayer);
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity entity) {
if (entity instanceof Player) {
if (this.playername.isEmpty())
this.knownBedLoc = this.plugin.getBlockSafety().getSafeBedSpawn(((Player) entity).getBedSpawnLocation());
else
this.knownBedLoc = this.plugin.getBlockSafety().getSafeBedSpawn(Bukkit.getOfflinePlayer(this.playername).getBedSpawnLocation());
if (this.knownBedLoc == null) {
((Player) entity).sendMessage("The bed was " + ChatColor.RED + "invalid or blocked" + ChatColor.RESET + ". Sorry.");
}
return this.knownBedLoc;
}
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector();
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
this.plugin = (MultiverseCore) plugin;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Bed";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Bed";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
if (knownBedLoc != null) {
return "multiverse.access." + knownBedLoc.getWorld().getName();
}
return "";
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
// Bukkit should have already checked this.
return false;
}
@Override
public String toString() {
return "b:" + (playername.isEmpty() ? OWN_BED_STRING : playername);
}
}
@@ -1,21 +1,35 @@
package com.onarandombox.utils;
/******************************************************************************
* 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. *
******************************************************************************/
import java.util.Arrays;
import java.util.List;
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import com.onarandombox.MultiverseCore.MultiverseCore;
import java.util.Arrays;
import java.util.List;
/**
* A cannon-{@link MVDestination}.
*/
public class CannonDestination implements MVDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
private double speed;
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
double pitchRadians = Math.toRadians(location.getPitch());
double yawRadians = Math.toRadians(location.getYaw());
@@ -28,20 +42,28 @@ public class CannonDestination implements MVDestination {
return new Vector(x, y, z);
}
/**
* {@inheritDoc}
*/
@Override
public String getIdentifer() {
public String getIdentifier() {
return "ca";
}
// NEED ca:world:x,y,z:pitch:yaw:speed
// so basically 6
private static final int SPLIT_SIZE = 6;
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// NEED ca:world:x,y,z:pitch:yaw:speed
// so basically 6
if (parsed.size() != 6) {
if (parsed.size() != SPLIT_SIZE) {
return false;
}
// If it's not an Cannon type
@@ -50,7 +72,7 @@ public class CannonDestination implements MVDestination {
}
// If it's not a MV world
if (!((MultiverseCore) plugin).isMVWorld(parsed.get(1))) {
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
return false;
}
// Verify X,Y,Z are numbers
@@ -59,49 +81,58 @@ public class CannonDestination implements MVDestination {
}
try {
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
Float.parseFloat(parsed.get(3));
Float.parseFloat(parsed.get(4));
Float.parseFloat(parsed.get(5));
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
} catch (NumberFormatException e) {
return false;
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return this.location;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String dest) {
public void setDestination(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
List<String> parsed = Arrays.asList(dest.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (parsed.size() != 6) {
List<String> parsed = Arrays.asList(destination.split(":"));
if (parsed.size() != SPLIT_SIZE) {
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifer())) {
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) {
this.isValid = false;
return;
}
if (!((MultiverseCore) plugin).isMVWorld(parsed.get(1))) {
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
this.isValid = false;
return;
}
this.location = new Location(((MultiverseCore) plugin).getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
this.location = new Location(((MultiverseCore) plugin).getMVWorldManager().getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
if (!parsed.get(2).matches(this.coordRegex)) {
this.isValid = false;
@@ -122,9 +153,11 @@ public class CannonDestination implements MVDestination {
this.location.setZ(coords[2]);
try {
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
this.location.setPitch(Float.parseFloat(parsed.get(3)));
this.location.setYaw(Float.parseFloat(parsed.get(4)));
this.speed = Math.abs(Float.parseFloat(parsed.get(5)));
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
} catch (NumberFormatException e) {
this.isValid = false;
return;
@@ -134,18 +167,30 @@ public class CannonDestination implements MVDestination {
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Cannon!";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Cannon (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":" +
this.location.getPitch() + ":" + this.location.getYaw() + ":" + this.speed + ")";
return "Cannon (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":"
+ this.location.getPitch() + ":" + this.location.getYaw() + ":" + this.speed + ")";
}
/**
* Sets this {@link CannonDestination}.
*
* @param location The {@link Location}.
* @param speed The speed.
*/
public void setDestination(Location location, double speed) {
if (location != null) {
this.location = location;
@@ -155,16 +200,28 @@ public class CannonDestination implements MVDestination {
this.isValid = false;
}
@Override
public String toString() {
if (isValid) {
return "ca:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
}
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
return false;
}
@Override
public String toString() {
if (isValid) {
return "ca:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
}
return "i:Invalid Destination";
}
}
@@ -0,0 +1,29 @@
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.api.Teleporter;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
public abstract class CustomTeleporterDestination implements MVDestination {
@Override
public final Location getLocation(final Entity entity) {
throw new UnsupportedOperationException();
}
@Override
public final Vector getVelocity() {
throw new UnsupportedOperationException();
}
@Override
public final boolean useSafeTeleporter() {
throw new UnsupportedOperationException();
}
@Override
public abstract String toString();
public abstract Teleporter getTeleporter();
}
@@ -0,0 +1,104 @@
/******************************************************************************
* 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.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
import com.onarandombox.MultiverseCore.utils.PermissionTools;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** A factory class that will create destinations from specific strings. */
public class DestinationFactory {
private MultiverseCore plugin;
private Map<String, Class<? extends MVDestination>> destList;
private Command teleportCommand;
public DestinationFactory(MultiverseCore plugin) {
this.plugin = plugin;
this.destList = new HashMap<String, Class<? extends MVDestination>>();
List<Command> cmds = this.plugin.getCommandHandler().getAllCommands();
for (Command c : cmds) {
if (c instanceof TeleportCommand) {
this.teleportCommand = c;
}
}
}
/**
* Gets a new destination from a string.
* Returns a new InvalidDestination if the string could not be parsed.
*
* @param destination The destination in string format.
*
* @return A non-null MVDestination
*/
public MVDestination getDestination(String destination) {
String idenChar = "";
if (destination.split(":").length > 1) {
idenChar = destination.split(":")[0];
}
if (this.destList.containsKey(idenChar)) {
Class<? extends MVDestination> myClass = this.destList.get(idenChar);
try {
MVDestination mydest = myClass.newInstance();
if (!mydest.isThisType(this.plugin, destination)) {
return new InvalidDestination();
}
mydest.setDestination(this.plugin, destination);
return mydest;
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
return new InvalidDestination();
}
/**
* Registers a {@link MVDestination}.
*
* @param c The {@link Class} of the {@link MVDestination} to register.
* @param identifier The {@link String}-identifier.
* @return True if the class was successfully registered.
*/
public boolean registerDestinationType(Class<? extends MVDestination> c, String identifier) {
if (this.destList.containsKey(identifier)) {
return false;
}
this.destList.put(identifier, c);
// Special case for world defaults:
if (identifier.equals("")) {
identifier = "w";
}
Permission self = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.self." + identifier);
Permission other = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.other." + identifier);
PermissionTools pt = new PermissionTools(this.plugin);
if (self == null) {
self = new Permission("multiverse.teleport.self." + identifier,
"Permission to teleport yourself for the " + identifier + " destination.", PermissionDefault.OP);
this.plugin.getServer().getPluginManager().addPermission(self);
pt.addToParentPerms("multiverse.teleport.self." + identifier);
}
if (other == null) {
other = new Permission("multiverse.teleport.other." + identifier,
"Permission to teleport others for the " + identifier + " destination.", PermissionDefault.OP);
this.plugin.getServer().getPluginManager().addPermission(other);
pt.addToParentPerms("multiverse.teleport.other." + identifier);
}
this.teleportCommand.addAdditonalPermission(self);
this.teleportCommand.addAdditonalPermission(other);
return true;
}
}
@@ -0,0 +1,263 @@
/******************************************************************************
* 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.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.util.Arrays;
import java.util.List;
/**
* An exact {@link MVDestination}.
*/
public class ExactDestination implements MVDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*|~-?[\\d]+\\.?[\\d]*|~),(-?[\\d]+\\.?[\\d]*|~-?[\\d]+\\.?[\\d]*|~),(-?[\\d]+\\.?[\\d]*|~-?[\\d]+\\.?[\\d]*|~)";
private boolean isValid;
private Location location;
private boolean relativeX, relativeY, relativeZ;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "e";
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 3 || parsed.size() == 5)) { // SUPPRESS CHECKSTYLE: MagicNumberCheck
return false;
}
// If it's not an Exact type
if (!parsed.get(0).equalsIgnoreCase("e")) {
return false;
}
// If it's not a MV world
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
return false;
}
if (!parsed.get(2).matches(coordRegex)) {
return false;
}
// This is 1 now, because we've removed 2
if (parsed.size() == 3) {
return true;
}
try {
Float.parseFloat(parsed.get(3));
Float.parseFloat(parsed.get(4)); // SUPPRESS CHECKSTYLE: MagicNumberCheck
} catch (NumberFormatException e) {
return false;
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
Location loc = this.location.clone();
if (relativeX || relativeY || relativeZ) {
Location eLoc = e.getLocation();
loc.add(relativeX ? eLoc.getX() : 0, relativeY ? eLoc.getY() : 0, relativeZ ? eLoc.getZ() : 0);
// Since the location is relative, it makes sense to use the entity's pitch and yaw unless those were
// specified in the destination.
if (loc.getPitch() == 0) {
loc.setPitch(eLoc.getPitch());
}
if (loc.getYaw() == 0) {
loc.setYaw(eLoc.getYaw());
}
}
return loc;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 3 || parsed.size() == 5)) { // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) {
this.isValid = false;
return;
}
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
this.isValid = false;
return;
}
this.location = new Location(((MultiverseCore) plugin).getMVWorldManager().getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
if (!parsed.get(2).matches(this.coordRegex)) {
this.isValid = false;
return;
}
double[] coords = new double[3];
String[] coordString = parsed.get(2).split(",");
for (int i = 0; i < 3; i++) {
String[] relSplit = coordString[i].split("~");
boolean relative = false;
if (relSplit.length == 0) {
// coord is "~" form
relative = true;
coords[i] = 0;
} else if (relSplit.length == 1) {
// coord is "123" form
try {
coords[i] = Double.parseDouble(relSplit[0]);
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
} else {
// coord is "~123" form
relative = true;
try {
coords[i] = Double.parseDouble(relSplit[1]);
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
}
if (relative) {
switch (i) {
case 0:
relativeX = true;
break;
case 1:
relativeY = true;
break;
case 2:
relativeZ = true;
break;
}
}
}
this.location.setX(coords[0]);
this.location.setY(coords[1]);
this.location.setZ(coords[2]);
if (parsed.size() == 3) {
this.isValid = true;
return;
}
try {
this.location.setPitch(Float.parseFloat(parsed.get(3)));
this.location.setYaw(Float.parseFloat(parsed.get(4))); // SUPPRESS CHECKSTYLE: MagicNumberCheck
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
this.isValid = true;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Exact";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Exact (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ()
+ ":" + location.getPitch() + ":" + location.getYaw() + ")";
}
/**
* Sets this {@link ExactDestination}.
*
* @param location The {@link Location}.
*/
public void setDestination(Location location) {
this.isValid = (this.location = location) != null;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
if (isValid) {
return "e:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw();
}
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
// This is an EXACT destination, don't safely teleport here.
return false;
}
}
@@ -0,0 +1,107 @@
/******************************************************************************
* 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.destination;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* An invalid {@link MVDestination}.
*/
public class InvalidDestination implements MVDestination {
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "i";
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
// Nothing needed, it's invalid.
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return ChatColor.RED + "Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return ChatColor.RED + "Invalid Destination";
}
@Override
public String toString() {
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
return false;
}
}
Loaded 100 of 210 files, more files were not shown because too many files have changed in this diff. Show more