Compare commits

..
242 Commits
Author SHA1 Message Date
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
235 changed files with 5413 additions and 7055 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 -b`:** <!-- Replace this with the command output's https://pastebin.com 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: 'type: Bug'
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 -b`:** <!-- Replace this with the command output's https://pastebin.com 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: Suggestion'
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? -->
+1
View File
@@ -12,6 +12,7 @@
# maven
/target
dependency-reduced-pom.xml
# vim
.*.sw[a-p]
+6
View File
@@ -0,0 +1,6 @@
language: java
jdk:
- oraclejdk8
notifications:
email: false
dist: trusty
+1
View File
@@ -13,3 +13,4 @@ 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.
-44
View File
@@ -1,44 +0,0 @@
# Eclipse stuff
/.classpath
/.project
/.settings
/.checkstyle
# netbeans
/nbproject
# we use maven!
/build.xml
# maven
/target
# vim
.*.sw[a-p]
# various other potential build files
/build
/bin
/dist
/manifest.mf
/world
# Mac filesystem dust
*.DS_Store
# intellij
*.iml
*.ipr
*.iws
.idea/
# Fern's utils
uploadtoserver.sh
# Testing files:
debug.log
# Doxygen
/docs/html
debug.txt
-140
View File
@@ -1,140 +0,0 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Multiverse 2 Copyright (c) the Multiverse Team 2012. ~
~ Multiverse 2 is licensed under the BSD License. ~
~ For more information please check the README.md file included ~
~ with this project. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!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">
<property name="severity" value="info"/>
</module>
<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="120"/>
<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"/>
</module>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter">
<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="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
</module>
<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="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
<module name="ArrayTypeStyle"/>
<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>
-186
View File
@@ -1,186 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mvplugin</groupId>
<artifactId>MultiverseCore</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<artifactId>MultiverseCore-Base</artifactId>
<repositories>
<repository>
<id>onarandombox</id>
<url>http://repo.onarandombox.com/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<!-- Profiles are used to detect whether this is a local or Jenkins build
and adjust the build number accordingly -->
<profiles>
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
</properties>
</profile>
</profiles>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- 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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<excludes>
<exclude>**/TestCommandSender.java</exclude>
<exclude>**/TestInstanceCreator.java</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.11</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
<configuration>
<enableRulesSummary>true</enableRulesSummary>
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</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.8.1</version>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Start of PluginBase Dependency -->
<dependency>
<groupId>com.dumptruckman.minecraft</groupId>
<artifactId>Plugin</artifactId>
<version>1.5-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of PluginBase Dependency -->
<!-- Start of Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<version>1.4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<!-- End of Test Dependencies -->
</dependencies>
<distributionManagement>
<repository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/content/repositories/multiverse/</url>
</repository>
<snapshotRepository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/content/repositories/multiverse-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
@@ -1,329 +0,0 @@
package com.mvplugin.core;
import com.mvplugin.core.api.MultiverseWorld;
import com.mvplugin.core.api.WorldProperties;
import com.mvplugin.core.api.WorldProperties.Spawning;
import com.mvplugin.core.minecraft.Difficulty;
import com.mvplugin.core.minecraft.GameMode;
import com.mvplugin.core.minecraft.PlayerPosition;
import com.mvplugin.core.minecraft.PortalType;
import com.mvplugin.core.minecraft.WorldEnvironment;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
abstract class AbstractMultiverseWorld implements MultiverseWorld, Observer {
private final WorldProperties worldProperties;
protected AbstractMultiverseWorld(final WorldProperties worldProperties) {
this.worldProperties = worldProperties;
worldProperties.addObserver(this);
worldProperties.get(WorldProperties.SPAWNING).get(Spawning.ANIMALS).addObserver(this);
worldProperties.get(WorldProperties.SPAWNING).get(Spawning.MONSTERS).addObserver(this);
}
@Override
public final void update(Observable o, Object arg) {
update(arg);
}
protected abstract void update(Object property);
@Override
public WorldEnvironment getEnvironment() {
return getProperties().get(WorldProperties.ENVIRONMENT);
}
@Override
public void setEnvironment(final WorldEnvironment environment) {
getProperties().set(WorldProperties.ENVIRONMENT, environment);
}
@Override
public Difficulty getDifficulty() {
return getProperties().get(WorldProperties.DIFFICULTY);
}
@Override
public boolean setDifficulty(final Difficulty difficulty) {
// TODO Validate?
return getProperties().set(WorldProperties.DIFFICULTY, difficulty);
}
@Override
public long getSeed() {
return getProperties().get(WorldProperties.SEED);
}
@Override
public void setSeed(long seed) {
getProperties().set(WorldProperties.SEED, seed);
}
@Override
public String getGenerator() {
return getProperties().get(WorldProperties.GENERATOR);
}
@Override
public void setGenerator(final String generator) {
getProperties().set(WorldProperties.GENERATOR, generator != null ? generator : "");
}
@Override
public WorldProperties getProperties() {
return worldProperties;
}
@Override
public String getAllPropertyNames() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public String getAlias() {
return getProperties().get(WorldProperties.ALIAS);
}
@Override
public void setAlias(final String alias) {
getProperties().set(WorldProperties.ALIAS, alias != null ? alias : "");
}
@Override
public boolean canAnimalsSpawn() {
return getProperties().get(WorldProperties.SPAWNING)
.get(WorldProperties.Spawning.ANIMALS)
.get(WorldProperties.Spawning.Animals.SPAWN);
}
@Override
public void setAllowAnimalSpawn(final boolean allowAnimalSpawn) {
getProperties().get(WorldProperties.SPAWNING)
.get(WorldProperties.Spawning.ANIMALS)
.set(WorldProperties.Spawning.Animals.SPAWN, allowAnimalSpawn);
}
@Override
public List<String> getAnimalList() {
return getProperties().get(WorldProperties.SPAWNING)
.get(WorldProperties.Spawning.ANIMALS)
.get(WorldProperties.Spawning.Animals.EXCEPTIONS);
}
@Override
public boolean canMonstersSpawn() {
return getProperties().get(WorldProperties.SPAWNING)
.get(WorldProperties.Spawning.MONSTERS)
.get(WorldProperties.Spawning.Monsters.SPAWN);
}
@Override
public void setAllowMonsterSpawn(final boolean allowMonsterSpawn) {
getProperties().get(WorldProperties.SPAWNING)
.get(WorldProperties.Spawning.MONSTERS)
.set(WorldProperties.Spawning.Monsters.SPAWN, allowMonsterSpawn);
}
@Override
public List<String> getMonsterList() {
return getProperties().get(WorldProperties.SPAWNING)
.get(WorldProperties.Spawning.ANIMALS)
.get(WorldProperties.Spawning.Monsters.EXCEPTIONS);
}
@Override
public boolean isPVPEnabled() {
return getProperties().get(WorldProperties.PVP);
}
@Override
public void setPVPMode(final boolean pvpMode) {
getProperties().set(WorldProperties.PVP, pvpMode);
}
@Override
public boolean isHidden() {
return getProperties().get(WorldProperties.HIDDEN);
}
@Override
public void setHidden(final boolean hidden) {
getProperties().set(WorldProperties.HIDDEN, hidden);
}
@Override
public boolean getPrefixChat() {
return getProperties().get(WorldProperties.PREFIX_CHAT);
}
@Override
public void setPrefixChat(final boolean prefixChat) {
getProperties().set(WorldProperties.PREFIX_CHAT, prefixChat);
}
@Override
public boolean isWeatherEnabled() {
return getProperties().get(WorldProperties.ALLOW_WEATHER);
}
@Override
public void setEnableWeather(final boolean enableWeather) {
getProperties().set(WorldProperties.ALLOW_WEATHER, enableWeather);
}
@Override
public boolean isKeepingSpawnInMemory() {
return getProperties().get(WorldProperties.KEEP_SPAWN);
}
@Override
public void setKeepSpawnInMemory(final boolean keepSpawnInMemory) {
getProperties().set(WorldProperties.KEEP_SPAWN, keepSpawnInMemory);
}
@Override
public PlayerPosition getSpawnLocation() {
return getProperties().get(WorldProperties.SPAWN_LOCATION);
}
@Override
public void setSpawnLocation(final PlayerPosition spawnLocation) {
getProperties().set(WorldProperties.SPAWN_LOCATION, spawnLocation);
}
@Override
public boolean getHunger() {
return getProperties().get(WorldProperties.HUNGER);
}
@Override
public void setHunger(final boolean hungerEnabled) {
getProperties().set(WorldProperties.HUNGER, hungerEnabled);
}
@Override
public GameMode getGameMode() {
return getProperties().get(WorldProperties.GAME_MODE);
}
@Override
public boolean setGameMode(final GameMode gameMode) {
// Todo validate?
return getProperties().set(WorldProperties.GAME_MODE, gameMode);
}
@Override
public double getPrice() {
return getProperties().get(WorldProperties.ENTRY_FEE).get(WorldProperties.EntryFee.AMOUNT);
}
@Override
public void setPrice(final double price) {
getProperties().get(WorldProperties.ENTRY_FEE).set(WorldProperties.EntryFee.AMOUNT, price);
}
@Override
public int getCurrency() {
return getProperties().get(WorldProperties.ENTRY_FEE).get(WorldProperties.EntryFee.CURRENCY);
}
@Override
public void setCurrency(final int item) {
getProperties().get(WorldProperties.ENTRY_FEE).set(WorldProperties.EntryFee.CURRENCY, item);
}
@Override
public String getRespawnToWorld() {
return getProperties().get(WorldProperties.RESPAWN_WORLD);
}
@Override
public boolean setRespawnToWorld(final String respawnWorld) {
// TODO validation?
return getProperties().set(WorldProperties.RESPAWN_WORLD, respawnWorld);
}
@Override
public double getScaling() {
return getProperties().get(WorldProperties.SCALE);
}
@Override
public boolean setScaling(final double scaling) {
// TODO validation?
return getProperties().set(WorldProperties.SCALE, scaling);
}
@Override
public boolean getAutoHeal() {
return getProperties().get(WorldProperties.AUTO_HEAL);
}
@Override
public void setAutoHeal(final boolean heal) {
getProperties().set(WorldProperties.AUTO_HEAL, heal);
}
@Override
public boolean getAdjustSpawn() {
return getProperties().get(WorldProperties.ADJUST_SPAWN);
}
@Override
public void setAdjustSpawn(final boolean adjust) {
getProperties().set(WorldProperties.ADJUST_SPAWN, adjust);
}
@Override
public boolean getAutoLoad() {
return getProperties().get(WorldProperties.AUTO_LOAD);
}
@Override
public void setAutoLoad(final boolean autoLoad) {
getProperties().set(WorldProperties.AUTO_LOAD, autoLoad);
}
@Override
public boolean getBedRespawn() {
return getProperties().get(WorldProperties.BED_RESPAWN);
}
@Override
public void setBedRespawn(final boolean bedRespawn) {
getProperties().set(WorldProperties.BED_RESPAWN, bedRespawn);
}
@Override
public void setPlayerLimit(final int limit) {
getProperties().set(WorldProperties.PLAYER_LIMIT, limit);
}
@Override
public int getPlayerLimit() {
return getProperties().get(WorldProperties.PLAYER_LIMIT);
}
@Override
public void allowPortalMaking(final PortalType type) {
getProperties().set(WorldProperties.PORTAL_FORM, type);
}
@Override
public PortalType getAllowedPortals() {
return getProperties().get(WorldProperties.PORTAL_FORM);
}
@Override
public List<String> getWorldBlacklist() {
return getProperties().get(WorldProperties.BLACK_LIST);
}
@Override
public void save() {
getProperties().flush();
}
}
@@ -1,112 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
import com.mvplugin.core.api.MultiverseCore;
import com.mvplugin.core.api.MultiverseWorld;
import com.mvplugin.core.api.WorldManager;
import com.mvplugin.core.minecraft.WorldEnvironment;
import com.mvplugin.core.minecraft.WorldType;
import com.mvplugin.core.util.Language;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
abstract class AbstractWorldManager implements WorldManager {
protected final MultiverseCore core;
protected final Map<String, MultiverseWorld> worldsMap;
protected AbstractWorldManager(final MultiverseCore core) {
this.core = core;
this.worldsMap = new HashMap<String, MultiverseWorld>();
}
@Override
public MultiverseWorld addWorld(String name, WorldEnvironment env, String seedString, WorldType type, Boolean generateStructures, String generator) throws WorldCreationException {
return this.addWorld(name, env, seedString, type, generateStructures, generator, true);
}
@Override
public MultiverseWorld addWorld(String name,
WorldEnvironment env,
String seedString,
WorldType type,
Boolean generateStructures,
String generator,
boolean useSpawnAdjust) throws WorldCreationException {
final WorldCreationSettings settings = new WorldCreationSettings(name);
if (seedString != null && !seedString.isEmpty()) {
try {
settings.seed(Long.parseLong(seedString));
} catch (NumberFormatException numberformatexception) {
settings.seed((long) seedString.hashCode());
}
}
settings.type(type);
settings.generateStructures(generateStructures);
// TODO: Use the fancy kind with the commandSender | dumptruckman has no idea what this means..
if (generator != null && !generator.isEmpty()) {
settings.generator(generator);
}
settings.adjustSpawn(useSpawnAdjust);
return addWorld(settings);
}
@Override
public MultiverseWorld addWorld(WorldCreationSettings settings) throws WorldCreationException {
if (this.worldsMap.containsKey(settings.name())) {
throw new WorldCreationException(new BundledMessage(Language.WORLD_ALREADY_EXISTS, settings.name()));
}
MultiverseWorld mvWorld = createWorld(settings);
mvWorld.setAdjustSpawn(settings.adjustSpawn());
this.worldsMap.put(settings.name(), mvWorld);
return mvWorld;
}
/**
* Creates a world with the given properties.
*
* If a Minecraft world is already loaded with this name, null will be returned. If a Minecraft world already
* exists but it not loaded, it will be loaded instead.
*
* @param name The name for the world. May not be null.
* @param env The environment for the world. May not be null.
* @param seed The seed for the world. Null means a random seed will be used if creating a new Minecraft world.
* @param type The world type for the world. Null means the Minecraft default will be used if creating a new
* Minecraft world or, if loading a world, the loaded world's type will be used.
* @param generateStructures Whether or not to generate structures for the world. Null means the Minecraft default
* will be used if creating a new world or, if loading a world, the loaded world's
* setting will be used.
* @param generator The name of the generator for the world. Null may be used to specify no generator.
* @return A new {@link W} or null if a Minecraft world by this name is already loaded.
* @throws WorldCreationException If any problems occured while trying to create the world.
*/
/**
* Creates a world with the given properties.
*
* If a Minecraft world is already loaded with this name, null will be returned. If a Minecraft world already
* exists but it not loaded, it will be loaded instead.
*
* @param settings
* @return
* @throws WorldCreationException
*/
protected abstract MultiverseWorld createWorld(WorldCreationSettings settings) throws WorldCreationException;
@Override
public boolean isMVWorld(final String name) {
return this.worldsMap.containsKey(name);
}
@Override
public Collection<MultiverseWorld> getMVWorlds() {
return Collections.unmodifiableCollection(this.worldsMap.values());
}
}
@@ -1,24 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
import com.dumptruckman.minecraft.pluginbase.messaging.ChatColor;
public class MultiverseException extends Exception {
private final BundledMessage languageMessage;
public MultiverseException(BundledMessage b) {
super(String.format(ChatColor.translateAlternateColorCodes('&', b.getMessage().getDefault().get(0)), b.getArgs()));
this.languageMessage = b;
}
public MultiverseException(BundledMessage b, Throwable throwable) {
super(String.format(ChatColor.translateAlternateColorCodes('&', b.getMessage().getDefault().get(0)), b.getArgs()), throwable);
this.languageMessage = b;
}
public BundledMessage getBundledMessage() {
return this.languageMessage;
}
}
@@ -1,21 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.mvplugin.core;
/**
* Thrown when a world-property doesn't exist.
*/
public class UnknownPropertyException extends Exception {
public UnknownPropertyException(String name) {
super(name);
}
public UnknownPropertyException(String name, Throwable cause) {
super(name, cause);
}
}
@@ -1,14 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
public class WorldCreationException extends MultiverseException {
public WorldCreationException(BundledMessage languageMessage) {
super(languageMessage);
}
public WorldCreationException(BundledMessage languageMessage, Throwable throwable) {
super(languageMessage, throwable);
}
}
@@ -1,11 +0,0 @@
package com.mvplugin.core.api;
import com.dumptruckman.minecraft.pluginbase.config.BaseConfig;
import com.dumptruckman.minecraft.pluginbase.properties.Properties;
/**
* This is where you will find all of the configuration options for the Multiverse-Core plugin and potentially some
* options used here and in other Multiverse plugins.
*/
public interface CoreConfig extends BaseConfig, Properties {
}
@@ -1,28 +0,0 @@
package com.mvplugin.core.api;
import com.dumptruckman.minecraft.pluginbase.plugin.PluginBase;
/**
* Multiverse 3 Core API
* <p>
* This API contains a bunch of useful things you can get out of Multiverse in general!
* This is the class you should cast your plugin to unless you need more Implementation specific API.
*/
public interface MultiverseCore extends MultiversePlugin, PluginBase {
/**
* Gets the Multiverse world manager.
*
* The world manager allows you to perform various tasks related to Minecraft worlds.
*
* @return {@link WorldManager}.
*/
WorldManager getWorldManager();
/**
* Gets the Multiverse-Core configuration.
*
* @return The Multiverse-Core configuration.
*/
CoreConfig getMVConfig();
}
@@ -1,31 +0,0 @@
package com.mvplugin.core.api;
/**
* Implement this if you would
*/
public interface MultiversePlugin {
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link MultiverseCore}.
*/
MultiverseCore getCore();
/**
* Sets the reference to MultiverseCore.
*
* @param core A valid {@link 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. Generally your plugin should be checking the
* Multiverse-Core's protocol version to ensure compatibility.
*
* @return The protocol version.
*/
int getProtocolVersion();
}
@@ -1,508 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.mvplugin.core.api;
import com.mvplugin.core.minecraft.Difficulty;
import com.mvplugin.core.minecraft.GameMode;
import com.mvplugin.core.minecraft.PlayerPosition;
import com.mvplugin.core.minecraft.PortalType;
import com.mvplugin.core.minecraft.WorldEnvironment;
import com.mvplugin.core.minecraft.WorldType;
import java.util.List;
import java.util.UUID;
/**
* The API for a Multiverse Handled World.
*/
public interface MultiverseWorld {
/**
* 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 UUID for this world.
*
* This is what Minecraft uses to keep tracks of worlds.
*
* @return The UUID for this world.
*/
UUID getWorldUID();
/**
* Returns the WorldProperties object that contains the backing for all the values of a Multiverse World.
*
* All of these properties are generally gettable and settable via the MultiverseWorld class. Specific uses for
* the returned object may be to set properties in a different way and to perform more complex actions related
* to properties.
*
* @return The properties for this world.
*/
WorldProperties getProperties();
/**
* 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.
*
* This environment matches that of the actual game world.
*
* @return The environment of this world.
*/
WorldEnvironment getEnvironment();
/**
* Sets the environment of a world.
* <p>
* Note: This will ONLY take effect once the world is unloaded/reloaded.
*
* @param environment The new environment for the world.
*/
void setEnvironment(WorldEnvironment environment);
/**
* Gets the difficulty of this world.
*
* @return The difficulty of this world.
*/
Difficulty getDifficulty();
/**
* 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 all the names of all properties that can be SET.
*
* @return All property names, with alternating colors.
*/
String getAllPropertyNames();
/**
* 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);
// 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);
/**
* Gets whether or not this world will display in mv who and mv list regardless if a user has the
* access permissions to go to this world.
*
* @return True if the world will be hidden, false if not.
* @see {@link #getPrefixChat()}
*/
boolean isHidden();
/**
* Sets whether or not this world will display in mv who and mv list regardless if a user has the
* access permissions to go to this world.
*
* @param hidden Set
*/
void setHidden(boolean hidden);
/**
* Gets whether or not this world will display it's name/alias as a prefix in chat.
*
* If the global configuration setting for prefixChat is false, this setting has no effect.
*
* @return True if the world name/alias will be used as a prefix in chat, false if not.
*/
boolean getPrefixChat();
/**
* Sets whether or not this world will display it's name/alias as a prefix in chat.
*
* If the global configuration setting for prefixChat is false, this setting has no effect.
*
* @param prefixChat True if the world name/alias will be used as a prefix in chat, false if not.
*/
void setPrefixChat(boolean prefixChat);
/**
* 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.
*/
PlayerPosition getSpawnLocation();
/**
* Sets the spawn location for a world.
*
* @param spawnLocation The spawn location for a world.
*/
void setSpawnLocation(PlayerPosition 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 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(int)}
*
* @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.
*
* @return The Type of currency that will be used when users enter this world.
*/
int getCurrency();
/**
* Sets the type of item that will be required given the price is not 0.
* Use -1 to use an AllPay economy, or any valid itemid
*
* @param item The Type of currency that will be used when users enter this world.
*/
void setCurrency(int item);
/**
* Gets the world players will respawn in if they die in this one.
*
* @return A world that exists on the server.
*/
String 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 bedRespawn True if players dying in this world respawn at their bed.
*/
void setBedRespawn(boolean bedRespawn);
/**
* 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(PortalType type);
/**
* Gets which type(s) of portals are allowed to be constructed in this world.
*
* @return The type of portals that are allowed.
*/
PortalType 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();
void save();
}
@@ -1,11 +0,0 @@
package com.mvplugin.core.api;
import com.dumptruckman.minecraft.pluginbase.permission.Perm;
import com.dumptruckman.minecraft.pluginbase.permission.PermFactory;
public interface Perms {
Perm ALL_MULTIVERSE = PermFactory.newPerm("multiverse.*").child(Perm.ALL).build();
Perm CMD_IMPORT = PermFactory.newPerm("cmd.import").commandPermission().build();
}
@@ -1,353 +0,0 @@
package com.mvplugin.core.api;
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
import com.dumptruckman.minecraft.pluginbase.properties.PropertyValidator;
import com.mvplugin.core.WorldCreationException;
import com.mvplugin.core.minecraft.Generator;
import com.mvplugin.core.minecraft.WorldEnvironment;
import com.mvplugin.core.minecraft.WorldType;
import com.mvplugin.core.util.PropertyDescriptions;
import java.io.IOException;
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 WorldManager {
public class WorldCreationSettings {
private final String name;
private WorldEnvironment env;
private Long seed;
private WorldType type;
private Boolean generateStructures;
private String generator;
private boolean adjustSpawn = true;
public WorldCreationSettings(final String name) {
if (name == null) {
throw new IllegalArgumentException("name cannot be null!");
}
this.name = name;
}
public String name() {
return name;
}
public WorldEnvironment env() {
return env;
}
public Long seed() {
return seed;
}
public WorldType type() {
return type;
}
public Boolean generateStructures() {
return generateStructures;
}
public String generator() {
return generator;
}
public boolean adjustSpawn() {
return adjustSpawn;
}
public WorldCreationSettings env(WorldEnvironment e) {
this.env = e;
return this;
}
public WorldCreationSettings seed(Long l) {
this.seed = l;
return this;
}
public WorldCreationSettings type(WorldType t) {
this.type = t;
return this;
}
public WorldCreationSettings generateStructures(Boolean b) {
this.generateStructures = b;
return this;
}
public WorldCreationSettings generator(String g) {
this.generator = g;
return this;
}
public WorldCreationSettings adjustSpawn(boolean a) {
this.adjustSpawn = a;
return this;
}
}
/**
* Gets an existing WorldProperties object or creates a new one based on the name.
*
* TODO explain that they should use getWorld() in general.
*
* @param worldName The name of the world to get properties for.
* @return The world properties for the given world name.
* @throws IOException In case there are any issues accessing the persistence for the world properties.
*/
WorldProperties getWorldProperties(final String worldName) throws IOException;
/**
* 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 The new world.
* @throws WorldCreationException If world creation fails.
*/
MultiverseWorld addWorld(String name,
WorldEnvironment env,
String seedString,
WorldType type,
Boolean generateStructures,
String generator) throws WorldCreationException;
/**
* 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 The new world.
* @throws WorldCreationException If world creation fails.
*/
MultiverseWorld addWorld(String name,
WorldEnvironment env,
String seedString,
WorldType type,
Boolean generateStructures,
String generator,
boolean useSpawnAdjust) throws WorldCreationException;
/**
* Adds a new World to the Multiverse Setup.
* @param settings Settings for the world creation.
* @return The new world.
* @throws WorldCreationException If world creation fails.
*/
MultiverseWorld addWorld(WorldCreationSettings settings) throws WorldCreationException;
/**
* 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.
* @return True if the world is copied successfully, false if not.
*/
//TODO boolean cloneWorld(String oldName, String newName, String generator);
/**
* 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.
*/
//TODO 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.
*/
//TODO 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.
*/
//TODO 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.
*/
//TODO boolean unloadWorld(String name);
/**
* 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.
*/
//TODO boolean loadWorld(String name);
/**
* Removes all players from the specified world.
*
* @param name World to remove players from.
*/
//TODO 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 Generator} or null
*/
//TODO Generator 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.
*/
//TODO W getMVWorld(String name);
/**
* 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);
/**
* Load the Worlds & Settings from the configuration file.
*
* @param forceLoad If set to true, this will perform a total
* reset and not just load new worlds.
*/
//TODO void loadWorlds(boolean forceLoad);
/**
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
* <p>
* This way people will _always_ have some worlds in the list.
*/
//TODO void loadDefaultWorlds();
//TODO WorldPurger getWorldPurger();
/**
* 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.
*/
//TODO MultiverseWorld getSpawnWorld();
/**
* Gets the list of worlds in the config, but unloaded.
*
* @return A List of worlds as strings.
*/
List<String> getUnloadedWorlds();
/**
* Saves the world config to disk.
*
* @return True if success, false if fail.
*/
//TODO 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.
*/
//TODO boolean removeWorldFromConfig(String name);
/**
* Sets the initial spawn world for new players.
*
* @param world The World new players should spawn in.
*/
//TODO void setFirstSpawnWorld(String world);
/**
* Gets the world players should spawn in first.
*
* @return The {@link MultiverseWorld} new players should spawn in.
*/
//TODO 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.
*/
//TODO boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed);
class RespawnWorldValidator implements PropertyValidator<String> {
private final WorldManager worldManager;
public RespawnWorldValidator(WorldManager worldManager) {
this.worldManager = worldManager;
}
@Override
public boolean isValid(String s) {
return worldManager.isMVWorld(s);
}
@Override
public Message getInvalidMessage() {
return PropertyDescriptions.INVALID_RESPAWN_WORLD;
}
}
}
@@ -1,226 +0,0 @@
package com.mvplugin.core.api;
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
import com.dumptruckman.minecraft.pluginbase.properties.ListProperty;
import com.dumptruckman.minecraft.pluginbase.properties.NestedProperties;
import com.dumptruckman.minecraft.pluginbase.properties.NestedProperty;
import com.dumptruckman.minecraft.pluginbase.properties.Properties;
import com.dumptruckman.minecraft.pluginbase.properties.PropertyFactory;
import com.dumptruckman.minecraft.pluginbase.properties.PropertyValidator;
import com.dumptruckman.minecraft.pluginbase.properties.SimpleProperty;
import com.mvplugin.core.minecraft.Difficulty;
import com.mvplugin.core.minecraft.GameMode;
import com.mvplugin.core.minecraft.PlayerPosition;
import com.mvplugin.core.minecraft.PortalType;
import com.mvplugin.core.minecraft.WorldEnvironment;
import com.mvplugin.core.util.PropertyDescriptions;
/**
* Houses all of the properties for a Multiverse world.
*/
public interface WorldProperties extends Properties {
SimpleProperty<String> ALIAS = PropertyFactory.newProperty(String.class, "alias", "")
.comment("World aliases allow you to name a world differently than what the folder name is.")
.comment("This lets you choose fancy names for your worlds while keeping the folders nice and neat.")
.comment("You may add minecraft color and formatting codes here prepended with a &")
.description(PropertyDescriptions.ALIAS)
.build();
SimpleProperty<Boolean> HIDDEN = PropertyFactory.newProperty(Boolean.class, "hidden", false)
.comment("The hidden property allows you to have a world that exists but does not show up in lists.")
.description(PropertyDescriptions.HIDDEN)
.build();
SimpleProperty<Boolean> PREFIX_CHAT = PropertyFactory.newProperty(Boolean.class, "prefixChat", true)
.comment("The prefixChat property adds the world's name (or alias) as a prefix to chat messages.")
.comment("Please note, this property can be disabled globally in the configuration.")
.description(PropertyDescriptions.PREFIX_CHAT)
.build();
SimpleProperty<Long> SEED = PropertyFactory.newProperty(Long.class, "seed", 0L)
.comment("The seed property allows you to change the world's seed.")
.description(PropertyDescriptions.SEED)
.build();
SimpleProperty<String> GENERATOR = PropertyFactory.newProperty(String.class, "generator", "")
.comment("The generator property allows you to specify the generator used to generate this world.")
.description(PropertyDescriptions.GENERATOR)
.build();
SimpleProperty<WorldEnvironment> ENVIRONMENT = PropertyFactory.newProperty(WorldEnvironment.class, "environment", WorldEnvironment.NORMAL)
.comment("The environment property the Minecraft world environment such as NORMAL, NETHER, THE_END")
.description(PropertyDescriptions.ENVIRONMENT)
.build();
SimpleProperty<Integer> PLAYER_LIMIT = PropertyFactory.newProperty(Integer.class, "playerLimit", -1)
.comment("The player limit property limits the number of players in a world at a time.")
.comment("A value of -1 or lower signifies no player limit.")
.description(PropertyDescriptions.PLAYER_LIMIT)
.build();
SimpleProperty<Boolean> ADJUST_SPAWN = PropertyFactory.newProperty(Boolean.class, "adjustSpawn", true)
.comment("The adjust spawn property determines whether or not Multiverse will make adjustments to the world's spawn location if it is unsafe.")
.description(PropertyDescriptions.ADJUST_SPAWN)
.build();
SimpleProperty<Boolean> AUTO_LOAD = PropertyFactory.newProperty(Boolean.class, "autoLoad", true)
.comment("The autoLoad dictates whether this world is loaded automatically on startup or not.")
.description(PropertyDescriptions.AUTO_LOAD)
.build();
SimpleProperty<Boolean> BED_RESPAWN = PropertyFactory.newProperty(Boolean.class, "bedRespawn", true)
.comment("The bedRespawn property specifies if a player dying in this world should respawn in their bed or not.")
.description(PropertyDescriptions.BED_RESPAWN)
.build();
SimpleProperty<Boolean> HUNGER = PropertyFactory.newProperty(Boolean.class, "hunger", true)
.comment("The hunger property specifies if hunger is depleted in this world")
.description(PropertyDescriptions.HUNGER)
.build();
ListProperty<String> BLACK_LIST = PropertyFactory.newListProperty(String.class, "worldBlacklist")
.comment("The worldBlackList property allows you to specify worlds that people cannot go to from this specified world.")
.description(PropertyDescriptions.BLACK_LIST)
.build();
SimpleProperty<Boolean> PVP = PropertyFactory.newProperty(Boolean.class, "pvp", true)
.comment("The pvp property states whether or not players may harm each other in this world. If set to true, they may.")
.comment("Bear in mind, many other plugins may have conflicts with this setting.")
.description(PropertyDescriptions.PVP)
.build();
SimpleProperty<Double> SCALE = PropertyFactory.newProperty(Double.class, "scale", 1D)
.comment("The scale property represents the scaling of worlds when using Multiverse-NetherPortals.")
.comment("Setting this value will have no effect on anything but Multiverse-NetherPortals.")
.description(PropertyDescriptions.SCALE)
.validator(new ScaleValidator())
.build();
class ScaleValidator implements PropertyValidator<Double> {
@Override
public boolean isValid(Double scale) {
return scale > 0D;
}
@Override
public Message getInvalidMessage() {
return PropertyDescriptions.INVALID_SCALE;
}
}
SimpleProperty<String> RESPAWN_WORLD = PropertyFactory.newProperty(String.class, "respawnWorld", "")
.comment("The respawnWorld property is the world you will respawn to if you die in this world.")
.comment("This value can be the same as this world.")
.description(PropertyDescriptions.RESPAWN_WORLD)
.build();
SimpleProperty<Boolean> ALLOW_WEATHER = PropertyFactory.newProperty(Boolean.class, "allowWeather", true)
.comment("The allowWeather property specifies whether or not to allow weather events in this world.")
.description(PropertyDescriptions.ALLOW_WEATHER)
.build();
SimpleProperty<Difficulty> DIFFICULTY = PropertyFactory.newProperty(Difficulty.class, "difficulty", Difficulty.EASY)
.comment("The difficulty property allows you to set the difficulty for the world.")
.comment("World difficulty affects spawn rates, hunger rates, and other things that make the game more or less difficult.")
.description(PropertyDescriptions.DIFFICULTY)
.build();
SimpleProperty<Boolean> AUTO_HEAL = PropertyFactory.newProperty(Boolean.class, "autoHeal", true)
.comment("The autoHeal property will specify whether ot not players will regain health in PEACEFUL difficulty only.")
.comment("This setting has no effect on worlds with a difficulty greater than peaceful or 0.")
.description(PropertyDescriptions.AUTO_HEAL)
.build();
SimpleProperty<PortalType> PORTAL_FORM = PropertyFactory.newProperty(PortalType.class, "portalForm", PortalType.ALL)
.comment("The portalFrom property allows you to specify which type of portals are allowed to be created in this world.")
.description(PropertyDescriptions.PORTAL_FORM)
.build();
SimpleProperty<GameMode> GAME_MODE = PropertyFactory.newProperty(GameMode.class, "gameMode", GameMode.SURVIVAL)
.comment("The gameMode property allows you to specify the GameMode for this world.")
.comment("Players entering this world will automatically be switched to this GameMode unless they are exempted.")
.description(PropertyDescriptions.GAME_MODE)
.build();
SimpleProperty<Boolean> KEEP_SPAWN = PropertyFactory.newProperty(Boolean.class, "keepSpawnInMemory", true)
.comment("The keepSpawnInMemory property specifies whether or not to keep the spawn chunks loaded in memory when players aren't in the spawn area.")
.comment("Setting this to false will potentially save you some memory.")
.description(PropertyDescriptions.KEEP_SPAWN)
.build();
SimpleProperty<PlayerPosition> SPAWN_LOCATION = PropertyFactory.newProperty(PlayerPosition.class, "spawnLocation", PlayerPosition.NULL_LOCATION)
.comment("The spawnLocation property specifies where in the world players will spawn.")
.comment("The world specified here has no effect.")
.description(PropertyDescriptions.SPAWN_LOCATION)
.build();
NestedProperty<EntryFee> ENTRY_FEE = PropertyFactory.newNestedProperty(EntryFee.class, "entryFee")
.build();
public static interface EntryFee extends NestedProperties {
SimpleProperty<Double> AMOUNT = PropertyFactory.newProperty(Double.class, "amount", 0D)
.comment("The amount property specifies how much a player has to pay to enter this world.")
.comment("What the player has to pay is specified by the 'currency' property")
.description(PropertyDescriptions.AMOUNT)
.build();
SimpleProperty<Integer> CURRENCY = PropertyFactory.newProperty(Integer.class, "currency", -1)
.comment("The currency property specifies what type of currency the player must pay (if any) to enter this world.")
.comment("Currency can be an economy money by specifying -1 or a block type by specifying the block id.")
.description(PropertyDescriptions.CURRENCY)
.build();
}
NestedProperty<Spawning> SPAWNING = PropertyFactory.newNestedProperty(Spawning.class, "spawning")
.build();
public static interface Spawning extends NestedProperties {
NestedProperty<Animals> ANIMALS = PropertyFactory.newNestedProperty(Animals.class, "animals")
.build();
NestedProperty<Monsters> MONSTERS = PropertyFactory.newNestedProperty(Monsters.class, "monsters")
.build();
public static interface Animals extends NestedProperties {
SimpleProperty<Boolean> SPAWN = PropertyFactory.newProperty(Boolean.class, "spawn", true)
.comment("The animals spawn property specifies whether or not to spawn animals in this world.")
.description(PropertyDescriptions.ANIMALS_SPAWN)
.build();
SimpleProperty<Integer> SPAWN_RATE = PropertyFactory.newProperty(Integer.class, "spawnRate", -1)
.comment("The animals spawnRate property defines how many ticks in between attempting to spawn animals.")
.comment("A value of -1 indicates the default should be used and is recommended unless you know what you are doing.")
.description(PropertyDescriptions.ANIMALS_SPAWN_RATE)
.build();
ListProperty<String> EXCEPTIONS = PropertyFactory.newListProperty(String.class, "exceptions")
.comment("The animals exceptions property defines what animals are exempt from the animals spawn property.")
.description(PropertyDescriptions.ANIMALS_SPAWN_EXCEPTIONS)
.build();
}
public static interface Monsters extends NestedProperties {
SimpleProperty<Boolean> SPAWN = PropertyFactory.newProperty(Boolean.class, "spawn", true)
.comment("The monsters spawn property specifies whether or not to spawn monsters in this world.")
.description(PropertyDescriptions.MONSTERS_SPAWN)
.build();
SimpleProperty<Integer> SPAWN_RATE = PropertyFactory.newProperty(Integer.class, "spawnRate", -1)
.comment("The monsters spawnRate property defines how many ticks in between attempting to spawn monsters.")
.comment("A value of -1 indicates the default should be used and is recommended unless you know what you are doing.")
.description(PropertyDescriptions.MONSTERS_SPAWN_RATE)
.build();
ListProperty<String> EXCEPTIONS = PropertyFactory.newListProperty(String.class, "exceptions")
.comment("The monsters exceptions property defines what monsters are exempt from the monsters spawn property.")
.description(PropertyDescriptions.MONSTERS_SPAWN_EXCEPTIONS)
.build();
}
}
}
@@ -1,63 +0,0 @@
package com.mvplugin.core.api;
import com.dumptruckman.minecraft.pluginbase.entity.BasePlayer;
import com.mvplugin.core.minecraft.Entity;
import java.util.List;
/**
* 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 com.mvplugin.core.api.MultiverseWorld}
*/
void purgeWorlds(List<MultiverseWorld> worlds);
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 java.util.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 java.util.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 BasePlayer} that initiated the action. He will/should be notified.
*/
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters, BasePlayer sender);
/**
* Determines whether the specified creature should be killed.
*
* @param e The creature.
* @param thingsToKill A {@link java.util.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);
}
@@ -1,5 +0,0 @@
/**
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
* plugins when interacting with Multiverse.
*/
package com.mvplugin.core.api;
@@ -1,8 +0,0 @@
package com.mvplugin.core.command;
class CommandHelp {
static void init() { }
}
@@ -1,188 +0,0 @@
package com.mvplugin.core.command;
import com.dumptruckman.minecraft.pluginbase.entity.BasePlayer;
import com.dumptruckman.minecraft.pluginbase.messaging.ChatColor;
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
import com.dumptruckman.minecraft.pluginbase.permission.Perm;
import com.dumptruckman.minecraft.pluginbase.plugin.command.CommandInfo;
import com.mvplugin.core.WorldCreationException;
import com.mvplugin.core.api.MultiverseCore;
import com.mvplugin.core.api.MultiverseWorld;
import com.mvplugin.core.api.Perms;
import com.mvplugin.core.minecraft.WorldEnvironment;
import com.mvplugin.core.util.Language;
import com.sk89q.minecraft.util.commands.CommandContext;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@CommandInfo(
primaryAlias = "import",
desc = "Import a world.",
usage = "{NAME} {ENVIRONMENT}",
prefixedAliases = "im",
directlyPrefixedAliases = "import",
flags = "g:n",
min = 1,
max = 2
)
public class ImportCommand extends MultiverseCommand {
public static final Message IMPORT_HELP = new Message("command.import.help",
"Imports a world into the server from a folder with the given name.",
"The folder must exist in the location where worlds are normally located and must contain Minecraft world data.",
"You must specify a world environment such as NORMAL or NETHER.",
"You may also specify a generator to use along with an optional generator ID.",
"The generator name is case sensitive!",
"Flags:",
" -g {GENERATOR[:ID]} Specify a generator.",
" -n Do not adjust spawn",
"Examples:",
" /mv import &6gargamel&a normal",
" /mv import &6hell_world&a nether",
" /mv import &6Cleanroom&a normal -g &3CleanroomGenerator");
public static final Message POTENTIAL_WORLD_LIST = new Message("command.import.potential_world_list",
"&b====[ These look like worlds ]====", "%s");
public static final Message NO_POTENTIAL_WORLDS = new Message("command.import.no_potential_worlds",
"&cNo potential worlds found. Sorry!");
public static final Message INVALID_ENVIRONMENT = new Message("command.import.invalid_environment",
"&cThat is not a valid environment.");
public static final Message STARTING_IMPORT = new Message("command.import.starting_import",
"Starting import of world '%s'...");
public static final Message IMPORT_COMPLETE = new Message("command.import.import_complete",
"&aImport complete!");
public static final Message IMPORT_FAILED = new Message("command.import.import_failed",
"&cImport failed!");
@Override
public Perm getPerm() {
return Perms.CMD_IMPORT;
}
@Override
public Message getHelp() {
return IMPORT_HELP;
}
@Override
public boolean runCommand(MultiverseCore core, BasePlayer sender, CommandContext context) {
final String worldName = context.getString(0);
if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
final String worldList = this.getPotentialWorlds(core);
if (worldList.length() > 2) {
core.getMessager().message(sender, POTENTIAL_WORLD_LIST, worldList);
} else {
core.getMessager().message(sender, NO_POTENTIAL_WORLDS);
}
return true;
}
// 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 (context.argsLength() == 1) {
return false;
}
// Make sure we don't already know about this world.
if (core.getWorldManager().isMVWorld(worldName)) {
core.getMessager().message(sender, Language.WORLD_ALREADY_EXISTS, worldName);
return true;
}
File worldFile = new File(core.getServerInterface().getWorldContainer(), worldName);
String generator = context.getFlag('g');
boolean useSpawnAdjust = !context.hasFlag('n');
String env = context.getString(1);
WorldEnvironment environment = WorldEnvironment.getFromString(env);
if (environment == null) {
core.getMessager().message(sender, INVALID_ENVIRONMENT);
// TODO EnvironmentCommand.showEnvironments(sender);
return true;
}
if (worldFile.exists() && env != null) {
core.getMessager().messageAndLog(sender, STARTING_IMPORT, worldName);
try {
core.getWorldManager().addWorld(worldName, environment, null, null, null, generator, useSpawnAdjust);
core.getMessager().messageAndLog(sender, IMPORT_COMPLETE);
} catch (WorldCreationException e) {
core.getMessager().messageAndLog(sender, IMPORT_FAILED);
core.getMessager().messageAndLog(sender, e.getBundledMessage().getMessage(), e.getBundledMessage().getArgs());
}
} else if (env == null) {
core.getMessager().message(sender, IMPORT_FAILED);
// TODO locale
sender.sendMessage("That world environment did not exist.");
sender.sendMessage("For a list of available world types, type: " + ChatColor.AQUA + "/mvenv");
} else {
core.getMessager().message(sender, IMPORT_FAILED);
String worldList = this.getPotentialWorlds(core);
// TODO locale
sender.sendMessage("That world folder does not exist. These look like worlds to me:");
sender.sendMessage(worldList);
}
return true;
}
/**
* 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.equalsIgnoreCase("level.dat");
}
});
if (files != null && files.length > 0) {
return true;
}
}
return false;
}
private String getPotentialWorlds(final MultiverseCore core) {
final File worldFolder = core.getServerInterface().getWorldContainer();
if (worldFolder == null) {
return "";
}
File[] files = worldFolder.listFiles();
String worldList = "";
Collection<MultiverseWorld> worlds = core.getWorldManager().getMVWorlds();
List<String> worldStrings = new ArrayList<String>();
for (MultiverseWorld world : worlds) {
worldStrings.add(world.getName());
}
for (String world : core.getWorldManager().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;
}
}
@@ -1,12 +0,0 @@
package com.mvplugin.core.command;
import com.dumptruckman.minecraft.pluginbase.plugin.command.Command;
import com.mvplugin.core.api.MultiverseCore;
abstract class MultiverseCommand extends Command<MultiverseCore> {
static {
// Statically initialize help language
CommandHelp.init();
}
}
@@ -1,8 +0,0 @@
package com.mvplugin.core.minecraft;
public enum Difficulty {
PEACEFUL,
EASY,
NORMAL,
HARD
}
@@ -1,4 +0,0 @@
package com.mvplugin.core.minecraft;
public class Entity {
}
@@ -1,8 +0,0 @@
package com.mvplugin.core.minecraft;
public enum GameMode {
ADVENTURE,
CREATIVE,
SURVIVAL
}
@@ -1,4 +0,0 @@
package com.mvplugin.core.minecraft;
public interface Generator {
}
@@ -1,45 +0,0 @@
package com.mvplugin.core.minecraft;
public final class PlayerPosition {
public static final PlayerPosition NULL_LOCATION = new PlayerPosition("", 0, 0, 0, 0, 0);
private final double x, y, z;
private final float pitch, yaw;
private final String world;
public PlayerPosition(final String world, final double x,
final double y, final double z,
final float pitch, final float yaw) {
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.pitch = pitch;
this.yaw = yaw;
}
public String getWorld() {
return world;
}
public float getPitch() {
return pitch;
}
public float getYaw() {
return this.yaw;
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
}
@@ -1,21 +0,0 @@
package com.mvplugin.core.minecraft;
public enum PortalType {
/**
* No portals are allowed.
*/
NONE,
/**
* All portal types are allowed.
*/
ALL,
/**
* Only Nether style portals are allowed.
*/
NETHER,
/**
* Only Ender style portals are allowed.
*/
END;
}
@@ -1,17 +0,0 @@
package com.mvplugin.core.minecraft;
public enum WorldEnvironment {
NETHER,
NORMAL,
THE_END
;
public static WorldEnvironment getFromString(final String name) {
for (final WorldEnvironment env : WorldEnvironment.values()) {
if (name.equalsIgnoreCase(env.toString())) {
return env;
}
}
return null;
}
}
@@ -1,8 +0,0 @@
package com.mvplugin.core.minecraft;
public enum WorldType {
FLAT,
LARGE_BIOMES,
NORMAL,
VERSION_1_1
}
@@ -1,9 +0,0 @@
package com.mvplugin.core.util;
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
public class Language {
public static final Message WORLD_ALREADY_EXISTS = new Message("worlds.world_exists",
"&aMultiverse&f already knows about '&b%s&f'!");
}
@@ -1,121 +0,0 @@
package com.mvplugin.core.util;
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
/**
* Houses localized (english) descriptions of the Multiverse world properties.
*/
public class PropertyDescriptions {
public static void init() { }
public static final Message ALIAS = new Message("world_properties.descriptions.alias",
"World aliases allow you to name a world differently than what the folder name is.",
"This lets you choose fancy names for your worlds while keeping the folders nice and neat.",
"You may add minecraft color and formatting codes here prepended with a &");
public static final Message HIDDEN = new Message("world_properties.descriptions.hidden",
"The hidden property allows you to have a world that exists but does not show up in lists.");
public static final Message PREFIX_CHAT = new Message("world_properties.descriptions.prefixChat",
"The prefixChat property adds the world's name (or alias) as a prefix to chat messages.");
public static final Message SEED = new Message("world_properties.descriptions.seed",
"The seed property allows you to change the world's seed.");
public static final Message GENERATOR = new Message("world_properties.descriptions.generator",
"The generator property allows you to specify the generator used to generate this world.");
public static final Message ENVIRONMENT = new Message("world_properties.descriptions.environment",
"The environment property the Minecraft world environment such as NORMAL, NETHER, THE_END");
public static final Message PLAYER_LIMIT = new Message("world_properties.descriptions.playerLimit",
"The player limit property limits the number of players in a world at a time.",
"A value of -1 or lower signifies no player limit.");
public static final Message ADJUST_SPAWN = new Message("world_properties.descriptions.adjustSpawn",
"The adjust spawn property determines whether or not Multiverse will make adjustments to the world's spawn location if it is unsafe.");
public static final Message AUTO_LOAD = new Message("world_properties.descriptions.autoLoad",
"The autoLoad property dictates whether this world is loaded automatically on startup or not.");
public static final Message BED_RESPAWN = new Message("world_properties.descriptions.bedRespawn",
"The bedRespawn property specifies if a player dying in this world should respawn in their bed or not.");
public static final Message HUNGER = new Message("world_properties.descriptions.hunger",
"The hunger property specifies if hunger is depleted in this world");
public static final Message BLACK_LIST = new Message("world_properties.descriptions.worldBlacklist",
"The worldBlackList property allows you to specify worlds that people cannot go to from this specified world.");
public static final Message PVP = new Message("world_properties.descriptions.pvp",
"The pvp property states whether or not players may harm each other in this world. If set to true, they may.");
public static final Message SCALE = new Message("world_properties.descriptions.scale",
"The scale property represents the scaling of worlds when using Multiverse-NetherPortals.",
"Setting this value will have no effect on anything but Multiverse-NetherPortals.");
public static final Message RESPAWN_WORLD = new Message("world_properties.descriptions.respawnWorld",
"The respawnWorld property is the world you will respawn to if you die in this world.",
"This value can be the same as this world.");
public static final Message ALLOW_WEATHER = new Message("world_properties.descriptions.allowWeather",
"The allowWeather property specifies whether or not to allow weather events in this world.");
public static final Message DIFFICULTY = new Message("world_properties.descriptions.difficulty",
"The difficulty property allows you to set the difficulty for the world.",
"World difficulty affects spawn rates, hunger rates, and other things that make the game more or less difficult.");
public static final Message AUTO_HEAL = new Message("world_properties.descriptions.autoHeal",
"The autoHeal property will specify whether ot not players will regain health in PEACEFUL difficulty only.",
"This setting has no effect on worlds with a difficulty greater than peaceful or 0.");
public static final Message PORTAL_FORM = new Message("world_properties.descriptions.portalForm",
"The portalFrom property allows you to specify which type of portals are allowed to be created in this world.");
public static final Message GAME_MODE = new Message("world_properties.descriptions.gameMode",
"The gameMode property allows you to specify the GameMode for this world.",
"Players entering this world will automatically be switched to this GameMode unless they are exempted.");
public static final Message KEEP_SPAWN = new Message("world_properties.descriptions.keepSpawnInMemory",
"The keepSpawnInMemory property specifies whether or not to keep the spawn chunks loaded in memory when players aren't in the spawn area.",
"Setting this to false will potentially save you some memory.");
public static final Message SPAWN_LOCATION = new Message("world_properties.descriptions.spawnLocation",
"The spawnLocation property specifies where in the world players will spawn.");
public static final Message AMOUNT = new Message("world_properties.descriptions.amount",
"The amount property specifies how much a player has to pay to enter this world.",
"What the player has to pay is specified by the 'currency' property");
public static final Message CURRENCY = new Message("world_properties.descriptions.currency",
"The currency property specifies what type of currency the player must pay (if any) to enter this world.",
"Currency can be an economy money by specifying -1 or a block type by specifying the block id.");
public static final Message ANIMALS_SPAWN = new Message("world_properties.descriptions.animals.spawn",
"The animals spawn property specifies whether or not to spawn animals in this world.");
public static final Message ANIMALS_SPAWN_RATE = new Message("world_properties.descriptions.animals.spawnRate",
"The animals spawnRate property defines how many ticks in between attempting to spawn animals.",
"A value of -1 indicates the default should be used and is recommended unless you know what you are doing.");
public static final Message ANIMALS_SPAWN_EXCEPTIONS = new Message("world_properties.descriptions.animals.exceptions",
"The animals exceptions property defines what animals are exempt from the animals spawn property.");
public static final Message MONSTERS_SPAWN = new Message("world_properties.descriptions.monsters.spawn",
"The monsters spawn property specifies whether or not to spawn monsters in this world.");
public static final Message MONSTERS_SPAWN_RATE = new Message("world_properties.descriptions.monsters.spawnRate",
"The monsters spawnRate property defines how many ticks in between attempting to spawn monsters.",
"A value of -1 indicates the default should be used and is recommended unless you know what you are doing.");
public static final Message MONSTERS_SPAWN_EXCEPTIONS = new Message("world_properties.descriptions.monsters.exceptions",
"The monsters exceptions property defines what monsters are exempt from the monsters spawn property.");
public static final Message INVALID_SCALE = new Message("world_properties.validation.scale",
"Scale must be a number higher than 0!");
public static final Message INVALID_RESPAWN_WORLD = new Message("world_properties.validation.respawnWorld",
"Respawn world must be a world known to Multiverse!");
}
-44
View File
@@ -1,44 +0,0 @@
# Eclipse stuff
/.classpath
/.project
/.settings
/.checkstyle
# netbeans
/nbproject
# we use maven!
/build.xml
# maven
/target
# vim
.*.sw[a-p]
# various other potential build files
/build
/bin
/dist
/manifest.mf
/world
# Mac filesystem dust
*.DS_Store
# intellij
*.iml
*.ipr
*.iws
.idea/
# Fern's utils
uploadtoserver.sh
# Testing files:
debug.log
# Doxygen
/docs/html
debug.txt
-143
View File
@@ -1,143 +0,0 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Multiverse 2 Copyright (c) the Multiverse Team 2011. ~
~ Multiverse 2 is licensed under the BSD License. ~
~ For more information please check the README.md file included ~
~ with this project. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!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="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
</module>
<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="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Don't like errors for `final` missing
<module name="DesignForExtension"/>
<module name="FinalClass"/>
-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>
<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>
-322
View File
@@ -1,322 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mvplugin</groupId>
<artifactId>MultiverseCore</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<artifactId>MultiverseCore-Bukkit</artifactId>
<repositories>
<repository>
<id>onarandombox</id>
<url>http://repo.onarandombox.com/content/groups/public</url>
</repository>
<repository>
<id>Bukkit Official</id>
<url>http://repo.bukkit.org/content/repositories/public</url>
</repository>
<!-- Required for Metrics -->
<repository>
<id>mcstats</id>
<url>http://repo.mcstats.org/content/repositories/snapshots</url>
</repository>
<!-- Required for Vault -->
<repository>
<id>herocraft</id>
<url>http://ci.herocraftonline.com/plugin/repository/everything/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<ciManagement>
<system>jenkins</system>
<url>http://ci.onarandombox.com</url>
</ciManagement>
<!-- Profiles are used to detect whether this is a local or Jenkins build
and adjust the build number accordingly -->
<profiles>
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
</properties>
</profile>
</profiles>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.3.8</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}-b${project.build.number}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<!-- Jar Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifestEntries>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<excludes>
<exclude>**/TestCommandSender.java</exclude>
<exclude>**/TestInstanceCreator.java</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.11</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
<configuration>
<enableRulesSummary>true</enableRulesSummary>
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</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.8.1</version>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.mvplugin:MultiverseCore-Base</include>
<include>com.dumptruckman.minecraft:BukkitPlugin</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.dumptruckman.minecraft.pluginbase</pattern>
<shadedPattern>com.mvplugin.pluginbase</shadedPattern>
</relocation>
</relocations>
<!--
<include>me.main__.util:SerializationConfig</include>
<include>com.pneumaticraft.commandhandler:CommandHandler</include>
<include>com.dumptruckman.minecraft:buscript</include>
<include>com.dumptruckman.minecraft:BukkitPlugin</include>
<include>org.mcstats:metrics</include>
<include>com.fernferret.allpay:AllPay</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.fernferret.allpay</pattern>
<shadedPattern>com.fernferret.allpay.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>me.main__.util</pattern>
<shadedPattern>me.main__.util.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>com.pneumaticraft.commandhandler</pattern>
<shadedPattern>com.pneumaticraft.commandhandler.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>buscript</pattern>
<shadedPattern>buscript.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>com.dumptruckman.minecraft.pluginbase.util.Logging</pattern>
<shadedPattern>com.onarandombox.multiverse.core.util.CoreLogging</shadedPattern>
</relocation>
<relocation>
<pattern>com.dumptruckman.minecraft.pluginbase.util.DebugLog</pattern>
<shadedPattern>com.onarandombox.multiverse.util.DebugFileLogger</shadedPattern>
</relocation>
<relocation>
<pattern>com.dumptruckman.minecraft.pluginbase</pattern>
<shadedPattern>com.dumptruckman.minecraft.pluginbase.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>org.mcstats</pattern>
<shadedPattern>org.mcstats.multiverse</shadedPattern>
</relocation>
</relocations>
-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.mvplugin</groupId>
<artifactId>MultiverseCore-Base</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- PluginBase Dependency -->
<dependency>
<groupId>com.dumptruckman.minecraft</groupId>
<artifactId>BukkitPlugin</artifactId>
<version>1.5-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Bukkit Dependency -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.3.2-R2.1-SNAPSHOT</version>
<!-- If you want the lates, use this -->
<!-- <version>LATEST</version> -->
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Start of Economy Dependency -->
<dependency>
<groupId>com.fernferret.allpay</groupId>
<artifactId>AllPay</artifactId>
<version>10</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.2.19-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of Economy Dependency -->
<!-- Start of CommandHandler Dependency -->
<dependency>
<groupId>com.pneumaticraft.commandhandler</groupId>
<artifactId>CommandHandler</artifactId>
<version>7</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of CommandHandler Dependency -->
<!-- Start of Buscript Dependency -->
<dependency>
<groupId>com.dumptruckman.minecraft</groupId>
<artifactId>buscript</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of Buscript Dependency -->
<!-- Start of Metrics Dependency -->
<dependency>
<groupId>org.mcstats</groupId>
<artifactId>metrics</artifactId>
<version>1.2-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of Metrics 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,82 +0,0 @@
package com.mvplugin.core;
import com.mvplugin.core.api.BukkitMultiverseWorld;
import com.mvplugin.core.api.WorldProperties;
import com.mvplugin.core.api.WorldProperties.Spawning.Animals;
import com.mvplugin.core.minecraft.PlayerPosition;
import com.mvplugin.core.minecraft.WorldType;
import com.mvplugin.core.util.Convert;
import org.bukkit.Bukkit;
import org.bukkit.World;
import java.util.UUID;
class BukkitWorld extends AbstractMultiverseWorld implements BukkitMultiverseWorld {
private final String name;
private final UUID worldUID;
private final WorldType worldType;
BukkitWorld(final World world, final WorldProperties worldProperties) {
super(worldProperties);
this.name = world.getName();
this.worldUID = world.getUID();
this.worldType = Convert.fromBukkit(world.getWorldType());
}
@Override
protected void update(Object obj) {
if (obj == WorldProperties.DIFFICULTY) {
getBukkitWorld().setDifficulty(Convert.toBukkit(getDifficulty()));
} else if (obj == WorldProperties.ALLOW_WEATHER) {
if (!isWeatherEnabled()) {
final World world = getBukkitWorld();
world.setWeatherDuration(0);
world.setStorm(false);
world.setThunderDuration(0);
world.setThundering(false);
}
} else if (obj == WorldProperties.PVP) {
getBukkitWorld().setPVP(isPVPEnabled());
} else if (obj == WorldProperties.SPAWN_LOCATION) {
final PlayerPosition pos = getSpawnLocation();
getBukkitWorld().setSpawnLocation((int) pos.getX(), (int) pos.getY(), (int) pos.getZ());
} else if (obj == Animals.SPAWN_RATE) {
//getBukkitWorld().set
}
}
@Override
public String getName() {
return this.name;
}
@Override
public UUID getWorldUID() {
return this.worldUID;
}
@Override
public WorldType getWorldType() {
return worldType;
}
@Override
public World getBukkitWorld() {
final World world = Bukkit.getWorld(worldUID);
if (world == null) {
throw new IllegalStateException("Multiverse lost track of Bukkit world '" + this.name + "'");
}
return world;
}
@Override
public String getTime() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public boolean setTime(String timeAsString) {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
}
@@ -1,198 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.logging.Logging;
import com.dumptruckman.minecraft.pluginbase.messaging.BundledMessage;
import com.mvplugin.core.api.BukkitMultiverseWorld;
import com.mvplugin.core.api.WorldProperties;
import com.mvplugin.core.util.BukkitLanguage;
import com.mvplugin.core.util.Convert;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
public class BukkitWorldManager extends AbstractWorldManager {
private final MultiverseCorePlugin plugin;
private final File worldsFolder;
private final Map<String, WorldProperties> worldPropertiesMap;
private final Map<String, String> defaultGens;
public BukkitWorldManager(MultiverseCorePlugin plugin) {
super(plugin);
this.plugin = plugin;
this.worldsFolder = new File(plugin.getDataFolder(), "worlds");
this.worldPropertiesMap = new HashMap<String, WorldProperties>();
this.defaultGens = new HashMap<String, String>();
initializeDefaultWorldGenerators();
initializeWorlds();
}
private void initializeDefaultWorldGenerators() {
File[] files = this.plugin.getServerFolder().listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String s) {
return s.equalsIgnoreCase("bukkit.yml");
}
});
if (files != null && files.length == 1) {
FileConfiguration bukkitConfig = YamlConfiguration.loadConfiguration(files[0]);
if (bukkitConfig.isConfigurationSection("worlds")) {
Set<String> keys = bukkitConfig.getConfigurationSection("worlds").getKeys(false);
for (String key : keys) {
defaultGens.put(key, bukkitConfig.getString("worlds." + key + ".generator", ""));
}
}
} else {
Logging.warning("Could not read 'bukkit.yml'. Any Default worldgenerators will not be loaded!");
}
}
private void initializeWorlds() {
StringBuilder builder = new StringBuilder();
for (final World w : this.plugin.getServer().getWorlds()) {
try {
worldsMap.put(w.getName(), getBukkitWorld(w));
if (builder.length() != 0) {
builder.append(", ");
}
builder.append(w.getName());
} catch (IOException e) {
Logging.severe("Multiverse could not initialize loaded Bukkit world '%s'", w.getName());
}
}
for (File file : getPotentialWorldFiles()) {
final String worldName = getWorldNameFromFile(file);
if (worldsMap.containsKey(worldName)) {
continue;
}
try {
WorldProperties worldProperties = getWorldProperties(file);
if (worldProperties.get(WorldProperties.AUTO_LOAD)) {
addWorld(worldName, worldProperties.get(WorldProperties.ENVIRONMENT), null, null,
null, worldProperties.get(WorldProperties.GENERATOR),
worldProperties.get(WorldProperties.ADJUST_SPAWN));
if (builder.length() != 0) {
builder.append(", ");
}
builder.append(worldName);
} else {
Logging.fine("Not loading '%s' because it is set to autoLoad: false", worldName);
}
} catch (IOException e) {
Logging.getLogger().log(Level.WARNING, String.format("Could not load world from file '%s'", file), e);
} catch (WorldCreationException e) {
Logging.getLogger().log(Level.WARNING, String.format("Error while attempting to load world '%s'", worldName), e);
}
}
// Simple Output to the Console to show how many Worlds were loaded.
Logging.config("Multiverse is now managing: %s", builder.toString());
}
private String getWorldNameFromFile(final File file) {
final String simpleName = file.getName();
if (simpleName.endsWith(".yml")) {
return simpleName.substring(0, simpleName.indexOf(".yml"));
}
return simpleName;
}
private File[] getPotentialWorldFiles() {
return worldsFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".yml");
}
});
}
private WorldProperties getWorldProperties(final File file) throws IOException {
final YamlWorldProperties worldProperties = new YamlWorldProperties(file);
worldProperties.setPropertyValidator(WorldProperties.RESPAWN_WORLD, new RespawnWorldValidator(this));
return worldProperties;
}
@Override
public WorldProperties getWorldProperties(String worldName) throws IOException {
final World world = Bukkit.getWorld(worldName);
if (world != null) {
worldName = world.getName();
}
if (worldPropertiesMap.containsKey(worldName)) {
return worldPropertiesMap.get(worldName);
} else {
final WorldProperties worldProperties = getWorldProperties(new File(worldsFolder, worldName + ".yml"));
worldPropertiesMap.put(worldName, worldProperties);
return worldProperties;
}
}
/**
* {@inheritDoc}
*/
@Override
public BukkitMultiverseWorld createWorld(final WorldCreationSettings settings) throws WorldCreationException {
if (Bukkit.getWorld(settings.name()) != null) {
return null;
}
final WorldCreator c = WorldCreator.name(settings.name());
if (settings.env() != null) {
c.environment(Convert.toBukkit(settings.env()));
}
if (settings.type() != null) {
c.type(Convert.toBukkit(settings.type()));
}
if (settings.seed() != null) {
c.seed(settings.seed());
}
if (settings.generateStructures() != null) {
c.generateStructures(settings.generateStructures());
}
if (settings.generator() != null) {
final String[] split = settings.generator().split(":", 2);
final String id = (split.length > 1) ? split[1] : null;
final Plugin plugin = Bukkit.getPluginManager().getPlugin(split[0]);
if (plugin == null) {
throw new WorldCreationException(new BundledMessage(BukkitLanguage.WGEN_UNKNOWN_GENERATOR, settings.generator()));
} else if (!plugin.isEnabled()) {
throw new WorldCreationException(new BundledMessage(BukkitLanguage.WGEN_DISABLED_GENERATOR, settings.generator()));
} else {
c.generator(plugin.getDefaultWorldGenerator(settings.name(), id));
}
}
try {
final World w = c.createWorld();
return getBukkitWorld(w);
} catch (Exception e) {
throw new WorldCreationException(new BundledMessage(BukkitLanguage.CREATE_WORLD_ERROR, settings.name()), e);
}
}
private BukkitWorld getBukkitWorld(final World world) throws IOException {
return new BukkitWorld(world, getWorldProperties(world.getName()));
}
@Override
public List<String> getUnloadedWorlds() {
return Collections.unmodifiableList(new ArrayList<String>(worldPropertiesMap.keySet()));
}
}
@@ -1,90 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.plugin.AbstractBukkitPlugin;
import com.dumptruckman.minecraft.pluginbase.properties.Properties;
import com.mvplugin.core.api.CoreConfig;
import com.mvplugin.core.api.MultiverseCore;
import com.mvplugin.core.command.ImportCommand;
import com.mvplugin.core.util.PropertyDescriptions;
import java.io.IOException;
/**
* The primary Bukkit plugin implementation of Multiverse-Core.
*
* See {@link MultiverseCore} for a more detailed external api javadocs.
*/
public class MultiverseCorePlugin extends AbstractBukkitPlugin implements MultiverseCore {
private static final int PROTOCOL = 19;
private static final String COMMAND_PREFIX = "mv";
private BukkitWorldManager worldManager;
public MultiverseCorePlugin() {
this.setPermissionName("multiverse.core");
}
@Override
protected void onPluginLoad() {
PropertyDescriptions.init();
}
@Override
public void onPluginEnable() {
worldManager = new BukkitWorldManager(this);
}
@Override
protected void onReloadConfig() {
worldManager = new BukkitWorldManager(this);
}
@Override
protected void registerCommands() {
registerCommand(ImportCommand.class);
}
@Override
public String getCommandPrefix() {
return COMMAND_PREFIX;
}
@Override
protected Properties getNewConfig() throws IOException {
return new YamlCoreConfig(this);
}
@Override
public CoreConfig config() {
return (CoreConfig) super.config();
}
@Override
public CoreConfig getMVConfig() {
return config();
}
@Override
protected boolean useDatabase() {
return false;
}
@Override
public BukkitWorldManager getWorldManager() {
return this.worldManager;
}
@Override
public MultiverseCore getCore() {
return this;
}
@Override
public void setCore(MultiverseCore core) { }
@Override
public int getProtocolVersion() {
return PROTOCOL;
}
}
@@ -1,17 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.properties.YamlProperties;
import com.mvplugin.core.api.CoreConfig;
import java.io.File;
import java.io.IOException;
/**
* A yaml implementation of Multiverse-Core's primary configuration file.
*/
class YamlCoreConfig extends YamlProperties implements CoreConfig {
public YamlCoreConfig(MultiverseCorePlugin plugin) throws IOException {
super(true, true, new File(plugin.getDataFolder(), "config.yml"), CoreConfig.class);
}
}
@@ -1,76 +0,0 @@
package com.mvplugin.core;
import com.dumptruckman.minecraft.pluginbase.properties.PropertySerializer;
import com.dumptruckman.minecraft.pluginbase.properties.YamlProperties;
import com.mvplugin.core.api.WorldProperties;
import com.mvplugin.core.minecraft.PlayerPosition;
import org.bukkit.configuration.ConfigurationSection;
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* YAML implementation of {@link WorldProperties} which will store all the world properties in a
* YAML file named after the world.
*/
class YamlWorldProperties extends YamlProperties implements WorldProperties {
YamlWorldProperties(File configFile) throws IOException {
super(false, true, configFile, WorldProperties.class);
}
@Override
protected void registerSerializers() {
super.registerSerializers();
setPropertySerializer(PlayerPosition.class, new PlayerPositionSerializer());
}
private static class PlayerPositionSerializer implements PropertySerializer<PlayerPosition> {
@Override
public PlayerPosition deserialize(Object o) {
String world = "";
double x = 0D;
double y = 0D;
double z = 0D;
float pitch = 0F;
float yaw = 0F;
if (o instanceof ConfigurationSection) {
o = ((ConfigurationSection) o).getValues(false);
}
if (o instanceof Map) {
Map map = (Map) o;
world = map.get("world").toString();
try {
x = Double.valueOf(map.get("x").toString());
} catch (Exception ignore) { }
try {
y = Double.valueOf(map.get("y").toString());
} catch (Exception ignore) { }
try {
z = Double.valueOf(map.get("z").toString());
} catch (Exception ignore) { }
try {
pitch = Float.valueOf(map.get("pitch").toString());
} catch (Exception ignore) { }
try {
yaw = Float.valueOf(map.get("yaw").toString());
} catch (Exception ignore) { }
}
return new PlayerPosition(world, x, y, z, pitch, yaw);
}
@Override
public Object serialize(PlayerPosition playerPosition) {
Map<String, Object> result = new LinkedHashMap<String, Object>(6);
result.put("world", playerPosition.getWorld() != null ? playerPosition.getWorld() : "");
result.put("x", playerPosition.getX());
result.put("y", playerPosition.getY());
result.put("z", playerPosition.getZ());
result.put("pitch", playerPosition.getPitch());
result.put("yaw", playerPosition.getYaw());
return result;
}
}
}
@@ -1,16 +0,0 @@
package com.mvplugin.core.api;
import org.bukkit.World;
/**
* Additional API for a Multiverse handled world specifically for Bukkit.
*/
public interface BukkitMultiverseWorld extends MultiverseWorld {
/**
* Gets the Bukkit {@link World} associated with this MultiverseWorld.
*
* @return The Bukkit world associated with this Multiverse world.
*/
World getBukkitWorld();
}
@@ -1,12 +0,0 @@
package com.mvplugin.core.util;
import com.dumptruckman.minecraft.pluginbase.messaging.Message;
public class BukkitLanguage {
public static final Message CREATE_WORLD_ERROR = new Message("worlds.create_world_error",
"&aBukkit&f experienced a problem while attempting to create '&b%s&f'!");
public static final Message WGEN_UNKNOWN_GENERATOR = new Message("worlds.create.unknown_generator",
"I can't create a &bBukkit&f world that uses the generator &c%s&f because it doesn't exist!");
public static final Message WGEN_DISABLED_GENERATOR = new Message("worlds.create.unknown_generator",
"I can't create a &bBukkit&f world that uses the generator &c%s&f because it is not enabled!");
}
@@ -1,33 +0,0 @@
package com.mvplugin.core.util;
import com.mvplugin.core.minecraft.PlayerPosition;
import com.mvplugin.core.minecraft.WorldEnvironment;
import org.bukkit.Difficulty;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldType;
public final class Convert {
private Convert() {}
public static Difficulty toBukkit(com.mvplugin.core.minecraft.Difficulty d) {
return Difficulty.valueOf(d.name());
}
public static WorldType toBukkit(com.mvplugin.core.minecraft.WorldType t) {
return WorldType.valueOf(t.name());
}
public static com.mvplugin.core.minecraft.WorldType fromBukkit(WorldType t) {
return com.mvplugin.core.minecraft.WorldType.valueOf(t.name());
}
public static Environment toBukkit(WorldEnvironment e) {
return Environment.valueOf(e.name());
}
public static Location toBukkit(PlayerPosition position, World world) {
return new Location(world, position.getX(), position.getY(), position.getZ());
}
}
-4
View File
@@ -1,4 +0,0 @@
name: Multiverse-Core
main: com.mvplugin.core.MultiverseCorePlugin
authors: ['Rigby', 'fernferret', 'lithium3141', 'main--', 'dumptruckman']
version: maven-version-number
-2
View File
@@ -104,7 +104,6 @@
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
@@ -116,7 +115,6 @@
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Don't like errors for `final` missing
@@ -1,76 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import 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 java.util.List;
/**
* 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.addKey("mvsetspawn");
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);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
setWorldSpawn(sender);
}
/**
* Does the actual spawn-setting-work.
*
* @param sender The {@link CommandSender} that's setting the spawn.
*/
protected void setWorldSpawn(CommandSender sender) {
if (sender instanceof Player) {
Player p = (Player) sender;
Location l = p.getLocation();
World w = p.getWorld();
MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName());
if (foundWorld != null) {
foundWorld.setSpawnLocation(p.getLocation());
BlockSafety bs = this.plugin.getBlockSafety();
if (!bs.playerCanSpawnHereSafely(p.getLocation()) && foundWorld.getAdjustSpawn()) {
sender.sendMessage("It looks like that location would normally be unsafe. But I trust you.");
sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world.");
sender.sendMessage("If you want this turned back on just do:");
sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias());
foundWorld.setAdjustSpawn(false);
}
sender.sendMessage("Spawn was set to: " + plugin.getLocationManipulation().strCoords(p.getLocation()));
} else {
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");
}
} else {
sender.sendMessage("You cannot use this command from the console.");
}
}
}
@@ -1,66 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
/*
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import org.getspout.spoutapi.gui.GenericButton;
import org.getspout.spoutapi.gui.GenericPopup;
import org.getspout.spoutapi.gui.PopupScreen;
import org.getspout.spoutapi.player.SpoutPlayer;
import java.util.List;
/**
* Edit a world with spout.
* /
public class SpoutCommand extends MultiverseCommand {
public SpoutCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Edit World with Spout");
this.setCommandUsage("/mv spout");
this.setArgRange(0, 0);
this.addKey("mv spout");
this.setPermission("multiverse.core.spout", "Edit a world with spout.", PermissionDefault.OP);
this.addCommandExample("/mv spout");
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "This command must be run as a player!");
return;
}
if (plugin.getSpout() == null) {
sender.sendMessage(ChatColor.RED + "You need spout installed on this server to use it with Multiverse!");
return;
}
SpoutPlayer p = (SpoutPlayer) sender;
if (!p.isSpoutCraftEnabled()) {
sender.sendMessage(ChatColor.RED + p.getName() + "You need to be using the Spoutcraft client to run this command!");
return;
}
PopupScreen pop = new GenericPopup();
GenericButton button = new GenericButton("Fish");
// TO-DO maybe use constants for these
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
button.setX(50);
button.setY(50);
button.setWidth(100);
button.setHeight(40);
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
pop.attachWidget(this.plugin, button);
sender.sendMessage(ChatColor.GREEN + "YAY!");
p.getMainScreen().attachPopupScreen(pop);
}
}
*/
@@ -1,123 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
import com.onarandombox.MultiverseCore.utils.webpaste.BitlyURLShortener;
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 org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Dumps version info to the console.
*/
public class VersionCommand extends MultiverseCommand {
private static final URLShortener SHORTENER = new BitlyURLShortener();
public VersionCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Multiverse Version");
this.setCommandUsage("/mv version " + ChatColor.GOLD + "-[pb]");
this.setArgRange(0, 1);
this.addKey("mv version");
this.addKey("mvv");
this.addKey("mvversion");
this.setPermission("multiverse.core.version",
"Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
}
@Override
public void runCommand(final CommandSender sender, final List<String> args) {
// Check if the command was sent from a Player.
if (sender instanceof Player) {
sender.sendMessage("Version info dumped to console. Please check your server logs.");
}
StringBuilder buffer = new StringBuilder();
buffer.append("[Multiverse-Core] Multiverse-Core Version: ").append(this.plugin.getDescription().getVersion()).append('\n');
buffer.append("[Multiverse-Core] Bukkit Version: ").append(this.plugin.getServer().getVersion()).append('\n');
buffer.append("[Multiverse-Core] Loaded Worlds: ").append(this.plugin.getMVWorldManager().getMVWorlds()).append('\n');
buffer.append("[Multiverse-Core] Multiverse Plugins Loaded: ").append(this.plugin.getPluginCount()).append('\n');
final boolean usingVault = plugin.getVaultHandler().getEconomy() != null;
buffer.append("[Multiverse-Core] Using Vault: ").append(usingVault).append('\n');
if (usingVault) {
buffer.append("[Multiverse-Core] Economy being used: ").append(plugin.getVaultHandler().getEconomy().getName()).append('\n');
} else {
buffer.append("[Multiverse-Core] Economy being used: ").append(this.plugin.getBank().getEconUsed()).append('\n');
}
buffer.append("[Multiverse-Core] Permissions Plugin: ").append(this.plugin.getMVPerms().getType()).append('\n');
buffer.append("[Multiverse-Core] Dumping Config Values: (version ")
.append(this.plugin.getMVConfig().getVersion()).append(")").append('\n');
buffer.append("[Multiverse-Core] messagecooldown: ").append(plugin.getMessaging().getCooldown()).append('\n');
buffer.append("[Multiverse-Core] teleportcooldown: ").append(plugin.getMVConfig().getTeleportCooldown()).append('\n');
buffer.append("[Multiverse-Core] worldnameprefix: ").append(plugin.getMVConfig().getPrefixChat()).append('\n');
buffer.append("[Multiverse-Core] enforceaccess: ").append(plugin.getMVConfig().getEnforceAccess()).append('\n');
buffer.append("[Multiverse-Core] displaypermerrors: ").append(plugin.getMVConfig().getDisplayPermErrors()).append('\n');
buffer.append("[Multiverse-Core] teleportintercept: ").append(plugin.getMVConfig().getTeleportIntercept()).append('\n');
buffer.append("[Multiverse-Core] firstspawnoverride: ").append(plugin.getMVConfig().getFirstSpawnOverride()).append('\n');
buffer.append("[Multiverse-Core] firstspawnworld: ").append(plugin.getMVConfig().getFirstSpawnWorld()).append('\n');
buffer.append("[Multiverse-Core] debug: ").append(plugin.getMVConfig().getGlobalDebug()).append('\n');
buffer.append("[Multiverse-Core] Special Code: FRN002").append('\n');
MVVersionEvent versionEvent = new MVVersionEvent(buffer.toString());
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
// log to console
final String data = versionEvent.getVersionInfo();
String[] lines = data.split("\n");
for (String line : lines) {
Logging.info(line);
}
this.plugin.getServer().getScheduler().scheduleAsyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
if (args.size() == 1) {
String pasteUrl;
if (args.get(0).equalsIgnoreCase("-p")) {
pasteUrl = postToService(PasteServiceType.PASTIE, true, data); // private post to pastie
} else if (args.get(0).equalsIgnoreCase("-b")) {
pasteUrl = postToService(PasteServiceType.PASTEBIN, true, data); // private post to pastie
} else {
return;
}
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
Logging.info("Version info dumped here: %s", pasteUrl);
}
}
});
}
/**
* Send the current contents of this.pasteBinBuffer to a web service.
*
* @param type Service type to send to
* @param isPrivate Should the paste be marked as private.
* @return URL of visible paste
*/
private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData) {
PasteService ps = PasteServiceFactory.getService(type, isPrivate);
try {
return SHORTENER.shorten(ps.postData(ps.encodeData(pasteData), ps.getPostURL()));
} catch (PasteFailedException e) {
System.out.print(e);
return "Error posting to service";
}
}
}
@@ -1,37 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.configuration;
/**
* An "active" {@link MVConfigProperty} that uses the specified method to be "actually" set.
* @param <T> The type of the config-property.
* @deprecated This is deprecated.
* @see MVConfigProperty
*/
@Deprecated
public interface MVActiveConfigProperty<T> extends MVConfigProperty<T> {
/**
* Gets the method that will be executed.
*
* @return The name of the method in MVWorld to be called.
*/
String getMethod();
/**
* Sets the method that will be executed.
*
* @param methodName The name of the method in MVWorld to be called.
*/
void setMethod(String methodName);
/**
* Returns the class of the object we're looking at.
* @return the class of the object we're looking at.
*/
Class<?> getPropertyClass();
}
@@ -1,69 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.configuration;
/**
* A generic config-property.
*
* @param <T> The type of the config-property.
* @deprecated This is deprecated.
*/
@Deprecated
public interface MVConfigProperty<T> {
/**
* Gets the name of this property.
*
* @return The name of this property.
*/
String getName();
/**
* Gets the value of this property.
*
* @return The value of this property.
*/
T getValue();
/**
* Gets the string representation of this value.
*
* @return The value of this property as a string.
*/
String toString();
/**
* Gets the help string for this.
*
* @return The value of this property as a string.
*/
String getHelp();
/**
* Sets the value of this property.
*
* @param value The T representation of this value.
* @return True the value was successfully set.
*/
boolean setValue(T value);
/**
* This parseValue should be used with strings.
*
* @param value The string representation of the value to set.
*
* @return True if the value was set, false if not.
*/
boolean parseValue(String value);
/**
* Gets the name of the config-node that this {@link MVConfigProperty} is saved as.
*
* @return The name of the config-node that this {@link MVConfigProperty} is saved as.
*/
String getConfigNode();
}
@@ -1,50 +0,0 @@
package com.onarandombox.MultiverseCore.event;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when somebody requests version information about Multiverse.
*/
public class MVVersionEvent extends Event {
private final StringBuilder versionInfoBuilder;
public MVVersionEvent(String versionInfo) {
this.versionInfoBuilder = new StringBuilder(versionInfo);
}
private static final HandlerList HANDLERS = new HandlerList();
/**
* {@inheritDoc}
*/
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
/**
* Gets the handler list. This is required by the event system.
* @return A list of HANDLERS.
*/
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Gets the version-info currently saved in this event.
* @return The version-info.
*/
public String getVersionInfo() {
return this.versionInfoBuilder.toString();
}
/**
* Appends more version-info to the version-info currently saved in this event.
* @param moreVersionInfo The version-info to add. Should end with '\n'.
*/
public void appendVersionInfo(String moreVersionInfo) {
this.versionInfoBuilder.append(moreVersionInfo);
}
}
@@ -1,63 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.listeners;
import com.fernferret.allpay.AllPay;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import java.util.Arrays;
/**
* Multiverse's Plugin {@link Listener}.
*/
public class MVPluginListener implements Listener {
private MultiverseCore plugin;
public MVPluginListener(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* Keep an eye out for Plugins which we can utilize.
* @param event The event.
*/
@EventHandler(priority = EventPriority.MONITOR)
public void pluginEnable(PluginEnableEvent event) {
if (plugin.getVaultHandler().getEconomy() != null) {
// Don't hook 2 economy plugins.
return;
}
// Let AllPay handle all econ plugin loadings, only go for econ plugins we support
if (Arrays.asList(AllPay.getValidEconPlugins()).contains(event.getPlugin().getDescription().getName())) {
this.plugin.setBank(this.plugin.getBanker().loadEconPlugin());
}
/*
if (event.getPlugin().getDescription().getName().equals("Spout")) {
this.plugin.setSpout();
this.plugin.log(Level.INFO, "Spout integration enabled.");
}
*/
}
/**
* We'll check if any of the plugins we rely on decide to Disable themselves.
* @param event The event.
*/
@EventHandler(priority = EventPriority.MONITOR)
public void pluginDisable(PluginDisableEvent event) {
// TODO: Disable econ when it disables.
}
}
@@ -1,281 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.utils;
import com.dumptruckman.minecraft.util.Logging;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Vehicle;
/**
* Used to determine block/location-related facts.
*
* @deprecated Use instead: {@link com.onarandombox.MultiverseCore.api.BlockSafety} and {@link SimpleBlockSafety}.
*/
@Deprecated
public class 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.
*/
public boolean isBlockAboveAir(Location l) {
Location downOne = l.clone();
downOne.setY(downOne.getY() - 1);
return (downOne.getBlock().getType() == Material.AIR);
}
// TODO maybe remove this?
private boolean blockIsNotSafe(World world, double x, double y, double z) {
return !playerCanSpawnHereSafely(world, x, y, z);
}
/**
* 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.
*/
public boolean playerCanSpawnHereSafely(World world, double x, double y, double z) {
Location l = new Location(world, x, y, z);
return playerCanSpawnHereSafely(l);
}
/**
* 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}
*/
public boolean playerCanSpawnHereSafely(Location l) {
if (l == null) {
// Can't safely spawn at a null location!
return false;
}
World world = l.getWorld();
Location actual = l.clone();
Location upOne = l.clone();
Location downOne = l.clone();
upOne.setY(upOne.getY() + 1);
downOne.setY(downOne.getY() - 1);
if (this.isSolidBlock(world.getBlockAt(actual).getType())
|| this.isSolidBlock(upOne.getBlock().getType())) {
Logging.finer("Error Here (Actual)? (%s)[%s]", actual.getBlock().getType(),
this.isSolidBlock(actual.getBlock().getType()));
Logging.finer("Error Here (upOne)? (%s)[%s]", upOne.getBlock().getType(),
this.isSolidBlock(upOne.getBlock().getType()));
return false;
}
if (downOne.getBlock().getType() == Material.LAVA || downOne.getBlock().getType() == Material.STATIONARY_LAVA) {
Logging.finer("Error Here (downOne)? (%s)[%s]", downOne.getBlock().getType(),
this.isSolidBlock(downOne.getBlock().getType()));
return false;
}
if (downOne.getBlock().getType() == Material.FIRE) {
Logging.finer("There's fire below! (%s)[%s]", actual.getBlock().getType(),
this.isSolidBlock(actual.getBlock().getType()));
return false;
}
if (isBlockAboveAir(actual)) {
Logging.finer("Is block above air [%s]", isBlockAboveAir(actual));
Logging.finer("Has 2 blocks of water below [%s]", this.hasTwoBlocksofWaterBelow(actual));
return this.hasTwoBlocksofWaterBelow(actual);
}
return true;
}
/**
* 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.
*/
public Location getTopBlock(Location l) {
Location check = l.clone();
check.setY(127); // SUPPRESS CHECKSTYLE: MagicNumberCheck
while (check.getY() > 0) {
if (this.playerCanSpawnHereSafely(check)) {
return check;
}
check.setY(check.getY() - 1);
}
return null;
}
/**
* 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.
*/
public Location getBottomBlock(Location l) {
Location check = l.clone();
check.setY(0);
while (check.getY() < 127) { // SUPPRESS CHECKSTYLE: MagicNumberCheck
if (this.playerCanSpawnHereSafely(check)) {
return check;
}
check.setY(check.getY() + 1);
}
return null;
}
/*
* If someone has a better way of this... Please either tell us, or submit a pull request!
*/
private boolean isSolidBlock(Material type) {
switch (type) {
case AIR:
return false;
case SNOW:
return false;
case TRAP_DOOR:
return false;
case TORCH:
return false;
case YELLOW_FLOWER:
return false;
case RED_ROSE:
return false;
case RED_MUSHROOM:
return false;
case BROWN_MUSHROOM:
return false;
case REDSTONE:
return false;
case REDSTONE_WIRE:
return false;
case RAILS:
return false;
case POWERED_RAIL:
return false;
case REDSTONE_TORCH_ON:
return false;
case REDSTONE_TORCH_OFF:
return false;
case DEAD_BUSH:
return false;
case SAPLING:
return false;
case STONE_BUTTON:
return false;
case LEVER:
return false;
case LONG_GRASS:
return false;
case PORTAL:
return false;
case STONE_PLATE:
return false;
case WOOD_PLATE:
return false;
case SEEDS:
return false;
case SUGAR_CANE_BLOCK:
return false;
case WALL_SIGN:
return false;
case SIGN_POST:
return false;
case WOODEN_DOOR:
return false;
case STATIONARY_WATER:
return false;
case WATER:
return false;
default:
return true;
}
}
/**
* 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}.
*/
public boolean isEntitiyOnTrack(Location l) {
Material currentBlock = l.getBlock().getType();
return (currentBlock == Material.POWERED_RAIL || currentBlock == Material.DETECTOR_RAIL || currentBlock == Material.RAILS);
}
// TODO maybe remove this?
private void showDangers(Location l) {
Location actual = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
Location upOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
upOne.setY(upOne.getY() + 1);
downOne.setY(downOne.getY() - 1);
System.out.print("Location Up: " + upOne.getBlock().getType());
System.out.print(" " + upOne);
System.out.print("Location: " + actual.getBlock().getType());
System.out.print(" " + actual);
System.out.print("Location Down: " + downOne.getBlock().getType());
System.out.print(" " + downOne);
}
/**
* Checks recursively below a {@link Location} for 2 blocks of water.
*
* @param l The {@link Location}
* @return Whether there are 2 blocks of water
*/
private boolean hasTwoBlocksofWaterBelow(Location l) {
if (l.getBlockY() < 0) {
return false;
}
Location oneBelow = l.clone();
oneBelow.subtract(0, 1, 0);
if (oneBelow.getBlock().getType() == Material.WATER || oneBelow.getBlock().getType() == Material.STATIONARY_WATER) {
Location twoBelow = oneBelow.clone();
twoBelow.subtract(0, 1, 0);
return (oneBelow.getBlock().getType() == Material.WATER || oneBelow.getBlock().getType() == Material.STATIONARY_WATER);
}
if (oneBelow.getBlock().getType() != Material.AIR) {
return false;
}
return hasTwoBlocksofWaterBelow(oneBelow);
}
/**
* Checks if the specified {@link Minecart} can spawn safely.
* @param cart The {@link Minecart}.
* @return True if the minecart can spawn safely.
*/
public boolean canSpawnCartSafely(Minecart cart) {
if (this.isBlockAboveAir(cart.getLocation())) {
return true;
}
if (this.isEntitiyOnTrack(LocationManipulation.getNextBlock(cart))) {
return true;
}
return false;
}
/**
* Checks if the specified {@link Vehicle} can spawn safely.
* @param vehicle The {@link Vehicle}.
* @return True if the vehicle can spawn safely.
*/
public boolean canSpawnVehicleSafely(Vehicle vehicle) {
if (this.isBlockAboveAir(vehicle.getLocation())) {
return true;
}
return false;
}
}
@@ -1,122 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Logger;
/**
* File-utilities.
*/
public class FileUtils {
protected FileUtils() {
throw new UnsupportedOperationException();
}
/**
* Used to delete a folder.
*
* @param file The folder to delete.
* @return true if the folder was successfully deleted.
*/
public static boolean deleteFolder(File file) {
if (file.exists()) {
boolean ret = true;
// If the file exists, and it has more than one file in it.
if (file.isDirectory()) {
for (File f : file.listFiles()) {
ret = ret && deleteFolder(f);
}
}
return ret && file.delete();
} else {
return false;
}
}
/**
* Used to delete the contents of a folder, without deleting the folder itself.
*
* @param file The folder whose contents to delete.
* @return true if the contents were successfully deleted
*/
public static boolean deleteFolderContents(File file) {
if (file.exists()) {
boolean ret = true;
// If the file exists, and it has more than one file in it.
if (file.isDirectory()) {
for (File f : file.listFiles()) {
ret = ret && deleteFolder(f);
}
}
return ret;
} else {
return false;
}
}
private static final int COPY_BLOCK_SIZE = 1024;
/**
* Helper method to copy the world-folder.
* @param source Source-File
* @param target Target-File
* @param log A logger that logs the operation
*
* @return if it had success
*/
public static boolean copyFolder(File source, File target, Logger log) {
InputStream in = null;
OutputStream out = null;
try {
if (source.isDirectory()) {
if (!target.exists())
target.mkdir();
String[] children = source.list();
// for (int i=0; i<children.length; i++) {
for (String child : children) {
copyFolder(new File(source, child), new File(target, child), log);
}
} else {
in = new FileInputStream(source);
out = new FileOutputStream(target);
byte[] buf = new byte[COPY_BLOCK_SIZE];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
}
return true;
} catch (FileNotFoundException e) {
log.warning("Exception while copying file: " + e.getMessage());
} catch (IOException e) {
log.warning("Exception while copying file: " + e.getMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ignore) { }
}
if (out != null) {
try {
out.close();
} catch (IOException ignore) { }
}
}
return false;
}
}
@@ -1,122 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.utils;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.destination.CannonDestination;
import org.bukkit.Location;
import org.bukkit.TravelAgent;
import org.bukkit.entity.Player;
import java.util.logging.Level;
/**
* The Multiverse-{@link TravelAgent}.
*/
public class MVTravelAgent implements TravelAgent {
private MVDestination destination;
private MultiverseCore core;
private Player player;
public MVTravelAgent(MultiverseCore multiverseCore, MVDestination d, Player p) {
this.destination = d;
this.core = multiverseCore;
this.player = p;
}
/**
* {@inheritDoc}
*/
@Override
public TravelAgent setSearchRadius(int radius) {
return this;
}
/**
* {@inheritDoc}
*/
@Override
public int getSearchRadius() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public TravelAgent setCreationRadius(int radius) {
return this;
}
/**
* {@inheritDoc}
*/
@Override
public int getCreationRadius() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getCanCreatePortal() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void setCanCreatePortal(boolean create) {
}
/**
* {@inheritDoc}
*/
@Override
public Location findOrCreate(Location location) {
return this.getSafeLocation();
}
/**
* {@inheritDoc}
*/
@Override
public Location findPortal(Location location) {
return this.getSafeLocation();
}
/**
* {@inheritDoc}
*/
@Override
public boolean createPortal(Location location) {
return false;
}
private Location getSafeLocation() {
// At this time, these can never use the velocity.
if (this.destination instanceof CannonDestination) {
this.core.log(Level.FINE, "Using Stock TP method. This cannon will have 0 velocity");
}
SafeTTeleporter teleporter = this.core.getSafeTTeleporter();
Location newLoc = this.destination.getLocation(this.player);
if (this.destination.useSafeTeleporter()) {
newLoc = teleporter.getSafeLocation(this.player, this.destination);
}
if (newLoc == null) {
return this.player.getLocation();
}
return newLoc;
}
}
@@ -1,358 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.utils;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.BlockSafety;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
import com.onarandombox.MultiverseCore.enums.TeleportResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
import java.util.logging.Level;
/**
* The {@link SafeTTeleporter}.
*
* @deprecated Use instead: {@link com.onarandombox.MultiverseCore.api.SafeTTeleporter} and {@link SimpleSafeTTeleporter}.
*/
@Deprecated
public class SafeTTeleporter {
private MultiverseCore plugin;
private BlockSafety bs;
public SafeTTeleporter(MultiverseCore plugin) {
this.plugin = plugin;
this.bs = plugin.getBlockSafety();
}
private static final int DEFAULT_TOLERANCE = 6;
private static final int DEFAULT_RADIUS = 9;
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @return A safe {@link Location}.
*/
public Location getSafeLocation(Location l) {
return this.getSafeLocation(l, DEFAULT_TOLERANCE, DEFAULT_RADIUS);
}
/**
* 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}.
*/
public Location getSafeLocation(Location l, int tolerance, int radius) {
// Check around the player first in a configurable radius:
Location safe = checkAboveAndBelowLocation(l, tolerance, radius);
if (safe != null) {
safe.setX(safe.getBlockX() + .5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
safe.setZ(safe.getBlockZ() + .5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.plugin.log(Level.FINE, "Hey! I found one: " + plugin.getLocationManipulation().strCoordsRaw(safe));
} else {
this.plugin.log(Level.FINE, "Uh oh! No safe place found!");
}
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;
this.plugin.log(Level.FINER, "Given Location of: " + plugin.getLocationManipulation().strCoordsRaw(l));
this.plugin.log(Level.FINER, "Checking +-" + tolerance + " with a radius of " + radius);
// 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.
*/
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;
}
/**
* 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
*/
public TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, MVDestination d) {
if (d instanceof InvalidDestination) {
this.plugin.log(Level.FINER, "Entity tried to teleport to an invalid destination");
return TeleportResult.FAIL_INVALID;
}
Player teleporteePlayer = null;
if (teleportee instanceof Player) {
teleporteePlayer = ((Player) teleportee);
} else if (teleportee.getPassenger() instanceof Player) {
teleporteePlayer = ((Player) teleportee.getPassenger());
}
if (teleporteePlayer == null) {
return TeleportResult.FAIL_INVALID;
}
MultiverseCore.addPlayerToTeleportQueue(teleporter.getName(), teleporteePlayer.getName());
Location safeLoc = d.getLocation(teleportee);
if (d.useSafeTeleporter()) {
safeLoc = this.getSafeLocation(teleportee, d);
}
if (safeLoc != null) {
if (teleportee.teleport(safeLoc)) {
if (!d.getVelocity().equals(new Vector(0, 0, 0))) {
teleportee.setVelocity(d.getVelocity());
}
return TeleportResult.SUCCESS;
}
return TeleportResult.FAIL_OTHER;
}
return TeleportResult.FAIL_UNSAFE;
}
/**
* 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.
*/
public TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location, boolean safely) {
if (safely) {
location = this.getSafeLocation(location);
}
if (location != null) {
if (teleportee.teleport(location)) {
return TeleportResult.SUCCESS;
}
return TeleportResult.FAIL_OTHER;
}
return TeleportResult.FAIL_UNSAFE;
}
/**
* 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.
*/
public Location getSafeLocation(Entity e, MVDestination d) {
Location l = d.getLocation(e);
if (this.bs.playerCanSpawnHereSafely(l)) {
plugin.log(Level.FINE, "The first location you gave me was safe.");
return l;
}
if (e instanceof Minecart) {
Minecart m = (Minecart) e;
if (!this.bs.canSpawnCartSafely(m)) {
return null;
}
} else if (e instanceof Vehicle) {
Vehicle v = (Vehicle) e;
if (!this.bs.canSpawnVehicleSafely(v)) {
return null;
}
}
Location safeLocation = this.getSafeLocation(l);
if (safeLocation != null) {
// Add offset to account for a vehicle on dry land!
if (e instanceof Minecart && !this.bs.isEntitiyOnTrack(safeLocation)) {
safeLocation.setY(safeLocation.getBlockY() + .5);
this.plugin.log(Level.FINER, "Player was inside a minecart. Offsetting Y location.");
}
this.plugin.log(Level.FINE, "Had to look for a bit, but I found a safe place for ya!");
return safeLocation;
}
if (e instanceof Player) {
Player p = (Player) e;
this.plugin.getMessaging().sendMessage(p, "No safe locations found!", false);
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
} else if (e.getPassenger() instanceof Player) {
Player p = (Player) e.getPassenger();
this.plugin.getMessaging().sendMessage(p, "No safe locations found!", false);
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
}
this.plugin.log(Level.FINE, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
return null;
}
/**
* Finds a portal-block next to the specified {@link Location}.
* @param l The {@link Location}
* @return The next portal-block's {@link Location}.
*/
public static Location findPortalBlockNextTo(Location l) {
Block b = l.getWorld().getBlockAt(l);
Location foundLocation = null;
if (b.getType() == Material.PORTAL) {
return l;
}
if (b.getRelative(BlockFace.NORTH).getType() == Material.PORTAL) {
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.NORTH).getLocation(), foundLocation);
}
if (b.getRelative(BlockFace.SOUTH).getType() == Material.PORTAL) {
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.SOUTH).getLocation(), foundLocation);
}
if (b.getRelative(BlockFace.EAST).getType() == Material.PORTAL) {
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.EAST).getLocation(), foundLocation);
}
if (b.getRelative(BlockFace.WEST).getType() == Material.PORTAL) {
foundLocation = getCloserBlock(l, b.getRelative(BlockFace.WEST).getLocation(), foundLocation);
}
return foundLocation;
}
private static Location getCloserBlock(Location source, Location blockA, Location blockB) {
// If B wasn't given, return a.
if (blockB == null) {
return blockA;
}
// Center our calculations
blockA.add(.5, 0, .5);
blockB.add(.5, 0, .5);
// Retrieve the distance to the normalized blocks
double testA = source.distance(blockA);
double testB = source.distance(blockB);
// Compare and return
if (testA <= testB) {
return blockA;
}
return blockB;
}
}
@@ -1,130 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.utils;
import com.dumptruckman.minecraft.util.Logging;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Logger;
import java.util.regex.Pattern;
/*
* Apparently this isn't used and I don't know if we'll ever use this,
* so I'm just going to deprecate it for now and suppress the warnings.
*
* BEGIN CHECKSTYLE-SUPPRESSION: ALL
*/
/**
* @deprecated Currently unused.
*/
@Deprecated
public class UpdateChecker {
public static final Logger log = Logger.getLogger("Minecraft");
private Timer timer = new Timer(); // Create a new Timer.
private String name; // Hold the Plugins Name.
private String cversion; // Hold the Plugins Current Version.
public UpdateChecker(String name, String version) {
this.name = name;
this.cversion = version;
int delay = 0; // No Delay, fire the first check instantly.
int period = 1800; // Delay 30 Minutes
this.timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
checkUpdate();
}
}, delay * 1000, period * 1000);
}
public void checkUpdate() {
BufferedReader rd = null;
try {
URL url = new URL("http://bukkit.onarandombox.com/multiverse/version.php?n=" + URLEncoder.encode(this.name, "UTF-8") + "&v=" + this.cversion);
URLConnection conn = url.openConnection();
conn.setReadTimeout(2000); // 2000 = 2 Seconds.
int code = ((HttpURLConnection) conn).getResponseCode();
if (code != 200) {
return;
}
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String version = null;
while ((line = rd.readLine()) != null) {
if (version == null) {
version = line;
}
}
if (version == null) {
return;
}
String v1 = normalisedVersion(version);
String v2 = normalisedVersion(this.cversion);
int compare = v1.compareTo(v2);
if (compare > 0) {
Logging.info("[%s] - Update Available (%s)", this.name, version);
}
rd.close();
} catch (Exception e) {
// No need to alert the user of any error here... it's not important.
} finally {
if (rd != null) {
try {
rd.close();
} catch (IOException ignore) { }
}
}
}
/**
* Convert the given Version String to a Normalized Version String so we can compare it.
*
* @param version The version string
* @return The normalized version string
*/
public static String normalisedVersion(String version) {
return normalisedVersion(version, ".", 4);
}
public static String normalisedVersion(String version, String sep, int maxWidth) {
String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version);
StringBuilder sb = new StringBuilder();
for (String s : split) {
sb.append(String.format("%" + maxWidth + 's', s));
}
return sb.toString();
}
}
/*
* END CHECKSTYLE-SUPPRESSION: ALL
*/
@@ -1,34 +0,0 @@
package com.onarandombox.MultiverseCore.utils.webpaste;
import java.io.IOException;
/**
* An {@link URLShortener} using {@code bit.ly}.
*/
public class BitlyURLShortener extends HttpAPIClient implements URLShortener {
private static final String GENERIC_BITLY_REQUEST_FORMAT = "https://api-ssl.bitly.com/v3/shorten?format=txt&apiKey=%s&login=%s&longUrl=%s";
// I think it's no problem that these are public
private static final String USERNAME = "multiverse2";
private static final String API_KEY = "R_9dbff4862a3bc0c4218a7d78cc10d0e0";
public BitlyURLShortener() {
super(String.format(GENERIC_BITLY_REQUEST_FORMAT, API_KEY, USERNAME, "%s"));
}
/**
* {@inheritDoc}
*/
@Override
public String shorten(String longUrl) {
try {
String result = this.exec(longUrl);
if (!result.startsWith("http://j.mp/")) // ... then it's failed :/
throw new IOException(result);
return result;
} catch (IOException e) {
e.printStackTrace();
return longUrl; // sorry ...
}
}
}
@@ -1,50 +0,0 @@
package com.onarandombox.MultiverseCore.utils.webpaste;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
/**
* HTTP API-client.
*/
public abstract class HttpAPIClient {
/**
* The URL for this API-request.
*/
protected final String urlFormat;
public HttpAPIClient(String urlFormat) {
this.urlFormat = urlFormat;
}
/**
* Executes this API-Request.
* @param args Format-args.
* @return The result (as text).
* @throws IOException When the I/O-operation failed.
*/
protected final String exec(Object... args) throws IOException {
URLConnection conn = new URL(String.format(this.urlFormat, args)).openConnection();
conn.connect();
StringBuilder ret = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while (!reader.ready()); // wait until reader is ready, may not be necessary, SUPPRESS CHECKSTYLE: EmptyStatement
while (reader.ready()) {
ret.append(reader.readLine()).append('\n');
}
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException ignore) { }
}
}
return ret.toString();
}
}
@@ -1,45 +0,0 @@
package com.onarandombox.MultiverseCore.utils.webpaste;
import java.net.URL;
/**
* An interface to a web-based text-pasting service. Classes implementing this
* interface should implement its methods to send data to an online text-sharing
* service, such as pastebin.com. Conventionally, a paste is accomplished by (given
* some PasteService instance ps):
*
* {@code ps.postData(ps.encodeData(someString), ps.getPostURL());}
*
* Services that provide a distinction between "public" and "private" pastes
* should implement a custom constructor that specifies which kind the PasteService
* instance is submitting; an example of this is the PastiePasteService class.
*/
public interface PasteService {
/**
* Encode the given String data into a format suitable for transmission in an HTTP request.
*
* @param data The raw data to encode.
* @return A URL-encoded string.
*/
String encodeData(String data);
/**
* Get the URL to which this paste service sends new pastes.
*
* @return The URL that will be accessed to complete the paste.
*/
URL getPostURL();
/**
* Post encoded data to the Web.
*
* @param encodedData A URL-encoded String containing the full request to post to
* the given URL. Can be the result of calling #encodeData().
* @param url The URL to which to paste. Can be the result of calling #getPostURL().
* @throws PasteFailedException When pasting/posting the data failed.
* @return The URL at which the new paste is visible.
*/
String postData(String encodedData, URL url) throws PasteFailedException;
}
@@ -1,89 +0,0 @@
package com.onarandombox.MultiverseCore.utils.webpaste;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
/**
* Pastes to {@code pastebin.com}.
*/
public class PastebinPasteService implements PasteService {
private boolean isPrivate;
public PastebinPasteService(boolean isPrivate) {
this.isPrivate = isPrivate;
}
/**
* {@inheritDoc}
*/
@Override
public URL getPostURL() {
try {
return new URL("http://pastebin.com/api/api_post.php");
} catch (MalformedURLException e) {
return null; // should never hit here
}
}
/**
* {@inheritDoc}
*/
@Override
public String encodeData(String data) {
try {
String encData = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("d61d68d31e8e0392b59b50b277411c71", "UTF-8");
encData += "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
encData += "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8");
encData += "&" + URLEncoder.encode("api_paste_private", "UTF-8") + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", "UTF-8");
encData += "&" + URLEncoder.encode("api_paste_format", "UTF-8") + "=" + URLEncoder.encode("yaml", "UTF-8");
return encData;
} catch (UnsupportedEncodingException e) {
return ""; // should never hit here
}
}
/**
* {@inheritDoc}
*/
@Override
public String postData(String encodedData, URL url) throws PasteFailedException {
OutputStreamWriter wr = null;
BufferedReader rd = null;
try {
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(encodedData);
wr.flush();
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String pastebinUrl = "";
while ((line = rd.readLine()) != null) {
pastebinUrl = line;
}
return pastebinUrl;
} catch (Exception e) {
throw new PasteFailedException(e);
} finally {
if (wr != null) {
try {
wr.close();
} catch (IOException ignore) { }
}
if (rd != null) {
try {
rd.close();
} catch (IOException ignore) { }
}
}
}
}
@@ -1,107 +0,0 @@
package com.onarandombox.MultiverseCore.utils.webpaste;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Pastes to {@code pastie.org}.
*/
public class PastiePasteService implements PasteService {
private boolean isPrivate;
public PastiePasteService(boolean isPrivate) {
this.isPrivate = isPrivate;
}
/**
* {@inheritDoc}
*/
@Override
public URL getPostURL() {
try {
return new URL("http://pastie.org/pastes");
} catch (MalformedURLException e) {
return null; // should never hit here
}
}
/**
* {@inheritDoc}
*/
@Override
public String encodeData(String data) {
try {
String encData = URLEncoder.encode("paste[authorization]", "UTF-8") + "=" + URLEncoder.encode("burger", "UTF-8"); // burger is magic
encData += "&" + URLEncoder.encode("paste[restricted]", "UTF-8") + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", "UTF-8");
encData += "&" + URLEncoder.encode("paste[parser_id]", "UTF-8") + "=" + URLEncoder.encode("6", "UTF-8"); // 6 is plain text
encData += "&" + URLEncoder.encode("paste[body]", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8");
return encData;
} catch (UnsupportedEncodingException e) {
return ""; // should never hit here
}
}
/**
* {@inheritDoc}
*/
@Override
public String postData(String encodedData, URL url) throws PasteFailedException {
OutputStreamWriter wr = null;
BufferedReader rd = null;
try {
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(encodedData);
wr.flush();
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String pastieUrl = "";
Pattern pastiePattern = this.getURLMatchingPattern();
while ((line = rd.readLine()) != null) {
Matcher m = pastiePattern.matcher(line);
if (m.matches()) {
String pastieID = m.group(1);
pastieUrl = this.formatURL(pastieID);
}
}
return pastieUrl;
} catch (Exception e) {
throw new PasteFailedException(e);
} finally {
if (wr != null) {
try {
wr.close();
} catch (IOException ignore) { }
}
if (rd != null) {
try {
rd.close();
} catch (IOException ignore) { }
}
}
}
private Pattern getURLMatchingPattern() {
if (this.isPrivate) {
return Pattern.compile(".*http://pastie.org/.*key=([0-9a-z]+).*");
} else {
return Pattern.compile(".*http://pastie.org/([0-9]+).*");
}
}
private String formatURL(String pastieID) {
return "http://pastie.org/" + (this.isPrivate ? "private/" : "") + pastieID;
}
}
@@ -1,13 +0,0 @@
package com.onarandombox.MultiverseCore.utils.webpaste;
/**
* URL-Shortener.
*/
public interface URLShortener {
/**
* Shorten an URL.
* @param longUrl The long form.
* @return The shortened URL.
*/
String shorten(String longUrl);
}
-217
View File
@@ -1,217 +0,0 @@
name: Multiverse-Core
main: com.onarandombox.MultiverseCore.MultiverseCore
authors: ['Rigby', 'fernferret', 'lithium3141', 'main--']
version: maven-version-number
commands:
mv:
description: Generic Multiverse Command
usage: /<command>
mvcreate:
description: World create command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
mvc:
description: World create command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
mvimport:
description: World import command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
mvim:
description: World import command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
mvremove:
description: World remove command
usage: |
/<command> <world>
mvdelete:
description: World delete command
usage: |
/<command> <world>
mvunload:
description: World unload command
usage: |
/<command> <world>
mvmodify:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmset:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmadd:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmremove:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmclear:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvm:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvtp:
description: Command to teleport between Worlds
usage: |
/<command> <world>[:spawn]
Example: /<command> creative - Teleports you to the relevant location in the 'creative' world.
Example: /<command> creative:spawn - Teleports you to the spawn of the 'creative' world.
mvlist:
description: Print list of loaded Worlds
usage: |
/<command> [environment]
Example: /<command> NETHER - Shows all NETHER Worlds.
Example: /<command> NORMAL - Shows all NORMAL Worlds.
mvl:
description: Print list of loaded Worlds
usage: |
/<command> [environment]
Example: /<command> NETHER - Shows all NETHER Worlds.
Example: /<command> NORMAL - Shows all NORMAL Worlds.
mvsetspawn:
description: Set the spawn area for a particular world
usage: /<command> -- Sets the spawn area of the current world to your location.
mvset:
description: Set the spawn area for a particular world
usage: /<command> -- Sets the spawn area of the current world to your location.
mvss:
description: Set the spawn area for a particular world
usage: /<command> -- Sets the spawn area of the current world to your location.
mvspawn:
description: Teleport to the spawn area
usage: /<command> -- Teleports you to the spawn area of your current world.
mvs:
description: Teleport to the spawn area
usage: /<command> -- Teleports you to the spawn area of your current world.
mvcoord:
description: Display World, Coordinates, Direction & Compression for a world.
usage: |
/<command> [world]
/<command> -- Shows the relevant coordinates in your current world.
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
mvc:
description: Display World, Coordinates, Direction & Compression for a world.
usage: |
/<command> [world]
/<command> -- Shows the relevant coordinates in your current world.
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
mvwho:
description: Display online users per world.
usage: |
/<command> [world]
/<command> -- Shows who is online in each world.
/<command> creative -- Shows who is online in the 'creative' world.
mvw:
description: Display online users per world.
usage: |
/<command> [world]
/<command> -- Shows who is online in each world.
/<command> creative -- Shows who is online in the 'creative' world.
mvreload:
description: Reload Configuration files.
usage: /<command>
mvr:
description: Reload Configuration files.
usage: /<command>
mvpurge:
description: Purge the targetted world of creatures.
usage: |
/<command> [world] [creatures]
/<command> -- Purges the players world of all creatures.
/<command> creative * -- Purges the creative world of all Creatures.
/<command> creative creeper -- Purges the creative world of all CREEPERS.
mvconfirm:
description: Confirms sensitive decisions like deleting a world.
usage: |
/<command>
mvinfo:
description: Gets world info.
usage: |
/<command> [world]
mvi:
description: Gets world info.
usage: |
/<command> [world]
mvenv:
description: Tells the user all possible environment types.
usage: |
/<command>
mvv:
description: Prints out version info.
usage: |
/<command>
mvversion:
description: Prints out version info.
usage: |
/<command>
mvco:
description: Displays the player's coordinates.
usage: |
/<command>
mvh:
description: Displays the Multiverse Help.
usage: |
/<command>
mvsearch:
description: Displays the Multiverse Help.
usage: |
/<command>
mvhelp:
description: Displays the Multiverse Help.
usage: |
/<command>
mvdebug:
description: Turns on debugging.
usage: |
/<command>
mvgenerators:
description: Displays all found world generators.
usage: |
/<command>
mvgens:
description: Displays all found world generators.
usage: |
/<command>
mvload:
description: Loads a world into Multiverse.
usage: |
/<command> {WORLD}
mvregen:
description: Regenerates a world Multiverse already knows about.
usage: |
/<command> {WORLD}
mvscript:
description: Runs a script from the Multiverse scripts directory.
usage: |
/<command> {script} [target]
mvclone:
description: World clone command
usage: |
/<command> <world> <environment>
/<command> creative grieftastic -- Creates a world called 'grieftastic' exactly identical to the world 'creative'.
mvsilent:
description: Reduces startup messages
usage: |
/<command> [true|false]
+383 -31
View File
@@ -1,45 +1,397 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.mvplugin</groupId>
<artifactId>MultiverseCore</artifactId>
<version>3.0-SNAPSHOT</version>
<name>Multiverse-Core</name>
<url>http://ci.onarandombox.org</url>
<description>World Management Plugin</description>
<packaging>pom</packaging>
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>4.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>
<project.bitly-access-token>bitly-access-token</project.bitly-access-token>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>LOCAL</project.build.number>
</properties>
<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>spigot</id>
<url>https://hub.spigotmc.org/nexus/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>
<!-- Modules -->
<modules>
<module>base</module>
<module>bukkit</module>
</modules>
<pluginRepositories>
<pluginRepository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<ciManagement>
<system>jenkins</system>
<url>http://ci.onarandombox.com</url>
</ciManagement>
<ciManagement>
<system>jenkins</system>
<url>http://ci.onarandombox.com</url>
</ciManagement>
<!-- Profiles are used to detect whether this is a local or Jenkins build
and adjust the build number accordingly -->
<profiles>
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
</properties>
</profile>
<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>
<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>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13.2-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>
<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.7</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>
<!-- 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>
<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>
<scm>
<connection>scm:git:git://github.com/multiverse/Multiverse-Core.git</connection>
<url>https://github.com/multiverse/Multiverse-Core</url>
<developerConnection>scm:git:git@github.com:multiverse/Multiverse-Core.git</developerConnection>
</scm>
</project>
</project>
@@ -7,10 +7,24 @@
package com.onarandombox.MultiverseCore;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import buscript.Buscript;
import com.dumptruckman.minecraft.util.Logging;
import com.fernferret.allpay.AllPay;
import com.fernferret.allpay.GenericBank;
import com.onarandombox.MultiverseCore.MVWorld.NullLocation;
import com.onarandombox.MultiverseCore.api.BlockSafety;
import com.onarandombox.MultiverseCore.api.Core;
import com.onarandombox.MultiverseCore.api.LocationManipulation;
@@ -18,7 +32,6 @@ import com.onarandombox.MultiverseCore.api.MVPlugin;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.commands.AnchorCommand;
import com.onarandombox.MultiverseCore.commands.CheckCommand;
@@ -30,6 +43,8 @@ import com.onarandombox.MultiverseCore.commands.CreateCommand;
import com.onarandombox.MultiverseCore.commands.DebugCommand;
import com.onarandombox.MultiverseCore.commands.DeleteCommand;
import com.onarandombox.MultiverseCore.commands.EnvironmentCommand;
import com.onarandombox.MultiverseCore.commands.GameruleCommand;
import com.onarandombox.MultiverseCore.commands.GamerulesCommand;
import com.onarandombox.MultiverseCore.commands.GeneratorCommand;
import com.onarandombox.MultiverseCore.commands.HelpCommand;
import com.onarandombox.MultiverseCore.commands.ImportCommand;
@@ -60,61 +75,56 @@ import com.onarandombox.MultiverseCore.destination.DestinationFactory;
import com.onarandombox.MultiverseCore.destination.ExactDestination;
import com.onarandombox.MultiverseCore.destination.PlayerDestination;
import com.onarandombox.MultiverseCore.destination.WorldDestination;
import com.onarandombox.MultiverseCore.event.MVDebugModeEvent;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import com.onarandombox.MultiverseCore.listeners.MVAsyncPlayerChatListener;
import com.onarandombox.MultiverseCore.listeners.MVChatListener;
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
import com.onarandombox.MultiverseCore.listeners.MVMapListener;
import com.onarandombox.MultiverseCore.listeners.MVPlayerChatListener;
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
import com.onarandombox.MultiverseCore.listeners.MVPortalListener;
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
import com.onarandombox.MultiverseCore.listeners.MVWorldInitListener;
import com.onarandombox.MultiverseCore.listeners.MVWorldListener;
import com.onarandombox.MultiverseCore.utils.AnchorManager;
import com.onarandombox.MultiverseCore.utils.MVEconomist;
import com.onarandombox.MultiverseCore.utils.MVMessaging;
import com.onarandombox.MultiverseCore.utils.MVPermissions;
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
import com.onarandombox.MultiverseCore.utils.MaterialConverter;
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
import com.onarandombox.MultiverseCore.utils.VaultHandler;
import com.onarandombox.MultiverseCore.utils.WorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import me.main__.util.SerializationConfig.NoSuchPropertyException;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.Metrics;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.plugin.java.JavaPluginLoader;
/**
* The implementation of the Multiverse-{@link Core}.
*/
public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
private static final int PROTOCOL = 18;
private static final int PROTOCOL = 24;
// TODO: Investigate if this one is really needed to be static.
// Doubt it. -- FernFerret
private static Map<String, String> teleportQueue = new HashMap<String, String>();
@@ -123,6 +133,21 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// TODO please let's make this non-static
private volatile MultiverseCoreConfiguration config;
public MultiverseCore() {
super();
}
/**
* This is for unit testing.
* @param loader The PluginLoader to use.
* @param description The Description file to use.
* @param dataFolder The folder that other datafiles can be found in.
* @param file The location of the plugin.
*/
public MultiverseCore(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
super(loader, description, dataFolder, file);
}
/**
* This method is used to find out who is teleporting a player.
* @param playerName The teleported player (the teleportee).
@@ -148,11 +173,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
teleportQueue.put(teleportee, teleporter);
}
@Override
public String toString() {
return "The Multiverse-Core Plugin";
}
/**
* {@inheritDoc}
* @deprecated This is now deprecated, nobody needs it any longer.
@@ -196,24 +216,22 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// Setup the block/player/entity listener.
private final MVPlayerListener playerListener = new MVPlayerListener(this);
private final MVEntityListener entityListener = new MVEntityListener(this);
private final MVPluginListener pluginListener = new MVPluginListener(this);
private final MVWeatherListener weatherListener = new MVWeatherListener(this);
private final MVPortalListener portalListener = new MVPortalListener(this);
private final MVWorldListener worldListener = new MVWorldListener(this);
private MVChatListener chatListener;
// HashMap to contain information relating to the Players.
private HashMap<String, MVPlayerSession> playerSessions;
private VaultHandler vaultHandler;
private GenericBank bank = null;
private AllPay banker;
private MVEconomist economist;
private Buscript buscript;
private int pluginCount;
private DestinationFactory destFactory;
//private SpoutInterface spoutInterface = null;
private MultiverseMessaging messaging;
private BlockSafety blockSafety;
private LocationManipulation locationManipulation;
private SafeTTeleporter safeTTeleporter;
private UnsafeCallWrapper unsafeCallWrapper;
private File serverFolder = new File(System.getProperty("user.dir"));
@@ -222,7 +240,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// Register our config
SerializationConfig.registerAll(MultiverseCoreConfiguration.class);
// Register our world
SerializationConfig.registerAll(MVWorld.class);
SerializationConfig.registerAll(WorldProperties.class);
// Create our DataFolder
getDataFolder().mkdirs();
// Setup our Debug Log
@@ -234,31 +252,18 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.locationManipulation = new SimpleLocationManipulation();
// Setup our SafeTTeleporter
this.safeTTeleporter = new SimpleSafeTTeleporter(this);
this.unsafeCallWrapper = new UnsafeCallWrapper(this);
}
/**
* {@inheritDoc}
* @deprecated This is deprecated.
*/
@Override
@Deprecated
public FileConfiguration getMVConfiguration() {
return this.multiverseConfig;
}
/**
* {@inheritDoc}
* @deprecated Now using Vault.
*/
@Override
@Deprecated
public GenericBank getBank() {
return this.bank;
}
@Override
public VaultHandler getVaultHandler() {
return vaultHandler;
return getEconomist().getVaultHandler();
}
public MVEconomist getEconomist() {
return economist;
}
/**
@@ -266,9 +271,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
*/
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new MVWorldInitListener(this), this);
this.messaging = new MVMessaging();
this.banker = new AllPay(this, LOG_TAG + " ");
this.vaultHandler = new VaultHandler(this);
this.economist = new MVEconomist(this);
// Load the defaultWorldGenerators
this.worldManager.getDefaultWorldGenerators();
@@ -276,8 +282,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP().
this.ph = new MVPermissions(this);
this.bank = this.banker.loadEconPlugin();
// Setup the command manager
this.commandHandler = new CommandHandler(this, this.ph);
// Call the Function to assign all the Commands to their Class.
@@ -297,7 +301,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// Setup & Load our Configuration files.
loadConfigs();
if (this.multiverseConfig != null) {
Logging.setDebugLevel(getMVConfig().getGlobalDebug());
Logging.setShowingConfig(!getMVConfig().getSilentStart());
this.worldManager.loadDefaultWorlds();
this.worldManager.loadWorlds(true);
@@ -326,118 +329,34 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.chatListener = new MVPlayerChatListener(this, this.playerListener);
}
getServer().getPluginManager().registerEvents(this.chatListener, this);
/*
// Check to see if spout was already loaded (most likely):
if (this.getServer().getPluginManager().getPlugin("Spout") != null) {
this.setSpout();
this.log(Level.INFO, "Spout integration enabled.");
}
*/
this.initializeBuscript();
this.setupMetrics();
// Output a little snippet to show it's enabled.
Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors());
if (getMVConfig().isShowingDonateMessage()) {
getLogger().config("Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman");
getLogger().config("One time donations are also appreciated: https://www.paypal.me/dumptruckman");
}
}
private void setupMetrics() {
MetricsConfigurator.configureMetrics(this);
}
/**
* Initializes the buscript javascript library.
*/
private void initializeBuscript() {
buscript = new Buscript(this);
// Add global variable "multiverse" to javascript environment
buscript.getGlobalScope().put("multiverse", buscript.getGlobalScope(), this);
}
/**
* Plotter for Environment-Values.
*/
private static final class EnvironmentPlotter extends Metrics.Plotter {
private MultiverseCore core;
private final Environment env;
public EnvironmentPlotter(MultiverseCore core, Environment env) {
super(envToString(env));
this.core = core;
this.env = env;
}
private static String envToString(Environment env) {
return new StringBuilder().append(env.name().toUpperCase().charAt(0))
.append(env.name().toLowerCase().substring(1)).toString();
}
@Override
public int getValue() {
int count = 0;
for (MultiverseWorld w : core.getMVWorldManager().getMVWorlds())
if (w.getEnvironment() == env)
count++;
core.log(Level.FINE, String.format("Tracking %d worlds of type %s", count, env));
return count;
}
}
/**
* Plotter for Generator-Values.
*/
private static final class GeneratorPlotter extends Metrics.Plotter {
private MultiverseCore core;
private final String gen;
public GeneratorPlotter(MultiverseCore core, String gen) {
super(gen);
this.core = core;
this.gen = gen;
}
@Override
public int getValue() {
int count = 0;
for (MultiverseWorld w : core.getMVWorldManager().getMVWorlds())
if (gen.equals(w.getGenerator()))
count++;
core.log(Level.FINE, String.format("Tracking %d worlds of type %s", count, gen));
return count;
}
}
private void setupMetrics() {
try {
Metrics m = new Metrics(this);
Metrics.Graph envGraph = m.createGraph("worlds_by_env");
for (Environment env : Environment.values())
envGraph.addPlotter(new EnvironmentPlotter(this, env));
m.addCustomData(new Metrics.Plotter("Loaded worlds") {
@Override
public int getValue() {
return getMVWorldManager().getMVWorlds().size();
}
});
m.addCustomData(new Metrics.Plotter("Total number of worlds") {
@Override
public int getValue() {
return getMVWorldManager().getMVWorlds().size()
+ getMVWorldManager().getUnloadedWorlds().size();
}
});
Set<String> gens = new HashSet<String>();
for (MultiverseWorld w : this.getMVWorldManager().getMVWorlds())
gens.add(w.getGenerator());
gens.remove(null);
gens.remove("null");
Metrics.Graph genGraph = m.createGraph("custom_gens");
for (String gen : gens)
genGraph.addPlotter(new GeneratorPlotter(this, gen));
m.start();
log(Level.FINE, "Metrics have run!");
} catch (IOException e) {
log(Level.WARNING, "There was an issue while enabling metrics: " + e.getMessage());
buscript = new Buscript(this);
// Add global variable "multiverse" to javascript environment
buscript.setScriptVariable("multiverse", this);
} catch (NullPointerException e) {
buscript = null;
Logging.warning("Buscript failed to load! The script command will be disabled!");
}
}
@@ -459,10 +378,11 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(this.playerListener, this);
pm.registerEvents(this.entityListener, this);
pm.registerEvents(this.pluginListener, this);
pm.registerEvents(this.weatherListener, this);
pm.registerEvents(this.portalListener, this);
log(Level.INFO, "We are aware of the warning about the deprecated event. There is no alternative that allows us to do what we need to do. The performance impact is negligible.");
pm.registerEvents(this.worldListener, this);
pm.registerEvents(new MVMapListener(this), this);
}
/**
@@ -472,8 +392,19 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
public void loadConfigs() {
// Now grab the Configuration Files.
this.multiverseConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
Configuration coreDefaults = YamlConfiguration.loadConfiguration(this.getClass().getResourceAsStream("/defaults/config.yml"));
this.multiverseConfig.setDefaults(coreDefaults);
InputStream resourceURL = this.getClass().getResourceAsStream("/defaults/config.yml");
// Read in our default config with UTF-8 now
Configuration coreDefaults;
try {
coreDefaults = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(resourceURL, "UTF-8")));
this.multiverseConfig.setDefaults(coreDefaults);
} catch (UnsupportedEncodingException e) {
Logging.severe("Couldn't load default config with UTF-8 encoding. Details follow:");
e.printStackTrace();
Logging.severe("Default configs NOT loaded.");
}
this.multiverseConfig.options().copyDefaults(false);
this.multiverseConfig.options().copyHeader(true);
@@ -497,6 +428,12 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// Old Config Format
this.migrate22Values();
this.saveMVConfigs();
int level = Logging.getDebugLevel();
Logging.setDebugLevel(getMVConfig().getGlobalDebug());
if (level != Logging.getDebugLevel()) {
getServer().getPluginManager().callEvent(new MVDebugModeEvent(level));
}
}
/**
@@ -550,12 +487,22 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
}
}
private static final char PATH_SEPARATOR = '\uF8FF';
/**
* Migrate the worlds.yml to SerializationConfig.
*/
private void migrateWorldConfig() { // SUPPRESS CHECKSTYLE: MethodLength
FileConfiguration wconf = YamlConfiguration
.loadConfiguration(new File(getDataFolder(), "worlds.yml"));
FileConfiguration wconf = new YamlConfiguration();
wconf.options().pathSeparator(PATH_SEPARATOR);
File worldsFile = new File(getDataFolder(), "worlds.yml");
try {
wconf.load(worldsFile);
} catch (IOException e) {
log(Level.WARNING, "Cannot load worlds.yml");
} catch (InvalidConfigurationException e) {
log(Level.WARNING, "Your worlds.yml is invalid!");
}
if (!wconf.isConfigurationSection("worlds")) { // empty config
this.log(Level.FINE, "No worlds to migrate!");
@@ -567,14 +514,13 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
boolean wasChanged = false;
Map<String, Object> newValues = new LinkedHashMap<String, Object>(values.size());
for (Map.Entry<String, Object> entry : values.entrySet()) {
if (entry.getValue() instanceof MVWorld) {
if (entry.getValue() instanceof WorldProperties) {
// fine
newValues.put(entry.getKey(), entry.getValue());
} else if (entry.getValue() instanceof ConfigurationSection) {
this.log(Level.FINE, "Migrating: " + entry.getKey());
// we have to migrate this
MVWorld world = new MVWorld(Collections.EMPTY_MAP);
world.setPluginAndWorld(this, entry.getKey());
WorldProperties world = new WorldProperties(Collections.EMPTY_MAP);
ConfigurationSection section = (ConfigurationSection) entry.getValue();
// migrate animals and monsters
@@ -608,8 +554,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// migrate entryfee
if (section.isConfigurationSection("entryfee")) {
ConfigurationSection feeSection = section.getConfigurationSection("entryfee");
if (feeSection.isInt("currency"))
world.setCurrency(feeSection.getInt("currency"));
if (feeSection.isInt("currency")) {
world.setCurrency(MaterialConverter.convertConfigType(feeSection, "currency"));
}
if (feeSection.isDouble("amount"))
world.setPrice(feeSection.getDouble("amount"));
@@ -668,8 +615,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// migrate portalform
if (section.isString("portalform")) {
try {
world.setPropertyValue("portalform", section.getString("portalform"));
} catch (PropertyDoesNotExistException e) {
world.setProperty("portalform", section.getString("portalform"), true);
} catch (NoSuchPropertyException e) {
throw new RuntimeException("Who forgot to update the migrator?", e);
}
}
@@ -677,8 +624,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// migrate environment
if (section.isString("environment")) {
try {
world.setPropertyValue("environment", section.getString("environment"));
} catch (PropertyDoesNotExistException e) {
world.setProperty("environment", section.getString("environment"), true);
} catch (NoSuchPropertyException e) {
throw new RuntimeException("Who forgot to update the migrator?", e);
}
}
@@ -716,7 +663,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// migrate spawn
if (section.isConfigurationSection("spawn")) {
ConfigurationSection spawnSect = section.getConfigurationSection("spawn");
Location spawnLoc = world.getSpawnLocation();
Location spawnLoc = new NullLocation();
if (spawnSect.isDouble("yaw"))
spawnLoc.setYaw((float) spawnSect.getDouble("yaw"));
if (spawnSect.isDouble("pitch"))
@@ -733,7 +680,14 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// migrate difficulty
if (section.isString("difficulty")) {
final Difficulty difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
Difficulty difficulty;
try {
difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
} catch (IllegalArgumentException e) {
this.log(Level.WARNING, "Could not parse difficulty: " + section.getString("difficulty"));
this.log(Level.WARNING, "Setting world " + entry.getKey() + " difficulty to NORMAL");
difficulty = Difficulty.NORMAL;
}
if (difficulty != null) {
world.setDifficulty(difficulty);
}
@@ -822,6 +776,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.commandHandler.registerCommand(new GeneratorCommand(this));
this.commandHandler.registerCommand(new CheckCommand(this));
this.commandHandler.registerCommand(new ScriptCommand(this));
this.commandHandler.registerCommand(new GameruleCommand(this));
this.commandHandler.registerCommand(new GamerulesCommand(this));
}
/**
@@ -830,8 +786,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
@Override
public void onDisable() {
this.saveMVConfigs();
this.banker = null;
this.bank = null;
Logging.shutdown();
}
@@ -848,17 +802,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
}
}
/**
* {@inheritDoc}
*
* @deprecated This is deprecated.
*/
@Override
@Deprecated
public com.onarandombox.MultiverseCore.utils.SafeTTeleporter getTeleporter() {
return new com.onarandombox.MultiverseCore.utils.SafeTTeleporter(this);
}
/**
* {@inheritDoc}
*/
@@ -1017,26 +960,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.pluginCount -= 1;
}
/**
* {@inheritDoc}
* @deprecated Now using Vault.
*/
@Override
@Deprecated
public AllPay getBanker() {
return this.banker;
}
/**
* {@inheritDoc}
* @deprecated Now using Vault.
*/
@Override
@Deprecated
public void setBank(GenericBank bank) {
this.bank = bank;
}
/**
* {@inheritDoc}
*/
@@ -1078,25 +1001,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.serverFolder = newServerFolder;
}
/*
/**
* Initializes Spout.
* /
public void setSpout() {
this.spoutInterface = new SpoutInterface();
this.commandHandler.registerCommand(new SpoutCommand(this));
}
/**
* Gets our {@link SpoutInterface}.
*
* @return The {@link SpoutInterface} we're using.
* /
public SpoutInterface getSpout() {
return this.spoutInterface;
}
*/
/**
* {@inheritDoc}
*/
@@ -1229,6 +1133,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
*/
@Override
public void setBlockSafety(BlockSafety bs) {
if (bs == null) {
throw new NullPointerException("block safety may not be null.");
}
this.blockSafety = bs;
}
@@ -1287,4 +1194,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
public Buscript getScriptAPI() {
return buscript;
}
public UnsafeCallWrapper getUnsafeCallWrapper() {
return this.unsafeCallWrapper;
}
}
@@ -1,12 +1,14 @@
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 java.util.Map;
import org.bukkit.Bukkit;
/**
* Our configuration.
@@ -44,6 +46,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
@Property
private volatile boolean prefixchat;
@Property
private volatile String prefixchatformat;
@Property
private volatile boolean useasyncchat;
@Property
private volatile boolean teleportintercept;
@@ -63,6 +67,14 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
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();
@@ -83,6 +95,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
enforceaccess = false;
useasyncchat = true;
prefixchat = true;
prefixchatformat = "[%world%]%chat%";
teleportintercept = true;
firstspawnoverride = true;
displaypermerrors = true;
@@ -91,6 +104,10 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
teleportcooldown = 1000;
this.version = 2.9;
silentstart = false;
defaultportalsearch = false;
portalsearchradius = 128;
autopurge = true;
idonotwanttodonate = false;
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
}
@@ -139,6 +156,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
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}
@@ -203,6 +236,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
public void setGlobalDebug(int globalDebug) {
this.globaldebug = globalDebug;
Logging.setDebugLevel(globalDebug);
Bukkit.getPluginManager().callEvent(new MVDebugModeEvent(globalDebug));
}
/**
@@ -289,4 +323,44 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
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);
}
}
@@ -8,10 +8,9 @@
package com.onarandombox.MultiverseCore.api;
import buscript.Buscript;
import com.fernferret.allpay.AllPay;
import com.fernferret.allpay.GenericBank;
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;
@@ -19,7 +18,6 @@ import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.VaultHandler;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
/**
@@ -29,32 +27,24 @@ import org.bukkit.entity.Player;
*/
public interface Core {
/**
* Gets the Multiverse config file.
*
* @return The Multiverse config file.
* @deprecated Don't modify the config-file manually!
*/
@Deprecated
FileConfiguration getMVConfiguration();
/**
* Gets the Banking system that Multiverse-Core has hooked into.
*
* @return A {@link GenericBank} that can be used for payments.
* @deprecated Now using vault, see {@link VaultHandler#getEconomy}
*/
@Deprecated
GenericBank getBank();
/**
* 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.
@@ -80,17 +70,6 @@ public interface Core {
*/
MVPlayerSession getPlayerSession(Player player);
/**
* Gets the instantiated Safe-T-Teleporter for performing
* safe teleports.
*
* @return A non-null {@link SafeTTeleporter}.
*
* @deprecated Use {@link #getSafeTTeleporter()} instead.
*/
@Deprecated
com.onarandombox.MultiverseCore.utils.SafeTTeleporter getTeleporter();
/**
* Multiverse uses an advanced permissions setup, this object
* simplifies getting/setting permissions.
@@ -118,7 +97,7 @@ public interface Core {
/**
* Gets the primary class responsible for managing Multiverse Worlds.
*
* @return {@link WorldManager}.
* @return {@link MVWorldManager}.
*/
MVWorldManager getMVWorldManager();
@@ -151,24 +130,6 @@ public interface Core {
@Deprecated
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed);
/**
* Sets the {@link GenericBank}-Bank AllPay is using.
*
* @param bank The new {@link GenericBank}
* @deprecated Now using vault, see {@link VaultHandler#getEconomy}
*/
@Deprecated
void setBank(GenericBank bank);
/**
* Gets this plugin's {@link AllPay}-Banker.
*
* @return An {@link AllPay}-Banker
* @deprecated Now using vault, see {@link VaultHandler#getEconomy}
*/
@Deprecated
AllPay getBanker();
/**
* Decrements the number of plugins that have specifically hooked into core.
*/
@@ -30,14 +30,14 @@ public interface MVPlugin extends LoggablePlugin {
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link MultiverseCore}.
* @return A valid {@link com.onarandombox.MultiverseCore}.
*/
MultiverseCore getCore();
/**
* Sets the reference to MultiverseCore.
*
* @param core A valid {@link MultiverseCore}.
* @param core A valid {@link com.onarandombox.MultiverseCore}.
*/
void setCore(MultiverseCore core);
@@ -9,7 +9,6 @@ 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;
@@ -65,16 +64,30 @@ public interface MVWorldManager {
*
* @param oldName Name of world to be copied
* @param newName Name of world to be created
* @param generator The Custom generator plugin to use.
* @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);
/**
* Remove the world from the Multiverse list, from the
* config and deletes the folder.
* Make a copy of a world.
*
* @param name The name of the world to remove
* @param oldName
* Name of world to be copied
* @param newName
* Name of world to be created
* @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);
@@ -109,6 +122,15 @@ public interface MVWorldManager {
*/
boolean unloadWorld(String name);
/**
* Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.
*
* @param name Name of the world to unload
* @param unloadBukkit True if Bukkit world should be unloaded
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name, boolean unloadBukkit);
/**
* Loads the world. Only use this if the world has been
* unloaded with {@link #unloadWorld(String)}.
@@ -177,7 +199,7 @@ public interface MVWorldManager {
boolean isMVWorld(World world);
/**
* Load the Worlds & Settings from the configuration file.
* 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.
@@ -185,7 +207,7 @@ public interface MVWorldManager {
void loadWorlds(boolean forceLoad);
/**
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
* 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.
*/
@@ -278,4 +300,18 @@ public interface MVWorldManager {
* @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);
}
@@ -121,6 +121,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
* @return prefixChat.
*/
boolean getPrefixChat();
/**
* Sets prefixChatFormat.
* @param prefixChatFormat The new value.
*/
void setPrefixChatFormat(String prefixChatFormat);
/**
* Gets prefixChatFormat.
* @return prefixChatFormat.
*/
String getPrefixChatFormat();
/**
* Sets enforceAccess.
@@ -159,4 +171,60 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
* @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);
}
@@ -9,15 +9,16 @@ 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;
@@ -154,37 +155,6 @@ public interface MultiverseWorld {
*/
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
/**
* Gets the actual MVConfigProperty from this world.
* It will throw a PropertyDoesNotExistException if the property is not found.
*
* @param property The name of a world property to get.
* @param expected The type of the expected property. Use Object.class if this doesn't matter for you.
* @param <T> The type of the expected property.
*
* @return A valid MVWorldProperty.
*
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
* @deprecated We don't use {@link com.onarandombox.MultiverseCore.configuration.MVConfigProperty} any longer!
*/
@Deprecated
<T> com.onarandombox.MultiverseCore.configuration.MVConfigProperty<T> getProperty(String property, Class<T> expected) throws PropertyDoesNotExistException;
// old config
/**
* Adds the property to the given value.
* It will throw a PropertyDoesNotExistException if the property is not found.
*
* @param property The name of a world property to set.
* @param value A value in string representation, it will be parsed to the correct type.
* @param sender The sender who wants this value to be set.
* @return True if the value was set, false if not.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
* @deprecated Use {@link #setPropertyValue(String, String)} instead.
*/
@Deprecated
boolean setProperty(String property, String value, CommandSender sender) throws PropertyDoesNotExistException;
/**
* Adds a value to the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
*
@@ -505,26 +475,28 @@ public interface MultiverseWorld {
/**
* Sets the price for entry to this world.
* You can think of this like an amount.
* The type can be set with {@link #setCurrency(int)}
* 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.
* 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.
* @return The type of currency that will be used when users enter this world.
*/
int getCurrency();
@Nullable
Material getCurrency();
/**
* Sets the type of item that will be required given the price is not 0.
* Use -1 to use an AllPay economy, or any valid itemid
* Use a value of null to specify a non-item based currency.
*
* @param item The Type of currency that will be used when users enter this world.
*/
void setCurrency(int item);
void setCurrency(@Nullable Material item);
/**
* Gets the world players will respawn in if they die in this one.
@@ -685,4 +657,18 @@ public interface MultiverseWorld {
* @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);
}
@@ -9,7 +9,7 @@ import com.onarandombox.MultiverseCore.enums.TeleportResult;
/**
* Used to safely teleport people.
*/
public interface SafeTTeleporter {
public interface SafeTTeleporter extends Teleporter {
/**
* Gets the next safe location around the given location.
@@ -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);
}
@@ -17,7 +17,7 @@ public interface WorldPurger {
void purgeWorlds(List<MultiverseWorld> worlds);
/**
* Convenience method for {@link #purgeWorld(CommandSender, MultiverseWorld, List, boolean, boolean)} that takes the settings from the world-config.
* Convenience method for {@link #purgeWorld(MultiverseWorld, java.util.List, boolean, boolean)} that takes the settings from the world-config.
*
* @param world The {@link MultiverseWorld}.
*/
@@ -7,15 +7,14 @@
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
/**
* Creates a clone of a world.
@@ -34,27 +33,23 @@ public class CloneCommand extends MultiverseCommand {
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.addCommandExample("To clone a world that uses a generator:");
this.addCommandExample("/mv clone " + ChatColor.GOLD + "CleanRoom"
+ ChatColor.GREEN + " CleanRoomCopy" + ChatColor.DARK_AQUA + " -g CleanRoomGenerator");
this.setPermission("multiverse.core.clone", "Clones a world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Class<?>[] paramTypes = {String.class, String.class, String.class};
List<Object> objectArgs = new ArrayList<Object>();
objectArgs.add(args.get(0));
objectArgs.add(args.get(1));
objectArgs.add(CommandHandler.getFlag("-g", args));
if (!this.worldManager.isMVWorld(args.get(0))) {
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 " + args.get(0) + ", so we can't clone it!");
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;
}
this.plugin.getCommandHandler().queueCommand(sender, "mvclone", "cloneWorld", objectArgs,
paramTypes, ChatColor.GREEN + "World Cloned!", ChatColor.RED + "World could NOT be cloned!");
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!");
}
}
}
@@ -62,7 +62,7 @@ public class CoordCommand extends MultiverseCommand {
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 + Material.getMaterial(world.getBlockTypeIdAt(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.");
}
@@ -27,15 +27,19 @@ public class DeleteCommand extends MultiverseCommand {
this.setArgRange(1, 1);
this.addKey("mvdelete");
this.addKey("mv delete");
this.addCommandExample("/mv create " + ChatColor.GOLD + "MyWorld");
this.addCommandExample("/mv delete " + ChatColor.GOLD + "MyWorld");
this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
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!");
}
}
@@ -71,12 +71,14 @@ public class EnvironmentCommand extends MultiverseCommand {
*/
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"))
if (type.equalsIgnoreCase("normal")) {
type = "NORMAL";
if (type.equalsIgnoreCase("flat"))
} else if (type.equalsIgnoreCase("flat")) {
type = "FLAT";
if (type.equalsIgnoreCase("largebiomes")) {
} 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
Loaded 100 of 235 files, more files were not shown because too many files have changed in this diff. Show more