Compare commits

..
987 Commits
Author SHA1 Message Date
Jeremy Wood 1708d1dedd Added some javadocs. 2012-11-28 19:14:41 -05:00
Jeremy Wood 32c92fc39d Updated mv_checks.xml 2012-11-21 23:42:30 -05:00
Jeremy Wood 68a84a5041 Added several property validations and world updates. 2012-11-20 16:52:20 -05:00
Jeremy Wood 64835ea400 AbstractMultiverseWorld now observes its WorldProperties via Observer/Observable. 2012-11-20 15:43:51 -05:00
Jeremy Wood 4e9abcb62d Removed try-catch for latest PluginBase. 2012-11-20 10:54:54 -05:00
Jeremy Wood f5943d87a1 Updates for PluginBase. 2012-11-18 21:19:00 -05:00
Jeremy Wood 50dd916b0c Added remaining properties. 2012-11-11 22:46:34 -05:00
Jeremy Wood 8cdb221695 Added almost all of the world properties. 2012-11-11 12:30:19 -05:00
Jeremy Wood 841cd14098 Removed branch spillover. 2012-11-11 11:23:06 -05:00
Jeremy Wood 818222c39a Attempting multiverse repos now.. 2012-11-11 10:56:53 -05:00
Jeremy Wood 8c3f662579 trying different id, exactly like PluginBase now. 2012-11-11 10:55:31 -05:00
Jeremy Wood c3acaa4298 Trying different repos. 2012-11-11 10:52:11 -05:00
Jeremy Wood eb4eee83ad Trying bukkit-thirdparty. 2012-11-11 01:54:29 -05:00
Jeremy Wood c29f937fd8 Use correct repo url... 2012-11-11 01:37:10 -05:00
Jeremy Wood 9b67bf355d Fixed distribution management, maybe. 2012-11-11 01:33:19 -05:00
Jeremy Wood 19df3066a6 Added chestyle files. 2012-11-11 01:22:50 -05:00
Jeremy Wood 8227626613 Readded descriptions to properties. 2012-11-10 17:26:20 -05:00
Jeremy Wood 228e0562a4 Changed order of command registration. 2012-11-10 17:10:00 -05:00
Jeremy Wood 020dee2ab0 Exception messages now formatted better. 2012-11-10 10:55:22 -05:00
Jeremy Wood 40fff5c241 Now loads default worlds and previously imported worlds. 2012-11-10 02:04:34 -05:00
Jeremy Wood f8fd549da9 Import command now working! 2012-11-10 00:10:29 -05:00
Jeremy Wood b55cf778bc Implemented many property methods. 2012-11-09 23:03:35 -05:00
Jeremy Wood b643b3a3eb Re-added missing method. 2012-11-09 22:47:29 -05:00
Jeremy Wood 7c827c1c8a Fixed dependencies. 2012-11-09 22:44:38 -05:00
Jeremy Wood 6c313d1486 Removed todo. 2012-11-09 22:43:49 -05:00
Jeremy Wood 483bd83175 Removed api module. Refactored back to single implementation style. 2012-11-09 22:43:28 -05:00
Jeremy Wood c425b4d50b changed MVCore to MultiverseCore in api module. 2012-11-09 21:33:03 -05:00
Jeremy Wood f0bac0a84d Woops, missed some messaging stuff. 2012-11-09 21:31:31 -05:00
Jeremy Wood a235b09e8d Updated for latest PluginBase changes. 2012-11-09 21:29:32 -05:00
main() ac8965f1f0 What about this? 2012-11-10 02:09:52 +01:00
main() 2a56398d10 TABS!? What are you doing, Eclipse!? 2012-11-09 21:17:08 +01:00
main() 27639fc13d Optional implementation-specific features in the API.
Like this?
2012-11-09 21:10:36 +01:00
main() b0bb8729f1 gitignore? Are you there? 2012-11-09 21:08:53 +01:00
main() d42001dd33 Refactoring. Refactoring. REFACTORING!
* Added new module: MultiverseCore-API
 * groupId and package change: com.onarandombox.multiverse --> com.mvplugin
 * moved packages around a bit
2012-11-09 21:00:55 +01:00
main() c21e640dbd Added some values to Difficulty 2012-11-09 19:22:03 +01:00
Jeremy Wood b1c915f903 Fleshed out PlayerPosition. 2012-11-09 13:13:13 -05:00
Jeremy Wood 1899b45611 Merge pull request #955 from ammaraskar/rewrite_thing
Added some more basic properties
2012-11-09 10:01:55 -08:00
Ammar Askar 2aee358ec1 Added some more basic properties 2012-11-09 23:01:20 +05:00
Jeremy Wood ea38d3dc4e BukkitWorldManager should now be able to create a BukkitMultiverseWorld. 2012-11-09 12:56:29 -05:00
Jeremy Wood a230a340c7 Added BukkitMultiverseWorld implementation. 2012-11-09 12:56:07 -05:00
Jeremy Wood 48ccb2585d MultiverseCore now returns a WorldManager. 2012-11-09 12:55:07 -05:00
Jeremy Wood 0ac858c361 Added getWorldUID method to MultiverseWorld. 2012-11-09 12:54:44 -05:00
Jeremy Wood 0395ead29d Clarified comments in Core. 2012-11-09 12:54:19 -05:00
Jeremy Wood 227fb9ba81 Added generic to WorldManager so that it will return the implementation specific version of MultiverseWorld API. 2012-11-09 12:53:59 -05:00
Jeremy Wood 8c0a750d3e Added getWorldProperties method to WorldManager. 2012-11-09 12:52:55 -05:00
Jeremy Wood ea0d1c6702 Added AbstractMultiverseWorld as a basic skeleton for MultiverseWorld implementations. 2012-11-09 12:49:55 -05:00
Jeremy Wood 5ed096fb8f Added a Language class for Bukkit specific language. 2012-11-09 12:49:22 -05:00
Jeremy Wood 693f1f2bf1 Added MultiverseWorld API for Bukkit. 2012-11-09 12:48:49 -05:00
Jeremy Wood 8aa5428a14 Added Yaml implementation of WorldProperties. 2012-11-09 12:48:23 -05:00
Jeremy Wood 16eebc462b Almost able to load a world. 2012-11-08 17:24:55 -05:00
Jeremy Wood 9adef4b2ab Added import command. 2012-11-08 12:58:10 -05:00
Jeremy Wood 16b854e8a6 Fleshed out more of the API before adding Import command. 2012-11-08 12:28:56 -05:00
Jeremy Wood a09fa7781f Fleshed out the new MultiverseWorld interface. 2012-11-07 23:32:42 -05:00
Jeremy Wood ec22c930d0 Added a couple world properties. 2012-11-06 17:29:44 -05:00
Jeremy Wood 1d369378b4 Created the basic project structure for Multiverse 3 2012-11-06 15:18:19 -05:00
Jeremy Wood b888561d98 Added package-private method for setting MVWorld plugin and name. Fixes #923. 2012-11-05 13:08:37 -05:00
Jeremy Wood f210851294 Changed how we deal with CB world reference. Partially fixes #923. 2012-11-05 13:02:03 -05:00
main() 73e394d5ec Style. 2012-11-05 16:40:06 +01:00
Jeremy Wood 63f8811b67 Fixed #942. 2012-11-05 09:05:11 -05:00
Jeremy Wood d01ce71343 Fixed #935. 2012-10-31 08:31:07 -04:00
Jeremy Wood fe00aae7e3 Fixes #934 - Vault dependency issue. 2012-10-30 08:45:05 -04:00
Jeremy Wood d4347d0cff Fixed incorrect log level. 2012-10-25 15:48:28 -03:00
Jeremy Wood b033d59b8a Optimized some log messages and change some Level.INFO messages to Level.CONFIG for the new silent start mode. Fixes #697. 2012-10-25 14:36:44 -04:00
Jeremy Wood aedbfd7bab Added command "mv silent [on|off]" for enabling silent startup mode. 2012-10-25 14:35:22 -04:00
Jeremy Wood b93822502e Reverted debug command. 2012-10-25 14:02:01 -04:00
Jeremy Wood f053f0546b Now using Logging 1.0.9! 2012-10-25 13:56:57 -04:00
Jeremy Wood af3b3d0fab Added ability to set debug level to -1 to disable common startup messages. 2012-10-25 10:43:57 -04:00
Jeremy Wood b1fa677330 Now using Logging 1.0.8 2012-10-25 10:35:27 -04:00
main() 9691a0f978 Merge pull request #931 from ammaraskar/limit
Add player limit per world. Closes #727.
2012-10-25 02:11:29 -07:00
Ammar Askar 0b1a387003 Add player limit per world. Addresses #727 2012-10-25 14:02:27 +05:00
Jeremy Wood 4ce503f55e Cow using EnumSet for maximum performance!!!! 2012-10-23 14:26:09 -04:00
main() 74947a7efd Fixed all other style warnings 2012-10-23 16:58:16 +02:00
main() 85cd71cb8a Fixed high priority style warnings 2012-10-23 16:49:08 +02:00
Jeremy Wood 3ad7d86f74 Deprecated DebugLog. 2012-10-22 17:40:39 -04:00
Jeremy Wood ac9194ec87 Now building with SerializationConfig 1.6c, finally fixes weird config exception messages. 2012-10-22 17:35:06 -04:00
main() 96e8208f3d Merge branch 'ammaraskar_folder' 2012-10-22 19:08:15 +02:00
Ammar Askar 895360ce8b Only delete world folder contents on mv regen, fixes #767 2012-10-22 19:06:19 +02:00
main() 59e34ef353 Merge pull request #925 from ammaraskar/entities
Add golems to animals fixes #891
2012-10-22 08:39:44 -07:00
Ammar Askar 11e556c099 Add golems to animals fixes #891 2012-10-22 20:34:01 +05:00
main() a9579a6594 Merge pull request #922 from ammaraskar/spawn
Added configurable animal and monster ticks per spawn setting. Fixes #519
2012-10-22 04:12:42 -07:00
Ammar Askar 5a1fe2a9e5 Added configurable animal and monster ticks per spawn setting. Fixes #519 2012-10-22 13:20:09 +05:00
Eric Stokes 1c5c792cf3 A broadcast is not needed if we're not doing anything 2012-10-21 18:57:54 -06:00
Eric Stokes dbe9494dbf Fixed Bed Spawns
This fixes #652 and fixes #916
This also fixes some other issues with NullPointerExceptions when trying to teleport to a bed if it was invalid.
2012-10-21 18:49:48 -06:00
Jeremy Wood b116effa2b Using HashSet instead of ArrayList for better contains() efficiency. 2012-10-21 17:55:41 -04:00
Jeremy Wood d361ceb45b Increased efficiency/safety of recent /mv who changes. 2012-10-21 17:49:51 -04:00
Eric Stokes 35709f5389 Tell user when creating a duplicate world
Fixes #921
2012-10-21 14:49:56 -06:00
Eric Stokes b45a4cf20a Fix NPCs Showing up in mv who
This fixes #501. FINALLY!

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

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

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

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

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

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

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

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

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

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

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

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

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

This will break the latest other Plugin builds.
2011-10-13 21:38:44 -04:00
fernferret d3c1538083 Fix config.yml overwriting worlds.yml, Fix invalid spawn locations 2011-10-13 16:37:53 -04:00
fernferret b2ef10a699 Revamp config to simpler 2.4 format 2011-10-12 21:50:03 -04:00
fernferret fba3f71238 Fix invalid values in /mv config, Closes #178 2011-10-12 17:04:21 -04:00
fernferret af3dcf049d Remove outdated values from config.yml, Fix Configs and reloading, Closes #186 2011-10-12 16:50:04 -04:00
fernferret a30222bec7 Show whether or not gamemode is being enforced, Fix enum Config Property 2011-10-11 22:51:30 -04:00
fernferret 86af11b662 Fixes for hidden worlds displaying as null 2011-10-11 21:57:35 -04:00
fernferret 750adcf376 Fix color checking, fix price reporting failure on successful set 2011-10-11 17:01:56 -04:00
fernferret c200d43f51 Bunch of NPE fixes 2011-10-11 16:45:47 -04:00
fernferret f4093cbe51 Implement new config items 2011-10-10 21:37:58 -04:00
fernferret 4366b16a74 Start using the new config 2011-10-10 20:40:31 -04:00
fernferret cfdd1ac38c Remove naming conflict with bukkit 2011-10-10 20:12:22 -04:00
fernferret 3e10f18079 Add a bunch of examples, add loadworld to the plugin.yml 2011-10-10 13:02:29 -06:00
fernferret c7c73e7094 Implement Check Command 2011-10-10 12:28:02 -06:00
fernferret c7e5816b2e Add better debug for world access 2011-10-10 11:57:45 -06:00
fernferret 50a89b7b1a Update Config.yml, implement enforceaccess
Cache enforceaccess and enforcegamemodes, as both of these get accessed
a lot.
2011-10-10 11:49:53 -06:00
fernferret 1aad872333 Start adding the Config Command 2011-10-10 11:31:22 -06:00
fernferret 73b42b5430 Merge branch 'master' of https://github.com/Multiverse/Multiverse-Core 2011-10-10 09:36:36 -06:00
fernferret e93fec45ac Much needed code reformat 2011-10-10 09:34:04 -06:00
Eric Stokes 23933c4706 Correct some javadoc 2011-10-10 07:50:03 -06:00
Eric Stokes 9e14daac1f Implement getMvWorld 2011-10-09 21:03:05 -06:00
Eric Stokes aa079b2920 Add Colored string to the alias, remove Double, use double 2011-10-09 20:26:23 -06:00
Eric Stokes bac24e1c97 Use the MultiverseWorld instead of MVWorld 2011-10-09 20:10:59 -06:00
Eric Stokes c72f602045 Fix MVINFO NPE, Fix NPE on startup with addWorld, Remove deprecated methods 2011-10-09 18:25:42 -06:00
Eric Stokes c22a8a9d18 Implement new world creation methods 2011-10-09 18:11:36 -06:00
Eric Stokes 2759d75125 Finalize API v5 2011-10-09 16:36:05 -06:00
Eric Stokes 980381194b Continue updating API. Fix squids not being monitored, Closes #181 2011-10-09 15:38:18 -06:00
Eric Stokes 8370a72776 Add hunger API, bump protocol to 5 2011-10-09 11:48:09 -06:00
Eric Stokes e0f9344d20 Merge branch 'master' of github.com:Multiverse/Multiverse-Core 2011-10-09 11:43:13 -06:00
Eric Stokes 3fde98049f Add a bunch more to the API 2011-10-09 11:31:50 -06:00
main() 40c04a1f4e Made removePlayersFromWorld() visible from the API and moved the javadoc 2011-10-09 19:27:40 +02:00
Eric Stokes 5386aadbb7 Add new api items for hiding worlds, Move the severe perms error to a level 2 log 2011-10-09 08:51:29 -06:00
Eric Stokes 5e0903086e Display API version, fix difficulty enums missing 2011-10-08 14:59:47 -06:00
Eric Stokes ff47610424 Bump protocol to 4 2011-10-08 14:29:44 -06:00
Eric Stokes 84e178d12e Bump API to version 3 2011-10-08 12:38:54 -06:00
Eric Stokes f2a263f86c Merge WorldManager Changes to keep the API happy 2011-10-08 12:38:23 -06:00
Eric Stokes 3c750104a5 rename some methods in the WorldManagerAPI 2011-10-08 12:36:57 -06:00
main() f69c85e6b0 Added loadWorld(String name) to the WorldManager and made it accessible with a command
Added some "'" around log-messages
2011-10-08 12:28:27 -06:00
Eric Stokes 6e4de79bfb Add WorldManager API, API is now level 2 2011-10-08 11:57:50 -06:00
Eric Stokes 2d112edee5 Start writing the Core API 2011-10-08 11:42:35 -06:00
Eric Stokes 4a634e8418 Final backwards compatability checks 2011-10-08 10:57:48 -06:00
Eric Stokes e31f2c79ac Fix breakages with SignPortals 2011-10-08 10:14:52 -06:00
Eric Stokes cc3889b166 Increment v to 2.1, start adding dummy files 2011-10-08 08:22:19 -06:00
Eric Stokes 7bbdac9012 Move a bunch of classes into utils 2011-10-07 18:47:39 -06:00
Eric Stokes d04a42ee92 Move utils package inside multiversecore 2011-10-07 18:26:40 -06:00
Eric Stokes fa80b66ac2 Pull changes from master 2011-10-07 18:22:54 -06:00
Eric Stokes ae19604eab Add difficulty to the info command 2011-10-03 19:59:29 -06:00
Eric Stokes 6e7daf4e85 And this is why we need unit tests... 2011-10-03 19:40:21 -06:00
Eric Stokes 86d3628b1c Actually save the difficulty 2011-10-03 19:24:38 -06:00
Rigby 9be14a2a0c You just can't get the right staff these days... 2011-10-04 01:28:42 +01:00
Eric Stokes 091c5a9621 Move GameMode check to onPlayerChangeWorld, fix difficulty case settings 2011-10-03 17:43:57 -06:00
Eric Stokes c566ead9ef Add multiworld difficulty 2011-10-02 21:18:25 -06:00
Eric Stokes d97bbfb1b1 Fixed Hunger/Food setting Closes #119 2011-09-28 19:56:41 -06:00
Eric Stokes ea6e94d99d Fix Signportals not going anywhere 2011-09-28 19:34:00 -06:00
Eric Stokes f0ae8cbb8e Ensure that the world players are going to is not null 2011-09-28 17:02:21 -06:00
Eric Stokes 1a6e93f0df Add aditional checks for onPlayerPortal 2011-09-28 16:28:09 -06:00
Eric Stokes 8fe128ec0f Add more api items 2011-09-26 20:21:39 -06:00
Eric Stokes f3cd433e80 Remove ALL perms3 refs 2011-09-25 12:11:42 -06:00
Eric Stokes 0964f461eb Remove Permissions 3 support 2011-09-25 12:02:28 -06:00
Eric Stokes fa409ac4f5 Remove fakePvp from the API 2011-09-25 11:05:48 -06:00
Eric Stokes 3753256611 Move destinations to their own package 2011-09-25 10:46:07 -06:00
Eric Stokes b378b0cf79 Update World API's comments to reflect new API changes 2011-09-25 10:43:22 -06:00
Eric Stokes e5646bbbfd Remove silly nullable reference 2011-09-25 10:41:43 -06:00
Eric Stokes 66538ccd02 Moved API around, added more docs 2011-09-25 10:40:23 -06:00
Eric Stokes d63c043368 New code format 2011-09-25 09:14:17 -06:00
Eric Stokes 65dce752d4 Don't set the hunger, only cancel the events 2011-09-22 19:47:14 -06:00
Eric Stokes 268b272f4d Implement Hunger. Untested 2011-09-21 22:15:16 -06:00
Eric Stokes eb0b83c507 Add getHunger api. No implementation yet 2011-09-21 19:26:02 -06:00
Eric Stokes f009ad6dd6 Merge branch 'master' into development 2011-09-21 17:50:16 -06:00
Eric Stokes 6b543a793a Add BedDestination 2011-09-21 17:45:10 -06:00
Rigby 05de5055ab Lets try this. 2011-09-21 19:16:25 +01:00
Rigby 688ea7a1d3 Merge branch 'master' of github.com:Herocraft/Multiverse-Core 2011-09-21 18:43:18 +01:00
Rigby fc02efd90f Added Doxygen... hopefully we'll have pretty JavaDocs. 2011-09-21 18:42:44 +01:00
Eric Stokes 6039009e3f Merge branch 'master' into development 2011-09-18 13:53:36 -06:00
Eric Stokes a9cb378eab Fixed the from worlds being the to worlds. 2011-09-18 13:51:28 -06:00
Eric Stokes fcfa45717c Fix Change Gamemode with NetherPortals, Fix NetherPortals allowing you entry to worlds you shouldn't be able to access. 2011-09-18 13:22:48 -06:00
Eric Stokes 9333f70add Working on messaging 2011-09-18 13:04:37 -06:00
Eric Stokes 30704338e6 Require spawn permission if you're using mvtp to go back to spawn (Thanks Verrier!) 2011-09-18 12:31:41 -06:00
Eric Stokes 17a519f961 Add the teleport permissions to the teleport command... oops 2011-09-18 11:45:06 -06:00
Eric Stokes 74aba9d6e8 Refactor so a Teleporter can be a CommandSender 2011-09-18 10:03:59 -06:00
Eric Stokes 43fcbc9af9 Add new messaging stuff 2011-09-18 09:48:46 -06:00
Eric Stokes fa3e0d6186 Check for console, Closes #118 2011-09-18 09:48:23 -06:00
Eric Stokes 20ce518d33 Added Copyright notice and remove trailing whitespace. 2011-09-17 12:59:37 -06:00
Eric Stokes f9481db5a6 Document WorldManager.java 2011-09-17 12:55:28 -06:00
Eric Stokes 1b42a25ccb Only set the velocity if a player did successfully teleport. Issue #72 2011-09-17 11:12:02 -06:00
Eric Stokes e3edcb88df Remove JDK 6 dependency 2011-09-17 10:05:01 -06:00
Eric Stokes bef22ba534 Add Per-Destination perms, Closes #61 2011-09-17 09:59:38 -06:00
Eric Stokes 10d6a7e1dc Add Documentation to MVDestination 2011-09-17 08:27:10 -06:00
Eric Stokes b39098a592 Move Mode to page 1: Closes #111, Fix nether imports not defaulting to 8: Closes #103. 2011-09-17 07:35:39 -06:00
Eric Stokes a2c6dad243 Remove my silly printlines 2011-09-16 19:18:36 -06:00
Eric Stokes b76da91013 Merge branch 'master' of github.com:Herocraft/Multiverse-Core 2011-09-16 18:35:22 -06:00
Eric Stokes e7f97a8ae7 Add new debugging 2011-09-16 18:35:17 -06:00
Rigby e792c338aa Fern's FAULT. 2011-09-16 11:19:52 +01:00
Rigby 133810550f Allow the per world Game Modes to not be enforced. 2011-09-16 10:11:30 +01:00
Eric Stokes 97168043ff Fix && should be ||, Allow Creative mode, Set all players in a world to a specific mode when it's changed 2011-09-14 20:06:03 -06:00
Tim Ekl 40c4ce0a37 Merge branch 'master' into gamemodes 2011-09-14 19:11:47 -04:00
Eric Stokes 318564ccf2 Add new CH and CH checks 2011-09-13 20:13:27 -06:00
Eric Stokes 9c1a9769b2 Update to new AllPay version 2011-09-13 19:54:06 -06:00
Eric Stokes 89ea09fba2 Minor changes
Update CommandHandler
Fix typo in Debug
Version now posts as a Multiverse user
2011-09-11 17:37:32 -06:00
Rigby 9384f96549 Getting ready for 1.8 GameModes.
This setup will allow different worlds to be setup under different gamemodes, it handles per player modes during teleportation to and from Worlds.
2011-09-09 12:25:21 +01:00
Rigby 69b143ada6 Believe this should be a set :). 2011-09-09 12:16:54 +01:00
Jeff Wardian a97b6f80d2 Fixed ArrayIndexOutofBounds on translateTempSpawn() 2011-09-02 16:26:36 -07:00
Eric Stokes ad47ce7d1b Add Bed Respawns back in! Thanks @Vaht 2011-09-01 19:18:56 -06:00
Eric Stokes d09d340e0f Fix "There are players in <Java Object>" 2011-08-31 21:05:53 -06:00
Eric Stokes 751ed5a8e8 Check for null creature types. Closes #83 2011-08-29 17:03:59 -06:00
Eric Stokes a0667d49b8 Fix our Custom PTA not obeying useSafeTeleporter 2011-08-25 19:42:52 -06:00
Eric Stokes 8c45d0b76a Exact destinations now don't use the safeTeleport check. Add API hook to allow this to be configurable per destination. 2011-08-25 19:31:46 -06:00
Eric Stokes 319567eb67 Fix the console spewing many many errors. Sorry. 2011-08-24 20:01:50 -06:00
Eric Stokes 7a38806134 Remove Additional Private Deprecations, Must keep methods until Portals 2.1 is out. 2011-08-24 19:05:20 -06:00
Eric Stokes b6755a1047 Return the Permission if it was created, or the old one if it existed. 2011-08-24 18:49:13 -06:00
Eric Stokes 69360a49ec Move World Functions to a new WorldManager. 2011-08-24 17:25:30 -06:00
Eric Stokes 3876c0f47f Remove prints. 2011-08-24 16:38:08 -06:00
Eric Stokes 5fe8f76c34 Add MVTeleportEvent back in. 2011-08-23 16:48:11 -06:00
Eric Stokes e556261e84 Small changes to BlockSafety for MVPortals, Remove hard spout dependency for real this time. Thanks @lithium3141 2011-08-22 19:53:00 -06:00
Eric Stokes 8d09c19988 Add the MVTravelAgent to Core since NetherPortals, Portals _and_ SignPortals use it. 2011-08-22 17:58:54 -06:00
Eric Stokes 4fd0150945 Add ability to query all generator plugins via /mv generators 2011-08-21 16:57:17 -06:00
Eric Stokes f96f3151f9 Allow you to set debug in the config. 2011-08-21 14:30:12 -06:00
Eric Stokes 047e0d8001 Remove hard Spout dependency. Sorry. Thanks Fetch! 2011-08-21 12:10:18 -06:00
Eric Stokes 5f88247810 More fixes to the new World Destinations that support pitch and yaw. 2011-08-21 11:38:01 -06:00
Eric Stokes d12725ca0e Deprecate 2 location methods in favor of using MVDestination instead of Location to preserver velocity. 2011-08-21 10:32:07 -06:00
Eric Stokes dc9f2fc360 Use DisplayName in mvwho Closes #62 2011-08-21 08:36:43 -06:00
Eric Stokes 2c865aa0ff Allow our own spawns to be more accurate, including decimal precision on XYZ and Pitch/Yaw.
We still set the spawn in the bukkit worlds to the inaccurate setting.
No migrator is included for this change, just do /mvss in game.
2011-08-21 08:34:07 -06:00
Eric Stokes f11f3dd88e Allow us to add permissions safely via the Permissions object. 2011-08-20 22:50:06 -06:00
Eric Stokes c503849107 Exposed getSafeLocation 2011-08-20 16:36:39 -06:00
Eric Stokes ce8b042919 Merge branch 'master' into development 2011-08-20 09:16:14 -06:00
Eric Stokes 92a762e5e4 Add MV Debug, Attempted fix for Portal teleportation fail, Water and Doors are now safe materials 2011-08-20 09:07:40 -06:00
Eric Stokes eb4f9700bc Made World Access by default OP. However, opfallback is still set to true by default 2011-08-19 16:48:55 -06:00
Eric Stokes 49e3a42550 Give an easy way of using cannons without portals
Behold: /mvtp cannon-2
2011-08-17 16:49:24 -06:00
Eric Stokes 1ab56096f8 Increment AllPay to 1.0.3 2011-08-16 18:32:05 -06:00
Eric Stokes afc388637f Update AllPay, Hopefully fix the BOSEcon bug 2011-08-16 18:02:43 -06:00
Eric Stokes 93fab486ff Add iCo 6 Support, update to AllPay 1.0.1 2011-08-15 20:53:16 -06:00
Eric Stokes e36210b99a Add spout tests 2011-08-13 14:58:43 -06:00
Eric Stokes f6299c60a0 Fix scale named scaling (thanks krinsdeath) 2011-08-11 18:28:45 -06:00
Eric Stokes 06bc0dea02 Fix not being able to set world scaling. (Thanks krinsdeath) Add pitch to mvcoord, add missing variables to mvinfo 2011-08-11 18:20:35 -06:00
Eric Stokes 11ce604938 Fix NPE when a world was not known by MV Thanks Rockstar04! 2011-08-10 19:35:48 -06:00
Eric Stokes 7ef564799e Actually fixed cannons this time... 2011-08-09 19:23:28 -06:00
Eric Stokes 62f15bb101 Sync the mobs when we clear a list. 2011-08-09 18:41:27 -06:00
Eric Stokes e551b7184d Cannon Refactor, Info fixes, Permissions clarification 2011-08-09 18:13:28 -06:00
Eric Stokes 06830f4e98 Fix Cannons, Closes #53 2011-08-09 17:41:35 -06:00
Eric Stokes c629fe72e4 Yes. Cannons. In Multiverse2. What now. 2011-08-08 22:02:56 -06:00
Eric Stokes 04779cb8ba Fix worlds being reported as deleted. Closes #52 2011-08-08 18:17:55 -06:00
Eric Stokes 1abcb187e6 Removed lightning from what we're watching 2011-08-07 21:06:50 -06:00
Eric Stokes ff89bda57e Add ability to disable weather per world. 2011-08-07 21:03:36 -06:00
Eric Stokes 9b9bbb4091 Fix MvInfo's respawn world 2011-08-07 16:42:50 -06:00
Eric Stokes 818756d45b Fix PlayerDestination 2011-08-07 09:40:22 -06:00
Eric Stokes 23ea0e0c37 Add new PlayerDestination, this build should be treated as unstable 2011-08-07 08:29:23 -06:00
Eric Stokes c9f8b06f34 Update CH 2011-08-06 14:02:14 -06:00
Eric Stokes f06c553055 Fix Animals info actually being monsters info in /mvi 2011-08-05 22:35:55 -06:00
Rigby 6e1cff5d26 Basic implementation of the spawn in memory setting. 2011-08-05 05:12:07 +01:00
Rigby 01b016f002 Prevent multiple configuration saves in the constructor, perform a single save at the end and then consequent saves when settings are changed. 2011-08-05 05:10:21 +01:00
Eric Stokes f81a9d15c0 Remove Spam, Add auto-pastebin code, Minor bugfixes. 2011-08-04 20:26:25 -06:00
Eric Stokes dd388d0d9f Fix world teleports. Whoops. 2011-08-03 20:24:44 -06:00
Eric Stokes 5e7d58a1dd Apparently GH for Mac doesn't handle deletes right yet... 2011-08-03 18:59:52 -06:00
Eric Stokes 1cc47ff1ba Fix "Blah, Blah" in delete command, abs class Dest -> interface MVDest, restrict teleports based on MVDest.getPermissionString. 2011-08-03 18:59:21 -06:00
Eric Stokes 1671a8163d Remove spam on delete. 2011-08-03 18:19:50 -06:00
Eric Stokes 9d2cc9a839 Fix license, Update CH, Fix mvdelete 2011-08-03 18:15:21 -06:00
Eric Stokes 34a0ab2e67 Add some examples to create, upgrade CH 2011-08-02 19:13:23 -06:00
Eric Stokes 4a478d159b Made the mvm commands prettier/more informative. 2011-08-01 20:53:06 -06:00
Eric Stokes dbdc6d91d2 Added search to help command! Thanks @AkiTensai! 2011-08-01 19:51:57 -06:00
Eric Stokes b9e9a65022 Upgrade CH 2011-07-31 21:58:53 -06:00
Eric Stokes ae7000b3ad Curse you Config.save() 2011-07-31 20:52:14 -06:00
Eric Stokes 6c061f1116 Add Version Event, Add MVPlugin Interface. 2011-07-31 19:18:59 -06:00
Eric Stokes 1e9a826999 Finalize the mv info command 2011-07-31 18:24:09 -06:00
Eric Stokes 1a938c8ce8 Command fixes. 2011-07-31 17:29:14 -06:00
Eric Stokes c5108c3463 Upgrade command Handler, start implementing mvinfo 2011-07-31 17:11:59 -06:00
Eric Stokes 9acc46f9d1 Cleaned up MVINFO Closes #47 2011-07-31 08:45:10 -06:00
Eric Stokes de9209b270 Remove debug, Add warning if users have spawn-monsters set to false. 2011-07-31 07:41:09 -06:00
Eric Stokes 3ccc08b9e5 Tune the teleport methods. 2011-07-30 21:28:59 -06:00
Eric Stokes c78e11bf52 Add new vehicle checks 2011-07-30 21:12:16 -06:00
Eric Stokes fbcadd9b21 Merge branch 'master' of github.com:Herocraft/Multiverse-Core 2011-07-30 19:09:36 -06:00
Eric Stokes 9d9a091e7a core work from lith 2011-07-30 19:09:30 -06:00
Tim Ekl 9fbccfded3 Update submodule & POM file 2011-07-30 15:42:31 -06:00
Eric Stokes 0c3a3732be Added fancy formatting to force teleport. 2011-07-30 09:27:18 -06:00
Eric Stokes addd95443a Add second chance to teleports 2011-07-30 09:17:23 -06:00
Eric Stokes a43e033a84 Fix opfallback not playing nicely with new bukkit perms. 2011-07-30 09:02:20 -06:00
Eric Stokes e5e908800d Add spaces to commands. 2011-07-30 00:53:55 -06:00
Eric Stokes 48f51e8a3a Fix Price not being able to be set. Closes #45 2011-07-29 23:17:17 -06:00
Eric Stokes dd129f2776 Fix MVWho Closes #44 2011-07-29 22:29:09 -06:00
Eric Stokes 37914bc4d1 Add LoggablePlugin interface, so we can log without knowing the plugin! 2011-07-29 18:42:17 -06:00
Eric Stokes e888738f0d This shoudld be gone 2011-07-29 18:20:26 -06:00
Eric Stokes f07be132f8 Move Listeners 2011-07-29 18:09:48 -06:00
Eric Stokes 48f9226d27 Refactoring on the ConfigMigrator 2011-07-29 16:57:38 -06:00
Eric Stokes cd7ad37887 Add New ConfigMigrator Style 2011-07-29 16:35:27 -06:00
Eric Stokes dca9a01c25 Fix my misspellings... 2011-07-29 15:54:32 -06:00
Eric Stokes f06642a7ce Add Config Migrate, clean up some logs. 2011-07-29 15:52:43 -06:00
Eric Stokes 0f10451269 Upgrade AllPay. Fix free recognition 2011-07-28 19:12:38 -06:00
Eric Stokes 0d4d344165 Fix WorldDest orientation not being saved. Fixed Permission oopsie. 2011-07-28 18:39:47 -06:00
Eric Stokes dac95eceba Add more currency stuff, lots of cleanup. 2011-07-28 16:14:15 -06:00
Eric Stokes 9e1484408c Add charge for entering worlds, add exemptions 2011-07-27 18:12:58 -06:00
Eric Stokes c81dcb227c Remove BlockSafety Spam, remove useless class. 2011-07-27 16:48:27 -06:00
Eric Stokes ad3643758d upgrade CH 2011-07-26 20:52:35 -06:00
Eric Stokes 0a8b77a99c Updated CH version 2011-07-26 20:45:43 -06:00
Eric Stokes 3eb10dc251 Getting new dependencies working, DO NOT USE THIS BUILD 2011-07-26 19:35:00 -06:00
Eric Stokes 524fe82784 adding new payment stuff 2011-07-26 19:13:25 -06:00
Eric Stokes 970e06042a Finall fix permissions issues 2011-07-26 18:47:33 -06:00
Eric Stokes 70e4bad62b Fix spawn permissions, upgrade CH 2011-07-26 16:58:20 -06:00
Eric Stokes 811aa811bb Yea it's not really a teleport event... 2011-07-26 16:34:22 -06:00
Eric Stokes 52f8476907 Fire off an event when we reload configs, so all plugins can too! 2011-07-26 16:06:00 -06:00
Eric Stokes 4c4fd08dc8 Allow World Destinations to have a direction. 2011-07-26 15:39:44 -06:00
Eric Stokes f9db8ef7f9 Fix getSafeLocation(L) only returning unsafe locations… Silly booleans... 2011-07-25 21:15:47 -06:00
Eric Stokes 6e88301351 Refactored the Teleportation Method. Finally Closes #1 :D 2011-07-25 19:16:00 -06:00
Eric Stokes ecbdff428c Compatibility for vehicles and directions 2011-07-24 17:43:30 -06:00
Eric Stokes 2897d23d4b Fix NSEW
(ha you thought I said NSFW)
2011-07-24 17:20:02 -06:00
Eric Stokes 320a8dfebf Fixed the Remove command having the wrong command. 2011-07-24 16:32:50 -06:00
Eric Stokes d9530061ff Compatibility changes for Portals directions. 2011-07-24 16:30:56 -06:00
Eric Stokes 61e917a60f Test Push. Do not use this build! 2011-07-24 12:10:39 -06:00
Eric Stokes 23158a0707 Compatibility with new Dest Types. 2011-07-23 16:56:19 -06:00
Eric Stokes de3e4ec1cb Now CH supports unordered commands. Yay! (Thanks Rigby) 2011-07-23 07:57:05 -06:00
Eric Stokes 9bf993ef12 Destination fixes. 2011-07-23 07:21:40 -06:00
Eric Stokes 45c76d8faa Remove old Dest References 2011-07-22 23:34:10 -06:00
Eric Stokes e0ebfdb806 Temp Fix for help command params 2011-07-22 23:27:57 -06:00
Eric Stokes 0bbb66737e Fix World Dest Bugs, add Exact Dest type. 2011-07-22 23:19:31 -06:00
Eric Stokes 6ae22cf752 Allow No identifier 2011-07-22 21:44:02 -06:00
Eric Stokes 83aa79deed Add new destination arch. This will break all plugins. 2011-07-22 20:57:56 -06:00
Eric Stokes 0532564431 Forgot the world... 2011-07-21 17:31:39 -06:00
Eric Stokes 04accbfded Add exact destination 2011-07-21 17:27:33 -06:00
Eric Stokes 2c47a414eb Add the multivers.core.tp.* node, decided to leave multiverse.core.tp They both do the same thing 2011-07-21 14:16:24 -06:00
Eric Stokes 1a16636c7a Refactor, Now we safely move players from a world to be unlaoded, unload actually unloads from memory 2011-07-21 14:07:57 -06:00
Eric Stokes a3e27da978 Add multiverse.* and all other recursive perms 2011-07-20 21:44:43 -06:00
Eric Stokes e374a97257 No slash for you! 2011-07-20 18:52:55 -06:00
Rigby 39d0f897b3 Bloody hypens 2011-07-20 16:23:09 +01:00
Rigby 02df3c478c Update .gitignore 2011-07-20 15:49:11 +01:00
Rigby ab1c1be9b1 Swap to Maven -- Hopefully 2011-07-20 15:48:46 +01:00
Eric Stokes c678750c90 Fixed the Version command.
Bad case of the copy pastes...
2011-07-19 17:21:44 -06:00
Eric Stokes 9eff255f47 Add new version cmd, lots of cleanup 2011-07-19 16:51:39 -06:00
Eric Stokes f09bcac644 Check for the MVWorld before doing a Coord - Thanks for the bug report JonDatz! 2011-07-17 19:15:33 -06:00
Eric Stokes e446c99f9e Remove deprecated methods, update all perms to default to OP, except help 2011-07-17 17:13:33 -06:00
Eric Stokes bdefb38f3c I'm sorry Kainzo. Now Core does NOT use PLAYER_MOVE. 2011-07-17 15:45:17 -06:00
Eric Stokes 5aa91c67f5 upgrade CH 2011-07-17 13:40:35 -06:00
Eric Stokes 2d48cda537 Final updates to work with Bukkit Permissions. Yes. MV2 works with the built in Bukkit Permissions system NOW!
The other plugins, however, do not :P Yet.
2011-07-17 13:37:49 -06:00
Eric Stokes 3c4135236d Commit because i've changed just about everything... Doubt this one works. 2011-07-17 13:06:21 -06:00
Eric Stokes bf51adaa3e Node based permissions 2011-07-17 11:01:44 -06:00
Eric Stokes 96fa18eab3 Cleaning up the Commands 2011-07-17 09:12:12 -06:00
Eric Stokes fc7db31b0d Add Exact type 2011-07-16 22:01:01 -06:00
Eric Stokes c9c58c93e6 MVPortals Compatibility changes 2011-07-16 20:19:37 -06:00
Eric Stokes 099bd9dbb6 Add prettier "MV does not know about this" method. Now it will be consistent. 2011-07-16 15:22:23 -06:00
Eric Stokes 8792d3b4c3 Merge branch 'master' of github.com:Herocraft/Multiverse-Core 2011-07-16 14:43:31 -06:00
Eric Stokes 7754f470c7 Merge pull request #40 from AkiTensai/Aki_ModifyCopy
Fixed grammer in command descriptions.
2011-07-16 13:40:27 -07:00
Aki Tensai 0cd86d7212 /mvspawn's description altered 2011-07-16 14:36:00 -06:00
Eric Stokes 2b4ab07417 Bits of cleanup. 2011-07-16 14:11:14 -06:00
Aki Tensai 2a7504c044 Attempting to get my local to get rid of old files. 2011-07-16 14:06:45 -06:00
Aki Tensai 6a6d1a2a10 Altered punctuation on several command's descriptions. Teleport's description altered to state it sends the provided player, or self if no player specified. 2011-07-16 13:59:32 -06:00
Eric Stokes d6f046a4fc Why do letters have to have a cAsE? 2011-07-16 13:31:16 -06:00
Aki Tensai 935f987a4d Merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	src/com/onarandombox/MultiverseCore/command/commands/CreateCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/ModifyAddCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/ModifyClearCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/ModifyRemoveCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/ModifySetCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/SpawnCommand.java
	src/com/onarandombox/MultiverseCore/command/commands/WhoCommand.java
	src/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java
	src/com/onarandombox/MultiverseCore/commands/ImportCommand.java
	src/com/onarandombox/MultiverseCore/commands/ListCommand.java
2011-07-16 13:28:20 -06:00
Eric Stokes c25205f61c Really? Really? Why didn't you catch this before... *sigh* 2011-07-16 12:54:16 -06:00
Eric Stokes 1d87be12e9 Fixed big oopsie in the Migrator - Thanks go out to MV2 tester Kane_Hart for this one! 2011-07-16 12:48:58 -06:00
Eric Stokes eaeb980aeb Changes to Destination, Added more error checking for ConfigMigrator 2011-07-16 11:58:33 -06:00
Eric Stokes 1a8c46581c Fix concurrent modification. Why would I ever have done that... 2011-07-16 08:43:55 -06:00
Eric Stokes a87756480a Add another layer of spawn traials, This is needed for generators such as Cleanroom. This also removes a NPE. 2011-07-16 08:09:56 -06:00
Eric Stokes 952a0be4a8 Pull changes that fix MVDelete 2011-07-16 07:41:26 -06:00
Eric Stokes b2f75c52a6 Remove copying file, the licsense should suffice 2011-07-16 06:45:44 -06:00
Eric Stokes beace36110 Removed spam. 2011-07-15 17:03:00 -06:00
Eric Stokes 48e86a8153 Finalized new respawn functionality 2011-07-15 16:59:32 -06:00
Eric Stokes 3c5a93be3b Remove super long package, convert to shorter. 2011-07-15 14:22:22 -06:00
Eric Stokes b7fd8f970b Remove the editwhite/blacklist garbage. 2011-07-15 14:18:22 -06:00
Rigby 8c8a0b713a Output the world for a more descriptive response. 2011-07-14 03:35:15 +01:00
Rigby 00449e9206 Some more formatting. 2011-07-14 03:31:44 +01:00
Rigby 0925c37eb4 Removed the console spam and instead alert the sender at the end. 2011-07-14 03:30:54 +01:00
Eric Stokes ab56f9ed4d Add version to config.yml 2011-07-13 18:30:07 -06:00
Eric Stokes 55c77f48e0 I am a bad person 2011-07-13 18:27:25 -06:00
Eric Stokes 64a7a1ad8b Add config.yml to the migrator 2011-07-13 18:24:09 -06:00
Eric Stokes c6a16d00ce Add ConfigMigrator 2011-07-13 18:13:12 -06:00
Rigby fa07867f64 Now you can have an equal share of blame =D, 10/90 split seem reasonable to you? 2011-07-13 12:11:02 +01:00
Rigby 1d9b94294b Alterred the respawn functionality to hopefully be more customiseable. 2011-07-13 12:10:25 +01:00
Rigby 889dbf2986 Once in a blue moon I need to make it look like I actually do some work on this project... 2011-07-13 11:37:52 +01:00
Rigby 78d2d242f2 Support for the new UUID Duplicate checks, createWorld can now return null if the world was a duplicate of an already loaded world. 2011-07-13 11:32:40 +01:00
Eric Stokes 3856d6777c Add new configMigrator class, update allpay 2011-07-12 21:13:56 -06:00
Eric Stokes 6d61e7e419 Fix command descriptions, upgrade CH 2011-07-12 18:44:57 -06:00
Eric Stokes 3ea2f42e7f Many fixes to aliases. Add newer CH version 2011-07-11 21:02:34 -06:00
Eric Stokes ac66c2f3bb Sync with the Wiki 2011-07-10 20:36:10 -06:00
Eric Stokes 77a25ad8e6 Added a bunch more short commands 2011-07-10 16:08:24 -06:00
Eric Stokes e059a565c7 Add more finely grained permissions for MVTP 2011-07-10 15:32:35 -06:00
Eric Stokes 91802f0e55 Move the filtering of commands out of the Handler 2011-07-10 14:23:44 -06:00
Eric Stokes 8e92496fb9 Revert "Permissions is Silly"
This reverts commit d9cca0f822.
2011-07-10 14:02:39 -06:00
Eric Stokes d9cca0f822 Permissions is Silly
Where Silly = Stupid
2011-07-10 13:42:13 -06:00
Eric Stokes 0edd3f80e0 Oh silly booleans... 2011-07-10 13:19:38 -06:00
Eric Stokes 8a0301f162 What's this? MV2 Supports multi-world bed respawns now? It sure does! 2011-07-10 12:06:14 -06:00
Eric Stokes c54a746c2f Minor Fixes to some commands 2011-07-10 08:40:06 -06:00
Eric Stokes b6d718a0ba Fix fakePVP 2011-07-09 22:15:36 -06:00
Eric Stokes 54573889af Add 'fakepvp' config, currently untested... 2011-07-09 22:00:07 -06:00
Eric Stokes 1c3d3b0807 Add a freshly baked BSD help command 2011-07-09 21:50:25 -06:00
Eric Stokes 6be11c01ee Remove deprecated method 2011-07-09 21:00:01 -06:00
Eric Stokes f9114996e2 increment CH version 2011-07-09 20:21:50 -06:00
Eric Stokes 8adf06f247 Implement permissions 2011-07-09 20:21:22 -06:00
Eric Stokes a8999ee5a1 Made MVPermissions implement PermissionsInterface, Increment CommandHandler 2011-07-09 20:10:43 -06:00
Eric Stokes 5da92705bb Increment commandhandler 2011-07-09 20:05:14 -06:00
Eric Stokes 5b30e7214e Implement new CommandHandler 2011-07-09 19:59:06 -06:00
Eric Stokes 83bb61a5ee update CommandHandler Again 2011-07-09 18:35:01 -06:00
Eric Stokes 71a63d10d6 Update commandhandler version 2011-07-09 18:32:33 -06:00
Eric Stokes aa96821df1 working on delete 2011-07-09 18:28:35 -06:00
Eric Stokes 20eb65fd59 Upade CommandHandler 2011-07-09 18:19:46 -06:00
Eric Stokes a4b74d172b More progress 2011-07-09 18:13:56 -06:00
Eric Stokes 9c924b04a0 ConfirmCommand has been refitted with the new hooks. 2011-07-09 18:06:42 -06:00
Eric Stokes f1c94bf851 Started implementing the new CommandHandler 2011-07-09 18:00:30 -06:00
Eric Stokes 4d39f2ec56 Removed Licensed CommandManager Code
We want no part in CC NoDeriv Code.
2011-07-09 17:42:32 -06:00
Eric Stokes 949e70b81c Remove code I don't want anymore. 2011-07-09 16:57:04 -06:00
Eric Stokes 6ccb52bc3e Change to BSD from CC 2011-07-09 08:34:18 -06:00
Eric Stokes 2985167936 Fixed Spacing, fixed Modify commands 2011-07-09 08:33:18 -06:00
Eric Stokes fc9aa456da Rewritten commandManager 2011-07-09 07:52:20 -06:00
Aki Tensai fda6b31f06 Consistant punctuation on descriptions of commands.
/mvspawn's description altered
Testing my ability to commit changes on GitHub.
2011-07-09 02:13:02 -06:00
Eric Stokes 8f56347572 Fixed ordering causing some commands to be read over MVModify 2011-07-07 21:32:21 -06:00
Eric Stokes 0187a600b3 Still working on these multi staged modify commands 2011-07-07 21:27:12 -06:00
Eric Stokes 55b873ddea Update more allpay libraries 2011-07-06 19:24:50 -06:00
Eric Stokes f3c67390ce Update AllPay 2011-07-06 19:11:51 -06:00
Eric Stokes 3b32e334d7 Add allpay submodule 2011-07-06 18:42:18 -06:00
Eric Stokes f86f753563 Fix telling people they can't go to a world, then taking them there anyways. #whoops 2011-07-06 18:17:41 -06:00
Eric Stokes 8ecfebe480 Decouple iConomy and Permissions from Core. Closes #32 2011-07-06 18:10:36 -06:00
Eric Stokes 79fba462b9 Add Message to ops and those who can create, Closes #25. Bullet proofed a few more methods. 2011-06-30 22:07:17 -06:00
Eric Stokes c43362bb5e Add default and none respawn styles 2011-06-30 21:07:48 -06:00
Eric Stokes 81315ba7a4 Add MVRespawnEvent 2011-06-30 20:42:32 -06:00
Eric Stokes 60d456900d This was missing from the last commit. 2011-06-30 18:41:08 -06:00
Eric Stokes 72fc006795 Allow disableautoheal 2011-06-30 18:40:57 -06:00
Eric Stokes 1024506f8c Remove unrequired imports. 2011-06-30 18:11:37 -06:00
Eric Stokes 406e31f5c5 Moved the flag extractor to the CommandManager 2011-06-30 18:09:30 -06:00
Eric Stokes f7ded5f129 Now you can say /mvpurge pig rather than /mvpurge PIG 2011-06-30 17:45:49 -06:00
Rigby 6858c878d3 Don't prevent plugins from spawning creatures. 2011-06-30 20:45:04 +01:00
Rigby 2ff10d0882 1.5 Compatibility 2011-06-30 20:44:46 +01:00
Eric Stokes dad4547c21 More code cleanup, remove bogus method in MVPlayerListener 2011-06-30 07:30:55 -06:00
Eric Stokes f7bdffa365 Fix Colors not saving correctly. Closes #26 2011-06-29 22:15:16 -06:00
Eric Stokes 04346f0efc Removed a bunch of Multiverse Spam 2011-06-29 21:47:36 -06:00
Eric Stokes 4f7c2d507a Fix Monster/Animals Spawning 2011-06-29 21:43:37 -06:00
Eric Stokes 535dcded34 Animals exceptions are working. Time to refactor. seriously. 2011-06-29 19:21:07 -06:00
Eric Stokes 69c23980e1 Wow. what was I thinking... 2011-06-28 21:31:50 -06:00
Eric Stokes 57941719ad Heh, switched my booleans... 2011-06-28 21:27:50 -06:00
Eric Stokes ed5dfd08ae Still a few bugs with Purge 2011-06-28 21:22:28 -06:00
Eric Stokes ce3e203bc1 Think I've finished the Purge Command. It's untested. o.O 2011-06-28 20:02:40 -06:00
Eric Stokes 3124a5c678 Put your commits in the air like you just don't care!
But seriously, working on MVPurge
2011-06-28 19:11:12 -06:00
Eric Stokes 7271e5cfb8 Started Purge Cmd. Moved Queued cmds to CmdMgr 2011-06-28 17:53:26 -06:00
Eric Stokes b37799354b Remove autoloading of worlds, Part of issue #25 2011-06-28 07:34:13 -06:00
Eric Stokes eceeb72b59 Environments no longer default to Normal, Closes #24 2011-06-27 21:26:49 -06:00
Eric Stokes ea45d2675e Add opfallback to config; Permissions cleanup 2011-06-26 20:56:10 -06:00
Eric Stokes 46ed043104 Add Colors to chat, update default config 2011-06-26 20:24:44 -06:00
Eric Stokes 84b726b636 Add colors to Who command. Fix not being able to use black 2011-06-26 19:58:37 -06:00
Eric Stokes a62d341d8f Add colors to world aliases
Now World aliases take priority over world folder names. Bit of cleanup
2011-06-26 19:50:40 -06:00
Eric Stokes 1a31fca6a7 Remove old breaking method 2011-06-26 18:26:57 -06:00
Eric Stokes bd7d5265a5 Temp debug lines. They'll go away. 2011-06-26 18:17:20 -06:00
Eric Stokes 252e15d48e Fix NPE when teleporting someone from console 2011-06-26 16:41:34 -06:00
Eric Stokes 4effff9145 Allow players to mvtp other players
Added permissions node: multiverse.world.tp.other/self
2011-06-26 16:25:53 -06:00
Eric Stokes 0885ba3089 Cleanup and Add 2nd permissions node to mvspawn 2011-06-26 15:58:23 -06:00
Eric Stokes 532e2c2f75 It was the ultimate refactor... of ultimate destiny.
Now requires use of getters and setters for MVWorld things.
2011-06-26 14:56:59 -06:00
Eric Stokes d4729653a1 Fix monsters and animals settings 2011-06-26 13:26:19 -06:00
Eric Stokes f33e93e077 MVModify is working now. Yay.
Still need to purge animals/mobs when the var is set.
2011-06-26 12:27:03 -06:00
Eric Stokes 28276daa81 More MVWorld Refactors
although the modify command got a lot messier...
2011-06-26 11:57:45 -06:00
Eric Stokes 04c6024616 More refactoring on MVWorld 2011-06-26 11:38:36 -06:00
Eric Stokes 0a88c086f4 Moving stuff into their gitters and setters
Pun intended.
2011-06-26 11:04:47 -06:00
Eric Stokes 028b910e9a Refactor MVWorld 2011-06-26 11:00:52 -06:00
Eric Stokes cedc097efa Remove libs, updated the update script
So we're not dependent on other people's failing websites (iConomy *cough* *cough*)
2011-06-26 10:51:51 -06:00
Eric Stokes 358dab345a Made CustomGenerators up to spec 2011-06-26 10:45:02 -06:00
Eric Stokes ca8a017d32 Fix worlds not being saved correctly. 2011-06-26 10:01:40 -06:00
Eric Stokes 4edecaaf6f Remove MVCommandHandler, we're finally free of it! 2011-06-26 09:31:00 -06:00
Eric Stokes be8ff3ad6d Fix null environments for worlds 2011-06-26 09:16:26 -06:00
Eric Stokes 19da230723 More work on mvmodify; Better integration with Custom gens 2011-06-26 08:55:24 -06:00
Eric Stokes b2bcb941c3 Made 'worlds' private and added accessor methods. 2011-06-25 17:15:46 -06:00
Eric Stokes 53345c2f42 Lots of Cleanup
Fixed a bunch of missing this.'s, unused imports, etc.
2011-06-25 15:43:46 -06:00
Eric Stokes dc2a8309bc Add Minecraft behavior to multiple worlds
If a world has NO exceptions, and has monsters/animals turned off, we should not even try and spawn them, or at least tell Bukkit to do this.
2011-06-25 14:32:37 -06:00
Eric Stokes 63a2fc0f1f Add Custom world types to MVWho and MVEnv 2011-06-24 21:43:05 -06:00
Eric Stokes 09b6d72881 Plugins can register with MV as a custom world type now! 2011-06-24 19:48:04 -06:00
Eric Stokes a2bef29bc2 Starting to support custom generators 2011-06-24 18:47:31 -06:00
Eric Stokes e24dc7f83a Add Crippled info command, update compatability with 920 2011-06-23 06:57:47 -06:00
Eric Stokes 086c96bf9b Update CB 2011-06-20 21:38:47 -06:00
Eric Stokes 9632414429 Disallow negative or 0 scaling 2011-06-20 20:22:50 -06:00
Eric Stokes 5a60df3f5a Rename Compression -> Scaling 2011-06-20 19:51:58 -06:00
Eric Stokes 98e1af0f66 Add fancy permissions (/mv) 2011-06-19 17:07:03 -06:00
Eric Stokes 82429ee7de Add true permissions support 2011-06-19 16:58:28 -06:00
Eric Stokes 665dccbcc5 Additional comments to logger 2011-06-19 09:55:21 -06:00
Eric Stokes 6af3964699 Small bits of clean up and commenting 2011-06-18 21:00:54 -06:00
Eric Stokes eab4067c7d Fix White/Blacklisting
Add more permissions support
2011-06-18 20:57:24 -06:00
Eric Stokes cdc858a1e3 Add ability to add dangerous commands, users must now confirm mvdelete 2011-06-18 16:29:22 -06:00
Eric Stokes 69bffd87c7 More print cleanup 2011-06-18 14:59:20 -06:00
Eric Stokes 20c3b516cc Fix seed not being added
Remove test methods
Bits of refactoring
2011-06-18 14:53:51 -06:00
Eric Stokes c668bdb4f5 Forgot to add environment to the worlds config! 2011-06-18 14:44:50 -06:00
Eric Stokes 6afd8dfdfb Add mvdelete, mvremove and mvunload 2011-06-18 14:26:30 -06:00
Eric Stokes 8e41d2ea4b Normal worlds now featuring Nether skyboxes... 2011-06-04 17:37:33 -04:00
Eric Stokes 7ff5c518f4 Cleanup the EntityListener a bit
Save worlds when they are initialized
Add Some test data for the list types since they don't show up
Working on the respawn issue still...
2011-06-04 17:01:43 -04:00
Eric Stokes 1971b8fc4e Import MVSpawn, close #11 2011-06-03 23:30:37 -04:00
Eric Stokes 7c595bd58b MVImport works, close #10 2011-06-03 22:25:26 -04:00
Eric Stokes 5233ab17c6 AutoLoad Default Worlds, close #13 2011-06-03 19:40:54 -04:00
Eric Stokes babc3a8d76 Lots of code cleanup 2011-06-03 16:44:15 -04:00
Eric Stokes 5223bef9d0 Cleanup CreateCommand, almost looks pretty now. 2011-06-03 15:40:50 -04:00
Eric Stokes 3651972901 Fix help not showing for invalid commands 2011-06-03 15:34:39 -04:00
Eric Stokes 8cb421b27a Working on issue #10 2011-06-03 14:43:31 -04:00
Eric Stokes 04a76b1eb2 Remove junk print code, cleanup parseAllQuotedStrings a bit 2011-06-03 14:25:20 -04:00
Eric Stokes 1f3a325bc9 Verify worlds and portals at the time of Destination creation 2011-06-03 14:17:28 -04:00
Eric Stokes 7061c7a9c2 Fix SKYLAND should be SKYLANDS, whoops 2011-06-03 10:31:02 -04:00
Eric Stokes 33b846cf22 Remove extra semicolon
Closes #4
2011-06-03 10:25:20 -04:00
Eric Stokes 4556b0d4c6 Teleports work with spaces, still needs refactor before merge 2011-06-02 21:43:01 -04:00
Eric Stokes 80fd19c0f8 Supports CommandManager level string combining
Now when someone enters a command surrounded in quotes, it gets combined and passed as an arg with spaces! Woot.
2011-06-02 20:58:03 -04:00
Eric Stokes a5a3618439 Creation of spaced worlds works, so do seeds. Now refactor hardcore. 2011-06-02 19:59:57 -04:00
Eric Stokes 3a6d401a72 Should allow spaces, needs testing 2011-06-02 16:43:22 -04:00
Eric Stokes 00b7af5c84 Starting on the create command 2011-06-02 15:38:41 -04:00
Eric Stokes f2b9b95dc9 Remove old MVCoord 2011-06-02 15:31:12 -04:00
Eric Stokes 2ea45c8219 Ported SetSpawn.
Extraced common in game only command error message
2011-06-02 10:58:15 -04:00
Eric Stokes 5c144f31c2 Multi-World travel now possible, not perfected at all 2011-06-02 10:41:24 -04:00
Eric Stokes 599bbcd16c Made DestinationType enum public 2011-06-02 10:10:20 -04:00
Eric Stokes 116b661b84 Move MVTP and MVList to proper command style
Add Destination which allows easier parsing of World/Portals. This currently has NO regex check, but it can be added here for easy control over portal/world naming conventions
2011-06-02 09:45:42 -04:00
Eric Stokes 2a991a3e7d Update for iConomy 5 2011-06-02 08:40:31 -04:00
Eric Stokes 45ca828107 Remove libs from repo, add other folders to .gitignore 2011-06-01 20:14:39 -04:00
Rigby db64804e27 WIP! Just doing this to test the GitBot... AGAIN 2011-05-02 03:51:02 +01:00
Rigby fae3d33a6c Remove NULL from the seedStr default. Also some debug output for outputting the seed of a world. Ready to implement getSeed(); 2011-04-05 22:26:38 +01:00
Rigby 20c14daf49 ReadMe + Copying 2011-04-01 19:21:14 +01:00
Rigby a9103d1ba9 Updated to b602
Minor Changes - Removed Static from some variables etc.
Added Custom seed to Worlds.
2011-04-01 01:38:17 +01:00
Rigby 85b219282e DebugLog + Messaging (Forgot these :)) 2011-03-31 16:07:03 +01:00
Rigby 93aae71375 CleanUp + Format 2011-03-31 16:06:48 +01:00
Rigby 3659e41098 Renamed from "MultiVerse-Core" to "Multiverse-Core" ./slaps Kainzo 2011-03-31 16:04:54 +01:00
Rigby 4fb9098485 Tidying up code to make it look like I'm actually doing something... 2011-03-31 03:29:29 +01:00
Rigby 6fdd00724f Sorry IRC Bot :( 2011-03-30 17:37:55 +01:00
petteyg 33afc8a3ca Stuff 2011-03-28 09:56:50 -05:00
petteyg 7241720677 Stuff 2011-03-28 09:52:20 -05:00
Rigby 9c3fbe54ce Updating to a new Bukkit build... everything broke :'( 2011-03-27 21:47:57 +01:00
Rigby 09c540453f If you're happy and you know it - make it easier to read. (Boredom) 2011-03-18 11:52:00 +00:00
Rigby 84d7fc0260 Silly formatting 2011-03-18 00:56:11 +00:00
Rigby bd589a6b9a Quick fixes to the purge command. 2011-03-18 00:55:58 +00:00
Rigby 6de723705f Alterations to the getAuthors function...
Set Permissions to null onDisable.
2011-03-18 00:55:10 +00:00
Rigby 3220dd0587 CleanUp - Remove debug line. 2011-03-14 23:44:55 +00:00
Rigby ec980248f8 Fixed up the Permissions link. 2011-03-14 23:44:20 +00:00
Rigby 178b15926f Started work on Permissions/isOP() support. 2011-03-14 22:55:36 +00:00
Rigby b8ee4c7f53 Ditching GM and weird API... No one has specifically requested GM
support anyways, wonder why...
2011-03-14 22:54:50 +00:00
Rigby f73d5dbcf1 GroupManager is going to be the death of me... this was a bad idea to
support it.
2011-03-14 22:13:58 +00:00
Rigby 097985f24a Output Authors correctly to the Console. 2011-03-14 21:33:57 +00:00
Rigby 924d027618 Helps if I do it right the first time. 2011-03-14 21:33:34 +00:00
Rigby fda6801f51 Author change 2011-03-14 21:21:12 +00:00
Rigby 2055055bbb CleanUp, need to sort out SafeTeleportation more... 2011-03-14 21:06:56 +00:00
Rigby 3b79634352 onLoad = decent... Needless spam in console due to lack of the
function within a plugin which doesn't utilize onLoad() = not so fun
2011-03-14 21:03:38 +00:00
Rigby a4aae6d47f Quick alteration to allow us not to send a response. 2011-03-14 12:16:41 +00:00
Rigby 7f690ae7d8 Basic PurgeWorld command, needs working on more for Permissions and
target worlds etc. Currently "/mvpurge CREATURETYPE" and "/mvpurge *"
work perfectly.
2011-03-14 12:14:27 +00:00
Rigby 37b2ad7e1d PurgeWorlds class, purges a given world of the given entities. 2011-03-14 12:12:32 +00:00
Rigby f579b36d65 GM Lib 2011-03-14 11:20:23 +00:00
Rigby 121f6f500d Added basic 'has()' permission. 2011-03-14 11:20:15 +00:00
Rigby 1dcaa0045f Added listener for GroupManager and also looking out for the Plugins
disabling themselves, if so we act accordingly.
2011-03-14 11:19:55 +00:00
Rigby ab0f78787a Lets try throwing GroupManager into the mix... Will see how this
performs.
2011-03-14 11:19:31 +00:00
Rigby 6a6f97ecd4 Keep the playerSessions updated with the players last location so the
portals can act accordingly.
2011-03-14 01:57:53 +00:00
Rigby 0d64b59851 Start of the MV Permissions Handler... centralise all Permission
checks and fall back to isOP().
2011-03-14 01:57:10 +00:00
Rigby 30e9b991b7 PluginListener for Permissions and iConomy. 2011-03-14 01:56:33 +00:00
Rigby a9aa346659 CleanUp + Permissions and iConomy checks & support. 2011-03-14 01:56:05 +00:00
Rigby f70f09880e Permissions Lib 2011-03-12 23:22:27 +00:00
Rigby 4763e04c90 UpdateChecker class, runs on a seperate thread and every 30 minutes it
checks for an update for the plugin.
2011-03-12 23:22:19 +00:00
Rigby aadb3b574e CleanUp + Moving permission checks over to its own class to tidy
things up and to handle it better.
2011-03-12 23:21:38 +00:00
Simon Rigby 3c054e4a95 Check Default node exists, if not write it. Saves erroring etc.
I'm sure theres an easier/better way to do this but this will do for
now.
2011-03-12 18:51:13 +00:00
Simon Rigby a288015bf0 Changing version and testing IRC. 2011-03-12 18:47:46 +00:00
Simon Rigby 26ee10b163 Added Slime check to the Entity... more as a precaution till I'm sure
it exists within Monster etc...
2011-03-11 17:14:52 +00:00
Simon Rigby 4e8d8626a7 Added findPortal -- Find a nearby portal around the destination...
Changed how a Destination is found and dealt with and changed how the
player is teleported. (Need to fix the safe teleportation code...
rather check X&Z before Y... Currently it prefers higher coordinates
over a block right infront of the destination.
2011-03-11 11:12:52 +00:00
Simon Rigby 0d85557362 Basic changes and Notes.
Including latest Lib Files as well.
2011-03-11 11:11:23 +00:00
Simon Rigby 724e05d73b Basic Spawn & setSpawn Commands. 2011-03-11 11:10:25 +00:00
Simon Rigby b110c51062 Change to CreatureType 2011-03-11 11:09:38 +00:00
Rigby b687b62a15 MVReload command. 2011-03-09 16:02:39 +00:00
Rigby 7f6e9e567e Ye... sort later 2011-03-09 14:50:57 +00:00
Rigby 195e8dc863 herp derp 2011-03-09 12:44:43 +00:00
Simon Rigby 438aa472d6 Fixed up the safe teleporting, now checks Y Properly and no longer
prioritises a higher coordinate over lower.
2011-03-09 08:11:35 +00:00
Simon Rigby 764b050baa Refactoring... Cleaning Up... Adding some Commands... Fixing up some
mistakes etc etc etc.
2011-03-07 09:14:02 +00:00
Simon Rigby bdf3d70bbf sigh... 2011-03-05 23:40:39 +00:00
Simon Rigby 63ea3c961b Added response messages and updated the teleport section... Needed to
add 0.5 to prevent half block teleports and then the player dieing.
2011-03-05 23:30:33 +00:00
Simon Rigby 130c51c366 Hopefully Fixed an NPE... 2011-03-05 00:32:39 +00:00
Simon Rigby 4053937019 Hopefully fixed Ghasts & PigZombies spawning regardless of setting.
Implemented PVP Setting & EnableHealth setting.
World Compressiong = 0 forces you to Spawn now.
2011-03-04 22:22:02 +00:00
Protected e4718d38d4 Portal targetting, compression 2011-03-04 12:12:41 +00:00
Simon Rigby 8a52e55cdf Tidy up + purgeWorld() -- Remove any entities in the world... this
needs improving to only remove those necessary. Quick workaround for
now.
2011-03-04 09:06:12 +00:00
Simon Rigby 4ca35d1c6a Added examples to default 'worlds.yml' as well as changing DataFolder
location.
2011-03-02 05:03:56 +00:00
Simon Rigby 466e31c9ee Removed unneeded crap. 2011-03-01 19:17:06 +00:00
Simon Rigby b8560a41c0 hmm :) 2011-03-01 19:09:36 +00:00
Simon Rigby 92e3917a17 Merge branch 'refs/heads/master' of git@github.com:Rigby90/MultiVerse-Core.git 2011-03-01 18:45:21 +00:00
Simon Rigby 441e6d40f8 Fixed the Listeners, stupid mistake on my part :). 2011-03-01 18:43:53 +00:00
Protected 015daf1695 Merge branch 'master' of https://github.com/Rigby90/MultiVerse-Core 2011-03-01 18:07:01 +00:00
Protected 187c6acbb6 Teleporter factory method 2011-03-01 18:05:24 +00:00
Simon Rigby 7da2c84806 Useless spam, quite obvious the default World will be loaded before
the plugin.
2011-03-01 18:03:28 +00:00
Simon Rigby 33603d3605 Fixed 2011-03-01 17:58:48 +00:00
Protected a5df509fdf Here it goes again 2011-03-01 17:49:08 +00:00
Simon Rigby 0efc0c98ff ... 2011-03-01 17:18:49 +00:00
Simon Rigby bee723182a Removed Permissions support for now. 2011-03-01 16:46:50 +00:00
Simon Rigby 7d9060879c Removed teleport from PlayerSession. 2011-03-01 16:10:28 +00:00
Simon Rigby a91991551c Getting there... 2011-03-01 15:47:36 +00:00
Simon Rigby cd1de2b594 Added basics for the Command Handler. 2011-02-27 06:43:39 +00:00
Simon Rigby 23c695b3a2 More basics... Configurations, PlayerSessions, Events etc... 2011-02-26 06:26:13 +00:00
Simon Rigby 3f678fcd36 Some more basics etc... 2011-02-26 05:21:56 +00:00
Simon Rigby 4fd9821c79 The old Lib files.... 2011-02-22 01:06:26 +00:00
Simon Rigby 81b5e33f64 Added onCommand, testing Eclipse with GIT. 2011-02-22 01:01:13 +00:00
Simon Rigby 68107d9df8 Basics 2011-02-22 00:55:37 +00:00
217 changed files with 25031 additions and 739 deletions

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
# 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
+15
View File
@@ -0,0 +1,15 @@
Building
========
Simply build the source with maven:
$ mvn install
More details are available on the [build instructions wiki page](https://github.com/Multiverse/Multiverse-Core/wiki/Building).
License
=======
Copyright (c) 2011, The Multiverse Team All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the The Multiverse Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+44
View File
@@ -0,0 +1,44 @@
# 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
@@ -0,0 +1,140 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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
@@ -0,0 +1,186 @@
<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>
@@ -0,0 +1,329 @@
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();
}
}
@@ -0,0 +1,112 @@
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());
}
}
@@ -0,0 +1,24 @@
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;
}
}
@@ -0,0 +1,21 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.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);
}
}
@@ -0,0 +1,14 @@
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);
}
}
@@ -0,0 +1,11 @@
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 {
}
@@ -0,0 +1,28 @@
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();
}
@@ -0,0 +1,31 @@
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();
}
@@ -0,0 +1,508 @@
/******************************************************************************
* 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();
}
@@ -0,0 +1,11 @@
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();
}
@@ -0,0 +1,353 @@
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;
}
}
}
@@ -0,0 +1,226 @@
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();
}
}
}
@@ -0,0 +1,63 @@
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);
}
@@ -0,0 +1,5 @@
/**
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
* plugins when interacting with Multiverse.
*/
package com.mvplugin.core.api;
@@ -0,0 +1,8 @@
package com.mvplugin.core.command;
class CommandHelp {
static void init() { }
}
@@ -0,0 +1,188 @@
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;
}
}
@@ -0,0 +1,12 @@
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();
}
}
@@ -0,0 +1,8 @@
package com.mvplugin.core.minecraft;
public enum Difficulty {
PEACEFUL,
EASY,
NORMAL,
HARD
}
@@ -0,0 +1,4 @@
package com.mvplugin.core.minecraft;
public class Entity {
}
@@ -0,0 +1,8 @@
package com.mvplugin.core.minecraft;
public enum GameMode {
ADVENTURE,
CREATIVE,
SURVIVAL
}
@@ -0,0 +1,4 @@
package com.mvplugin.core.minecraft;
public interface Generator {
}
@@ -0,0 +1,45 @@
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;
}
}
@@ -0,0 +1,21 @@
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;
}
@@ -0,0 +1,17 @@
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;
}
}
@@ -0,0 +1,8 @@
package com.mvplugin.core.minecraft;
public enum WorldType {
FLAT,
LARGE_BIOMES,
NORMAL,
VERSION_1_1
}
@@ -0,0 +1,9 @@
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'!");
}
@@ -0,0 +1,121 @@
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
@@ -0,0 +1,44 @@
# 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
@@ -0,0 +1,143 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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
@@ -0,0 +1,322 @@
<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>
@@ -0,0 +1,82 @@
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.
}
}
@@ -0,0 +1,198 @@
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()));
}
}
@@ -0,0 +1,90 @@
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;
}
}
@@ -0,0 +1,17 @@
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);
}
}
@@ -0,0 +1,76 @@
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;
}
}
}
@@ -0,0 +1,16 @@
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();
}
@@ -0,0 +1,12 @@
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!");
}
@@ -0,0 +1,33 @@
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
@@ -0,0 +1,4 @@
name: Multiverse-Core
main: com.mvplugin.core.MultiverseCorePlugin
authors: ['Rigby', 'fernferret', 'lithium3141', 'main--', 'dumptruckman']
version: maven-version-number
+1813
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+143
View File
@@ -0,0 +1,143 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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>
View File
Whitespace-only changes.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

-71
View File
@@ -1,71 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link href='https://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>Multiverse-Core by Multiverse</title>
</head>
<body>
<div id="container">
<div class="inner">
<header>
<h1>Multiverse-core</h1>
<h2>The original Bukkit Multi-World Plugin! </h2>
</header>
<section id="downloads" class="clearfix">
<a href="https://github.com/Multiverse/Multiverse-Core/zipball/master" id="download-zip" class="button"><span>Download .zip</span></a>
<a href="https://github.com/Multiverse/Multiverse-Core/tarball/master" id="download-tar-gz" class="button"><span>Download .tar.gz</span></a>
<a href="https://github.com/Multiverse/Multiverse-Core" id="view-on-github" class="button"><span>View on GitHub</span></a>
</section>
<hr>
<section id="main_content">
<h3>Welcome to GitHub Pages.</h3>
<p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:</p>
<pre><code>$ cd your_repo_root/repo_name
$ git fetch origin
$ git checkout gh-pages
</code></pre>
<p>If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.</p>
<h3>Designer Templates</h3>
<p>We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.</p>
<h3>Rather Drive Stick?</h3>
<p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
<h3>Authors and Contributors</h3>
<p>You can <a href="https://github.com/blog/821" class="user-mention">@mention</a> a GitHub username to generate a link to their profile. The resulting <code>&lt;a&gt;</code> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
<h3>Support or Contact</h3>
<p>Having trouble with Pages? Check out the documentation at <a href="http://help.github.com/pages">http://help.github.com/pages</a> or contact <a href="mailto:support@github.com">support@github.com</a> and we’ll help you sort it out.</p>
</section>
<footer>
Multiverse-core is maintained by <a href="https://github.com/Multiverse">Multiverse</a><br>
This page was generated by <a href="http://pages.github.com">GitHub Pages</a>. Tactile theme by <a href="http://twitter.com/jasonlong">Jason Long</a>.
</footer>
</div>
</div>
</body>
</html>
-1
View File
@@ -1 +0,0 @@
console.log('This would be the main JS file.');
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,292 @@
package com.onarandombox.MultiverseCore;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
import me.main__.util.SerializationConfig.NoSuchPropertyException;
import me.main__.util.SerializationConfig.Property;
import me.main__.util.SerializationConfig.SerializationConfig;
import java.util.Map;
/**
* Our configuration.
*/
public class MultiverseCoreConfiguration extends SerializationConfig implements MultiverseCoreConfig {
private static MultiverseCoreConfiguration instance;
/**
* Sets the statically saved instance.
* @param instance The new instance.
*/
public static void setInstance(MultiverseCoreConfiguration instance) {
MultiverseCoreConfiguration.instance = instance;
}
/**
* @return True if the static instance of config is set.
*/
public static boolean isSet() {
return instance != null;
}
/**
* Gets the statically saved instance.
* @return The statically saved instance.
*/
public static MultiverseCoreConfiguration getInstance() {
if (instance == null)
throw new IllegalStateException("The instance wasn't set!");
return instance;
}
@Property
private volatile boolean enforceaccess;
@Property
private volatile boolean prefixchat;
@Property
private volatile boolean useasyncchat;
@Property
private volatile boolean teleportintercept;
@Property
private volatile boolean firstspawnoverride;
@Property
private volatile boolean displaypermerrors;
@Property
private volatile int globaldebug;
@Property
private volatile boolean silentstart;
@Property
private volatile int messagecooldown;
@Property
private volatile double version;
@Property
private volatile String firstspawnworld;
@Property
private volatile int teleportcooldown;
public MultiverseCoreConfiguration() {
super();
MultiverseCoreConfiguration.setInstance(this);
}
public MultiverseCoreConfiguration(Map<String, Object> values) {
super(values);
MultiverseCoreConfiguration.setInstance(this);
}
/**
* {@inheritDoc}
*/
@Override
protected void setDefaults() {
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
enforceaccess = false;
useasyncchat = true;
prefixchat = true;
teleportintercept = true;
firstspawnoverride = true;
displaypermerrors = true;
globaldebug = 0;
messagecooldown = 5000;
teleportcooldown = 1000;
this.version = 2.9;
silentstart = false;
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
}
/**
* {@inheritDoc}
*/
@Override
public boolean setConfigProperty(String property, String value) {
try {
return this.setProperty(property, value, true);
} catch (NoSuchPropertyException e) {
return false;
}
}
// And here we go:
/**
* {@inheritDoc}
*/
@Override
public boolean getEnforceAccess() {
return this.enforceaccess;
}
/**
* {@inheritDoc}
*/
@Override
public void setEnforceAccess(boolean enforceAccess) {
this.enforceaccess = enforceAccess;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getPrefixChat() {
return this.prefixchat;
}
/**
* {@inheritDoc}
*/
@Override
public void setPrefixChat(boolean prefixChat) {
this.prefixchat = prefixChat;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getTeleportIntercept() {
return this.teleportintercept;
}
/**
* {@inheritDoc}
*/
@Override
public void setTeleportIntercept(boolean teleportIntercept) {
this.teleportintercept = teleportIntercept;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getFirstSpawnOverride() {
return this.firstspawnoverride;
}
/**
* {@inheritDoc}
*/
@Override
public void setFirstSpawnOverride(boolean firstSpawnOverride) {
this.firstspawnoverride = firstSpawnOverride;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getDisplayPermErrors() {
return this.displaypermerrors;
}
/**
* {@inheritDoc}
*/
@Override
public void setDisplayPermErrors(boolean displayPermErrors) {
this.displaypermerrors = displayPermErrors;
}
/**
* {@inheritDoc}
*/
@Override
public int getGlobalDebug() {
return this.globaldebug;
}
/**
* {@inheritDoc}
*/
@Override
public void setGlobalDebug(int globalDebug) {
this.globaldebug = globalDebug;
Logging.setDebugLevel(globalDebug);
}
/**
* {@inheritDoc}
*/
@Override
public int getMessageCooldown() {
return this.messagecooldown;
}
/**
* {@inheritDoc}
*/
@Override
public void setMessageCooldown(int messageCooldown) {
this.messagecooldown = messageCooldown;
}
/**
* {@inheritDoc}
*/
@Override
public double getVersion() {
return this.version;
}
/**
* {@inheritDoc}
*/
@Override
public void setVersion(int version) {
this.version = version;
}
/**
* {@inheritDoc}
*/
@Override
public String getFirstSpawnWorld() {
return this.firstspawnworld;
}
/**
* {@inheritDoc}
*/
@Override
public void setFirstSpawnWorld(String firstSpawnWorld) {
this.firstspawnworld = firstSpawnWorld;
}
/**
* {@inheritDoc}
*/
@Override
public int getTeleportCooldown() {
return this.teleportcooldown;
}
/**
* {@inheritDoc}
*/
@Override
public void setTeleportCooldown(int teleportCooldown) {
this.teleportcooldown = teleportCooldown;
}
@Override
public void setUseAsyncChat(boolean useAsyncChat) {
this.useasyncchat = useAsyncChat;
}
@Override
public boolean getUseAsyncChat() {
return this.useasyncchat;
}
@Override
public void setSilentStart(boolean silentStart) {
Logging.setShowingConfig(!silentStart);
this.silentstart = silentStart;
}
@Override
public boolean getSilentStart() {
return silentstart;
}
}
@@ -0,0 +1,79 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Vehicle;
/**
* Used to get block/location-related information.
*/
public interface BlockSafety {
/**
* This function checks whether the block at the given coordinates are above air or not.
* @param l The {@link Location} of the block.
* @return True if the block at that {@link Location} is above air.
*/
boolean isBlockAboveAir(Location l);
/**
* Checks if a player can spawn safely at the given coordinates.
* @param world The {@link World}.
* @param x The x-coordinate.
* @param y The y-coordinate.
* @param z The z-coordinate.
* @return True if a player can spawn safely at the given coordinates.
*/
boolean playerCanSpawnHereSafely(World world, double x, double y, double z);
/**
* This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air
* etc. This also ensures there is enough space for a player to spawn!
*
* @param l The {@link Location}
* @return Whether the player can spawn safely at the given {@link Location}
*/
boolean playerCanSpawnHereSafely(Location l);
/**
* Gets a safe bed spawn location OR null if the bed is invalid.
* @param l The location of the bead head (block with the pillow on it).
* @return Safe location around the bed or null if no location was found.
*/
Location getSafeBedSpawn(Location l);
/**
* Gets the location of the top block at the specified {@link Location}.
* @param l Any {@link Location}.
* @return The {@link Location} of the top-block.
*/
Location getTopBlock(Location l);
/**
* Gets the location of the top block at the specified {@link Location}.
* @param l Any {@link Location}.
* @return The {@link Location} of the top-block.
*/
Location getBottomBlock(Location l);
/**
* Checks if an entity would be on track at the specified {@link Location}.
* @param l The {@link Location}.
* @return True if an entity would be on tracks at the specified {@link Location}.
*/
boolean isEntitiyOnTrack(Location l);
/**
* Checks if the specified {@link Minecart} can spawn safely.
* @param cart The {@link Minecart}.
* @return True if the minecart can spawn safely.
*/
boolean canSpawnCartSafely(Minecart cart);
/**
* Checks if the specified {@link Vehicle} can spawn safely.
* @param vehicle The {@link Vehicle}.
* @return True if the vehicle can spawn safely.
*/
boolean canSpawnVehicleSafely(Vehicle vehicle);
}
@@ -0,0 +1,256 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import buscript.Buscript;
import com.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.MVPermissions;
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.VaultHandler;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
/**
* Multiverse 2 Core API
* <p>
* This API contains a bunch of useful things you can get out of Multiverse in general!
*/
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.
*/
VaultHandler getVaultHandler();
/**
* Reloads the Multiverse Configuration files:
* worlds.yml and config.yml.
*/
void loadConfigs();
/**
* Gets the Multiverse message system. This allows you to send messages
* to users at specified intervals.
*
* @return The loaded {@link MultiverseMessaging}.
*/
MultiverseMessaging getMessaging();
/**
* Gets the {@link MVPlayerSession} for the given player.
* This will also create a player session if one does not exist
* for a player.
*
* @param player The player's session to grab.
*
* @return The corresponding {@link MVPlayerSession}.
*/
MVPlayerSession getPlayerSession(Player player);
/**
* 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.
*
* @return A non-null {@link MVPermissions}.
*/
MVPermissions getMVPerms();
/**
* Multiverse uses {@link CommandHandler} to make adding and using commands
* a piece of cake.
*
* @return A non-null {@link CommandHandler}.
*/
CommandHandler getCommandHandler();
/**
* Gets the factory class responsible for loading many different destinations
* on demand.
*
* @return A valid {@link DestinationFactory}.
*/
DestinationFactory getDestFactory();
/**
* Gets the primary class responsible for managing Multiverse Worlds.
*
* @return {@link WorldManager}.
*/
MVWorldManager getMVWorldManager();
/**
* Saves all configs.
*
* @return Whether the config was successfully saved
*/
boolean saveMVConfigs();
/**
* Gets the {@link AnchorManager}.
*
* @return The {@link AnchorManager}
*/
AnchorManager getAnchorManager();
/**
* Used by queued commands to regenerate a world on a delay.
*
* @param name Name of the world to regenerate
* @param useNewSeed If a new seed should be used
* @param randomSeed IF the new seed should be random
* @param seed The seed of the world.
*
* @return True if success, false if fail.
*
* @deprecated Use {@link MVWorldManager#regenWorld(String, boolean, boolean, String)} instead.
*/
@Deprecated
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed);
/**
* 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.
*/
void decrementPluginCount();
/**
* Increments the number of plugins that have specifically hooked into core.
*/
void incrementPluginCount();
/**
* Returns the number of plugins that have specifically hooked into core.
*
* @return The number if plugins that have hooked into core.
*/
int getPluginCount();
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @return The readable authors-{@link String}
*/
String getAuthors();
/**
* Gets the {@link BlockSafety} this {@link Core} is using.
* @return The {@link BlockSafety} this {@link Core} is using.
* @see BlockSafety
* @see SimpleBlockSafety
*/
BlockSafety getBlockSafety();
/**
* Sets the {@link BlockSafety} this {@link Core} is using.
* @param blockSafety The new {@link BlockSafety}.
* @see BlockSafety
* @see SimpleBlockSafety
*/
void setBlockSafety(BlockSafety blockSafety);
/**
* Gets the {@link LocationManipulation} this {@link Core} is using.
* @return The {@link LocationManipulation} this {@link Core} is using.
* @see LocationManipulation
* @see SimpleLocationManipulation
*/
LocationManipulation getLocationManipulation();
/**
* Sets the {@link LocationManipulation} this {@link Core} is using.
* @param locationManipulation The new {@link LocationManipulation}.
* @see LocationManipulation
* @see SimpleLocationManipulation
*/
void setLocationManipulation(LocationManipulation locationManipulation);
/**
* Gets the {@link SafeTTeleporter} this {@link Core} is using.
* @return The {@link SafeTTeleporter} this {@link Core} is using.
* @see SafeTTeleporter
* @see SimpleSafeTTeleporter
*/
SafeTTeleporter getSafeTTeleporter();
/**
* Sets the {@link SafeTTeleporter} this {@link Core} is using.
* @param safeTTeleporter The new {@link SafeTTeleporter}.
* @see SafeTTeleporter
* @see SimpleSafeTTeleporter
*/
void setSafeTTeleporter(SafeTTeleporter safeTTeleporter);
/**
* Gets the {@link MultiverseCoreConfig}.
* @return The configuration.
*/
MultiverseCoreConfig getMVConfig();
/**
* Gets the buscript object for Multiverse. This is what handles Javascript processing.
*
* @return The Multiverse buscript object.
*/
Buscript getScriptAPI();
}
@@ -0,0 +1,20 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
/**
* A fancy text.
*/
public interface FancyText {
/**
* Gets the {@link String}-representation of this {@link FancyText}.
*
* @return The {@link String}-representation of this {@link FancyText}.
*/
String getFancyText();
}
@@ -0,0 +1,99 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
/**
* Used to manipulate locations.
*/
public interface LocationManipulation {
/**
* Convert a Location into a Colon separated string to allow us to store it in text.
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding String2Loc function is {@link #stringToLocation}
*
* @param location The Location to save.
* @return The location as a string in this format: WORLD:x,y,z:yaw:pitch
*/
String locationToString(Location location);
/**
* This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
*
* @param l The location to round to the block location
* @return A rounded location.
*/
Location getBlockLocation(Location l);
/**
* Returns a new location from a given string. The format is as follows:
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding Location2String function is {@link #stringToLocation}
*
* @param locationString The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
* @return A new location defined by the string or null if the string was invalid.
*/
Location stringToLocation(String locationString);
/**
* Returns a colored string with the coords.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoords(Location l);
/**
* Converts a location to a printable readable formatted string including pitch/yaw.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoordsRaw(Location l);
/**
* Return the NESW Direction a Location is facing.
*
* @param location The {@link Location}
* @return The NESW Direction
*/
String getDirection(Location location);
/**
* Returns the float yaw position for the given cardinal direction.
*
* @param orientation The cardinal direction
* @return The yaw
*/
float getYaw(String orientation);
/**
* Returns a speed float from a given vector.
*
* @param v The {@link Vector}
* @return The speed
*/
float getSpeed(Vector v);
/**
* Returns a translated vector from the given direction.
*
* @param v The old {@link Vector}
* @param direction The new direction
* @return The translated {@link Vector}
*/
Vector getTranslatedVector(Vector v, String direction);
/**
* Returns the next Location that a {@link Vehicle} is traveling at.
*
* @param v The {@link Vehicle}
* @return The {@link Location}
*/
Location getNextBlock(Vehicle v);
}
@@ -0,0 +1,30 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Server;
import java.util.logging.Level;
/** A simple API to require plugins to have a log method. */
public interface LoggablePlugin {
/**
* Logs a message at the specified level.
*
* @param level The Log-{@link Level}.
* @param msg The message to log.
*/
void log(Level level, String msg);
/**
* Gets the server instance that this plugin is attached to.
*
* @return A {@link Server} instance.
*/
Server getServer();
}
@@ -0,0 +1,141 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A destination API for Multiverse
* Any plugin can add these to MV and when they are, any action that uses them (portals, MVTP, etc.) can use them!
*/
public interface MVDestination {
/**
* Returns the identifier or prefix that is required for this destination.
* <p>
* Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
* Please check the wiki when adding a custom destination!
*
* @return The identifier or prefix that is required for this destination.
*/
String getIdentifier();
/**
* Allows you to determine if a Destination is valid for the type it thinks it is.
* <p>
* An example of this would be the exact destination. A valid string would be: e:0,0,0 where an invalid one would
* be e:1:2:3. The first string would return true the second would return false. This is simply a convenience
* method
* and does not even NEED to be called, but it's highly recommended if you're teleporting, but it's mainly for
* Multiverse Internal use.
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*
* @return True if the destination is valid, false if not.
*/
boolean isThisType(JavaPlugin plugin, String destination);
/**
* Returns the location a specific entity will spawn at when being teleported to this Destination.
* <p>
* To just retrieve the location as it is stored you can just pass null, but be warned some destinations may return
* null back to you if you do this. It is always safer to pass an actual entity. This is used so things like
* minecarts can be teleported.
* <p>
* Do not forget to use {@link #getVelocity()} as destinations can use this too!
*
* @param entity The entity to be teleported.
*
* @return The location of the entity.
*/
Location getLocation(Entity entity);
/**
* Returns the velocity vector for this destination.
* <p>
* Plugins wishing to fully support MVDestinations MUST implement this.
*
* @return A vector representing the speed/direction the player should travel when arriving
*/
Vector getVelocity();
/**
* Sets the destination string.
* <p>
* This should be used when you want to tell this destination object about a change in where it should take people.
* The destination param should be match the result from {@link #getIdentifier()}. A valid example would be that if
* {@link #getIdentifier()} returned "ow" our destination string could be "ow:TownCenter" but could not be
* "p:HomePortal"
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*/
void setDestination(JavaPlugin plugin, String destination);
/**
* Returns true if the destination is valid and players will be taken to it.
* <p>
* Even if destinations are in the correct format (p:MyPortal) MyPortal may not exist, and therefore this would
* return false.
*
* @return True if the destination is valid; false if not.
*/
boolean isValid();
/**
* Gives you a general friendly description of the type of destination.
* <p>
* For example, the PlayerDestination sets this to "Player". You can use this to show where a player will be taken.
*
* @return A friendly string description of the type of destination.
*/
String getType();
/**
* Gives you a specific name of the destination.
* <p>
* For example, the PlayerDestination sets this to The Player's Name.
*
* @return A friendly string stating the name of the destination.
*/
String getName();
/**
* Returns a string that can easily be saved in the config that contains all the details needed to rebuild this
* destination.
* <p>
* ex: e:0,0,0:50:50
*
* @return The savable config string.
*/
String toString();
/**
* Returns the permissions string required to go here.
* <p>
* ex: multiverse.access.world
* <p>
* NOTE: This is NOT the permission to use the teleport command.
*
* @return the permissions string required to go here.
*/
String getRequiredPermission();
/**
* Should the Multiverse SafeTeleporter be used?
* <p>
* If not, MV will blindly take people to the location specified.
*
* @return True if the SafeTeleporter will be used, false if not.
*/
boolean useSafeTeleporter();
}
@@ -0,0 +1,52 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
/**
* This interface is implemented by every official Multiverse-plugin.
*/
public interface MVPlugin extends LoggablePlugin {
/**
* Adds This plugin's version information to the buffer and returns the new string.
*
* @param buffer The string that contains Core and all other MV plugins' versions.
*
* @return A modified buffer that contains this MVPlugin's version information.
*
* @deprecated This is now deprecated, nobody needs it any longer.
* All version info-dumping is now done with {@link MVVersionEvent}.
*/
@Deprecated
String dumpVersionInfo(String buffer);
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link 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.
*
* @return The Integer protocol version.
*/
int getProtocolVersion();
}
@@ -0,0 +1,281 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.utils.PurgeWorlds;
import com.onarandombox.MultiverseCore.utils.SimpleWorldPurger;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldType;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.generator.ChunkGenerator;
import java.io.File;
import java.util.Collection;
import java.util.List;
/**
* Multiverse 2 World Manager API
* <p>
* This API contains all of the world managing
* functions that your heart desires!
*/
public interface MVWorldManager {
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator);
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator, boolean useSpawnAdjust);
/**
* Make a copy of a world.
*
* @param oldName Name of world to be copied
* @param newName Name of world to be created
* @param generator The Custom generator plugin to use.
* @return True if the world is copied successfully, false if not.
*/
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.
*/
boolean deleteWorld(String name);
/**
* Remove the world from the Multiverse list, from the
* config if wanted, and deletes the folder.
*
* @param name The name of the world to remove
* @param removeConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeConfig);
/**
*
* @param name The name of the world to remove
* @param removeFromConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @param deleteWorldFolder If true the world folder will be completely deleted. If false
* only the contents of the world folder will be deleted
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeFromConfig, boolean deleteWorldFolder);
/**
* Unload a world from Multiverse.
*
* @param name Name of the world to unload
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name);
/**
* Loads the world. Only use this if the world has been
* unloaded with {@link #unloadWorld(String)}.
*
* @param name The name of the world to load
* @return True if success, false if failure.
*/
boolean loadWorld(String name);
/**
* Removes all players from the specified world.
*
* @param name World to remove players from.
*/
void removePlayersFromWorld(String name);
/**
* Test if a given chunk generator is valid.
*
* @param generator The generator name.
* @param generatorID The generator id.
* @param worldName The worldName to use as the default.
* @return A {@link ChunkGenerator} or null
*/
ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName);
/**
* Returns a list of all the worlds Multiverse knows about.
*
* @return A list of {@link MultiverseWorld}.
*/
Collection<MultiverseWorld> getMVWorlds();
/**
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
* This will search name AND alias.
*
* @param name The name or alias of the world to get.
* @return A {@link MultiverseWorld} or null.
*/
MultiverseWorld getMVWorld(String name);
/**
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
*
* @param world The Bukkit world to check.
* @return A {@link MultiverseWorld} or null.
*/
MultiverseWorld getMVWorld(World world);
/**
* Checks to see if the given name is a valid {@link MultiverseWorld}.
*
* @param name The name or alias of the world to check.
* @return True if the world exists, false if not.
*/
boolean isMVWorld(String name);
/**
* Checks to see if the given world is a valid {@link MultiverseWorld}.
*
* @param world The Bukkit world to check.
* @return True if the world has been loaded into MV2, false if not.
*/
boolean isMVWorld(World world);
/**
* Load the Worlds & Settings from the configuration file.
*
* @param forceLoad If set to true, this will perform a total
* reset and not just load new worlds.
*/
void loadWorlds(boolean forceLoad);
/**
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
* <p>
* This way people will _always_ have some worlds in the list.
*/
void loadDefaultWorlds();
/**
* Return the World Purger.
*
* @return A valid {@link PurgeWorlds}.
* @deprecated {@link PurgeWorlds} is deprecated!
*/
@Deprecated
PurgeWorlds getWorldPurger();
/**
* Gets the {@link WorldPurger}.
* <p>
* TODO: Remove {@link #getWorldPurger()} and replace it with this method.
* @return The {@link WorldPurger} this {@link MVWorldManager} is using.
* @see WorldPurger
* @see SimpleWorldPurger
*/
WorldPurger getTheWorldPurger();
/**
* Gets the world players will spawn in on first join.
* Currently this always returns worlds.get(0) from Bukkit.
*
* @return A Multiverse world that players will spawn in or null if no MV world has been set.
*/
MultiverseWorld getSpawnWorld();
/**
* Gets the list of worlds in the config, but unloaded.
*
* @return A List of worlds as strings.
*/
List<String> getUnloadedWorlds();
/**
* This method populates an internal list and needs to be called after multiverse initialization.
*/
void getDefaultWorldGenerators();
/**
* Load the config from a file.
*
* @param file The file to load.
* @return A loaded configuration.
*/
FileConfiguration loadWorldConfig(File file);
/**
* Saves the world config to disk.
*
* @return True if success, false if fail.
*/
boolean saveWorldsConfig();
/**
* Remove the world from the Multiverse list and from the config.
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
boolean removeWorldFromConfig(String name);
/**
* Sets the initial spawn world for new players.
*
* @param world The World new players should spawn in.
*/
void setFirstSpawnWorld(String world);
/**
* Gets the world players should spawn in first.
*
* @return The {@link MultiverseWorld} new players should spawn in.
*/
MultiverseWorld getFirstSpawnWorld();
/**
* Regenerates a world.
*
* @param name Name of the world to regenerate
* @param useNewSeed If a new seed should be used
* @param randomSeed IF the new seed should be random
* @param seed The seed of the world.
*
* @return True if success, false if fail.
*/
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed);
}
@@ -0,0 +1,162 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
/**
* The configuration of MultiverseCore.
*/
public interface MultiverseCoreConfig extends ConfigurationSerializable {
/**
* Sets a property using a {@link String}.
* @param property The name of the property.
* @param value The value.
* @return True on success, false if the operation failed.
*/
boolean setConfigProperty(String property, String value);
/**
* Sets portalCooldown.
* @param portalCooldown The new value.
*/
void setTeleportCooldown(int portalCooldown);
/**
* Gets portalCooldown.
* @return portalCooldown.
*/
int getTeleportCooldown();
/**
* Sets firstSpawnWorld.
* @param firstSpawnWorld The new value.
*/
void setFirstSpawnWorld(String firstSpawnWorld);
/**
* Gets firstSpawnWorld.
* @return firstSpawnWorld.
*/
String getFirstSpawnWorld();
/**
* Sets version.
* @param version The new value.
*/
void setVersion(int version);
/**
* Gets version.
* @return version.
*/
double getVersion();
/**
* Sets messageCooldown.
* @param messageCooldown The new value.
*/
void setMessageCooldown(int messageCooldown);
/**
* Gets messageCooldown.
* @return messageCooldown.
*/
int getMessageCooldown();
/**
* Sets globalDebug.
* @param globalDebug The new value.
*/
void setGlobalDebug(int globalDebug);
/**
* Gets globalDebug.
* @return globalDebug.
*/
int getGlobalDebug();
/**
* Sets displayPermErrors.
* @param displayPermErrors The new value.
*/
void setDisplayPermErrors(boolean displayPermErrors);
/**
* Gets displayPermErrors.
* @return displayPermErrors.
*/
boolean getDisplayPermErrors();
/**
* Sets firstSpawnOverride.
* @param firstSpawnOverride The new value.
*/
void setFirstSpawnOverride(boolean firstSpawnOverride);
/**
* Gets firstSpawnOverride.
* @return firstSpawnOverride.
*/
boolean getFirstSpawnOverride();
/**
* Sets teleportIntercept.
* @param teleportIntercept The new value.
*/
void setTeleportIntercept(boolean teleportIntercept);
/**
* Gets teleportIntercept.
* @return teleportIntercept.
*/
boolean getTeleportIntercept();
/**
* Sets prefixChat.
* @param prefixChat The new value.
*/
void setPrefixChat(boolean prefixChat);
/**
* Gets prefixChat.
* @return prefixChat.
*/
boolean getPrefixChat();
/**
* Sets enforceAccess.
* @param enforceAccess The new value.
*/
void setEnforceAccess(boolean enforceAccess);
/**
* Gets enforceAccess.
* @return enforceAccess.
*/
boolean getEnforceAccess();
/**
* Sets useasyncchat.
* @param useAsyncChat The new value.
*/
void setUseAsyncChat(boolean useAsyncChat);
/**
* Gets useasyncchat.
* @return useasyncchat.
*/
boolean getUseAsyncChat();
/**
* Sets whether to suppress startup messages.
*
* @param silentStart true to suppress messages.
*/
void setSilentStart(boolean silentStart);
/**
* Whether we are suppressing startup messages.
*
* @return true if we are suppressing startup messages.
*/
boolean getSilentStart();
}
@@ -0,0 +1,56 @@
package com.onarandombox.MultiverseCore.api;
import java.util.Collection;
import org.bukkit.command.CommandSender;
/**
* Multiverse-messaging.
*/
public interface MultiverseMessaging {
/**
* Sets the message-cooldown.
* @param milliseconds The new message-cooldown in milliseconds.
*/
void setCooldown(int milliseconds);
/**
* Sends a message to the specified sender if the cooldown has passed.
*
* @param sender The person/console to send the message to.
* @param message The message to send.
* @param ignoreCooldown If true this message will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
boolean sendMessage(CommandSender sender, String message, boolean ignoreCooldown);
/**
* Sends a group of messages to the specified sender if the cooldown has passed.
* This method is needed, since sending many messages in quick succession would violate
* the cooldown.
*
* @param sender The person/console to send the message to.
* @param messages The messages to send.
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
boolean sendMessages(CommandSender sender, String[] messages, boolean ignoreCooldown);
/**
* Sends a group of messages to the specified sender if the cooldown has passed.
* This method is needed, since sending many messages in quick succession would violate
* the cooldown.
*
* @param sender The person/console to send the message to.
* @param messages The messages to send.
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
boolean sendMessages(CommandSender sender, Collection<String> messages, boolean ignoreCooldown);
/**
* Gets the message-cooldown.
* @return The message-cooldown.
*/
int getCooldown();
}
@@ -0,0 +1,161 @@
package com.onarandombox.MultiverseCore.api;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.utils.DebugLog;
import com.pneumaticraft.commandhandler.CommandHandler;
/**
* Make things easier for MV-Plugins!
*/
public abstract class MultiversePlugin extends JavaPlugin implements MVPlugin {
private MultiverseCore core;
/**
* Prefix for standard log entrys.
*/
protected String logTag;
private DebugLog debugLog;
/**
* {@inheritDoc}
*
* Note: You can't override this, use {@link #onPluginEnable()} instead!
* @see #onPluginEnable()
*/
@Override
public final void onEnable() {
MultiverseCore theCore = (MultiverseCore) this.getServer().getPluginManager().getPlugin("Multiverse-Core");
if (theCore == null) {
this.getLogger().severe("Core not found! The plugin dev needs to add a dependency!");
this.getLogger().severe("Disabling!");
this.getServer().getPluginManager().disablePlugin(this);
return;
}
if (theCore.getProtocolVersion() < this.getProtocolVersion()) {
this.getLogger().severe("You need a newer version of Multiverse-Core!");
this.getLogger().severe("Disabling!");
this.getServer().getPluginManager().disablePlugin(this);
return;
}
this.setCore(theCore);
this.getServer().getLogger().info(String.format("%s - Version %s enabled - By %s",
this.getDescription().getName(), this.getDescription().getVersion(), getAuthors()));
getDataFolder().mkdirs();
File debugLogFile = new File(getDataFolder(), "debug.log");
try {
debugLogFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
debugLog = new DebugLog(this.getDescription().getName(), getDataFolder() + File.separator + "debug.log");
debugLog.setTag(String.format("[%s-Debug]", this.getDescription().getName()));
this.onPluginEnable();
}
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @return The readable authors-{@link String}
*/
protected String getAuthors() {
String authors = "";
List<String> auths = this.getDescription().getAuthors();
if (auths.size() == 0) {
return "";
}
if (auths.size() == 1) {
return auths.get(0);
}
for (int i = 0; i < auths.size(); i++) {
if (i == this.getDescription().getAuthors().size() - 1) {
authors += " and " + this.getDescription().getAuthors().get(i);
} else {
authors += ", " + this.getDescription().getAuthors().get(i);
}
}
return authors.substring(2);
}
/**
* Called when the plugin is enabled.
* @see #onEnable()
*/
protected abstract void onPluginEnable();
/**
* You can register commands here.
* @param handler The CommandHandler.
*/
protected abstract void registerCommands(CommandHandler handler);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!this.isEnabled()) {
sender.sendMessage("This plugin is Disabled!");
return true;
}
ArrayList<String> allArgs = new ArrayList<String>(args.length + 1);
allArgs.add(command.getName());
allArgs.addAll(Arrays.asList(args));
return this.getCore().getCommandHandler().locateAndRunCommand(sender, allArgs);
}
@Override
public void log(Level level, String msg) {
int debugLevel = this.getCore().getMVConfig().getGlobalDebug();
if ((level == Level.FINE && debugLevel >= 1) || (level == Level.FINER && debugLevel >= 2)
|| (level == Level.FINEST && debugLevel >= 3)) {
debugLog.log(level, msg);
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
String message = new StringBuilder(getLogTag()).append(msg).toString();
this.getServer().getLogger().log(level, message);
debugLog.log(level, message);
}
}
private String getLogTag() {
if (logTag == null)
logTag = String.format("[%s]", this.getDescription().getName());
return logTag;
}
/**
* Sets the debug log-tag.
* @param tag The new tag.
*/
protected final void setDebugLogTag(String tag) {
this.debugLog.setTag(tag);
}
@Override
public final String dumpVersionInfo(String buffer) {
throw new UnsupportedOperationException("This is gone.");
}
@Override
public final MultiverseCore getCore() {
if (this.core == null)
throw new IllegalStateException("Core is null!");
return this.core;
}
@Override
public final void setCore(MultiverseCore core) {
this.core = core;
}
}
@@ -0,0 +1,688 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import java.util.List;
/**
* The API for a Multiverse Handled World.
*/
public interface MultiverseWorld {
/**
* Returns the Bukkit world object that this world describes.
*
* @return A {@link World}
*/
World getCBWorld();
/**
* Gets the name of this world. The name cannot be changed.
* <p>
* Note for plugin developers: Usually {@link #getAlias()}
* is what you want to use instead of this method.
*
* @return The name of the world as a String.
*/
String getName();
/**
* Gets the type of this world. As of 1.2 this will be:
* FLAT, NORMAL or VERSION_1_1
* <p>
* This is <b>not</b> the generator.
*
* @return The Type of this world.
*/
WorldType getWorldType();
/**
* Gets the environment of this world.
*
* @return A {@link org.bukkit.World.Environment}.
*/
World.Environment getEnvironment();
/**
* Sets the environment of a world.
* <p>
* Note: This will ONLY take effect once the world is unloaded/reloaded.
*
* @param environment A {@link org.bukkit.World.Environment}.
*/
void setEnvironment(World.Environment environment);
/**
* Gets the difficulty of this world.
*
* @return The difficulty of this world.
*/
Difficulty getDifficulty();
/**
* Sets the difficulty of this world and returns true if success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. {@code PEACEFUL}
*
* @param difficulty The difficulty to set the world to as a string.
* @return True if success, false if the provided string
* could not be translated to a difficulty.
* @deprecated Use {@link #setDifficulty(Difficulty)} or, if you have to
* pass a string, use {@link #setPropertyValue(String, String)} instead.
*/
@Deprecated
boolean setDifficulty(String difficulty);
/**
* Sets the difficulty of this world and returns {@code true} on success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. PEACEFUL
*
* @param difficulty The new difficulty.
* @return True if success, false if the operation failed... for whatever reason.
*/
boolean setDifficulty(Difficulty difficulty);
/**
* Gets the world seed of this world.
*
* @return The Long version of the seed.
*/
long getSeed();
/**
* Sets the seed of this world.
*
* @param seed A Long that is the seed.
*/
void setSeed(long seed);
/**
* Gets the generator of this world.
*
* @return The name of the generator.
*/
String getGenerator();
/**
* Sets the generator of this world.
*
* @param generator The new generator's name.
*/
void setGenerator(String generator);
/**
* Gets the help-message for a property.
* @param property The name of the property.
* @return The help-message.
* @throws PropertyDoesNotExistException Thrown if the property was not found.
*/
String getPropertyHelp(String property) throws PropertyDoesNotExistException;
/**
* Gets a property as {@link String}.
*
* @param property The name of a world property to get.
* @return The string-representation of that property.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
String getPropertyValue(String property) throws PropertyDoesNotExistException;
/**
* Sets a property to a given value.
*
* @param property The name of a world property to set.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was set, false if not.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
/**
* 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}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to add a value to.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was added, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean addToVariable(String property, String value);
/**
* Removes a value from the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to remove a value
* from.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was removed, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean removeFromVariable(String property, String value);
/**
* Removes all values from the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to clear.
* @return True if it was cleared, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean clearVariable(String property);
/**
* Clears a list property (sets it to []).
*
* @param property The property to clear.
* @return True if success, false if fail.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean clearList(String property);
// end of old config stuff
// permission stuff
/**
* Gets the lowercased name of the world. This method is required, since the permissables
* lowercase all permissions when recalculating.
* <p>
* Note: This also means if a user has worlds named: world and WORLD, that they can both
* exist, and both be teleported to independently, but their permissions **cannot** be
* uniqueified at this time. See bug report #.
*
* @return The lowercased name of the world.
*/
String getPermissibleName();
/**
* Gets the permission required to enter this world.
*
* @return The permission required to be exempt from charges to/from this world.
*/
Permission getAccessPermission();
/**
* Gets the permission required to be exempt when entering.
*
* @return The permission required to be exempt when entering.
*/
Permission getExemptPermission();
// end of permission stuff
/**
* Gets the alias of this world.
* <p>
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
*
* @return The alias of the world as a String.
*/
String getAlias();
/**
* Sets the alias of the world.
*
* @param alias A string that is the new alias.
*/
void setAlias(String alias);
/**
* Gets the color that this world's name/alias will display as.
*
* @return The color of this world.
*/
ChatColor getColor();
/**
* Sets the color that this world's name/alias will display as.
*
* @param color A valid color name.
* @return True if the color was set, false if not.
*/
boolean setColor(String color);
/**
* Gets the style that this world's name/alias will display as.
*
* @return The style of this world. {@code null} for "normal" style.
*/
ChatColor getStyle();
/**
* Sets the style that this world's name/alias will display as.
*
* @param style A valid style name.
* @return True if the style was set, false if not.
*/
boolean setStyle(String style);
/**
* Tells you if someone entered a valid color.
*
* @param color A string that may translate to a color.
* @return True if it is a color, false if not.
*
* @deprecated This has been moved: {@link com.onarandombox.MultiverseCore.enums.EnglishChatColor#isValidAliasColor(String)}
*/
@Deprecated
boolean isValidAliasColor(String color);
/**
* Returns a very nicely colored string (using Alias and Color if they are set).
*
* @return A nicely colored string.
*/
String getColoredWorldString();
// animals&monster stuff
/**
* Gets whether or not animals are allowed to spawn in this world.
*
* @return True if ANY animal can, false if no animals can spawn.
*/
boolean canAnimalsSpawn();
/**
* Sets whether or not animals can spawn.
* If there are values in {@link #getAnimalList()} and this is false,
* those animals become the exceptions, and will spawn
*
* @param allowAnimalSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowAnimalSpawn(boolean allowAnimalSpawn);
/**
* Returns a list of animals. This list always negates the {@link #canAnimalsSpawn()} result.
*
* @return A list of animals that will spawn if {@link #canAnimalsSpawn()} is false.
*/
List<String> getAnimalList();
/**
* Gets whether or not monsters are allowed to spawn in this world.
*
* @return True if ANY monster can, false if no monsters can spawn.
*/
boolean canMonstersSpawn();
/**
* Sets whether or not monsters can spawn.
* If there are values in {@link #getMonsterList()} and this is false,
* those monsters become the exceptions, and will spawn
*
* @param allowMonsterSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowMonsterSpawn(boolean allowMonsterSpawn);
/**
* Returns a list of monsters. This list always negates the {@link #canMonstersSpawn()} result.
*
* @return A list of monsters that will spawn if {@link #canMonstersSpawn()} is false.
*/
List<String> getMonsterList();
// end of animal&monster stuff
/**
* Gets whether or not PVP is enabled in this world in some form (fake or not).
*
* @return True if players can take damage from other players.
*/
boolean isPVPEnabled();
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode.
*
* @param pvpMode True to enable PVP damage, false to disable it.
*/
void setPVPMode(boolean pvpMode);
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
*
* @return True if this world has fakepvp on
* @deprecated This is deprecated.
*/
@Deprecated
boolean getFakePVP();
/**
* Gets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @return True if the world will be hidden, false if not.
*/
boolean isHidden();
/**
* Sets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @param hidden Set
*/
void setHidden(boolean hidden);
/**
* Gets whether weather is enabled in this world.
*
* @return True if weather events will occur, false if not.
*/
boolean isWeatherEnabled();
/**
* Sets whether or not there will be weather events in a given world.
* If set to false, Multiverse will disable the weather in the world immediately.
*
* @param enableWeather True if weather events should occur in a world, false if not.
*/
void setEnableWeather(boolean enableWeather);
/**
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
*
* @return True if CraftBukkit is keeping spawn chunks in memory.
*/
boolean isKeepingSpawnInMemory();
/**
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
* If not, CraftBukkit will attempt to free memory when players have not used that world.
* This will not happen immediately.
*
* @param keepSpawnInMemory If true, CraftBukkit will keep the spawn chunks loaded in memory.
*/
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
/**
* Gets the spawn location of this world.
*
* @return The spawn location of this world.
*/
Location getSpawnLocation();
/**
* Sets the spawn location for a world.
*
* @param spawnLocation The spawn location for a world.
*/
void setSpawnLocation(Location spawnLocation);
/**
* Gets whether or not the hunger level of players will go down in a world.
*
* @return True if it will go down, false if it will remain steady.
*/
boolean getHunger();
/**
* Sets whether or not the hunger level of players will go down in a world.
*
* @param hungerEnabled True if hunger will go down, false to keep it at
* the level they entered a world with.
*/
void setHunger(boolean hungerEnabled);
/**
* Gets the GameMode of this world.
*
* @return The GameMode of this world.
*/
GameMode getGameMode();
/**
* Sets the game mode of this world.
*
* @param gameMode A valid game mode string (either
* an int ex. 0 or a string ex. creative).
* @return True if the game mode was successfully changed, false if not.
* @deprecated Use {@link #setGameMode(GameMode)} instead. If you have to
* pass a string, use {@link #setPropertyValue(String, String)}.
*/
@Deprecated
boolean setGameMode(String gameMode);
/**
* Sets the game mode of this world.
*
* @param gameMode The new {@link GameMode}.
* @return True if the game mode was successfully changed, false if not.
*/
boolean setGameMode(GameMode gameMode);
/**
* Gets the amount of currency it requires to enter this world.
*
* @return The amount it costs to enter this world.
*/
double getPrice();
/**
* Sets the price for entry to this world.
* You can think of this like an amount.
* The type can be set with {@link #setCurrency(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.
*/
World getRespawnToWorld();
/**
* Sets the world players will respawn in if they die in this one.
* Returns true upon success, false upon failure.
*
* @param respawnWorld The name of a world that exists on the server.
* @return True if respawnWorld existed, false if not.
*/
boolean setRespawnToWorld(String respawnWorld);
/**
* Gets the scaling value of this world.Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @return This world's non-negative, non-zero scale.
*/
double getScaling();
/**
* Sets the scale of this world. Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @param scaling A scaling value, cannot be negative or 0.
* @return Whether the scale was set successfully.
*/
boolean setScaling(double scaling);
/**
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @return True if the world should heal (default), false if not.
*/
boolean getAutoHeal();
/**
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @param heal True if the world will heal.
*/
void setAutoHeal(boolean heal);
/**
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @return True if Multiverse should adjust the spawn, false if not.
*/
boolean getAdjustSpawn();
/**
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @param adjust True if multiverse should adjust the spawn, false if not.
*/
void setAdjustSpawn(boolean adjust);
/**
* Gets whether or not Multiverse should auto-load this world.
*
* @return True if Multiverse should auto-load this world.
*/
boolean getAutoLoad();
/**
* Sets whether or not Multiverse should auto-load this world.
* <p>
* True is default.
*
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
*/
void setAutoLoad(boolean autoLoad);
/**
* Gets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
*
* @return True if players dying in this world should respawn at their bed.
*/
boolean getBedRespawn();
/**
* Sets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
* <p>
* True is default.
*
* @param autoLoad True if players dying in this world respawn at their bed.
*/
void setBedRespawn(boolean autoLoad);
/**
* Sets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
* @param limit The new limit
*/
void setPlayerLimit(int limit);
/**
* Gets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
* @return The player limit
*/
int getPlayerLimit();
/**
* Same as {@link #getTime()}, but returns a string.
* @return The time as a short string: 12:34pm
*/
String getTime();
/**
* Sets the current time in a world.
* <p>
* This method will take the following formats:
* 11:37am
* 4:30p
* day(morning), night, noon, midnight
*
* @param timeAsString The formatted time to set the world to.
* @return True if the time was set, false if not.
*/
boolean setTime(String timeAsString);
/**
* Sets The types of portals that are allowed in this world.
*
* @param type The type of portals allowed in this world.
*/
void allowPortalMaking(AllowedPortalType type);
/**
* Gets which type(s) of portals are allowed to be constructed in this world.
*
* @return The type of portals that are allowed.
*/
AllowedPortalType getAllowedPortals();
// properties that are not "getter+setter" style
/**
* Gets a list of all the worlds that players CANNOT travel to from this world,
* regardless of their access permissions.
*
* @return A List of world names.
*/
List<String> getWorldBlacklist();
/**
* Gets all the names of all properties that can be SET.
*
* @return All property names, with alternating colors.
*/
String getAllPropertyNames();
}
@@ -0,0 +1,71 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import com.onarandombox.MultiverseCore.enums.TeleportResult;
/**
* Used to safely teleport people.
*/
public interface SafeTTeleporter {
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @return A safe {@link Location}.
*/
Location getSafeLocation(Location l);
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @param tolerance The tolerance.
* @param radius The radius.
* @return A safe {@link Location}.
*/
Location getSafeLocation(Location l, int tolerance, int radius);
/**
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who performed the teleport command.
* @param teleportee Entity to teleport
* @param d Destination to teleport them to
* @return true for success, false for failure
*/
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, MVDestination d);
/**
* Safely teleport the entity to the Location. This may perform checks to
* see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who issued the teleport command.
* @param teleportee Entity to teleport.
* @param location Location to teleport them to.
* @param safely Should the destination be checked for safety before teleport?
* @return true for success, false for failure.
*/
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location,
boolean safely);
/**
* Returns a safe location for the entity to spawn at.
*
* @param e The entity to spawn
* @param d The MVDestination to take the entity to.
* @return A new location to spawn the entity at.
*/
Location getSafeLocation(Entity e, MVDestination d);
/**
* Finds a portal-block next to the specified {@link Location}.
* @param l The {@link Location}
* @return The next portal-block's {@link Location}.
*/
Location findPortalBlockNextTo(Location l);
}
@@ -0,0 +1,68 @@
package com.onarandombox.MultiverseCore.api;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
/**
* Used to remove animals from worlds that don't belong there.
*/
public interface WorldPurger {
/**
* Synchronizes the given worlds with their settings.
*
* @param worlds A list of {@link MultiverseWorld}
*/
void purgeWorlds(List<MultiverseWorld> worlds);
/**
* Convenience method for {@link #purgeWorld(CommandSender, MultiverseWorld, List, boolean, boolean)} that takes the settings from the world-config.
*
* @param world The {@link MultiverseWorld}.
*/
void purgeWorld(MultiverseWorld world);
/**
* Clear all animals/monsters that do not belong to a world according to the config.
*
* @param mvworld The {@link MultiverseWorld}.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
*/
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters);
/**
* Clear all animals/monsters that do not belong to a world according to the config.
*
* @param mvworld The {@link MultiverseWorld}.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
* @param sender The {@link CommandSender} that initiated the action. He will/should be notified.
*/
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters, CommandSender sender);
/**
* Determines whether the specified creature should be killed.
*
* @param e The creature.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
* @return {@code true} if the creature should be killed, otherwise {@code false}.
*/
boolean shouldWeKillThisCreature(Entity e, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters);
/**
* Determines whether the specified creature should be killed and automatically reads the params from a world object.
*
* @param w The world.
* @param e The creature.
* @return {@code true} if the creature should be killed, otherwise {@code false}.
*/
boolean shouldWeKillThisCreature(MultiverseWorld w, Entity e);
}
@@ -0,0 +1,5 @@
/**
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
* plugins when interacting with Multiverse.
*/
package com.onarandombox.MultiverseCore.api;
@@ -0,0 +1,162 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Allows management of Anchor Destinations.
*/
public class AnchorCommand extends PaginatedCoreCommand<String> {
public AnchorCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create, Delete and Manage Anchor Destinations.");
this.setCommandUsage("/mv anchor " + ChatColor.GREEN + "{name}" + ChatColor.GOLD + " [-d]");
this.setArgRange(0, 2);
this.addKey("mv anchor");
this.addKey("mv anchors");
this.addKey("mvanchor");
this.addKey("mvanchors");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "otherthing");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething " + ChatColor.RED + "-d");
this.addCommandExample("/mv anchors ");
this.setPermission("multiverse.core.anchor.list", "Allows a player to list all anchors.", PermissionDefault.OP);
this.addAdditonalPermission(new Permission("multiverse.core.anchor.create",
"Allows a player to create anchors.", PermissionDefault.OP));
this.addAdditonalPermission(new Permission("multiverse.core.anchor.delete",
"Allows a player to delete anchors.", PermissionDefault.OP));
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
private List<String> getFancyAnchorList(Player p) {
List<String> anchorList = new ArrayList<String>();
ChatColor color = ChatColor.GREEN;
for (String anchor : this.plugin.getAnchorManager().getAnchors(p)) {
anchorList.add(color + anchor);
color = (color == ChatColor.GREEN) ? ChatColor.GOLD : ChatColor.GREEN;
}
return anchorList;
}
private void showList(CommandSender sender, List<String> args) {
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.list", true)) {
sender.sendMessage(ChatColor.RED + "You don't have the permission to list anchors!");
return;
}
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse Anchor List ]====");
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
FilterObject filterObject = this.getPageAndFilter(args);
List<String> availableAnchors = new ArrayList<String>(this.getFancyAnchorList(p));
if (filterObject.getFilter().length() > 0) {
availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
if (availableAnchors.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
} else {
if (availableAnchors.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No anchors were defined.");
return;
}
}
if (!(sender instanceof Player)) {
for (String c : availableAnchors) {
sender.sendMessage(c);
}
return;
}
int totalPages = (int) Math.ceil(availableAnchors.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
} else if (filterObject.getPage() < 1) {
filterObject.setPage(1);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
this.showPage(filterObject.getPage(), sender, availableAnchors);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() == 0) {
this.showList(sender, args);
return;
}
if (args.size() == 1 && (this.getPageAndFilter(args).getPage() != 1 || args.get(0).equals("1"))) {
this.showList(sender, args);
return;
}
if (args.size() == 2 && args.get(1).equalsIgnoreCase("-d")) {
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.delete", true)) {
sender.sendMessage(ChatColor.RED + "You don't have the permission to delete anchors!");
} else {
if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) {
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!");
} else {
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "deleted!");
}
}
return;
}
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to create Anchors.");
return;
}
if (!this.plugin.getMVPerms().hasPermission(sender, "multiverse.core.anchor.create", true)) {
sender.sendMessage(ChatColor.RED + "You don't have the permission to create anchors!");
} else {
Player player = (Player) sender;
if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) {
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!");
} else {
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "created!");
}
}
}
@Override
protected List<String> getFilteredItems(List<String> availableItems, String filter) {
List<String> filtered = new ArrayList<String>();
for (String s : availableItems) {
if (s.matches("(?i).*" + filter + ".*")) {
filtered.add(s);
}
}
return filtered;
}
@Override
protected String getItemText(String item) {
return item;
}
}
@@ -0,0 +1,57 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
import com.onarandombox.MultiverseCore.utils.MVPermissions;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Checks to see if a player can go to a destination.
*/
public class CheckCommand extends MultiverseCommand {
public CheckCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Help you validate your multiverse settings");
this.setCommandUsage("/mv check " + ChatColor.GREEN + "{PLAYER} {DESTINATION}");
this.setArgRange(2, 2);
this.addKey("mv check");
this.addKey("mvcheck");
this.addCommandExample("/mv check " + ChatColor.GREEN + "fernferret " + ChatColor.LIGHT_PURPLE + "w:MyWorld");
this.addCommandExample("/mv check " + ChatColor.GREEN + "Rigby90 " + ChatColor.LIGHT_PURPLE + "p:MyPortal");
this.addCommandExample("/mv check " + ChatColor.GREEN + "lithium3141 " + ChatColor.LIGHT_PURPLE + "ow:WarpName");
this.setPermission("multiverse.core.debug", "Checks to see if a player can go to a destination. Prints debug if false.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = this.plugin.getServer().getPlayer(args.get(0));
if (p == null) {
sender.sendMessage("Could not find player " + ChatColor.GREEN + args.get(0));
sender.sendMessage("Are they online?");
return;
}
MVDestination dest = this.plugin.getDestFactory().getDestination(args.get(1));
if (dest instanceof InvalidDestination) {
sender.sendMessage(String.format("You asked if '%s' could go to %s%s%s,",
args.get(0), ChatColor.GREEN, args.get(0), ChatColor.WHITE));
sender.sendMessage("but I couldn't find a Destination of that name? Did you type it correctly?");
return;
}
MVPermissions perms = this.plugin.getMVPerms();
perms.tellMeWhyICantDoThis(sender, p, dest);
}
}
@@ -0,0 +1,60 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Creates a clone of a world.
*/
public class CloneCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public CloneCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Clone World");
this.setCommandUsage("/mv clone" + ChatColor.GREEN + " {TARGET} {NAME}" + ChatColor.GOLD + " -g [GENERATOR[:ID]]");
this.setArgRange(2, 4); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.addKey("mvclone");
this.addKey("mvcl");
this.addKey("mv cl");
this.addKey("mv clone");
this.addCommandExample("/mv clone " + ChatColor.GOLD + "world" + ChatColor.GREEN + " world_backup");
this.addCommandExample("/mv clone " + ChatColor.GOLD + "skyblock_pristine" + ChatColor.GREEN + " skyblock");
this.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))) {
// 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("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!");
}
}
@@ -0,0 +1,72 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
import java.util.Map;
/**
* Allows you to set Global MV Variables.
*/
public class ConfigCommand extends MultiverseCommand {
public ConfigCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Configuration");
this.setCommandUsage("/mv config " + ChatColor.GREEN + "{PROPERTY} {VALUE}");
this.setArgRange(1, 2);
this.addKey("mv config");
this.addKey("mvconfig");
this.addKey("mv conf");
this.addKey("mvconf");
this.addCommandExample("/mv config show");
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() <= 1) {
StringBuilder builder = new StringBuilder();
Map<String, Object> serializedConfig = this.plugin.getMVConfig().serialize();
for (Map.Entry<String, Object> entry : serializedConfig.entrySet()) {
builder.append(ChatColor.GREEN);
builder.append(entry.getKey());
builder.append(ChatColor.WHITE).append(" = ").append(ChatColor.GOLD);
builder.append(entry.getValue().toString());
builder.append(ChatColor.WHITE).append(", ");
}
String message = builder.toString();
message = message.substring(0, message.length() - 2);
sender.sendMessage(message);
return;
}
if (!this.plugin.getMVConfig().setConfigProperty(args.get(0).toLowerCase(), args.get(1))) {
sender.sendMessage(String.format("%sSetting '%s' to '%s' failed!", ChatColor.RED, args.get(0).toLowerCase(), args.get(1)));
return;
}
// special rule
if (args.get(0).equalsIgnoreCase("firstspawnworld")) {
// Don't forget to set the world!
this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
}
if (this.plugin.saveMVConfigs()) {
sender.sendMessage(ChatColor.GREEN + "SUCCESS!" + ChatColor.WHITE + " Values were updated successfully!");
this.plugin.loadConfigs();
} else {
sender.sendMessage(ChatColor.RED + "FAIL!" + ChatColor.WHITE + " Check your console for details!");
}
}
}
@@ -0,0 +1,39 @@
/******************************************************************************
* 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.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Confirms actions.
*/
public class ConfirmCommand extends MultiverseCommand {
public ConfirmCommand(MultiverseCore plugin) {
super(plugin);
// Any command that is dangerous should require op
this.setName("Confirms a command that could destroy life, the universe and everything.");
this.setCommandUsage("/mv confirm");
this.setArgRange(0, 0);
this.addKey("mvconfirm");
this.addKey("mv confirm");
this.addCommandExample("/mv confirm");
this.setPermission("multiverse.core.confirm", "If you have not been prompted to use this, it will not do anything.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
this.plugin.getCommandHandler().confirmQueuedCommand(sender);
}
}
@@ -0,0 +1,70 @@
/******************************************************************************
* 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.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.text.DecimalFormat;
import java.util.List;
/**
* Returns detailed information on the Players where abouts.
*/
public class CoordCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public CoordCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Coordinates");
this.setCommandUsage("/mv coord");
this.setArgRange(0, 0);
this.addKey("mv coord");
this.addKey("mvcoord");
this.addKey("mvco");
this.addCommandExample("/mv coord");
this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
if (sender instanceof Player) {
Player p = (Player) sender;
World world = p.getWorld();
if (!this.worldManager.isMVWorld(world.getName())) {
this.plugin.showNotMVWorldMessage(sender, world.getName());
return;
}
MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName());
p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
DecimalFormat df = new DecimalFormat();
df.setMinimumFractionDigits(0);
df.setMaximumFractionDigits(2);
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + plugin.getLocationManipulation().strCoords(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + plugin.getLocationManipulation().getDirection(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + Material.getMaterial(world.getBlockTypeIdAt(p.getLocation())));
} else {
sender.sendMessage("This command needs to be used from a Player.");
}
}
}
@@ -0,0 +1,120 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.WorldType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Creates a new world and loads it.
*/
public class CreateCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public CreateCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create World");
this.setCommandUsage(String.format("/mv create %s{NAME} {ENV} %s-s [SEED] -g [GENERATOR[:ID]] -t [WORLDTYPE] [-n] -a [true|false]",
ChatColor.GREEN, ChatColor.GOLD));
this.setArgRange(2, 11); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.addKey("mvcreate");
this.addKey("mvc");
this.addKey("mv create");
this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP);
this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " end");
this.addCommandExample("/mv create " + ChatColor.GOLD + "flatroom" + ChatColor.GREEN + " normal" + ChatColor.AQUA + " -t flat");
this.addCommandExample("/mv create " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -s gargamel");
this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
String env = args.get(1);
String seed = CommandHandler.getFlag("-s", args);
String generator = CommandHandler.getFlag("-g", args);
boolean allowStructures = true;
String structureString = CommandHandler.getFlag("-a", args);
if (structureString != null) {
allowStructures = Boolean.parseBoolean(structureString);
}
String typeString = CommandHandler.getFlag("-t", args);
boolean useSpawnAdjust = true;
for (String s : args) {
if (s.equalsIgnoreCase("-n")) {
useSpawnAdjust = false;
}
}
if (this.worldManager.isMVWorld(worldName)) {
sender.sendMessage(ChatColor.RED + "Multiverse cannot create " + ChatColor.GOLD + ChatColor.UNDERLINE
+ "another" + ChatColor.RESET + ChatColor.RED + " world named " + worldName);
return;
}
if (worldFile.exists()) {
sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
return;
}
Environment environment = EnvironmentCommand.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
// If they didn't specify a type, default to NORMAL
if (typeString == null) {
typeString = "NORMAL";
}
WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString);
if (type == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid World Type.");
EnvironmentCommand.showWorldTypes(sender);
return;
}
// Determine if the generator is valid. #918
if (generator != null) {
List<String> genarray = new ArrayList<String>(Arrays.asList(generator.split(":")));
if (genarray.size() < 2) {
// If there was only one arg specified, pad with another empty one.
genarray.add("");
}
if (this.worldManager.getChunkGenerator(genarray.get(0), genarray.get(1), "test") == null) {
// We have an invalid generator.
sender.sendMessage("Invalid generator! '" + generator + "'. " + ChatColor.RED + "Aborting world creation.");
return;
}
}
Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'...");
if (this.worldManager.addWorld(worldName, environment, seed, type, allowStructures, generator, useSpawnAdjust)) {
Command.broadcastCommandMessage(sender, "Complete!");
} else {
Command.broadcastCommandMessage(sender, "FAILED.");
}
}
}
@@ -0,0 +1,66 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
import java.util.logging.Level;
/**
* Enables debug-information.
*/
public class DebugCommand extends MultiverseCommand {
public DebugCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Turn Debug on/off?");
this.setCommandUsage("/mv debug" + ChatColor.GOLD + " [1|2|3|off|silent]");
this.setArgRange(0, 1);
this.addKey("mv debug");
this.addKey("mv d");
this.addKey("mvdebug");
this.addCommandExample("/mv debug " + ChatColor.GOLD + "2");
this.setPermission("multiverse.core.debug", "Spams the console a bunch.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() == 1) {
if (args.get(0).equalsIgnoreCase("off")) {
plugin.getMVConfig().setGlobalDebug(0);
} else {
try {
int debugLevel = Integer.parseInt(args.get(0));
if (debugLevel > 3 || debugLevel < 0) {
throw new NumberFormatException();
}
plugin.getMVConfig().setGlobalDebug(debugLevel);
} catch (NumberFormatException e) {
sender.sendMessage(ChatColor.RED + "Error" + ChatColor.WHITE
+ " setting debug level. Please use a number 0-3 " + ChatColor.AQUA + "(3 being many many messages!)");
}
}
plugin.saveMVConfigs();
}
this.displayDebugMode(sender);
}
private void displayDebugMode(CommandSender sender) {
final int debugLevel = plugin.getMVConfig().getGlobalDebug();
if (debugLevel == 0) {
sender.sendMessage("Multiverse Debug mode is " + ChatColor.RED + "OFF");
} else {
sender.sendMessage("Multiverse Debug mode is " + ChatColor.GREEN + debugLevel);
this.plugin.log(Level.FINE, "Multiverse Debug ENABLED");
}
}
}
@@ -0,0 +1,41 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Deletes worlds.
*/
public class DeleteCommand extends MultiverseCommand {
public DeleteCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Delete World");
this.setCommandUsage("/mv delete" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvdelete");
this.addKey("mv delete");
this.addCommandExample("/mv create " + ChatColor.GOLD + "MyWorld");
this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Class<?>[] paramTypes = {String.class};
List<Object> objectArgs = new ArrayList<Object>(args);
this.plugin.getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", objectArgs,
paramTypes, ChatColor.GREEN + "World Deleted!", ChatColor.RED + "World could NOT be deleted!");
}
}
@@ -0,0 +1,116 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Lists valid known environments.
*/
public class EnvironmentCommand extends MultiverseCommand {
public EnvironmentCommand(MultiverseCore plugin) {
super(plugin);
this.setName("List Environments");
this.setCommandUsage("/mv env");
this.setArgRange(0, 0);
this.addKey("mvenv");
this.addKey("mv env");
this.addKey("mv type");
this.addKey("mv environment");
this.addKey("mv environments");
this.addCommandExample("/mv env");
this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP);
}
/**
* Shows all valid known environments to a {@link CommandSender}.
*
* @param sender The {@link CommandSender}.
*/
public static void showEnvironments(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
sender.sendMessage(ChatColor.GREEN + "NORMAL");
sender.sendMessage(ChatColor.RED + "NETHER");
sender.sendMessage(ChatColor.AQUA + "END");
}
/**
* Shows all valid known world types to a {@link CommandSender}.
*
* @param sender The {@link CommandSender}.
*/
public static void showWorldTypes(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "Valid World Types are:");
sender.sendMessage(String.format("%sNORMAL%s, %sFLAT, %sLARGEBIOMES %sor %sVERSION_1_1",
ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, ChatColor.RED, ChatColor.WHITE, ChatColor.GOLD));
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
EnvironmentCommand.showEnvironments(sender);
EnvironmentCommand.showWorldTypes(sender);
}
/**
* Converts a {@link String} into a {@link WorldType}.
*
* @param type The WorldType as a {@link String}
* @return The WorldType as a {@link WorldType}
*/
public static WorldType getWorldTypeFromString(String type) {
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
if (type.equalsIgnoreCase("normal"))
type = "NORMAL";
if (type.equalsIgnoreCase("flat"))
type = "FLAT";
if (type.equalsIgnoreCase("largebiomes")) {
type = "LARGE_BIOMES";
}
try {
// Now that we've converted a potentially unfriendly value
// to a friendly one, get it from the ENUM!
return WorldType.valueOf(type);
} catch (IllegalArgumentException e) {
return null;
}
}
/**
* Converts a {@link String} into an {@link org.bukkit.World.Environment}.
*
* @param env The environment as {@link String}
* @return The environment as {@link org.bukkit.World.Environment}
*/
public static World.Environment getEnvFromString(String env) {
env = env.toUpperCase();
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
if (env.equalsIgnoreCase("HELL") || env.equalsIgnoreCase("NETHER"))
env = "NETHER";
if (env.equalsIgnoreCase("END") || env.equalsIgnoreCase("THEEND") || env.equalsIgnoreCase("STARWARS"))
env = "THE_END";
if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD"))
env = "NORMAL";
try {
// Now that we've converted a potentially unfriendly value
// to a friendly one, get it from the ENUM!
return World.Environment.valueOf(env);
} catch (IllegalArgumentException e) {
return null;
}
}
}
@@ -0,0 +1,60 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.List;
/**
* Returns a list of loaded generator plugins.
*/
public class GeneratorCommand extends MultiverseCommand {
public GeneratorCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Information");
this.setCommandUsage("/mv generators");
this.setArgRange(0, 0);
this.addKey("mv generators");
this.addKey("mvgenerators");
this.addKey("mv gens");
this.addKey("mvgens");
this.addCommandExample("/mv generators");
this.setPermission("multiverse.core.generator", "Returns a list of Loaded Generator Plugins.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Logging.info("PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
Plugin[] plugins = this.plugin.getServer().getPluginManager().getPlugins();
List<String> generators = new ArrayList<String>();
for (Plugin p : plugins) {
if (p.isEnabled() && p.getDefaultWorldGenerator("world", "") != null) {
generators.add(p.getDescription().getName());
}
}
sender.sendMessage(ChatColor.AQUA + "--- Loaded Generator Plugins ---");
String loadedGens = "";
boolean altColor = false;
for (String s : generators) {
loadedGens += (altColor ? ChatColor.YELLOW : ChatColor.WHITE) + s + " ";
altColor = !altColor;
}
if (loadedGens.length() == 0) {
loadedGens = ChatColor.RED + "No Generator Plugins found.";
}
sender.sendMessage(loadedGens);
}
}
@@ -0,0 +1,106 @@
/******************************************************************************
* 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.pneumaticraft.commandhandler.Command;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Displays a nice help menu.
*/
public class HelpCommand extends PaginatedCoreCommand<Command> {
public HelpCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Get Help with Multiverse");
this.setCommandUsage("/mv " + ChatColor.GOLD + "[FILTER] [PAGE #]");
this.setArgRange(0, 2);
this.addKey("mv");
this.addKey("mvh");
this.addKey("mvhelp");
this.addKey("mv help");
this.addKey("mvsearch");
this.addKey("mv search");
this.addCommandExample("/mv help ?");
this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE);
this.setItemsPerPage(7); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
@Override
protected List<Command> getFilteredItems(List<Command> availableItems, String filter) {
List<Command> filtered = new ArrayList<Command>();
for (Command c : availableItems) {
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandName().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandDesc().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandUsage().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else {
for (String example : c.getCommandExamples()) {
if (example.matches("(?i).*" + filter + ".*")) {
filtered.add(c);
break;
}
}
}
}
return filtered;
}
@Override
protected String getItemText(Command item) {
return ChatColor.AQUA + item.getCommandUsage();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
FilterObject filterObject = this.getPageAndFilter(args);
List<Command> availableCommands = new ArrayList<Command>(this.plugin.getCommandHandler().getCommands(sender));
if (filterObject.getFilter().length() > 0) {
availableCommands = this.getFilteredItems(availableCommands, filterObject.getFilter());
if (availableCommands.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No commands matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
}
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
for (Command c : availableCommands) {
sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
}
return;
}
int totalPages = (int) Math.ceil(availableCommands.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
this.showPage(filterObject.getPage(), sender, availableCommands);
}
}
@@ -0,0 +1,162 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Imports a new world of the specified type.
*/
public class ImportCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ImportCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Import World");
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -g [GENERATOR[:ID]] [-n]");
this.setArgRange(1, 5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.addKey("mvimport");
this.addKey("mvim");
this.addKey("mv import");
this.addCommandExample("/mv import " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv import " + ChatColor.GOLD + "hell_world" + ChatColor.GREEN + " nether");
this.addCommandExample("To import a world that uses a generator, you'll need the generator:");
this.addCommandExample("/mv import " + ChatColor.GOLD + "CleanRoom" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " CleanRoomGenerator");
this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
/**
* A very basic check to see if a folder has a level.dat file.
* If it does, we can safely assume it's a world folder.
*
* @param worldFolder The File that may be a world.
* @return True if it looks like a world, false if not.
*/
private static boolean checkIfIsWorld(File worldFolder) {
if (worldFolder.isDirectory()) {
File[] files = worldFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String name) {
return name.equalsIgnoreCase("level.dat");
}
});
if (files != null && files.length > 0) {
return true;
}
}
return false;
}
private String getPotentialWorlds() {
File worldFolder = this.plugin.getServer().getWorldContainer();
if (worldFolder == null) {
return "";
}
File[] files = worldFolder.listFiles();
String worldList = "";
Collection<MultiverseWorld> worlds = this.worldManager.getMVWorlds();
List<String> worldStrings = new ArrayList<String>();
for (MultiverseWorld world : worlds) {
worldStrings.add(world.getName());
}
for (String world : this.worldManager.getUnloadedWorlds()) {
worldStrings.add(world);
}
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;
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
String worldList = this.getPotentialWorlds();
if (worldList.length() > 2) {
sender.sendMessage(ChatColor.AQUA + "====[ These look like worlds ]====");
sender.sendMessage(worldList);
} else {
sender.sendMessage(ChatColor.RED + "No potential worlds found. Sorry!");
}
return;
}
// Since we made an exception for the list, we have to make sure they have at least 2 params:
// Note the exception is --list, which is covered above.
if (args.size() == 1) {
this.showHelp(sender);
return;
}
// Make sure we don't already know about this world.
if (this.worldManager.isMVWorld(worldName)) {
sender.sendMessage(ChatColor.GREEN + "Multiverse" + ChatColor.WHITE
+ " already knows about '" + ChatColor.AQUA + worldName + ChatColor.WHITE + "'!");
return;
}
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
String generator = CommandHandler.getFlag("-g", args);
boolean useSpawnAdjust = true;
for (String s : args) {
if (s.equalsIgnoreCase("-n")) {
useSpawnAdjust = false;
}
}
String env = args.get(1);
Environment environment = EnvironmentCommand.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
if (worldFile.exists() && env != null) {
Command.broadcastCommandMessage(sender, String.format("Starting import of world '%s'...", worldName));
if (this.worldManager.addWorld(worldName, environment, null, null, null, generator, useSpawnAdjust))
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Complete!");
else
Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!");
} else if (env == null) {
sender.sendMessage(ChatColor.RED + "FAILED.");
sender.sendMessage("That world environment did not exist.");
sender.sendMessage("For a list of available world types, type: " + ChatColor.AQUA + "/mvenv");
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
String worldList = this.getPotentialWorlds();
sender.sendMessage("That world folder does not exist. These look like worlds to me:");
sender.sendMessage(worldList);
}
}
}
@@ -0,0 +1,271 @@
/******************************************************************************
* 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.FancyText;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.utils.FancyColorScheme;
import com.onarandombox.MultiverseCore.utils.FancyHeader;
import com.onarandombox.MultiverseCore.utils.FancyMessage;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
// Will use when we can compile with JDK 6
//import com.sun.xml.internal.ws.util.StringUtils;
/**
* Returns detailed information about a world.
*/
public class InfoCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public InfoCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Information");
this.setCommandUsage("/mv info" + ChatColor.GOLD + " [WORLD] [PAGE]");
this.setArgRange(0, 2);
this.addKey("mvinfo");
this.addKey("mvi");
this.addKey("mv info");
this.addCommandExample("/mv info " + ChatColor.GOLD + "1");
this.addCommandExample("/mv info " + ChatColor.GOLD + "3");
this.setPermission("multiverse.core.info", "Returns detailed information on the world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
String worldName = "";
int pageNum = 0;
if (args.size() == 0) {
if (sender instanceof Player) {
Player p = (Player) sender;
worldName = p.getWorld().getName();
} else {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
} else if (args.size() == 1) {
if (this.worldManager.isMVWorld(args.get(0))) {
// then we have a world!
worldName = args.get(0);
} else if (this.worldManager.getUnloadedWorlds().contains(args.get(0))) {
sender.sendMessage("That world exists, but it is unloaded!");
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, args.get(0)));
return;
} else {
if (sender instanceof Player) {
Player p = (Player) sender;
worldName = p.getWorld().getName();
try {
pageNum = Integer.parseInt(args.get(0)) - 1;
} catch (NumberFormatException e) {
sender.sendMessage("That world does not exist.");
return;
}
} else {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
}
} else if (args.size() == 2) {
worldName = args.get(0);
try {
pageNum = Integer.parseInt(args.get(1)) - 1;
} catch (NumberFormatException e) {
pageNum = 0;
}
}
if (this.worldManager.isMVWorld(worldName)) {
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
showPage(pageNum, sender, this.buildEntireCommand(this.worldManager.getMVWorld(worldName), p));
} else if (this.worldManager.getUnloadedWorlds().contains(worldName)) {
sender.sendMessage("That world exists, but it is unloaded!");
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, worldName));
} else if (this.plugin.getServer().getWorld(worldName) != null) {
sender.sendMessage("That world exists, but Multiverse does not know about it!");
sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
}
}
private List<List<FancyText>> buildEntireCommand(MultiverseWorld world, Player p) {
List<FancyText> message = new ArrayList<FancyText>();
List<List<FancyText>> worldInfo = new ArrayList<List<FancyText>>();
// Page 1
FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
message.add(new FancyHeader("General Info", colors));
message.add(new FancyMessage("World Name: ", world.getName(), colors));
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
message.add(new FancyMessage("Game Mode: ", world.getGameMode().toString(), colors));
message.add(new FancyMessage("Difficulty: ", world.getDifficulty().toString(), colors));
//message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors));
Location spawn = world.getSpawnLocation();
message.add(new FancyMessage("Spawn Location: ", plugin.getLocationManipulation().strCoords(spawn), colors));
message.add(new FancyMessage("World Scale: ", world.getScaling() + "", colors));
if (world.getPrice() > 0) {
final String formattedAmount;
if (world.getCurrency() <= 0 && plugin.getVaultHandler().getEconomy() != null) {
formattedAmount = plugin.getVaultHandler().getEconomy().format(world.getPrice());
} else {
formattedAmount = this.plugin.getBank().getFormattedAmount(p, world.getPrice(), world.getCurrency());
}
message.add(new FancyMessage("Price to enter this world: ", formattedAmount, colors));
} else {
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
}
if (world.getRespawnToWorld() != null) {
MultiverseWorld respawn = this.worldManager.getMVWorld(world.getRespawnToWorld());
if (respawn != null) {
message.add(new FancyMessage("Players will respawn in: ", respawn.getColoredWorldString(), colors));
} else {
message.add(new FancyMessage("Players will respawn in: ", ChatColor.RED + "!!INVALID!!", colors));
}
}
worldInfo.add(message);
// Page 2
message = new ArrayList<FancyText>();
message.add(new FancyHeader("More World Settings", colors));
message.add(new FancyMessage("World Type: ", world.getWorldType().toString(), colors));
message.add(new FancyMessage("Structures: ", world.getCBWorld().canGenerateStructures() + "", colors));
message.add(new FancyMessage("Weather: ", world.isWeatherEnabled() + "", colors));
message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
message.add(new FancyMessage("Keep spawn in memory: ", world.isKeepingSpawnInMemory() + "", colors));
message.add(new FancyHeader("PVP Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.isPVPEnabled() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
worldInfo.add(message);
// Page 3
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Monster Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canMonstersSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT "
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
} else {
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
}
} else {
message.add(new FancyMessage("Monsters that CAN spawn: ", world.canMonstersSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
// Page 4
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Animal Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canAnimalsSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT "
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
} else {
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
}
} else {
message.add(new FancyMessage("Animals that CAN spawn: ", world.canAnimalsSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
return worldInfo;
}
private static String toCommaSeperated(List<String> list) {
if (list == null || list.size() == 0) {
return "";
}
if (list.size() == 1) {
return list.get(0);
}
String result = list.get(0);
for (int i = 1; i < list.size() - 1; i++) {
result += ", " + list.get(i);
}
result += " and " + list.get(list.size() - 1);
return result;
}
/**
* Gets a "positive" or "negative" {@link ChatColor}.
*
* @param positive Whether this {@link ChatColor} should be "positive".
* @return The {@link ChatColor}.
*/
protected ChatColor getChatColor(boolean positive) {
return positive ? ChatColor.GREEN : ChatColor.RED;
}
private static void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
page = page < 0 ? 0 : page;
page = page > doc.size() - 1 ? doc.size() - 1 : page;
boolean altColor = false;
boolean appendedPageNum = false;
if (sender instanceof Player) {
List<FancyText> list = doc.get(page);
for (FancyText fancyT : list) {
if (fancyT instanceof FancyMessage) {
FancyMessage text = (FancyMessage) fancyT;
text.setAltColor(altColor);
altColor = !altColor;
sender.sendMessage(text.getFancyText());
} else if (fancyT instanceof FancyHeader) {
FancyHeader text = (FancyHeader) fancyT;
if (!appendedPageNum) {
text.appendText(ChatColor.DARK_PURPLE + " [ Page " + (page + 1) + " of " + doc.size() + " ]");
appendedPageNum = true;
}
sender.sendMessage(text.getFancyText());
altColor = false;
}
}
} else {
for (List<FancyText> list : doc) {
for (FancyText fancyT : list) {
if (fancyT instanceof FancyMessage) {
FancyMessage text = (FancyMessage) fancyT;
text.setAltColor(altColor);
altColor = !altColor;
sender.sendMessage(text.getFancyText());
} else {
FancyText text = fancyT;
if (appendedPageNum) {
sender.sendMessage(" ");
} else {
appendedPageNum = true;
}
sender.sendMessage(text.getFancyText());
altColor = false;
}
}
}
}
}
}
@@ -0,0 +1,130 @@
/******************************************************************************
* 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.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Displays a listing of all worlds that a player can enter.
*/
public class ListCommand extends PaginatedCoreCommand<String> {
public ListCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Listing");
this.setCommandUsage("/mv list");
this.setArgRange(0, 2);
this.addKey("mvlist");
this.addKey("mvl");
this.addKey("mv list");
this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.OP);
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
private List<String> getFancyWorldList(Player p) {
List<String> worldList = new ArrayList<String>();
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
continue;
}
ChatColor color = ChatColor.GOLD;
Environment env = world.getEnvironment();
if (env == Environment.NETHER) {
color = ChatColor.RED;
} else if (env == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (env == Environment.THE_END) {
color = ChatColor.AQUA;
}
StringBuilder builder = new StringBuilder();
builder.append(world.getColoredWorldString()).append(ChatColor.WHITE);
builder.append(" - ").append(color).append(world.getEnvironment());
if (world.isHidden()) {
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.core.modify", true)) {
// Prefix hidden worlds with an "[H]"
worldList.add(ChatColor.GRAY + "[H]" + builder.toString());
}
} else {
worldList.add(builder.toString());
}
}
for (String name : this.plugin.getMVWorldManager().getUnloadedWorlds()) {
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.access." + name, true)) {
worldList.add(ChatColor.GRAY + name + " - UNLOADED");
}
}
return worldList;
}
@Override
protected List<String> getFilteredItems(List<String> availableItems, String filter) {
List<String> filtered = new ArrayList<String>();
for (String s : availableItems) {
if (s.matches("(?i).*" + filter + ".*")) {
filtered.add(s);
}
}
return filtered;
}
@Override
protected String getItemText(String item) {
return item;
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse World List ]====");
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
FilterObject filterObject = this.getPageAndFilter(args);
List<String> availableWorlds = new ArrayList<String>(this.getFancyWorldList(p));
if (filterObject.getFilter().length() > 0) {
availableWorlds = this.getFilteredItems(availableWorlds, filterObject.getFilter());
if (availableWorlds.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No worlds matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
}
if (!(sender instanceof Player)) {
for (String c : availableWorlds) {
sender.sendMessage(c);
}
return;
}
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
this.showPage(filterObject.getPage(), sender, availableWorlds);
}
}
@@ -0,0 +1,42 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Loads a world into Multiverse.
*/
public class LoadCommand extends MultiverseCommand {
public LoadCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Load World");
this.setCommandUsage("/mv load" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvload");
this.addKey("mv load");
this.addCommandExample("/mv load " + ChatColor.GREEN + "MyUnloadedWorld");
this.setPermission("multiverse.core.load", "Loads a world into Multiverse.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.getMVWorldManager().loadWorld(args.get(0))) {
Command.broadcastCommandMessage(sender, "Loaded world '" + args.get(0) + "'!");
} else {
sender.sendMessage("Error trying to load world '" + args.get(0) + "'!");
}
}
}
@@ -0,0 +1,95 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
// This will contain all the properties that support the ADD/REMOVE
// Anything not in here will only support the SET action
/**
* Used to modify various aspects of worlds.
*/
public class ModifyAddCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyAddCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Add a value)");
this.setCommandUsage("/mv modify " + ChatColor.GREEN + "add {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
this.setArgRange(2, 3);
this.addKey("mvm add");
this.addKey("mvmadd");
this.addKey("mv modify add");
this.addKey("mvmodify add");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Add, property)) {
sender.sendMessage("Sorry, you can't ADD to " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
return;
}
// TODO fix this
if (world.addToVariable(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA
+ value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
if (!plugin.saveWorldConfig()) {
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
}
} else {
sender.sendMessage(value + " could not be added to " + property);
}
}
}
@@ -0,0 +1,92 @@
/******************************************************************************
* 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.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Removes all values from a world-property.
*/
public class ModifyClearCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyClearCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Clear a property)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " clear {PROPERTY}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(1, 2);
this.addKey("mvm clear");
this.addKey("mvmclear");
this.addKey("mv modify clear");
this.addKey("mvmodify clear");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.clear",
"Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 1 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String property = args.get(0);
if (args.size() == 1) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(1));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Clear, property)) {
sender.sendMessage("Sorry, you can't use CLEAR with " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/cgB2B");
return;
}
// TODO fix this
if (world.clearList(property)) {
sender.sendMessage(property + " was cleared. It contains 0 values now.");
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + property + ChatColor.WHITE + " was "
+ ChatColor.GREEN + "CLEARED" + ChatColor.WHITE + ". It contains " + ChatColor.LIGHT_PURPLE + "0" + ChatColor.WHITE + " values now.");
if (!plugin.saveWorldConfig()) {
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
}
} else {
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property
+ ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
}
}
}
@@ -0,0 +1,76 @@
/******************************************************************************
* 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.enums.Action;
import com.onarandombox.MultiverseCore.enums.AddProperties;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Used to modify various aspects of worlds.
*/
public class ModifyCommand extends MultiverseCommand {
public ModifyCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " {set|add|remove|clear} ...");
this.setArgRange(2, 3);
this.addKey("mvm");
this.addKey("mvmodify");
this.addKey("mv modify");
Map<String, Boolean> children = new HashMap<String, Boolean>();
children.put("multiverse.core.modify.add", true);
children.put("multiverse.core.modify.modify", true);
children.put("multiverse.core.modify.clear", true);
children.put("multiverse.core.modify.remove", true);
Permission modify = new Permission("multiverse.core.modify",
"Modify various aspects of worlds. It requires add/set/clear/remove. See the examples below", PermissionDefault.OP, children);
this.addCommandExample(ChatColor.AQUA + "/mv modify set ?");
this.addCommandExample(ChatColor.GREEN + "/mv modify add ?");
this.addCommandExample(ChatColor.BLUE + "/mv modify clear ?");
this.addCommandExample(ChatColor.RED + "/mv modify remove ?");
this.setPermission(modify);
}
/**
* Validates the specified action.
*
* @param action The {@link Action}.
* @param property The property.
* @return Whether this action is valid.
*/
protected static boolean validateAction(Action action, String property) {
if (action != Action.Set) {
try {
AddProperties.valueOf(property);
return true;
} catch (IllegalArgumentException e) {
return false;
}
}
return false;
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// This is just a place holder. The real commands are in:
// ModifyAddCommand
// ModifyRemoveCommand
// ModifySetCommand
// ModifyClearCommand
}
}
@@ -0,0 +1,97 @@
/******************************************************************************
* 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.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Removes values from a world-property.
*/
public class ModifyRemoveCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyRemoveCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Remove a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " remove {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(2, 3);
this.addKey("mvm remove");
this.addKey("mvmremove");
this.addKey("mv modify remove");
this.addKey("mvmodify remove");
this.addKey("mvm delete");
this.addKey("mvmdelete");
this.addKey("mv modify delete");
this.addKey("mvmodify delete");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Remove, property)) {
sender.sendMessage("Sorry, you can't REMOVE anything from" + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
return;
}
// TODO fix this
if (world.removeFromVariable(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE
+ " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
if (!plugin.saveWorldConfig()) {
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
}
} else {
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY
+ value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
}
}
}
@@ -0,0 +1,125 @@
/******************************************************************************
* 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.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Used to set world-properties.
*/
public class ModifySetCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifySetCommand(MultiverseCore plugin) {
super(plugin);
this.worldManager = this.plugin.getMVWorldManager();
this.setName("Modify a World (Set a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(1, 3);
this.addKey("mvm set");
this.addKey("mvmset");
this.addKey("mv modify set");
this.addKey("mvmodify set");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "mode " + ChatColor.RED + "creative");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "animals " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "monsters " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "alias " + ChatColor.RED + "MyWorld");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "color " + ChatColor.RED + "green");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "curr " + ChatColor.RED + "3");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "price " + ChatColor.RED + "5");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "scale " + ChatColor.RED + "1.2");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "memory " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "diff " + ChatColor.RED + "hard");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hunger " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hidden " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "pvp " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "heal " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "adjustspawn " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "spawn");
this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Special case for spawn:
if (args.size() == 1) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to set the" + ChatColor.GREEN + " spawn");
return;
}
if (args.get(0).equalsIgnoreCase("spawn")) {
SetSpawnCommand c = new SetSpawnCommand(this.plugin);
c.setWorldSpawn(sender);
} else {
sender.sendMessage("Spawn is the only param with no" + ChatColor.GREEN + " VALUE");
sender.sendMessage("Type " + ChatColor.GREEN + "/mv modify ?" + ChatColor.WHITE + " For help.");
}
return;
}
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String value = args.get(1);
String property = args.get(0);
if (args.size() == 2) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !EnglishChatColor.isValidAliasColor(value)) {
sender.sendMessage(value + " is not a valid color. Please pick one of the following:");
sender.sendMessage(EnglishChatColor.getAllColors());
return;
}
try {
if (world.setPropertyValue(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property
+ ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
if (!plugin.saveWorldConfig()) {
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
}
} else {
sender.sendMessage(ChatColor.RED + world.getPropertyHelp(property));
}
} catch (PropertyDoesNotExistException e) {
sender.sendMessage(ChatColor.RED + "Sorry, You can't set: '" + ChatColor.GRAY + property + ChatColor.RED + "'");
sender.sendMessage("Valid world-properties: " + world.getAllPropertyNames());
}
}
}
@@ -0,0 +1,40 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
* A generic Multiverse-command.
*/
public abstract class MultiverseCommand extends Command {
/**
* The reference to the core.
*/
protected MultiverseCore plugin;
/**
* The reference to {@link MultiverseMessaging}.
*/
protected MultiverseMessaging messaging;
public MultiverseCommand(MultiverseCore plugin) {
super(plugin);
this.plugin = plugin;
this.messaging = this.plugin.getMessaging();
}
@Override
public abstract void runCommand(CommandSender sender, List<String> args);
}
Loaded 100 of 217 files, more files were not shown because too many files have changed in this diff. Show more