Compare commits

..
340 Commits
Author SHA1 Message Date
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
82 changed files with 6300 additions and 739 deletions

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# Eclipse stuff
/.classpath
/.project
/.settings
# 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/
+7
View File
@@ -0,0 +1,7 @@
[submodule "lib/allpay"]
path = lib/allpay
url = git://github.com/FernFerret/AllPay.git
[submodule "lib/commandhandler"]
path = lib/commandhandler
url = git://github.com/PneumatiCraft/CommandHandler.git
branch = notrie
+5
View File
@@ -0,0 +1,5 @@
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.
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.');
Submodule
+1
Submodule lib/allpay added at b6b450e8b6.
Submodule lib/commandhandler added at ac9d8c94e4.
-1
View File
@@ -1 +0,0 @@
{"tagline":"The original Bukkit Multi-World Plugin! ","body":"### Welcome to GitHub Pages.\r\nThis 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:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe'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.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` 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.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.","note":"Don't delete this file! It's used internally to help with page regeneration.","google":"","name":"Multiverse-core"}
+160
View File
@@ -0,0 +1,160 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.onarandombox.multiversecore</groupId>
<artifactId>Multiverse-Core</artifactId>
<version>2.0</version>
<name>Multiverse-Core</name>
<description>World Management Plugin</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>UNKNOWN</project.build.number>
</properties>
<repositories>
<repository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/artifactory/repo</url>
</repository>
</repositories>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- Build Helper - Additional Source Folders -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-wsdl-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/lib/allpay/src</source>
<source>${project.basedir}/lib/commandhandler/src</source>
<source>${project.basedir}/lib/commandhandler/lib/ShellParser/src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.3.8</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}-${project.build.number}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<!-- Jar Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifestEntries>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Bukkit Dependency -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Bukkit Dependency -->
<!-- Start of Economy Dependencies -->
<dependency>
<groupId>cosine.boseconomy</groupId>
<artifactId>BOSEconomy</artifactId>
<version>0.6.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>fr.crafter.tickleman.RealShop</groupId>
<artifactId>RealShop</artifactId>
<version>0.63</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.iConomy</groupId>
<artifactId>iConomy</artifactId>
<version>5.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nijiko.coelho.iConomy</groupId>
<artifactId>iConomy</artifactId>
<version>4.65</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.earth2me.essentials</groupId>
<artifactId>Essentials</artifactId>
<version>2.4.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of Economy Dependencies -->
<!-- Start of Permissions Dependencies -->
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>3.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<!-- End of Permissions Dependencies -->
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.onarandombox.MultiverseCore;
import java.util.logging.Level;
import org.bukkit.Server;
public interface LoggablePlugin {
public void log(Level level, String msg);
public Server getServer();
}
@@ -0,0 +1,176 @@
package com.onarandombox.MultiverseCore;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.utils.MVDestination;
import com.pneumaticraft.commandhandler.PermissionsInterface;
public class MVPermissions implements PermissionsInterface {
private MultiverseCore plugin;
private PermissionHandler permissions = null;
/**
* Constructor FTW
*
* @param plugin Pass along the Core Plugin.
*/
public MVPermissions(MultiverseCore plugin) {
this.plugin = plugin;
// We have to see if permissions was loaded before MV was
if (this.plugin.getServer().getPluginManager().getPlugin("Permissions") != null) {
this.setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
this.plugin.log(Level.INFO, "- Attached to Permissions");
}
}
/**
* Check if a Player can teleport to the Destination world from there current world.
*
* @param p
* @param w
* @return
*/
public Boolean canTravelFromWorld(Player p, MVWorld w) {
List<String> blackList = w.getWorldBlacklist();
boolean returnValue = true;
for (String s : blackList) {
if (s.equalsIgnoreCase(p.getWorld().getName())) {
returnValue = false;
break;
}
}
return returnValue;
}
public boolean canTravelFromLocation(Player teleporter, Location location) {
if (!this.plugin.isMVWorld(location.getWorld().getName())) {
return false;
}
return canTravelFromWorld(teleporter, this.plugin.getMVWorld(location.getWorld().getName()));
}
/**
* Check if the Player has the permissions to enter this world.
*
* @param p
* @param w
* @return
*/
public Boolean canEnterWorld(Player p, MVWorld w) {
return this.hasPermission(p, "multiverse.access." + w.getName(), false);
}
public Boolean canEnterLocation(Player p, Location l) {
if (l == null) {
return false;
}
String worldName = l.getWorld().getName();
if (!this.plugin.isMVWorld(worldName)) {
return false;
}
return this.hasPermission(p, "multiverse.access." + worldName, false);
}
public Boolean canEnterDestination(Player p, MVDestination d) {
if (d == null || d.getLocation(p) == null) {
return false;
}
String worldName = d.getLocation(p).getWorld().getName();
if (!this.plugin.isMVWorld(worldName)) {
return false;
}
if(!canEnterLocation(p, d.getLocation(p))) {
return false;
}
return this.hasPermission(p, d.getRequiredPermission(), false);
}
public void setPermissions(PermissionHandler handler) {
this.permissions = handler;
}
public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) {
if (!(sender instanceof Player)) {
return true;
}
// NO one can access a null permission (mainly used for destinations):w
if(node == null) {
return false;
}
// Everyone can access an empty permission
// Currently used for the PlayerDestination
if(node.equals("")) {
return true;
}
Player player = (Player) sender;
boolean opFallback = this.plugin.getConfig().getBoolean("opfallback", true);
if (this.permissions != null && this.permissions.has(player, node)) {
// If Permissions is enabled we check against them.
// this.plugin.log(Level.WARNING, "Allowed by P3/P2 ");
return true;
} else if (sender.hasPermission(node)) {
// If Now check the bukkit permissions
// this.plugin.log(Level.WARNING, "Allowed by BukkitPerms");
return true;
} else if (player.isOp() && opFallback) {
// If Player is Op we always let them use it if they have the fallback enabled!
// this.plugin.log(Level.WARNING, "Allowed by OP");
return true;
}
// If the Player doesn't have Permissions and isn't an Op then
// we return true if OP is not required, otherwise we return false
// This allows us to act as a default permission guidance
// If they have the op fallback disabled, NO commands will work without a permissions plugin.
return !isOpRequired && opFallback;
}
public String getType() {
String opsfallback = "";
if(this.plugin.getConfig().getBoolean("opfallback", true)) {
opsfallback = " WITH OPs.txt fallback";
}
if (this.permissions != null) {
return "Permissions " + this.plugin.getServer().getPluginManager().getPlugin("Permissions").getDescription().getVersion() + opsfallback;
}
return "Bukkit Permissions" + opsfallback;
}
public boolean hasAnyPermission(CommandSender sender, List<String> nodes, boolean isOpRequired) {
for (String node : nodes) {
if (this.hasPermission(sender, node, isOpRequired)) {
return true;
}
}
return false;
}
@Override
public boolean hasAllPermission(CommandSender sender, List<String> nodes, boolean isOpRequired) {
for (String node : nodes) {
if (!this.hasPermission(sender, node, isOpRequired)) {
return false;
}
}
return true;
}
}
@@ -0,0 +1,96 @@
package com.onarandombox.MultiverseCore;
import java.util.Date;
import org.bukkit.entity.Player;
import org.bukkit.util.config.Configuration;
public class MVPlayerSession {
private Player player; // Player holder, may be unnecessary.
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
// private Location bedSpawn;
//
// // Beds are 2 blocks, thus we need to store both places
// private Location bedA;
// private Location bedB;
private Configuration config; // Configuration file to find out Cooldown Timers.
public MVPlayerSession(Player player, Configuration config, MultiverseCore multiVerseCore) {
this.player = player;
this.config = config;
// this.bedSpawn = null;
}
/**
* Update the Teleport time.
*/
public void teleport() {
this.teleportLast = (new Date()).getTime();
}
/**
* Grab whether the cooldown on Portal use has expired or not.
*
* @return
*/
public boolean getTeleportable() {
Long time = (new Date()).getTime();
if ((time - this.teleportLast) > this.config.getInt("portalcooldown", 5000)) {
return true;
} else {
return false;
}
}
/**
* Send a Message to the Player as long as enough time has passed since the last message.
*
* @param msg
*/
public void message(String msg) {
Long time = (new Date()).getTime();
if ((time - this.messageLast) > this.config.getInt("messagecooldown", 2000)) {
this.player.sendMessage(msg);
this.messageLast = time;
}
}
// Commented out bed code, i'll get rid of it soon.
// --FF
// public void setRespawnLocation(Location location) {
// this.bedSpawn = location;
// }
// // This one simply spawns the player closer to the bed.
// public Location getBedRespawnLocation() {
// // There is a bedrespawn set
// if (this.bedSpawn != null) {
// if (!this.bs.playerCanSpawnHereSafely(this.bedSpawn) || !bedStillExists(this.bedSpawn)) {
// this.bedSpawn = null;
// return this.bedSpawn;
// }
// Location actualRespawn = this.bedSpawn;
// Location bedRespawn = new Location(actualRespawn.getWorld(), actualRespawn.getX(), actualRespawn.getY(), actualRespawn.getZ());
// bedRespawn.setY(bedRespawn.getY() - .25);
// return bedRespawn;
// }
// return null;
// }
//
// private boolean bedStillExists(Location bedSpawn) {
// //System.out.print("Dangers:");
// //this.bs.showDangers(bedSpawn);
// Location locationDown = new Location(bedSpawn.getWorld(), bedSpawn.getX(), bedSpawn.getY(), bedSpawn.getZ());
// locationDown.setY(locationDown.getY() - 1);
// if (locationDown.getBlock().getType() != Material.BED_BLOCK) {
// return false;
// }
// return true;
// }
}
@@ -0,0 +1,7 @@
package com.onarandombox.MultiverseCore;
public interface MVPlugin extends LoggablePlugin {
public String dumpVersionInfo(String buffer);
public MultiverseCore getCore();
public void setCore(MultiverseCore core);
}
@@ -0,0 +1,216 @@
package com.onarandombox.MultiverseCore;
import java.util.logging.Level;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import com.onarandombox.utils.BlockSafety;
public class MVTeleport {
MultiverseCore plugin;
BlockSafety bs = new BlockSafety();
public MVTeleport(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* This method will be specific to beds, and check on top of the bed then around it.
*
* @return
*/
public Location getSafeBedDestination(Location bedLocation) {
// System.out.print(bedLocation);
Location idealLocation = bedLocation;
idealLocation.setY(idealLocation.getY() + 1);
idealLocation.setX(idealLocation.getX() + .5);
idealLocation.setZ(idealLocation.getZ() + .5);
// System.out.print(idealLocation);
if (this.bs.playerCanSpawnHereSafely(idealLocation)) {
// System.out.print(idealLocation);
return bedLocation;
}
return null;
}
private Location getSafeLocation(Location l) {
// Check around the player first in a configurable radius:
// TODO: Make this configurable
Location safe = checkAboveAndBelowLocation(l, 6, 9);
if (safe != null) {
safe.setX(safe.getBlockX() + .5);
safe.setZ(safe.getBlockZ() + .5);
}
return safe;
}
private Location checkAboveAndBelowLocation(Location l, int tolerance, int radius) {
// Tolerance must be an even number:
if (tolerance % 2 != 0) {
tolerance += 1;
}
// We want half of it, so we can go up and down
tolerance /= 2;
// For now this will just do a straight up block.
Location locToCheck = l.clone();
// Check the main level
Location safe = this.checkAroundLocation(locToCheck, radius);
if (safe != null) {
return safe;
}
// We've already checked zero right above this.
int currentLevel = 1;
while (currentLevel <= tolerance) {
// Check above
locToCheck = l.clone();
locToCheck.add(0, currentLevel, 0);
safe = this.checkAroundLocation(locToCheck, radius);
if (safe != null) {
return safe;
}
// Check below
locToCheck = l.clone();
locToCheck.subtract(0, currentLevel, 0);
safe = this.checkAroundLocation(locToCheck, radius);
if (safe != null) {
return safe;
}
currentLevel++;
}
return null;
}
/**
* For my crappy algorithm, radius MUST be odd
*
* @param l
* @param radius
* @return
*/
private Location checkAroundLocation(Location l, int diameter) {
if (diameter % 2 == 0) {
diameter += 1;
}
Location checkLoc = l.clone();
// Start at 3, the min diameter around a block
int loopcounter = 3;
while (loopcounter <= diameter) {
boolean foundSafeArea = checkAroundSpecificDiameter(checkLoc, loopcounter);
// If a safe area was found:
if (foundSafeArea) {
// Return the checkLoc, it is the safe location.
return checkLoc;
}
// Otherwise, let's reset our location
checkLoc = l.clone();
// And increment the radius
loopcounter += 2;
}
return null;
}
private boolean checkAroundSpecificDiameter(Location checkLoc, int circle) {
// Adjust the circle to get how many blocks to step out.
// A radius of 3 makes the block step 1
// A radius of 5 makes the block step 2
// A radius of 7 makes the block step 3
// ...
int adjustedCircle = ((circle - 1) / 2);
checkLoc.add(adjustedCircle, 0, 0);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
// Now we go to the right that adjustedCircle many
for (int i = 0; i < adjustedCircle; i++) {
checkLoc.add(0, 0, 1);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then down adjustedCircle *2
for (int i = 0; i < adjustedCircle * 2; i++) {
checkLoc.add(-1, 0, 0);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then left adjustedCircle *2
for (int i = 0; i < adjustedCircle * 2; i++) {
checkLoc.add(0, 0, -1);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then up Then left adjustedCircle *2
for (int i = 0; i < adjustedCircle * 2; i++) {
checkLoc.add(1, 0, 0);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
// Then finish up by doing adjustedCircle - 1
for (int i = 0; i < adjustedCircle - 1; i++) {
checkLoc.add(0, 0, 1);
if (this.bs.playerCanSpawnHereSafely(checkLoc)) {
return true;
}
}
return false;
}
public boolean safelyTeleport(Entity e, Location l) {
if (this.bs.playerCanSpawnHereSafely(l)) {
e.teleport(l);
//this.plugin.log(Level.WARNING, "The first location you gave me was safe.");
return true;
}
if(e instanceof Minecart) {
Minecart m = (Minecart)e;
if(!this.bs.canSpawnCartSafely(m)) {
return false;
}
}
else if(e instanceof Vehicle) {
Vehicle v = (Vehicle)e;
if(!this.bs.canSpawnVehicleSafely(v)) {
return false;
}
}
Location safeLocation = this.getSafeLocation(l);
if (safeLocation != null) {
// Add offset to account for a vehicle on dry land!
if (!this.bs.isEntitiyOnTrack(e, safeLocation)) {
safeLocation.setY(safeLocation.getBlockY() + .5);
}
e.teleport(safeLocation);
//this.plugin.log(Level.WARNING, "Had to look for a bit, but I found a safe place for ya!");
return true;
}
if (e instanceof Player) {
Player p = (Player) e;
p.sendMessage("No safe locations found!");
}
else if (e.getPassenger() instanceof Player) {
Player p = (Player) e.getPassenger();
p.sendMessage("No safe locations found!");
}
this.plugin.log(Level.WARNING, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
return false;
}
}
@@ -0,0 +1,645 @@
package com.onarandombox.MultiverseCore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.util.config.Configuration;
enum EnglishChatColor {
AQUA("AQUA", ChatColor.AQUA),
BLACK("BLACK", ChatColor.BLACK),
BLUE("BLUE", ChatColor.BLUE),
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
DARKRED("DARKRED", ChatColor.DARK_RED),
GOLD("GOLD", ChatColor.GOLD),
GRAY("GRAY", ChatColor.GRAY),
GREEN("GREEN", ChatColor.GREEN),
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
RED("RED", ChatColor.RED),
YELLOW("YELLOW", ChatColor.YELLOW),
WHITE("WHITE", ChatColor.WHITE);
private ChatColor color;
private String text;
EnglishChatColor(String name, ChatColor color) {
this.color = color;
this.text = name;
}
public String getText() {
return this.text;
}
public ChatColor getColor() {
return this.color;
}
public static EnglishChatColor fromString(String text) {
if (text != null) {
for (EnglishChatColor c : EnglishChatColor.values()) {
if (text.equalsIgnoreCase(c.text)) {
return c;
}
}
}
return EnglishChatColor.WHITE;
}
}
public class MVWorld {
private MultiverseCore plugin; // Hold the Plugin Instance.
private Configuration config; // Hold the Configuration File.
private World world; // The World Instance.
private Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL
private Long seed;
private String name; // The Worlds Name, EG its folder name.
private String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes.
private ChatColor aliasColor; // Color for this world
private boolean allowAnimals; // Does this World allow Animals to Spawn?
private boolean allowMonsters; // Does this World allow Monsters to Spawn?
private boolean keepSpawnInMemory; // Does the World have the spawn loaded all the time?
private Boolean pvp; // Does this World allow PVP?
private Boolean fakepvp; // Should this world have fakePVP on? (used for PVP zones)
private String respawnWorld; // Contains the name of the World to respawn the player to
private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
private HashMap<String, List<String>> masterList;
private Double scaling; // How stretched/compressed distances are
private Double price; // How much does it cost to enter this world
private int currency = -1; // What is the currency
/**
* The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID
*/
private String generator;
private Permission permission;
private Permission exempt;
private boolean canSave = false; // Prevents all the setters from constantly saving to the config when being called from the constructor.
private boolean allowWeather;
public MVWorld(World world, Configuration config, MultiverseCore instance, Long seed, String generatorString) {
this.config = config;
this.plugin = instance;
// Set local values that CANNOT be changed by user
this.world = world;
this.name = world.getName();
this.generator = generatorString;
this.seed = seed;
this.environment = world.getEnvironment();
// Initialize our lists
this.initLists();
// Write these files to the config (once it's saved)
if (generatorString != null) {
config.setProperty("worlds." + this.name + ".generator", this.generator);
}
if (seed != null) {
config.setProperty("worlds." + this.name + ".seed", this.seed);
}
config.setProperty("worlds." + this.name + ".environment", this.environment.toString());
// Set local values that CAN be changed by the user
this.setAlias(config.getString("worlds." + this.name + ".alias.name", ""));
this.setAliasColor(config.getString("worlds." + this.name + ".alias.color", ChatColor.WHITE.toString()));
this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true));
this.setScaling(config.getDouble("worlds." + this.name + ".scale", 1.0));
this.setRespawnToWorld(config.getString("worlds." + this.name + ".respawnworld", ""));
this.setEnableWeather(config.getBoolean("worlds." + this.name + ".allowweather", true));
this.setAnimals(config.getBoolean("worlds." + this.name + ".animals.spawn", true));
this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true));
this.setPrice(config.getDouble("worlds." + this.name + ".entryfee.amount", 0.0));
this.setCurrency(config.getInt("worlds." + this.name + ".entryfee.currency", -1));
this.getMobExceptions();
this.setSpawnInMemory(config.getBoolean("worlds." + this.name + ".keepspawninmemory", true));
this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
this.translateTempSpawn(config);
this.canSave = true;
saveConfig();
this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.TRUE);
this.exempt = new Permission("multiverse.exempt." + this.getName(), "A player who has this does not pay to enter this world, or use any MV portals in it " + this.getName(), PermissionDefault.OP);
try {
this.plugin.getServer().getPluginManager().addPermission(this.permission);
this.plugin.getServer().getPluginManager().addPermission(this.exempt);
addToUpperLists(this.permission);
} catch (IllegalArgumentException e) {
}
}
private void setEnableWeather(boolean weather) {
this.allowWeather = weather;
// Disable any current weather
if (!weather) {
this.getCBWorld().setStorm(false);
this.getCBWorld().setThundering(false);
}
this.config.setProperty("worlds." + this.name + ".allowweather", weather);
saveConfig();
}
private void addToUpperLists(Permission permission) {
Permission all = this.plugin.getServer().getPluginManager().getPermission("multiverse.*");
Permission allWorlds = this.plugin.getServer().getPluginManager().getPermission("multiverse.access.*");
Permission allExemption = this.plugin.getServer().getPluginManager().getPermission("multiverse.exempt.*");
if (allWorlds == null) {
allWorlds = new Permission("multiverse.access.*");
this.plugin.getServer().getPluginManager().addPermission(allWorlds);
}
allWorlds.getChildren().put(permission.getName(), true);
if (allExemption == null) {
allExemption = new Permission("multiverse.exempt.*");
this.plugin.getServer().getPluginManager().addPermission(allExemption);
}
allExemption.getChildren().put(this.exempt.getName(), true);
if (all == null) {
all = new Permission("multiverse.*");
this.plugin.getServer().getPluginManager().addPermission(all);
}
all.getChildren().put("multiverse.access.*", true);
all.getChildren().put("multiverse.exempt.*", true);
this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(all);
this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(allWorlds);
}
private void translateTempSpawn(Configuration config) {
String tempspawn = config.getString("worlds." + this.name + ".tempspawn", "");
if (tempspawn.length() > 0) {
String[] coordsString = tempspawn.split(":");
if (coordsString.length >= 3) {
int[] coords = new int[3];
try {
for (int i = 0; i < 3; i++) {
coords[i] = Integer.parseInt(coordsString[i]);
}
this.world.setSpawnLocation(coords[0], coords[1], coords[2]);
} catch (NumberFormatException e) {
this.plugin.log(Level.WARNING, "A MV1 spawn value was found, but it could not be migrated. Format Error. Sorry.");
}
} else {
this.plugin.log(Level.WARNING, "A MV1 spawn value was found, but it could not be migrated. Format Error. Sorry.");
}
this.config.removeProperty("worlds." + this.name + ".tempspawn");
}
}
public String getColoredWorldString() {
ChatColor color = this.getAliasColor();
if (color == null) {
if (this.environment == Environment.NETHER) {
color = ChatColor.RED;
} else if (this.environment == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (this.environment == Environment.SKYLANDS) {
color = ChatColor.AQUA;
}
}
return this.getAliasColor() + this.getAlias() + ChatColor.WHITE;
}
private void getMobExceptions() {
List<String> temp;
temp = this.config.getStringList("worlds." + this.name + ".animals.exceptions", new ArrayList<String>());
// Add Animals to the exclusion list
for (String s : temp) {
this.masterList.get("animals").add(s.toUpperCase());
}
temp = this.config.getStringList("worlds." + this.name + ".monsters.exceptions", new ArrayList<String>());
// Add Monsters to the exclusion list
for (String s : temp) {
this.masterList.get("monsters").add(s.toUpperCase());
}
}
public World getCBWorld() {
return this.world;
}
private void initLists() {
this.masterList = new HashMap<String, List<String>>();
this.blockBlacklist = new ArrayList<Integer>();
// Only int list, we don't need to add it to the masterlist
this.masterList.put("worldblacklist", new ArrayList<String>());
this.masterList.put("animals", new ArrayList<String>());
this.masterList.put("monsters", new ArrayList<String>());
}
public boolean clearVariable(String property) {
if (property.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.clear();
} else if (this.masterList.keySet().contains(property)) {
this.masterList.get(property).clear();
} else {
return false;
}
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.blockBlacklist);
this.saveConfig();
return true;
}
public boolean addToList(String list, String value) {
if (list.equalsIgnoreCase("blockblacklist")) {
try {
int intVal = Integer.parseInt(value);
return addToList(list, intVal);
} catch (Exception e) {
}
} else if (this.masterList.keySet().contains(list)) {
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
this.masterList.get(list).add(value.toUpperCase());
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
this.syncMobs();
} else {
this.masterList.get(list).add(value);
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
}
saveConfig();
return true;
}
return false;
}
public boolean removeFromList(String list, String value) {
if (list.equalsIgnoreCase("blockblacklist")) {
try {
int intVal = Integer.parseInt(value);
return removeFromList(list, intVal);
} catch (Exception e) {
}
}
if (this.masterList.keySet().contains(list)) {
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
this.masterList.get(list).remove(value.toUpperCase());
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
this.syncMobs();
} else {
this.masterList.get(list).remove(value);
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
}
saveConfig();
return true;
}
return false;
}
private void syncMobs() {
if (this.getAnimalList().isEmpty()) {
this.world.setSpawnFlags(this.world.getAllowMonsters(), this.allowAnimals);
} else {
this.world.setSpawnFlags(this.world.getAllowMonsters(), true);
}
if (this.getMonsterList().isEmpty()) {
this.world.setSpawnFlags(this.allowMonsters, this.world.getAllowAnimals());
} else {
this.world.setSpawnFlags(true, this.world.getAllowAnimals());
}
this.plugin.getWorldPurger().purgeWorld(null, this);
}
private boolean addToList(String list, Integer value) {
if (list.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.add(value);
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
saveConfig();
}
return false;
}
private boolean removeFromList(String list, Integer value) {
if (list.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.remove(value);
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
saveConfig();
}
return false;
}
private boolean setVariable(String name, boolean value) {
if (name.equalsIgnoreCase("pvp")) {
this.setPvp(value);
} else if (name.equalsIgnoreCase("animals")) {
this.setAnimals(value);
} else if (name.equalsIgnoreCase("monsters")) {
this.setMonsters(value);
} else if (name.equalsIgnoreCase("memory") || name.equalsIgnoreCase("spawnmemory")) {
this.setSpawnInMemory(value);
} else if (name.equalsIgnoreCase("weather") || name.equalsIgnoreCase("storm")) {
this.setEnableWeather(value);
} else {
return false;
}
return true;
}
private void setSpawnInMemory(boolean value) {
this.world.setKeepSpawnInMemory(value);
this.keepSpawnInMemory = value;
this.config.setProperty("worlds." + this.name + ".keepspawninmemory", value);
saveConfig();
}
private boolean setVariable(String name, double value) {
if (name.equalsIgnoreCase("scaling") || name.equalsIgnoreCase("scale")) {
this.setScaling(value);
return true;
}
if (name.equalsIgnoreCase("price")) {
this.setPrice(value);
return true;
}
return false;
}
/**
* This is the one people have access to. It'll handle the rest.
*
* @param name
* @param value
* @return
*/
public boolean setVariable(String name, String value) {
if (name.equalsIgnoreCase("alias")) {
this.setAlias(value);
return true;
}
if (name.equalsIgnoreCase("respawn")) {
this.setRespawnToWorld(value);
return true;
}
if (name.equalsIgnoreCase("aliascolor") || name.equalsIgnoreCase("color")) {
this.setAliasColor(value);
return true;
}
if (name.equalsIgnoreCase("currency") || name.equalsIgnoreCase("curr")) {
try {
int intValue = Integer.parseInt(value);
this.setCurrency(intValue);
return true;
} catch (Exception e) {
}
}
if (name.equalsIgnoreCase("price")) {
try {
double doubValue = Double.parseDouble(value);
return this.setPrice(doubValue);
} catch (Exception e) {
}
}
try {
boolean boolValue = Boolean.parseBoolean(value);
return this.setVariable(name, boolValue);
} catch (Exception e) {
}
try {
double doubValue = Double.parseDouble(value);
return this.setVariable(name, doubValue);
} catch (Exception e) {
}
return false;
}
public Environment getEnvironment() {
return this.environment;
}
public void setEnvironment(Environment environment) {
this.environment = environment;
}
public Long getSeed() {
return this.seed;
}
public void setSeed(Long seed) {
this.seed = seed;
}
public String getName() {
return this.name;
}
public String getAlias() {
if (this.alias == null || this.alias.length() == 0) {
return this.name;
}
return this.alias;
}
public void setAlias(String alias) {
this.alias = alias;
this.config.setProperty("worlds." + this.name + ".alias.name", alias);
saveConfig();
}
public Boolean allowAnimalSpawning() {
return this.allowAnimals;
}
private void setAnimals(Boolean animals) {
this.allowAnimals = animals;
// If animals are a boolean, then we can turn them on or off on the server
// If there are ANY exceptions, there will be something spawning, so turn them on
this.config.setProperty("worlds." + this.name + ".animals.spawn", animals);
saveConfig();
this.syncMobs();
}
public List<String> getAnimalList() {
return this.masterList.get("animals");
}
public Boolean allowMonsterSpawning() {
return this.allowMonsters;
}
private void setMonsters(Boolean monsters) {
this.allowMonsters = monsters;
// If monsters are a boolean, then we can turn them on or off on the server
// If there are ANY exceptions, there will be something spawning, so turn them on
this.config.setProperty("worlds." + this.name + ".monsters.spawn", monsters);
saveConfig();
this.syncMobs();
}
public List<String> getMonsterList() {
return this.masterList.get("monsters");
}
public Boolean getPvp() {
return this.pvp;
}
public void setPvp(Boolean pvp) {
this.fakepvp = this.plugin.getConfig().getBoolean("fakepvp", false);
if (this.fakepvp) {
this.world.setPVP(true);
} else {
this.world.setPVP(pvp);
}
this.pvp = pvp;
this.config.setProperty("worlds." + this.name + ".pvp", pvp);
saveConfig();
}
public List<Integer> getBlockBlacklist() {
return this.blockBlacklist;
}
public List<String> getWorldBlacklist() {
return this.masterList.get("worldblacklist");
}
public Double getScaling() {
return this.scaling;
}
public void setScaling(Double scaling) {
if (scaling <= 0) {
// Disallow negative or 0 scalings.
scaling = 1.0;
}
this.scaling = scaling;
this.config.setProperty("worlds." + this.name + ".scaling", scaling);
saveConfig();
}
/**
* Sets the chat color from a string.
*
* @param aliasColor
*/
public void setAliasColor(String aliasColor) {
EnglishChatColor color = EnglishChatColor.fromString(aliasColor);
if (color == null) {
color = EnglishChatColor.WHITE;
}
this.aliasColor = color.getColor();
this.config.setProperty("worlds." + this.name + ".alias.color", color.getText());
saveConfig();
return;
}
public boolean isValidAliasColor(String aliasColor) {
return (EnglishChatColor.fromString(aliasColor) != null);
}
public ChatColor getAliasColor() {
return this.aliasColor;
}
public boolean clearList(String property) {
if (property.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.clear();
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
saveConfig();
return true;
} else if (this.masterList.containsKey(property)) {
this.masterList.get(property).clear();
this.config.setProperty("worlds." + this.name + "." + property.toLowerCase(), this.masterList.get(property));
this.syncMobs();
saveConfig();
return true;
}
return false;
}
public boolean getFakePVP() {
return this.fakepvp;
}
public String getRespawnToWorld() {
return this.respawnWorld;
}
public void setRespawnToWorld(String respawnToWorld) {
this.respawnWorld = respawnToWorld;
this.config.setProperty("worlds." + this.name + ".respawnworld", respawnToWorld);
saveConfig();
}
public Permission getPermission() {
return this.permission;
}
public int getCurrency() {
return this.currency;
}
public double getPrice() {
return this.price;
}
private boolean setCurrency(int currency) {
this.currency = currency;
config.getInt("worlds." + this.name + ".entryfee.currency", currency);
saveConfig();
return true;
}
private boolean setPrice(double price) {
this.price = price;
config.setProperty("worlds." + this.name + ".entryfee.amount", price);
saveConfig();
return true;
}
public boolean isExempt(Player p) {
return (this.plugin.getPermissions().hasPermission(p, this.exempt.getName(), true));
}
public Permission getExempt() {
return this.exempt;
}
private void saveConfig() {
if (this.canSave) {
this.config.save();
}
}
public boolean getWeatherEnabled() {
return this.allowWeather;
}
}
@@ -0,0 +1,817 @@
package com.onarandombox.MultiverseCore;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.config.Configuration;
import com.fernferret.allpay.AllPay;
import com.fernferret.allpay.GenericBank;
import com.onarandombox.MultiverseCore.commands.ConfirmCommand;
import com.onarandombox.MultiverseCore.commands.CoordCommand;
import com.onarandombox.MultiverseCore.commands.CreateCommand;
import com.onarandombox.MultiverseCore.commands.DeleteCommand;
import com.onarandombox.MultiverseCore.commands.EnvironmentCommand;
import com.onarandombox.MultiverseCore.commands.HelpCommand;
import com.onarandombox.MultiverseCore.commands.ImportCommand;
import com.onarandombox.MultiverseCore.commands.InfoCommand;
import com.onarandombox.MultiverseCore.commands.ListCommand;
import com.onarandombox.MultiverseCore.commands.ModifyAddCommand;
import com.onarandombox.MultiverseCore.commands.ModifyClearCommand;
import com.onarandombox.MultiverseCore.commands.ModifyCommand;
import com.onarandombox.MultiverseCore.commands.ModifyRemoveCommand;
import com.onarandombox.MultiverseCore.commands.ModifySetCommand;
import com.onarandombox.MultiverseCore.commands.PurgeCommand;
import com.onarandombox.MultiverseCore.commands.ReloadCommand;
import com.onarandombox.MultiverseCore.commands.RemoveCommand;
import com.onarandombox.MultiverseCore.commands.SetSpawnCommand;
import com.onarandombox.MultiverseCore.commands.SleepCommand;
import com.onarandombox.MultiverseCore.commands.SpawnCommand;
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
import com.onarandombox.MultiverseCore.commands.VersionCommand;
import com.onarandombox.MultiverseCore.commands.WhoCommand;
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
import com.onarandombox.MultiverseCore.configuration.MVConfigMigrator;
import com.onarandombox.MultiverseCore.configuration.MVCoreConfigMigrator;
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
import com.onarandombox.utils.CannonDestination;
import com.onarandombox.utils.DebugLog;
import com.onarandombox.utils.DestinationFactory;
import com.onarandombox.utils.ExactDestination;
import com.onarandombox.utils.PlayerDestination;
import com.onarandombox.utils.PurgeWorlds;
import com.onarandombox.utils.UpdateChecker;
import com.onarandombox.utils.WorldDestination;
import com.pneumaticraft.commandhandler.CommandHandler;
public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
// Useless stuff to keep us going.
private static final Logger log = Logger.getLogger("Minecraft");
private static DebugLog debugLog;
public static boolean MobsDisabledInDefaultWorld = false;
// Debug Mode
private boolean debug;
// Setup our Map for our Commands using the CommandHandler.
private CommandHandler commandHandler;
private final String tag = "[Multiverse-Core]";
// Multiverse Permissions Handler
private MVPermissions ph;
// Configurations
private Configuration configMV = null;
private Configuration configWorlds = null;
// Setup the block/player/entity listener.
private MVPlayerListener playerListener = new MVPlayerListener(this);
private MVEntityListener entityListener = new MVEntityListener(this);
private MVPluginListener pluginListener = new MVPluginListener(this);
private MVWeatherListener weatherListener = new MVWeatherListener(this);
public UpdateChecker updateCheck;
// HashMap to contain all the Worlds which this Plugin will manage.
private HashMap<String, MVWorld> worlds = new HashMap<String, MVWorld>();
// HashMap to contain information relating to the Players.
private HashMap<String, MVPlayerSession> playerSessions;
private PurgeWorlds worldPurger;
private GenericBank bank = null;
private AllPay banker = new AllPay(this, tag + " ");
protected MVConfigMigrator migrator = new MVCoreConfigMigrator(this);
protected int pluginCount;
private DestinationFactory destFactory;
@Override
public void onLoad() {
// Create our DataFolder
getDataFolder().mkdirs();
// Setup our Debug Log
debugLog = new DebugLog("Multiverse-Core", getDataFolder() + File.separator + "debug.log");
}
public Configuration getConfig() {
return this.configMV;
}
public GenericBank getBank() {
return this.bank;
}
public void onEnable() {
// Output a little snippet to show it's enabled.
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
this.checkServerProps();
// Setup all the Events the plugin needs to Monitor.
this.initializeDestinationFactory();
this.registerEvents();
// Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP().
this.ph = new MVPermissions(this);
this.bank = this.banker.loadEconPlugin();
// Setup the command manager
this.commandHandler = new CommandHandler(this, this.ph);
// Setup the world purger
this.worldPurger = new PurgeWorlds(this);
// Call the Function to assign all the Commands to their Class.
this.registerCommands();
this.playerSessions = new HashMap<String, MVPlayerSession>();
// Start the Update Checker
// updateCheck = new UpdateChecker(this.getDescription().getName(), this.getDescription().getVersion());
// Call the Function to load all the Worlds and setup the HashMap
// When called with null, it tries to load ALL
// this function will be called every time a plugin registers a new envtype with MV
// Setup & Load our Configuration files.
loadConfigs();
if (this.configMV != null) {
this.loadWorlds(true);
} else {
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
}
}
private void initializeDestinationFactory() {
this.destFactory = new DestinationFactory(this);
this.destFactory.registerDestinationType(WorldDestination.class, "");
this.destFactory.registerDestinationType(WorldDestination.class, "w");
this.destFactory.registerDestinationType(ExactDestination.class, "e");
this.destFactory.registerDestinationType(PlayerDestination.class, "pl");
this.destFactory.registerDestinationType(CannonDestination.class, "ca");
}
/**
* Function to Register all the Events needed.
*/
private void registerEvents() {
PluginManager pm = getServer().getPluginManager();
// pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Highest, this); // Low so it acts above any other.
pm.registerEvent(Event.Type.PLAYER_TELEPORT, this.playerListener, Priority.Highest, this); // Cancel Teleports if needed.
pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Priority.Normal, this); // To create the Player Session
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Low, this); // Let plugins which specialize in (re)spawning carry more weight.
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Priority.Normal, this); // To prepend the world name
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow fake PVP
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning.
pm.registerEvent(Event.Type.PLUGIN_ENABLE, this.pluginListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.PLUGIN_DISABLE, this.pluginListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.WEATHER_CHANGE, this.weatherListener, Priority.Normal, this);
pm.registerEvent(Event.Type.THUNDER_CHANGE, this.weatherListener, Priority.Normal, this);
}
/**
* Load the Configuration files OR create the default config files.
*/
public void loadConfigs() {
// Call the defaultConfiguration class to create the config files if they don't already exist.
new DefaultConfig(getDataFolder(), "config.yml", this.migrator);
new DefaultConfig(getDataFolder(), "worlds.yml", this.migrator);
// Now grab the Configuration Files.
this.configMV = new Configuration(new File(getDataFolder(), "config.yml"));
this.configWorlds = new Configuration(new File(getDataFolder(), "worlds.yml"));
// Now attempt to Load the configurations.
try {
this.configMV.load();
log(Level.INFO, "- Multiverse Config -- Loaded");
} catch (Exception e) {
log(Level.INFO, "- Failed to load config.yml");
}
try {
this.configWorlds.load();
log(Level.INFO, "- World Config -- Loaded");
} catch (Exception e) {
log(Level.INFO, "- Failed to load worlds.yml");
}
// Setup the Debug option, we'll default to false because this option will not be in the default config.
this.debug = this.configMV.getBoolean("debug", false);
}
/**
* Register Multiverse-Core commands to Command Manager.
*/
private void registerCommands() {
// Intro Commands
this.commandHandler.registerCommand(new HelpCommand(this));
this.commandHandler.registerCommand(new VersionCommand(this));
this.commandHandler.registerCommand(new ListCommand(this));
this.commandHandler.registerCommand(new InfoCommand(this));
this.commandHandler.registerCommand(new CreateCommand(this));
this.commandHandler.registerCommand(new ImportCommand(this));
this.commandHandler.registerCommand(new ReloadCommand(this));
this.commandHandler.registerCommand(new SetSpawnCommand(this));
this.commandHandler.registerCommand(new CoordCommand(this));
this.commandHandler.registerCommand(new TeleportCommand(this));
this.commandHandler.registerCommand(new WhoCommand(this));
this.commandHandler.registerCommand(new SpawnCommand(this));
// Dangerous Commands
this.commandHandler.registerCommand(new UnloadCommand(this));
this.commandHandler.registerCommand(new RemoveCommand(this));
this.commandHandler.registerCommand(new DeleteCommand(this));
this.commandHandler.registerCommand(new ConfirmCommand(this));
// Modification commands
this.commandHandler.registerCommand(new ModifyCommand(this));
this.commandHandler.registerCommand(new PurgeCommand(this));
this.commandHandler.registerCommand(new ModifyAddCommand(this));
this.commandHandler.registerCommand(new ModifySetCommand(this));
this.commandHandler.registerCommand(new ModifyRemoveCommand(this));
this.commandHandler.registerCommand(new ModifyClearCommand(this));
// Misc Commands
this.commandHandler.registerCommand(new EnvironmentCommand(this));
this.commandHandler.registerCommand(new SleepCommand(this));
}
/**
* Load the Worlds & Settings from the configuration file.
*/
public void loadWorlds(boolean forceLoad) {
// Basic Counter to count how many Worlds we are loading.
int count = 0;
// Grab all the Worlds from the Config.
List<String> worldKeys = this.configWorlds.getKeys("worlds");
// Force the worlds to be loaded, ie don't just load new worlds.
if (forceLoad) {
// Remove all world permissions.
Permission allAccess = this.getServer().getPluginManager().getPermission("multiverse.access.*");
Permission allExempt = this.getServer().getPluginManager().getPermission("multiverse.exempt.*");
for (MVWorld w : this.worlds.values()) {
// Remove this world from the master list
if (allAccess != null) {
allAccess.getChildren().remove(w.getPermission().getName());
}
if (allExempt != null) {
allExempt.getChildren().remove(w.getPermission().getName());
}
this.getServer().getPluginManager().removePermission(w.getPermission().getName());
this.getServer().getPluginManager().removePermission(w.getExempt().getName());
}
// Recalc the all permission
this.getServer().getPluginManager().recalculatePermissionDefaults(allAccess);
this.getServer().getPluginManager().recalculatePermissionDefaults(allExempt);
this.worlds.clear();
}
// Check that the list is not null.
if (worldKeys != null) {
for (String worldKey : worldKeys) {
// Check if the World is already loaded within the Plugin.
if (this.worlds.containsKey(worldKey)) {
continue;
}
// Grab the initial values from the config file.
String environment = this.configWorlds.getString("worlds." + worldKey + ".environment", "NORMAL"); // Grab the Environment as a String.
String seedString = this.configWorlds.getString("worlds." + worldKey + ".seed", "");
String generatorstring = this.configWorlds.getString("worlds." + worldKey + ".generator");
addWorld(worldKey, getEnvFromString(environment), seedString, generatorstring);
// Increment the world count
count++;
}
}
// Ensure that the worlds created by the default server were loaded into MV, useful for first time runs
// count += loadDefaultWorlds();
// TODO: This was taken out because some people don't want nether! Instead show a message to people who have MVImport
// and tell them to do MVImports for their worlds!
// Simple Output to the Console to show how many Worlds were loaded.
log(Level.INFO, count + " - World(s) loaded.");
}
/**
* Add a new World to the Multiverse Setup.
* <p/>
* Isn't there a prettier way to do this??!!?!?!
*
* @param name World Name
* @param env Environment Type
*/
public boolean addWorld(String name, Environment env, String seedString, String generator) {
this.debugLog(Level.CONFIG, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator);
Long seed = null;
if (seedString != null && seedString.length() > 0) {
try {
seed = Long.parseLong(seedString);
} catch (NumberFormatException numberformatexception) {
seed = (long) seedString.hashCode();
}
}
String generatorID = null;
String generatorName = null;
if (generator != null) {
String[] split = generator.split(":", 2);
String id = (split.length > 1) ? split[1] : null;
generatorName = split[0];
generatorID = id;
}
ChunkGenerator customGenerator = getChunkGenerator(generatorName, generatorID, name);
if (customGenerator == null && generator != null && (generator.length() > 0)) {
if (!pluginExists(generatorName)) {
log(Level.WARNING, "Could not find plugin: " + generatorName);
} else {
log(Level.WARNING, "Found plugin: " + generatorName + ", but did not find generatorID: " + generatorID);
}
return false;
}
World world = null;
if (seed != null) {
if (customGenerator != null) {
world = getServer().createWorld(name, env, seed, customGenerator);
log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " with seed: " + seed + " & Custom Generator: " + generator);
} else {
world = getServer().createWorld(name, env, seed);
log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " with seed: " + seed);
}
} else {
if (customGenerator != null) {
world = getServer().createWorld(name, env, customGenerator);
log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " & Custom Generator: " + generator);
} else {
world = getServer().createWorld(name, env);
log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env);
}
}
if (world == null) {
log(Level.SEVERE, "Failed to Create/Load the world '" + name + "'");
return false;
}
MVWorld mvworld = new MVWorld(world, this.configWorlds, this, seed, generator);
this.worldPurger.purgeWorld(null, mvworld);
this.worlds.put(name, mvworld);
return true;
}
private boolean pluginExists(String generator) {
Plugin plugin = getServer().getPluginManager().getPlugin(generator);
return plugin != null;
}
private ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName) {
if (generator == null) {
return null;
}
Plugin plugin = getServer().getPluginManager().getPlugin(generator);
if (plugin == null) {
return null;
} else {
return plugin.getDefaultWorldGenerator(worldName, generatorID);
}
}
/**
* Remove the world from the Multiverse list
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
public boolean removeWorldFromList(String name) {
if (this.worlds.containsKey(name)) {
this.worlds.remove(name);
this.log(Level.INFO, "World " + name + " was unloaded from memory.");
this.unloadWorld(name, true);
return true;
} else if (this.getServer().getWorld(name) != null) {
this.log(Level.WARNING, "Hmm Multiverse does not know about this world but it's still loaded in memory.");
this.log(Level.WARNING, "To be on the safe side, you should import it then try unloading again...");
} else {
this.log(Level.INFO, "The world " + name + " was already unloaded/did not exist.");
}
return false;
}
/**
* 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.
*/
public boolean removeWorldFromConfig(String name) {
if (this.configWorlds.getProperty("worlds." + name) != null) {
removeWorldFromList(name);
this.log(Level.INFO, "World " + name + " was removed from config.yml");
this.configWorlds.removeProperty("worlds." + name);
this.configWorlds.save();
return true;
} else {
this.log(Level.INFO, "World " + name + " was already removed from config.yml");
}
return false;
}
/**
* 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.
*/
public Boolean deleteWorld(String name) {
if (this.getServer().getWorld(name) != null) {
if(!unloadWorld(name, false)) {
// If the world was loaded, and we couldn't unload it, return false. DON"T DELTEE
return false;
}
}
removeWorldFromConfig(name);
try {
File serverFolder = new File(this.getDataFolder().getAbsolutePath()).getParentFile().getParentFile();
File worldFile = new File(serverFolder.getAbsolutePath() + File.separator + name);
if (name.equalsIgnoreCase("plugins")) {
this.log(Level.SEVERE, "Really? Are you high? This would delete your plugins folder. Luckily the MV2 devs are crazy smart or you're server would be ended...");
return false;
} else if (name.toLowerCase().contains("plugins")) {
this.log(Level.SEVERE, "I'm sorry, did you mean to type: 'rm plugins" + File.separator + "Essential*'? I could do that for you if you'd like...");
return false;
} else if (name.contains("..")) {
this.log(Level.SEVERE, "Uh yea... No way i'm going to delete a parent directory for you. You can go do 'rm -rf *.*' on your own time...");
return false;
} else if (name.equals(".")) {
this.log(Level.SEVERE, "Why on earth would you want to use Multiverse-Core to delete your Bukkit Server! How many beers have you had tonight... Give the keys to a friend.");
return false;
} else if (!worldFile.isDirectory()) {
this.log(Level.SEVERE, "C'mon man... Really?!?! Multiverse-Core is a great way to get players from A to B, but not to manage your files. To delete this file type:");
this.log(Level.SEVERE, "stop");
this.log(Level.SEVERE, "rm " + worldFile.getAbsolutePath());
return false;
}
boolean deletedWorld = deleteFolder(worldFile);
if (deletedWorld)
{
this.log(Level.INFO, "World " + name + " was DELETED.");
} else {
this.log(Level.SEVERE, "World " + name + " was NOT deleted.");
this.log(Level.SEVERE, "Are you sure the folder " + name + " exists?");
this.log(Level.SEVERE, "Please check your file permissions on " + name);
}
return deletedWorld;
} catch (Exception e) {
this.log(Level.SEVERE, "Hrm, something didn't go as planned. Here's an exception for ya.");
this.log(Level.SEVERE, "You can go politely explain your situation in #multiverse on esper.net");
this.log(Level.SEVERE, "But from here, it looks like your folder is oddly named.");
this.log(Level.SEVERE, "This world has been removed from Multiverse-Core so your best bet is to go delete the folder by hand. Sorry.");
System.out.print(e);
return false;
}
}
private boolean unloadWorld(String name, boolean safely) {
this.removePlayersFromWorld(name);
return getServer().unloadWorld(name, safely);
}
private void removePlayersFromWorld(String name) {
World w = this.getServer().getWorld(name);
if (w != null) {
World safeWorld = this.getServer().getWorlds().get(0);
List<Player> ps = w.getPlayers();
for (Player p : ps) {
p.teleport(safeWorld.getSpawnLocation());
}
}
}
/**
* Delete a folder Courtesy of: lithium3141
*
* @param file The folder to delete
* @return true if success
*/
private boolean deleteFolder(File file) {
if (file.exists()) {
// If the file exists, and it has more than one file in it.
if (file.isDirectory()) {
for (File f : file.listFiles()) {
if (!this.deleteFolder(f)) {
return false;
}
}
}
file.delete();
return !file.exists();
} else {
return false;
}
}
/**
* What happens when the plugin gets disabled...
*/
public void onDisable() {
debugLog.close();
this.ph.setPermissions(null);
this.banker = null;
this.bank = null;
log(Level.INFO, "- Disabled");
}
/**
* Grab the players session if one exists, otherwise create a session then return it.
*
* @param player
* @return
*/
public MVPlayerSession getPlayerSession(Player player) {
if (this.playerSessions.containsKey(player.getName())) {
return this.playerSessions.get(player.getName());
} else {
this.playerSessions.put(player.getName(), new MVPlayerSession(player, this.configMV, this));
return this.playerSessions.get(player.getName());
}
}
/**
* Grab and return the Teleport class.
*
* @return
*/
public MVTeleport getTeleporter() {
return new MVTeleport(this);
}
/**
* Grab the Permissions Handler for MultiVerse
*/
public MVPermissions getPermissions() {
return this.ph;
}
public PurgeWorlds getWorldPurger() {
return this.worldPurger;
}
/**
* onCommand
*/
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
if (this.isEnabled() == false) {
sender.sendMessage("This plugin is Disabled!");
return true;
}
ArrayList<String> allArgs = new ArrayList<String>(Arrays.asList(args));
allArgs.add(0, command.getName());
return this.commandHandler.locateAndRunCommand(sender, allArgs);
}
/**
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information from the Servers Log Output.
*
* @param level
* @param msg
*/
public void log(Level level, String msg) {
log.log(level, this.tag + " " + msg);
debugLog.log(level, this.tag + " " + msg);
}
/**
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the standard Server Console.
*
* @param level
* @param msg
*/
public void debugLog(Level level, String msg) {
if (this.debug) {
log.log(level, "[Debug] " + msg);
}
debugLog.log(level, "[Debug] " + msg);
}
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @return
*/
private String getAuthors() {
String authors = "";
ArrayList<String> auths = this.getDescription().getAuthors();
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);
}
public CommandHandler getCommandHandler() {
return this.commandHandler;
}
public String getTag() {
return this.tag;
}
/**
* This code should get moved somewhere more appropriate, but for now, it's here.
*
* @param env
* @return
*/
public Environment getEnvFromString(String env) {
// 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("SKYLANDS") || env.equalsIgnoreCase("SKYLAND") || env.equalsIgnoreCase("STARWARS"))
env = "SKYLANDS";
if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD"))
env = "NORMAL";
try {
return Environment.valueOf(env);
} catch (IllegalArgumentException e) {
return null;
}
}
// TODO: Find out where to put these next 3 methods! I just stuck them here for now --FF
public Collection<MVWorld> getMVWorlds() {
return this.worlds.values();
}
public MVWorld getMVWorld(String name) {
if (this.worlds.containsKey(name)) {
return this.worlds.get(name);
}
return this.getMVWorldByAlias(name);
}
private MVWorld getMVWorldByAlias(String alias) {
for (MVWorld w : this.worlds.values()) {
if (w.getAlias().equalsIgnoreCase(alias)) {
return w;
}
}
return null;
}
public boolean isMVWorld(String name) {
return (this.worlds.containsKey(name) || isMVWorldAlias(name));
}
/**
* This method ONLY checks the alias of each world.
*
* @param name
* @return
*/
private boolean isMVWorldAlias(String name) {
for (MVWorld w : this.worlds.values()) {
if (w.getAlias().equalsIgnoreCase(name)) {
return true;
}
}
return false;
}
public void showNotMVWorldMessage(CommandSender sender, String worldName) {
sender.sendMessage("Multiverse doesn't know about " + ChatColor.DARK_AQUA + worldName + ChatColor.WHITE + " yet.");
sender.sendMessage("Type " + ChatColor.DARK_AQUA + "/mv import ?" + ChatColor.WHITE + " for help!");
}
public void removePlayerSession(Player player) {
if (this.playerSessions.containsKey(player.getName())) {
this.playerSessions.remove(player.getName());
}
}
/**
* Returns the number of plugins that have specifically hooked into core.
*
* @return
*/
public int getPluginCount() {
return this.pluginCount;
}
/**
* Increments the number of plugins that have specifically hooked into core.
*/
public void incrementPluginCount() {
this.pluginCount += 1;
}
/**
* Decrements the number of plugins that have specifically hooked into core.
*/
public void decrementPluginCount() {
this.pluginCount -= 1;
}
public AllPay getBanker() {
return this.banker;
}
public void setBank(GenericBank bank) {
this.bank = bank;
}
public DestinationFactory getDestinationFactory() {
return this.destFactory;
}
/**
* This is a convenience method to allow the QueuedCommand system to call it. You should NEVER call this directly.
*
* @param p Player
* @param l The potentially unsafe location.
*/
public void teleportPlayer(Player p, Location l) {
p.teleport(l);
}
private void checkServerProps() {
File serverFolder = new File(this.getDataFolder().getAbsolutePath()).getParentFile().getParentFile();
File serverProperties = new File(serverFolder.getAbsolutePath() + File.separator + "server.properties");
try {
FileInputStream fileStream = new FileInputStream(serverProperties);
DataInputStream in = new DataInputStream(fileStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String propLine;
while ((propLine = br.readLine()) != null) {
// Print the content on the console
if (propLine.matches(".*spawn-monsters.*") && !propLine.matches(".*spawn-monsters\\s*=\\s*true.*")) {
this.log(Level.SEVERE, "Monster spawning has been DISABLED.");
this.log(Level.SEVERE, "In order to let Multiverse fully control your worlds:");
this.log(Level.SEVERE, "Please set 'spawn-monsters=true' in your server.properties file!");
MultiverseCore.MobsDisabledInDefaultWorld = true;
}
}
} catch (IOException e) {
// This should never happen...
this.log(Level.SEVERE, e.getMessage());
}
}
}
@@ -0,0 +1,29 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
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.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,57 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.LocationManipulation;
public class CoordCommand extends MultiverseCommand {
private LocationManipulation locMan = new LocationManipulation();
public CoordCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Coordinates");
this.setCommandUsage("/mv coord");
this.setArgRange(0, 0);
this.addKey("mv coord");
this.addKey("mvcoord");
this.addKey("mvco");
this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
if (sender instanceof Player) {
Player p = (Player) sender;
World world = p.getWorld();
if(!this.plugin.isMVWorld(world.getName())) {
this.plugin.showNotMVWorldMessage(sender, world.getName());
return;
}
MVWorld mvworld = this.plugin.getMVWorld(world.getName());
// TODO: Convert to fancy stuff
p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + LocationManipulation.getDirection(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + Material.getMaterial(world.getBlockTypeIdAt(p.getLocation())));
} else {
sender.sendMessage("This command needs to be used from a Player.");
}
}
}
@@ -0,0 +1,63 @@
package com.onarandombox.MultiverseCore.commands;
import java.io.File;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.CommandHandler;
public class CreateCommand extends MultiverseCommand {
public CreateCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create World");
this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]]");
this.setArgRange(2, 6);
this.addKey("mvcreate");
this.addKey("mvc");
this.addKey("mv create");
this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP);
this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " skylands");
this.addCommandExample("/mv create " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -s gargamel");
this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() % 2 != 0) {
sender.sendMessage("You must preface your SEED with -s OR your GENERATOR with -g. Type /mv for help");
return;
}
String worldName = args.get(0);
String env = args.get(1);
String seed = CommandHandler.getFlag("-s", args);
String generator = CommandHandler.getFlag("-g", args);
if (new File(worldName).exists() || this.plugin.isMVWorld(worldName)) {
sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
return;
}
Environment environment = this.plugin.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
sender.sendMessage(ChatColor.AQUA + "Starting world creation...");
if (this.plugin.addWorld(worldName, environment, seed, generator)) {
sender.sendMessage(ChatColor.GREEN + "Complete!");
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
}
return;
}
}
@@ -0,0 +1,30 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
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.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,38 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class EnvironmentCommand extends MultiverseCommand {
public EnvironmentCommand(MultiverseCore plugin) {
super(plugin);
this.setName("List Environments");
this.setCommandUsage("/mv env");
this.setArgRange(0, 0);
this.addKey("mvenv");
this.addKey("mv env");
this.addKey("mv environment");
this.addKey("mv environments");
this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
}
public static void showEnvironments(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
sender.sendMessage(ChatColor.GREEN + "NORMAL");
sender.sendMessage(ChatColor.RED + "NETHER");
sender.sendMessage(ChatColor.AQUA + "SKYLANDS");
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
EnvironmentCommand.showEnvironments(sender);
}
}
@@ -0,0 +1,128 @@
// This file is no longer licensed under that silly CC license. I have blanked it out and will start implementaiton of my own in a few days. For now there is no help.
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.Command;
public class HelpCommand extends MultiverseCommand {
private static final int CMDS_PER_PAGE = 7;
public HelpCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Get Help with Multiverse");
this.setCommandUsage("/mv " + ChatColor.GOLD + "[FILTER] [PAGE #]");
this.setArgRange(0, 2);
this.addKey("mv");
this.addKey("mvh");
this.addKey("mvhelp");
this.addKey("mv help");
this.addKey("mvsearch");
this.addKey("mv search");
this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
int page = 1;
String filter = "";
if (args.size() == 0)
{
filter = "";
page = 1;
} else if (args.size() == 1) {
try {
page = Integer.parseInt(args.get(0));
} catch (NumberFormatException ex) {
filter = args.get(0);
page = 1;
}
} else if (args.size() == 2) {
filter = args.get(0);
try {
page = Integer.parseInt(args.get(1));
} catch (NumberFormatException ex) {
page = 1;
}
}
List<Command> availableCommands = new ArrayList<Command>(this.plugin.getCommandHandler().getCommands(sender));
if (filter.length() > 0) {
availableCommands = this.getFilteredCommands(availableCommands, filter);
if (availableCommands.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No commands matched your filter: " + ChatColor.AQUA + filter);
return;
}
}
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
for (Command c : availableCommands) {
sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
}
return;
}
int totalPages = (int) Math.ceil(availableCommands.size() / (CMDS_PER_PAGE + 0.0));
if (page > totalPages) {
page = totalPages;
}
sender.sendMessage(ChatColor.AQUA + " Page " + page + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
this.showPage(page, sender, availableCommands);
}
private List<Command> getFilteredCommands(List<Command> availableCommands, String filter) {
List<Command> filtered = new ArrayList<Command>();
for (Command c : availableCommands) {
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandName().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandDesc().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
}else if (c.getCommandUsage().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
}
}
return filtered;
}
private String stitchThisString(List<String> list) {
String returnstr = "";
for (String s : list) {
returnstr += s + " ";
}
return returnstr;
}
private void showPage(int page, CommandSender sender, List<Command> cmds) {
int start = (page - 1) * CMDS_PER_PAGE;
int end = start + CMDS_PER_PAGE;
for (int i = start; i < end; i++) {
// For consistancy, print some extra lines if it's a player:
if (i < cmds.size()) {
sender.sendMessage(ChatColor.AQUA + cmds.get(i).getCommandUsage());
} else if (sender instanceof Player) {
sender.sendMessage(" ");
}
}
}
}
@@ -0,0 +1,61 @@
package com.onarandombox.MultiverseCore.commands;
import java.io.File;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class ImportCommand extends MultiverseCommand {
public ImportCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Import World");
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]");
this.setArgRange(2, 3);
this.addKey("mvimport");
this.addKey("mvim");
this.addKey("mv import");
this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
if (this.plugin.isMVWorld(worldName) && new File(worldName).exists()) {
sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");
return;
}
String generator = null;
if (args.size() == 3) {
generator = args.get(2);
}
String env = args.get(1);
Environment environment = this.plugin.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
if (new File(worldName).exists() && env != null) {
sender.sendMessage(ChatColor.AQUA + "Starting world import...");
this.plugin.addWorld(worldName, environment, null, generator);
sender.sendMessage(ChatColor.GREEN + "Complete!");
return;
} else if (env == null) {
sender.sendMessage(ChatColor.RED + "FAILED.");
sender.sendMessage("That world type did not exist.");
sender.sendMessage("For a list of available world types, type: /mvenv");
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
sender.sendMessage("That world folder does not exist...");
}
}
}
@@ -0,0 +1,226 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.FancyColorScheme;
import com.onarandombox.utils.FancyHeader;
import com.onarandombox.utils.FancyMessage;
import com.onarandombox.utils.FancyText;
public class InfoCommand extends MultiverseCommand {
public InfoCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Information");
this.setCommandUsage("/mv info" + ChatColor.GOLD + " [WORLD] [PAGE]");
this.setArgRange(0, 2);
this.addKey("mvinfo");
this.addKey("mvi");
this.addKey("mv info");
this.setPermission("multiverse.core.info", "Returns detailed information on the world.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
String worldName = "";
int pageNum = 0;
if (args.size() == 0) {
if (sender instanceof Player) {
Player p = (Player) sender;
worldName = p.getWorld().getName();
} else {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
}
else if (args.size() == 1) {
if (this.plugin.getMVWorld(args.get(0)) != null) {
// then we have a world!
worldName = args.get(0);
} else {
if (sender instanceof Player) {
Player p = (Player) sender;
worldName = p.getWorld().getName();
try {
pageNum = Integer.parseInt(args.get(0)) - 1;
} catch (NumberFormatException e) {
pageNum = 0;
}
} else {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
}
}
else if (args.size() == 2) {
worldName = args.get(0);
try {
pageNum = Integer.parseInt(args.get(1)) - 1;
} catch (NumberFormatException e) {
pageNum = 0;
}
}
if (this.plugin.isMVWorld(worldName)) {
showPage(pageNum, sender, this.buildEntireCommand(this.plugin.getMVWorld(worldName)));
} else if (this.plugin.getServer().getWorld(worldName) != null) {
sender.sendMessage("That world exists, but multiverse does not know about it!");
sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
}
}
private List<List<FancyText>> buildEntireCommand(MVWorld world) {
List<FancyText> message = new ArrayList<FancyText>();
List<List<FancyText>> worldInfo = new ArrayList<List<FancyText>>();
// Page 1
FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
message.add(new FancyHeader("General Info", colors));
message.add(new FancyMessage("World Name: ", world.getName(), colors));
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
message.add(new FancyMessage("Seed: ", world.getCBWorld().getSeed() + "", colors));
Location spawn = world.getCBWorld().getSpawnLocation();
message.add(new FancyMessage("Spawn Location: ", "(" + spawn.getBlockX() + ", " + spawn.getBlockY() + ", " + spawn.getBlockZ() + ")", colors));
message.add(new FancyMessage("World Scale: ", world.getScaling().toString(), colors));
if (world.getPrice() > 0) {
message.add(new FancyMessage("Price to enter this world: ", this.plugin.getBank().getFormattedAmount(world.getPrice(), world.getCurrency()), colors));
} else {
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
}
if (world.getRespawnToWorld() != null) {
MVWorld respawn = this.plugin.getMVWorld(world.getRespawnToWorld());
if (respawn != null) {
message.add(new FancyMessage("Players will respawn in: ", respawn.getColoredWorldString(), colors));
} else {
message.add(new FancyMessage("Players will respawn in: ", ChatColor.RED + "!!INVALID!!", colors));
}
}
worldInfo.add(message);
// Page 2
message = new ArrayList<FancyText>();
message.add(new FancyHeader("PVP Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.getPvp().toString(), colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
message.add(new FancyMessage("Fake PVP Enabled: ", world.getFakePVP() + "", colors));
worldInfo.add(message);
// Page 3
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Monster Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.allowMonsterSpawning().toString(), colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
if (MultiverseCore.MobsDisabledInDefaultWorld) {
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Monsters WILL NOT SPAWN IN THIS WORLD.", colors));
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Check your server log for more details.", colors));
}
if (world.getMonsterList().size() > 0) {
if (world.allowMonsterSpawning()) {
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
} else {
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
}
} else {
message.add(new FancyMessage("Monsters that CAN spawn: ", world.allowMonsterSpawning() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
// Page 4
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Animal Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.allowAnimalSpawning().toString(), colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.allowMonsterSpawning()) {
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
} else {
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
}
} else {
message.add(new FancyMessage("Animals that CAN spawn: ", world.allowAnimalSpawning() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
return worldInfo;
}
private String toCommaSeperated(List<String> list) {
if(list == null || list.size() == 0) {
return "";
}
if(list.size() == 1) {
return list.get(0);
}
String result = list.get(0);
for (int i = 1; i < list.size() - 1; i++) {
result += ", " + list.get(i);
}
result += " and " + list.get(list.size() - 1);
return result;
}
protected ChatColor getChatColor(boolean positive) {
return positive ? ChatColor.GREEN : ChatColor.RED;
}
private void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
page = page < 0 ? 0 : page;
page = page > doc.size() - 1 ? doc.size() - 1 : page;
boolean altColor = false;
boolean appendedPageNum = false;
if (sender instanceof Player) {
List<FancyText> list = doc.get(page);
for (FancyText fancyT : list) {
if (fancyT instanceof FancyMessage) {
FancyMessage text = (FancyMessage) fancyT;
text.setAltColor(altColor);
altColor = !altColor;
sender.sendMessage(text.getFancyText());
} else if (fancyT instanceof FancyHeader) {
FancyHeader text = (FancyHeader) fancyT;
if (!appendedPageNum) {
text.appendText(ChatColor.DARK_PURPLE + " [ Page " + (page + 1) + " of " + doc.size() + " ]");
appendedPageNum = true;
}
sender.sendMessage(text.getFancyText());
altColor = false;
}
}
} else {
for (List<FancyText> list : doc) {
for (FancyText fancyT : list) {
if (fancyT instanceof FancyMessage) {
FancyMessage text = (FancyMessage) fancyT;
text.setAltColor(altColor);
altColor = !altColor;
sender.sendMessage(text.getFancyText());
} else {
FancyText text = fancyT;
if (appendedPageNum) {
sender.sendMessage(" ");
} else {
appendedPageNum = true;
}
sender.sendMessage(text.getFancyText());
altColor = false;
}
}
}
}
}
}
@@ -0,0 +1,58 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class ListCommand extends MultiverseCommand {
public ListCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Listing");
this.setCommandUsage("/mv list");
this.setArgRange(0, 0);
this.addKey("mvlist");
this.addKey("mvl");
this.addKey("mv list");
this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
for (MVWorld world : this.plugin.getMVWorlds()) {
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
continue;
}
ChatColor color = ChatColor.GOLD;
Environment env = world.getEnvironment();
if (env == Environment.NETHER) {
color = ChatColor.RED;
} else if (env == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (env == Environment.SKYLANDS) {
color = ChatColor.AQUA;
}
output += world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment() + " \n";
}
String[] response = output.split("\n");
for (String msg : response) {
sender.sendMessage(msg);
}
}
}
@@ -0,0 +1,73 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
// This will contain all the properties that support the ADD/REMOVE
// Anything not in here will only support the SET action
public class ModifyAddCommand extends MultiverseCommand {
public ModifyAddCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Add a value)");
this.setCommandUsage("/mv modify " + ChatColor.GREEN + "add {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
this.setArgRange(2, 3);
this.addKey("mvm add");
this.addKey("mvmadd");
this.addKey("mv modify add");
this.addKey("mvmodify add");
this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Add, property)) {
sender.sendMessage("Sorry, you can't ADD to " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
return;
}
if (world.addToList(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
} else {
sender.sendMessage(value + " could not be added to " + property);
}
}
}
@@ -0,0 +1,69 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class ModifyClearCommand extends MultiverseCommand {
public ModifyClearCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Clear a property)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " clear {PROPERTY}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(1, 2);
this.addKey("mvm clear");
this.addKey("mvmclear");
this.addKey("mv modify clear");
this.addKey("mvmodify clear");
this.setPermission("multiverse.core.modify.clear", "Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 1 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String property = args.get(0);
if (args.size() == 1) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(1));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Clear, property)) {
sender.sendMessage("Sorry, you can't use CLEAR with " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/cgB2B");
return;
}
if (world.clearList(property)) {
sender.sendMessage(property + " was cleared. It contains 0 values now.");
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + property + ChatColor.WHITE + " was " + ChatColor.GREEN + "CLEARED" + ChatColor.WHITE + ". It contains " + ChatColor.LIGHT_PURPLE + "0" + ChatColor.WHITE + " values now.");
} else {
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property + ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
}
}
}
@@ -0,0 +1,72 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
enum AddProperties {
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
}
enum Action {
Set, Add, Remove, Clear
}
// Color == Aliascolor
enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm
}
public class ModifyCommand extends MultiverseCommand {
public ModifyCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " {set|add|remove|clear} ...");
this.setArgRange(2, 3);
this.addKey("mvm");
this.addKey("mvmodify");
this.addKey("mv modify");
Map<String, Boolean> children = new HashMap<String, Boolean>();
children.put("multiverse.core.modify.add", true);
children.put("multiverse.core.modify.modify", true);
children.put("multiverse.core.modify.clear", true);
children.put("multiverse.core.modify.remove", true);
Permission modify = new Permission("multiverse.core.modify", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP, children);
this.setPermission(modify);
}
protected static boolean validateAction(Action action, String property) {
if (action == Action.Set) {
try {
SetProperties.valueOf(property);
return true;
} catch (IllegalArgumentException e) {
return false;
}
} else {
try {
AddProperties.valueOf(property);
return true;
} catch (IllegalArgumentException e) {
return false;
}
}
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// This is just a place holder. The real commands are in:
// ModifyAddCommand
// ModifyRemoveCommand
// ModifySetCommand
// ModifyClearCommand
}
}
@@ -0,0 +1,74 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class ModifyRemoveCommand extends MultiverseCommand {
public ModifyRemoveCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Remove a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " remove {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(2, 3);
this.addKey("mvm remove");
this.addKey("mvmremove");
this.addKey("mv modify remove");
this.addKey("mvmodify remove");
this.addKey("mvm delete");
this.addKey("mvmdelete");
this.addKey("mv modify delete");
this.addKey("mvmodify delete");
this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Remove, property)) {
sender.sendMessage("Sorry, you can't REMOVE anything from" + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
return;
}
if (world.removeFromList(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE + " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
} else {
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY + value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
}
}
}
@@ -0,0 +1,71 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class ModifySetCommand extends MultiverseCommand {
public ModifySetCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Set a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(2, 3);
this.addKey("mvm set");
this.addKey("mvmset");
this.addKey("mv modify set");
this.addKey("mvmodify set");
this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MVWorld world;
String value = args.get(1);
String property = args.get(0);
if (args.size() == 2) {
world = this.plugin.getMVWorld(p.getWorld().getName());
} else {
world = this.plugin.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Set, property)) {
sender.sendMessage("Sorry, you can't SET " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/l54PH");
return;
}
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
} else if (world.setVariable(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
} else {
sender.sendMessage(ChatColor.RED + "There was an error setting " + ChatColor.GRAY + property);
}
}
}
@@ -0,0 +1,21 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.Command;
public abstract class MultiverseCommand extends Command {
protected MultiverseCore plugin;
public MultiverseCommand(MultiverseCore plugin) {
super(plugin);
this.plugin = plugin;
}
@Override
public abstract void runCommand(CommandSender sender, List<String> args);
}
@@ -0,0 +1,77 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.PurgeWorlds;
public class PurgeCommand extends MultiverseCommand {
public PurgeCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Purge World of Creatures");
this.setCommandUsage("/mv purge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}");
this.setArgRange(1, 2);
this.addKey("mvpurge");
this.addKey("mv purge");
this.setPermission("multiverse.core.purge", "Removed the specified type of mob from the specified world.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 1 && p == null) {
sender.sendMessage("This command requires a WORLD when being run from the console!");
sender.sendMessage(this.getCommandUsage());
return;
}
String worldName = null;
String deathName = null;
if (args.size() == 1) {
worldName = p.getWorld().getName();
deathName = args.get(0);
} else {
worldName = args.get(0);
deathName = args.get(1);
}
if (!worldName.equalsIgnoreCase("all") && !this.plugin.isMVWorld(worldName)) {
((MultiverseCore)this.plugin).showNotMVWorldMessage(sender, worldName);
sender.sendMessage("It cannot be purged.");
return;
}
List<MVWorld> worldsToRemoveEntitiesFrom = new ArrayList<MVWorld>();
// Handle all case any user who names a world "all" should know better...
if (worldName.equalsIgnoreCase("all")) {
worldsToRemoveEntitiesFrom.addAll(this.plugin.getMVWorlds());
} else {
worldsToRemoveEntitiesFrom.add(this.plugin.getMVWorld(worldName));
}
PurgeWorlds purger = this.plugin.getWorldPurger();
ArrayList<String> thingsToKill = new ArrayList<String>();
if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
thingsToKill.add(deathName.toUpperCase());
} else {
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
}
for (MVWorld w : worldsToRemoveEntitiesFrom) {
purger.purgeWorld(sender, w, thingsToKill, false, false);
}
return;
}
}
@@ -0,0 +1,44 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
public class ReloadCommand extends MultiverseCommand {
public ReloadCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Reload Configs");
this.setCommandUsage("/mv reload");
this.setArgRange(0, 0);
this.addKey("mvreload");
this.addKey("mv reload");
this.setPermission("multiverse.core.reload", "Reloads worlds.yml and config.yml.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs...");
this.plugin.loadConfigs();
this.plugin.loadWorlds(true);
// Create the event
List<String> configsLoaded = new ArrayList<String>();
configsLoaded.add("Multiverse-Core - config.yml");
configsLoaded.add("Multiverse-Core - worlds.yml");
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
this.plugin.getServer().getPluginManager().callEvent(configReload);
for(String s : configReload.getAllConfigsLoaded()) {
sender.sendMessage(s);
}
sender.sendMessage(ChatColor.GREEN + "Reload Complete!");
}
}
@@ -0,0 +1,31 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class RemoveCommand extends MultiverseCommand {
public RemoveCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Remove World");
this.setCommandUsage("/mv remove" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvremove");
this.addKey("mv remove");
this.setPermission("multiverse.core.remove", "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.removeWorldFromConfig(args.get(0))) {
sender.sendMessage("World removed from config!");
} else {
sender.sendMessage("Error trying to remove world from config!");
}
}
}
@@ -0,0 +1,40 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class SetSpawnCommand extends MultiverseCommand {
public SetSpawnCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Set World Spawn");
this.setCommandUsage("/mv setspawn");
this.setArgRange(0, 0);
this.addKey("mvsetspawn");
this.addKey("mvss");
this.addKey("mv set spawn");
this.addKey("mv setspawn");
this.addKey("mvset spawn");
this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (sender instanceof Player) {
Player p = (Player) sender;
Location l = p.getLocation();
World w = p.getWorld();
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
p.sendMessage(w.getName() + " - Spawn set to X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
} else {
sender.sendMessage("You cannot use this command from the console.");
}
}
}
@@ -0,0 +1,41 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class SleepCommand extends MultiverseCommand {
public SleepCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Go to Sleep");
this.setCommandUsage("/mv sleep");
this.setArgRange(0, 0);
this.addKey("mv sleep");
this.setPermission("multiverse.core.sleep", "Takes you the latest bed you've slept in (Currently BROKEN).", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (p == null) {
return;
}
// MVPlayerSession session = this.plugin.getPlayerSession(p);
// if (session.getBedRespawnLocation() != null) {
// p.teleport(session.getBedRespawnLocation());
// } else {
// sender.sendMessage("Hmm this is awkward...");
// sender.sendMessage("Something is wrong with your bed.");
// sender.sendMessage("It has either been destroyed or obstructed.");
// }
}
}
@@ -0,0 +1,66 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class SpawnCommand extends MultiverseCommand {
public SpawnCommand(MultiverseCore plugin) {
super(plugin);
Permission otherPerm = new Permission("multiverse.core.spawn.other", "Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
this.setName("Spawn");
this.setCommandUsage("/mv spawn" + ChatColor.GOLD + " [PLAYER]");
this.setArgRange(0, 1);
this.addKey("mvspawn");
this.addKey("mv spawn");
this.addKey("mvs");
this.setPermission("multiverse.core.spawn.self", "Teleports you to the Spawn Point of the world you are in.", PermissionDefault.OP);
this.addAdditonalPermission(otherPerm);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
// If a persons name was passed in, you must be A. the console, or B have permissions
if (args.size() == 1) {
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.other", true)) {
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.core.spawn.other)");
return;
}
Player target = this.plugin.getServer().getPlayer(args.get(0));
if (target != null) {
target.sendMessage("Teleporting to this world's spawn...");
target.teleport(target.getWorld().getSpawnLocation());
if (player != null) {
target.sendMessage("You were teleported by: " + ChatColor.YELLOW + player.getName());
} else {
target.sendMessage("You were teleported by: " + ChatColor.LIGHT_PURPLE + "the console");
}
} else {
sender.sendMessage(args.get(0) + " is not logged on right now!");
}
} else {
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.core.spawn.self)");
return;
}
if (player != null) {
player.sendMessage("Teleporting to this world's spawn...");
player.teleport(player.getWorld().getSpawnLocation());
} else {
sender.sendMessage("From the console, you must provide a PLAYER.");
}
}
}
}
@@ -0,0 +1,118 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVTeleport;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.utils.MVDestination;
import com.onarandombox.utils.DestinationFactory;
import com.onarandombox.utils.InvalidDestination;
public class TeleportCommand extends MultiverseCommand {
private MVTeleport playerTeleporter;
public TeleportCommand(MultiverseCore plugin) {
super(plugin);
Permission self = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP);
Permission other = new Permission("multiverse.core.tp.other", "Allows you to teleport others to other worlds.", PermissionDefault.OP);
this.setName("Teleport");
this.setCommandUsage("/mv tp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 2);
this.addKey("mvtp");
this.addKey("mv tp");
this.playerTeleporter = new MVTeleport(this.plugin);
// setPermission in some for is REQUIRED
this.setPermission(self);
this.addAdditonalPermission(other);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
Player teleporter = null;
Player teleportee = null;
if (sender instanceof Player) {
teleporter = (Player) sender;
}
String destinationName;
if (args.size() == 2) {
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.other", true)) {
sender.sendMessage("You don't have permission to teleport another player. (multiverse.core.tp.other)");
return;
}
teleportee = this.plugin.getServer().getPlayer(args.get(0));
if (teleportee == null) {
sender.sendMessage("Sorry, I couldn't find player: " + args.get(0));
return;
}
destinationName = args.get(1);
} else {
destinationName = args.get(0);
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.core.tp.self)");
return;
}
if (!(sender instanceof Player)) {
sender.sendMessage("From the console, you must specifiy a player to teleport");
return;
}
teleporter = (Player) sender;
teleportee = (Player) sender;
}
DestinationFactory df = this.plugin.getDestinationFactory();// .parseDestination(worldName, (MultiverseCore) this.plugin);
MVDestination d = df.getDestination(destinationName);
if (d != null && d instanceof InvalidDestination) {
sender.sendMessage("Multiverse does not know how to take you to: " + ChatColor.RED + destinationName);
return;
}
if (teleporter != null && !this.plugin.getPermissions().canEnterDestination(teleporter, d)) {
if (teleportee.equals(teleporter)) {
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
} else {
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
}
return;
} else if (teleporter != null && !this.plugin.getPermissions().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
if (teleportee.equals(teleporter)) {
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + "THERE from " + ChatColor.GREEN + teleporter.getWorld().getName());
} else {
teleporter.sendMessage("DOH! Doesn't look like " + ChatColor.GREEN + teleporter.getWorld().getName() + " can get to " + ChatColor.RED + "THERE from where they are...");
}
return;
}
Location l = d.getLocation(teleportee);
if (l == null) {
teleporter.sendMessage("Sorry Boss, I tried everything, but just couldn't teleport ya there!");
return;
}
if (!this.playerTeleporter.safelyTeleport(teleportee, l)) {
Class<?> paramTypes[] = { Player.class, Location.class };
List<Object> items = new ArrayList<Object>();
items.add(teleportee);
items.add(l);
String player = "you";
if (!teleportee.equals(teleporter)) {
player = teleportee.getName();
}
String message = ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " did not teleport " + ChatColor.AQUA + player + ChatColor.WHITE + " to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items, paramTypes, message, "Would you like to try anyway?", "", "", 15);
} else {
teleportee.setVelocity(d.getVelocity());
}
}
}
@@ -0,0 +1,31 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class UnloadCommand extends MultiverseCommand {
public UnloadCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Unload World");
this.setCommandUsage("/mv unload" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvunload");
this.addKey("mv unload");
this.setPermission("multiverse.core.unload", "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.removeWorldFromList(args.get(0))) {
sender.sendMessage("World Unloaded!");
} else {
sender.sendMessage("Error trying to unload world!");
}
}
}
@@ -0,0 +1,100 @@
package com.onarandombox.MultiverseCore.commands;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent;
public class VersionCommand extends MultiverseCommand {
public VersionCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Multiverse Version");
this.setCommandUsage("/mv version " + ChatColor.GOLD + "-p");
this.setArgRange(0, 1);
this.addKey("mv version");
this.addKey("mvv");
this.addKey("mvversion");
this.setPermission("multiverse.core.version", "Dumps version info to the console, optionally to pastebin.com with a -p.", PermissionDefault.TRUE);
}
private String pasteBinBuffer = "";
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
if (sender instanceof Player) {
sender.sendMessage("Version info dumped to console. Please check your server logs.");
}
logAndAddToPasteBinBuffer("Multiverse-Core Version: " + this.plugin.getDescription().getVersion());
logAndAddToPasteBinBuffer("Bukkit Version: " + this.plugin.getServer().getVersion());
logAndAddToPasteBinBuffer("Loaded Worlds: " + this.plugin.getMVWorlds().size());
logAndAddToPasteBinBuffer("Multiverse Plugins Loaded: " + this.plugin.getPluginCount());
logAndAddToPasteBinBuffer("Economy being used: " + this.plugin.getBank().getEconUsed());
logAndAddToPasteBinBuffer("Permissions Plugin: " + this.plugin.getPermissions().getType());
logAndAddToPasteBinBuffer("Dumping Config Values: (version " + this.plugin.getConfig().getString("version", "NOT SET") + ")");
logAndAddToPasteBinBuffer("messagecooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
logAndAddToPasteBinBuffer("teleportcooldown: " + this.plugin.getConfig().getString("teleportcooldown", "NOT SET"));
logAndAddToPasteBinBuffer("worldnameprefix: " + this.plugin.getConfig().getString("worldnameprefix", "NOT SET"));
logAndAddToPasteBinBuffer("opfallback: " + this.plugin.getConfig().getString("opfallback", "NOT SET"));
logAndAddToPasteBinBuffer("disableautoheal: " + this.plugin.getConfig().getString("disableautoheal", "NOT SET"));
logAndAddToPasteBinBuffer("fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
logAndAddToPasteBinBuffer("Special Code: FRN001");
MVVersionRequestEvent versionEvent = new MVVersionRequestEvent(pasteBinBuffer);
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
pasteBinBuffer = versionEvent.getPasteBinBuffer();
if (args.size() == 1 && args.get(0).equalsIgnoreCase("-p")) {
String pasteBinUrl = postToPasteBin();
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteBinUrl);
this.plugin.log(Level.INFO, "Version info dumped here: " + pasteBinUrl);
}
}
private void logAndAddToPasteBinBuffer(String string) {
this.pasteBinBuffer += "[Multiverse-Core] " + string + "\n";
this.plugin.log(Level.INFO, string);
}
private String postToPasteBin() {
try {
String data = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("33ab32380506d99d872b69d35dc9d007", "UTF-8");
data += "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
data += "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(this.pasteBinBuffer, "UTF-8");
URL url = new URL("http://pastebin.com/api/api_post.php");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String pasteBinUrl = "";
while ((line = rd.readLine()) != null) {
pasteBinUrl = line;
}
wr.close();
rd.close();
return pasteBinUrl;
} catch (Exception e) {
System.out.print(e);
return "Error Posting to pastebin.com";
}
}
}
@@ -0,0 +1,88 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class WhoCommand extends MultiverseCommand {
public WhoCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Who?");
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(0, 1);
this.addKey("mv who");
this.addKey("mvw");
this.addKey("mvwho");
this.setPermission("multiverse.core.list.who", "States who is in what world.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// If this command was sent from a Player then we need to check Permissions
Player p = null;
// By default, show all from the console
boolean showAll = true;
if (sender instanceof Player) {
p = (Player) sender;
showAll = false;
}
List<MVWorld> worlds = new ArrayList<MVWorld>();
if (args.size() > 0) {
if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
showAll = true;
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
} else if (this.plugin.isMVWorld(args.get(0))) {
worlds.add(this.plugin.getMVWorld(args.get(0)));
} else {
sender.sendMessage(ChatColor.RED + "World does not exist");
return;
}
} else {
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
}
if (worlds.size() == 0) {
sender.sendMessage("Multiverse does not know about any of your worlds :(");
} else if (worlds.size() == 1) {
sender.sendMessage(ChatColor.AQUA + "--- " + "Players in" + ChatColor.YELLOW + worlds.get(0) + ChatColor.AQUA + " ---");
} else {
sender.sendMessage(ChatColor.AQUA + "--- There are players in ---");
}
for (MVWorld world : worlds) {
if (!(this.plugin.isMVWorld(world.getName()))) {
continue;
}
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
continue;
}
List<Player> players = world.getCBWorld().getPlayers();
String result = "";
if (players.size() <= 0 && !showAll) {
continue;
}
if (players.size() <= 0) {
result = "Empty";
} else {
for (Player player : players) {
result += player.getName() + " ";
}
}
sender.sendMessage(world.getColoredWorldString() + ChatColor.WHITE + " - " + result);
}
}
}
@@ -0,0 +1,50 @@
package com.onarandombox.MultiverseCore.configuration;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
public class DefaultConfig {
public DefaultConfig(File folder, String name, MVConfigMigrator migrator) {
File actual = new File(folder, name);
if (actual.exists() && migrator.createdDefaults.contains(name)) {
actual.delete();
}
// If defaults have been created, and we're being called again, we should try to migrate
if (!actual.exists() && !migrator.migrate(name, folder)) {
InputStream defConfig = this.getClass().getResourceAsStream("/defaults/" + name);
if (defConfig != null) {
FileOutputStream newConfig = null;
try {
newConfig = new FileOutputStream(actual);
byte[] buf = new byte[8192];
int length = 0;
while ((length = defConfig.read(buf)) > 0) {
newConfig.write(buf, 0, length);
}
migrator.createdDefaults.add(name);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (defConfig != null)
defConfig.close();
} catch (Exception e) {
}
try {
if (newConfig != null)
newConfig.close();
} catch (Exception e) {
}
}
}
}
}
}
@@ -0,0 +1,54 @@
package com.onarandombox.MultiverseCore.configuration;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
import com.onarandombox.MultiverseCore.LoggablePlugin;
public abstract class MVConfigMigrator {
public List<String> createdDefaults = new ArrayList<String>();
public abstract boolean migrate(String name, File folder);
protected final void migrateListItem(Configuration newConfig, Configuration oldConfig, String key, String oldProperty, String newProperty) {
List<String> list = Arrays.asList(oldConfig.getString("worlds." + key + oldProperty).split(","));
if (list.size() > 0) {
if (list.get(0).length() == 0) {
list = new ArrayList<String>();
}
}
newConfig.setProperty("worlds." + key + newProperty, list);
}
protected final File detectMultiverseFolders(File folder, LoggablePlugin mvPlugin) {
File oldFolder = null;
mvPlugin.log(Level.INFO, "Starting Multiverse Configuration Migrator(MVCM)!");
// They still have MV 1 installed! Good!
if (mvPlugin.getServer().getPluginManager().getPlugin("MultiVerse") != null) {
mvPlugin.log(Level.INFO, "Found MultiVerse 1. Starting Config Migration...");
Plugin plugin = mvPlugin.getServer().getPluginManager().getPlugin("MultiVerse");
oldFolder = plugin.getDataFolder();
} else {
// They didn't have MV 1 enabled... let's try and find the folder...
File[] folders = folder.getParentFile().listFiles();
List<File> folderList = Arrays.asList(folders);
for (File f : folderList) {
if (f.getName().equalsIgnoreCase("MultiVerse")) {
mvPlugin.log(Level.INFO, "Found the MultiVerse 1 config folder. Starting Config Migration...");
oldFolder = f;
}
}
if (oldFolder == null) {
mvPlugin.log(Level.INFO, "Did not find the MV1 Folder. If you did not have MultiVerse 1 installed and this is the FIRST time you're running MV2, this message is GOOD. ");
mvPlugin.log(Level.INFO, "If you did, your configs were **NOT** migrated! Go Here: INSERTURLFORHELP");
return null;
}
}
return oldFolder;
}
}
@@ -0,0 +1,76 @@
package com.onarandombox.MultiverseCore.configuration;
import java.io.File;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.util.config.Configuration;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class MVCoreConfigMigrator extends MVConfigMigrator {
private MultiverseCore core;
public MVCoreConfigMigrator(MultiverseCore core) {
this.core = core;
}
public boolean migrate(String name, File folder) {
File oldFolder = this.detectMultiverseFolders(folder, core);
if (name.equalsIgnoreCase("worlds.yml")) {
return this.migrateWorlds(name, oldFolder, folder);
}
if (name.equalsIgnoreCase("config.yml")) {
return this.migrateMainConfig(name, oldFolder, folder);
}
return true;
}
private boolean migrateWorlds(String name, File oldFolder, File newFolder) {
Configuration newConfig = new Configuration(new File(newFolder, "worlds.yml"));
this.core.log(Level.INFO, "Trying to migrate worlds.yml...");
Configuration oldConfig = new Configuration(new File(oldFolder, "Worlds.yml"));
oldConfig.load();
List<String> keys = oldConfig.getKeys("worlds");
if (keys == null) {
this.core.log(Level.SEVERE, "Migration FAILURE!");
return false;
}
for (String key : keys) {
newConfig.setProperty("worlds." + key + ".animals.spawn", oldConfig.getProperty("worlds." + key + ".animals"));
newConfig.setProperty("worlds." + key + ".monsters.spawn", oldConfig.getProperty("worlds." + key + ".mobs"));
newConfig.setProperty("worlds." + key + ".pvp", oldConfig.getProperty("worlds." + key + ".pvp"));
newConfig.setProperty("worlds." + key + ".alias.name", oldConfig.getProperty("worlds." + key + ".alias"));
newConfig.setProperty("worlds." + key + ".tempspawn", oldConfig.getProperty("worlds." + key + ".spawn"));
newConfig.setProperty("worlds." + key + ".entryfee.amount", oldConfig.getProperty("worlds." + key + ".price"));
newConfig.setProperty("worlds." + key + ".entryfee.currency", -1);
newConfig.setProperty("worlds." + key + ".environment", oldConfig.getProperty("worlds." + key + ".environment"));
// Have to convert CSLs to arrays
migrateListItem(newConfig, oldConfig, key, ".blockBlacklist", ".blockblacklist");
migrateListItem(newConfig, oldConfig, key, ".worldBlacklist", ".worldblacklist");
}
newConfig.save();
this.core.log(Level.INFO, "Migration SUCCESS!");
return true;
}
private boolean migrateMainConfig(String name, File oldFolder, File newFolder) {
Configuration newConfig = new Configuration(new File(newFolder, "config.yml"));
this.core.log(Level.INFO, "Migrating config.yml...");
Configuration oldConfig = new Configuration(new File(oldFolder, "MultiVerse.yml"));
oldConfig.load();
newConfig.setProperty("worldnameprefix", oldConfig.getProperty("prefix"));
newConfig.setProperty("messagecooldown", oldConfig.getProperty("alertcooldown"));
// Default values:
newConfig.setProperty("opfallback", true);
newConfig.setProperty("disableautoheal", false);
newConfig.setProperty("fakepvp", false);
newConfig.setProperty("bedrespawn", true);
newConfig.setProperty("version", 2.2);
newConfig.save();
return true;
}
}
@@ -0,0 +1,23 @@
package com.onarandombox.MultiverseCore.event;
import java.util.List;
import org.bukkit.event.Event;
public class MVConfigMigrateEvent extends Event {
private static final long serialVersionUID = 3647950355746345397L;
private List<String> configsLoaded;
public MVConfigMigrateEvent(List<String> configsLoaded) {
super("MVConfigMigrate");
this.configsLoaded = configsLoaded;
}
public void addConfig(String config) {
this.configsLoaded.add(config);
}
public List<String> getAllConfigsLoaded() {
return this.configsLoaded;
}
}
@@ -0,0 +1,23 @@
package com.onarandombox.MultiverseCore.event;
import java.util.List;
import org.bukkit.event.Event;
public class MVConfigReloadEvent extends Event {
private static final long serialVersionUID = 3647950355746345397L;
private List<String> configsLoaded;
public MVConfigReloadEvent(List<String> configsLoaded) {
super("MVConfigReload");
this.configsLoaded = configsLoaded;
}
public void addConfig(String config) {
this.configsLoaded.add(config);
}
public List<String> getAllConfigsLoaded() {
return this.configsLoaded;
}
}
@@ -0,0 +1,36 @@
package com.onarandombox.MultiverseCore.event;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
public class MVRespawnEvent extends Event {
private static final long serialVersionUID = -2991894063331856687L;
private Player player;
private Location location;
private String respawnMethod;
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
super("MVRespawn");
this.player = p;
this.location = spawningAt;
this.respawnMethod = respawnMethod;
}
public Player getPlayer() {
return this.player;
}
public String getRespawnMethod() {
return this.respawnMethod;
}
public Location getPlayersRespawnLocation() {
return this.location;
}
public void setRespawnLocation(Location l) {
this.location = l;
}
}
@@ -0,0 +1,33 @@
package com.onarandombox.MultiverseCore.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import com.onarandombox.utils.MVDestination;
public class MVTeleportEvent extends Event {
private static final long serialVersionUID = 854826818438649269L;
private Player player;
private MVDestination dest;
private String teleportString;
public MVTeleportEvent(MVDestination dest, Player p, String teleportString) {
super("MVTeleport");
this.player = p;
this.dest = dest;
this.teleportString = teleportString;
}
public Player getPlayer() {
return this.player;
}
public String getDestString() {
return this.teleportString;
}
public Class<? extends MVDestination> getDestType() {
return this.dest.getClass();
}
}
@@ -0,0 +1,19 @@
package com.onarandombox.MultiverseCore.event;
import org.bukkit.event.Event;
public class MVVersionRequestEvent extends Event {
private String pasteBinBuffer;
public MVVersionRequestEvent(String pasteBinBuffer) {
super("MVVersion");
this.pasteBinBuffer = pasteBinBuffer;
}
public String getPasteBinBuffer() {
return this.pasteBinBuffer;
}
public void setPasteBinBuffer(String buffer) {
this.pasteBinBuffer = buffer;
}
}
@@ -0,0 +1,47 @@
package com.onarandombox.MultiverseCore.listeners;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import com.onarandombox.MultiverseCore.MultiverseCore;
//import org.bukkit.event.block.BlockRightClickEvent;
public class MVBlockListener extends BlockListener {
MultiverseCore plugin;
public MVBlockListener(MultiverseCore plugin) {
this.plugin = plugin;
}
// public void onBlockRightClicked(BlockRightClickEvent event){
// }
@Override
public void onBlockDamage(BlockDamageEvent event) {
}
@Override
public void onBlockPhysics(BlockPhysicsEvent event) {
if (event.isCancelled()) {
return;
}
int id = event.getChangedTypeId();
if (id == 90) { // && config.getBoolean("portalanywhere", false)
event.setCancelled(true);
return;
}
}
public void onBlockPlaced(BlockPlaceEvent event) {
}
}
@@ -0,0 +1,150 @@
package com.onarandombox.MultiverseCore.listeners;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Animals;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
//import org.bukkit.event.entity.ExplosionPrimedEvent;
public class MVEntityListener extends EntityListener {
MultiverseCore plugin;
public MVEntityListener(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* Event - When a Entity is Damaged, we first sort out whether it is of importance to us, such as EntityVSEntity or EntityVSProjectile. Then we grab the attacked and defender and check if its a player. Then deal with the PVP Aspect.
*/
@Override
public void onEntityDamage(EntityDamageEvent event) {
if (event.isCancelled()) {
return;
}
Entity attacker = null;
Entity defender = null;
if (event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
attacker = sub.getDamager();
defender = sub.getEntity();
} else {
return;
}
if (attacker == null || defender == null) {
return;
}
if (defender instanceof Player) {
Player player = (Player) defender;
World w = player.getWorld();
if (!this.plugin.isMVWorld(w.getName())) {
// if the world is not handled, we don't care
return;
}
MVWorld world = this.plugin.getMVWorld(w.getName());
if (attacker != null && attacker instanceof Player) {
Player pattacker = (Player) attacker;
if (!world.getPvp() && this.plugin.getConfig().getBoolean("fakepvp", false)) {
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
event.setCancelled(true);
return;
}
}
}
}
@Override
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (event.isCancelled()) {
return;
}
RegainReason reason = event.getRegainReason();
if (reason == RegainReason.REGEN && this.plugin.getConfig().getBoolean("disableautoheal", false)) {
event.setCancelled(true);
return;
}
}
/**
* Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit.
*/
@Override
public void onCreatureSpawn(CreatureSpawnEvent event) {
// Check to see if the Creature is spawned by a plugin, we don't want to prevent this behaviour.
if (event.getSpawnReason() == SpawnReason.CUSTOM) {
return;
}
World world = event.getEntity().getWorld();
if (event.isCancelled())
return;
// Check if it's a world which we are meant to be managing.
if (!(this.plugin.isMVWorld(world.getName())))
return;
CreatureType creature = event.getCreatureType();
MVWorld mvworld = this.plugin.getMVWorld(world.getName());
/**
* Animal Handling
*/
if (event.getEntity() instanceof Animals) {
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.allowAnimalSpawning(), creature.toString().toUpperCase()));
}
/**
* Monster Handling
*/
if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime) {
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.allowMonsterSpawning(), creature.toString().toUpperCase()));
}
}
private boolean shouldWeKillThisCreature(List<String> creatureList, boolean allowCreatureSpawning, String creature) {
if (creatureList.isEmpty() && allowCreatureSpawning) {
// 1. There are no exceptions and animals are allowed. Save it.
return false;
} else if (creatureList.isEmpty()) {
// 2. There are no exceptions and animals are NOT allowed. Kill it.
return true;
} else if (creatureList.contains(creature) && allowCreatureSpawning) {
// 3. There ARE exceptions and animals ARE allowed. Kill it.
return true;
} else if (!creatureList.contains(creature.toString().toUpperCase()) && allowCreatureSpawning) {
// 4. There ARE exceptions and animals ARE NOT allowed. SAVE it.
return false;
} else if (creatureList.contains(creature.toString().toUpperCase()) && !allowCreatureSpawning) {
// 5. No animals are allowed to be spawned, BUT this one can stay...
return false;
} else if (!creatureList.contains(creature.toString().toUpperCase()) && !allowCreatureSpawning) {
// 6. Animals are NOT allowed to spawn, and this creature is not in the save list... KILL IT
return true;
}
// This code should NEVER execute. I just left the verbose conditions in right now.
return false;
}
}
@@ -0,0 +1,135 @@
package com.onarandombox.MultiverseCore.listeners;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import com.fernferret.allpay.GenericBank;
import com.onarandombox.MultiverseCore.MVTeleport;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
public class MVPlayerListener extends PlayerListener {
MultiverseCore plugin;
MVTeleport mvteleporter;
public MVPlayerListener(MultiverseCore plugin) {
this.plugin = plugin;
}
// Taken out until we do persistance.
// @Override
// public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
// Location bedLoc = event.getBed().getLocation();
// bedLoc = this.plugin.getTeleporter().getSafeBedDestination(bedLoc);
// this.plugin.getPlayerSession(event.getPlayer()).setRespawnLocation(bedLoc);
// event.getPlayer().sendMessage("You should come back here when you type '/mv sleep'!");
// }
@Override
public void onPlayerChat(PlayerChatEvent event) {
if (event.isCancelled()) {
return;
}
// Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias.
if (this.plugin.getConfig().getBoolean("worldnameprefix", true)) {
this.plugin.getConfig().save();
String world = event.getPlayer().getWorld().getName();
String prefix = "";
// If we're not a MV world, don't do anything
if (!this.plugin.isMVWorld(world)) {
return;
}
MVWorld mvworld = this.plugin.getMVWorld(world);
prefix = mvworld.getColoredWorldString();
String format = event.getFormat();
event.setFormat("[" + prefix + "]" + format);
}
}
@Override
public void onPlayerRespawn(PlayerRespawnEvent event) {
// TODO: Reimplement bed respawning, needs to be a way to persist the bed location or something otherwise it's not very effective.
World world = event.getPlayer().getWorld();
// If it's not a World MV manages we stop.
if (!this.plugin.isMVWorld(world.getName())) {
return;
}
// Get the MVWorld
MVWorld mvWorld = this.plugin.getMVWorld(world.getName());
// Get the instance of the World the player should respawn at.
MVWorld respawnWorld = null;
if (this.plugin.isMVWorld(mvWorld.getRespawnToWorld())) {
respawnWorld = this.plugin.getMVWorld(mvWorld.getRespawnToWorld());
}
// If it's null then it either means the World doesn't exist or the value is blank, so we don't handle it.
if (respawnWorld == null) {
return;
}
Location respawnLocation = respawnWorld.getCBWorld().getSpawnLocation();
MVRespawnEvent respawnEvent = new MVRespawnEvent(respawnLocation, event.getPlayer(), "compatability");
this.plugin.getServer().getPluginManager().callEvent(respawnEvent);
event.setRespawnLocation(respawnEvent.getPlayersRespawnLocation());
}
@Override
public void onPlayerJoin(PlayerJoinEvent event) {
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.getPermissions().hasPermission(event.getPlayer(), "multiverse.core.import", true)) {
event.getPlayer().sendMessage("You don't have any worlds imported into Multiverse!");
event.getPlayer().sendMessage("You can import your current worlds with " + ChatColor.AQUA + "/mvimport");
event.getPlayer().sendMessage("or you can create new ones with " + ChatColor.GOLD + "/mvcreate");
event.getPlayer().sendMessage("If you just wanna see all of the Multiverse Help, type: " + ChatColor.GREEN + "/mv");
}
}
@Override
public void onPlayerQuit(PlayerQuitEvent event) {
this.plugin.removePlayerSession(event.getPlayer());
}
@Override
public void onPlayerTeleport(PlayerTeleportEvent event) {
MVWorld fromWorld = this.plugin.getMVWorld(event.getTo().getWorld().getName());
MVWorld toWorld = this.plugin.getMVWorld(event.getTo().getWorld().getName());
if (toWorld != null) {
if (!this.plugin.getPermissions().canEnterWorld(event.getPlayer(), toWorld)) {
event.getPlayer().sendMessage("You don't have access to go here...");
event.setCancelled(true);
return;
}
}
if (fromWorld != null) {
if (fromWorld.getWorldBlacklist().contains(toWorld.getName())) {
event.getPlayer().sendMessage("You don't have access to go to " + toWorld.getColoredWorldString() + " from " + fromWorld.getColoredWorldString());
event.setCancelled(true);
return;
}
}
// Only check payments if it's a different world:
if (!event.getTo().getWorld().equals(event.getFrom().getWorld())) {
// If the player does not have to pay, return now.
if(toWorld.isExempt(event.getPlayer())) {
return;
}
GenericBank bank = plugin.getBank();
if (!bank.hasEnough(event.getPlayer(), toWorld.getPrice(), toWorld.getCurrency(), "You need " + bank.getFormattedAmount(toWorld.getPrice(), toWorld.getCurrency()) + " to enter " + toWorld.getColoredWorldString())) {
event.setCancelled(true);
} else {
bank.pay(event.getPlayer(), toWorld.getPrice(), toWorld.getCurrency());
}
}
}
}
@@ -0,0 +1,61 @@
package com.onarandombox.MultiverseCore.listeners;
import java.util.Arrays;
import java.util.logging.Level;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import com.fernferret.allpay.AllPay;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class MVPluginListener extends ServerListener {
MultiverseCore plugin;
public MVPluginListener(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* Keep an eye out for Plugins which we can utilize.
*/
@Override
public void onPluginEnable(PluginEnableEvent event) {
/**
* Check to see if Permissions was just enabled
*/
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
this.plugin.getPermissions().setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
this.plugin.log(Level.INFO, "- Attached to Permissions");
}
// Let AllPay handle all econ plugin loadings, only go for econ plugins we support
if (Arrays.asList(AllPay.validEconPlugins).contains(event.getPlugin().getDescription().getName())) {
this.plugin.setBank(this.plugin.getBanker().loadEconPlugin());
}
if (event.getPlugin().getDescription().getName().equals("MultiVerse")) {
if (event.getPlugin().isEnabled()) {
this.plugin.getServer().getPluginManager().disablePlugin(event.getPlugin());
this.plugin.log(Level.WARNING, "I just disabled the old version of Multiverse for you. You should remove the JAR now, your configs have been migrated.");
}
}
}
/**
* We'll check if any of the plugins we rely on decide to Disable themselves.
*/
@Override
public void onPluginDisable(PluginDisableEvent event) {
/**
* Check to see if Permissions just disabled.
*/
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
this.plugin.log(Level.INFO, "Permissions disabled");
this.plugin.getPermissions().setPermissions(null);
}
// TODO: Disable econ when it disables.
}
}
@@ -0,0 +1,36 @@
package com.onarandombox.MultiverseCore.listeners;
import org.bukkit.event.weather.ThunderChangeEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.weather.WeatherListener;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class MVWeatherListener extends WeatherListener {
private MultiverseCore plugin;
public MVWeatherListener(MultiverseCore plugin) {
this.plugin = plugin;
}
@Override
public void onWeatherChange(WeatherChangeEvent event) {
MVWorld world = this.plugin.getMVWorld(event.getWorld().getName());
if (world != null) {
// If it's going to start raining and we have weather disabled
event.setCancelled((event.toWeatherState() && !world.getWeatherEnabled()));
}
}
@Override
public void onThunderChange(ThunderChangeEvent event) {
MVWorld world = this.plugin.getMVWorld(event.getWorld().getName());
if (world != null) {
// If it's going to start raining and we have weather disabled
event.setCancelled((event.toThunderState() && !world.getWeatherEnabled()));
}
}
}
@@ -0,0 +1,188 @@
package com.onarandombox.utils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Vehicle;
public class BlockSafety {
/**
* This function checks whether the block at the given coordinates are above air or not.
*
* @param world
* @param x
* @param y
* @param z
* @return
*/
public boolean isBlockAboveAir(Location l) {
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
downOne.setY(downOne.getY() - 1);
return (downOne.getBlock().getType() == Material.AIR);
}
public boolean blockIsNotSafe(World world, double x, double y, double z) {
Location l = new Location(world, x, y, z);
return !playerCanSpawnHereSafely(l);
}
/**
* This function checks whether the block at the coordinates given is safe or not by checking for Laval/Fire/Air etc. This also ensures there is enough space for a player to spawn!
*
* @param world
* @param x
* @param y
* @param z
* @return
*/
public boolean playerCanSpawnHereSafely(Location l) {
Location actual = l.clone();
Location upOne = l.clone();
Location downOne = l.clone();
upOne.setY(upOne.getY() + 1);
downOne.setY(downOne.getY() - 1);
if (this.isSolidBlock(actual.getBlock().getType()) || this.isSolidBlock(upOne.getBlock().getType())) {
return false;
}
if (downOne.getBlock().getType() == Material.LAVA || downOne.getBlock().getType() == Material.STATIONARY_LAVA) {
return false;
}
if (downOne.getBlock().getType() == Material.FIRE) {
return false;
}
if (isBlockAboveAir(actual)) {
return this.hasTwoBlocksofWaterBelow(actual);
}
return true;
}
/**
* If someone has a better way of this... Please either tell us, or submit a pull request!
*
* @param type
* @return
*/
private boolean isSolidBlock(Material type) {
switch (type) {
case AIR:
return false;
case SNOW:
return false;
case TRAP_DOOR:
return false;
case TORCH:
return false;
case YELLOW_FLOWER:
return false;
case RED_ROSE:
return false;
case RED_MUSHROOM:
return false;
case BROWN_MUSHROOM:
return false;
case REDSTONE:
return false;
case REDSTONE_WIRE:
return false;
case RAILS:
return false;
case POWERED_RAIL:
return false;
case REDSTONE_TORCH_ON:
return false;
case REDSTONE_TORCH_OFF:
return false;
case DEAD_BUSH:
return false;
case SAPLING:
return false;
case STONE_BUTTON:
return false;
case LEVER:
return false;
case LONG_GRASS:
return false;
case PORTAL:
return false;
case STONE_PLATE:
return false;
case WOOD_PLATE:
return false;
case SEEDS:
return false;
case SUGAR_CANE_BLOCK:
return false;
case WALL_SIGN:
return false;
case SIGN_POST:
return false;
}
return true;
}
public boolean isEntitiyOnTrack(Entity e, Location l) {
Material currentBlock = l.getBlock().getType();
return (currentBlock == Material.POWERED_RAIL || currentBlock == Material.DETECTOR_RAIL || currentBlock == Material.RAILS);
}
public void showDangers(Location l) {
Location actual = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
Location upOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
upOne.setY(upOne.getY() + 1);
downOne.setY(downOne.getY() - 1);
System.out.print("Location Up: " + upOne.getBlock().getType());
System.out.print(" " + upOne);
System.out.print("Location: " + actual.getBlock().getType());
System.out.print(" " + actual);
System.out.print("Location Down: " + downOne.getBlock().getType());
System.out.print(" " + downOne);
}
/**
* Checks recursively below location L for 2 blocks of water
* @param l
* @return
*/
public boolean hasTwoBlocksofWaterBelow(Location l) {
if(l.getBlockY() < 0) {
return false;
}
Location oneBelow = l.clone();
oneBelow.subtract(0, 1, 0);
if(oneBelow.getBlock().getType() == Material.WATER || oneBelow.getBlock().getType() == Material.STATIONARY_WATER) {
Location twoBelow = oneBelow.clone();
twoBelow.subtract(0, 1, 0);
return (oneBelow.getBlock().getType() == Material.WATER || oneBelow.getBlock().getType() == Material.STATIONARY_WATER);
}
if(oneBelow.getBlock().getType() != Material.AIR) {
return false;
}
return hasTwoBlocksofWaterBelow(oneBelow);
}
public boolean canSpawnCartSafely(Minecart cart) {
if(this.isBlockAboveAir(cart.getLocation())) {
return true;
}
if(this.isEntitiyOnTrack(cart, LocationManipulation.getNextBlock(cart))) {
return true;
}
return false;
}
public boolean canSpawnVehicleSafely(Vehicle vehicle) {
if(this.isBlockAboveAir(vehicle.getLocation())) {
return true;
}
return false;
}
}
@@ -0,0 +1,170 @@
package com.onarandombox.utils;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class CannonDestination implements MVDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
private double speed;
public Vector getVelocity() {
double pitchRadians = Math.toRadians(location.getPitch());
double yawRadians = Math.toRadians(location.getYaw());
double x = Math.sin(yawRadians) * speed * -1;
double y = Math.sin(pitchRadians) * speed * -1;
double z = Math.cos(yawRadians) * speed;
// Account for the angle they were pointed, and take away velocity
x = Math.cos(pitchRadians) * x;
z = Math.cos(pitchRadians) * z;
return new Vector(x, y, z);
}
@Override
public String getIdentifer() {
return "ca";
}
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// NEED ca:world:x,y,z:pitch:yaw:speed
// so basically 6
if (parsed.size() != 6) {
return false;
}
// If it's not an Cannon type
if (!parsed.get(0).equalsIgnoreCase("ca")) {
return false;
}
// If it's not a MV world
if (!((MultiverseCore) plugin).isMVWorld(parsed.get(1))) {
return false;
}
// Verify X,Y,Z are numbers
if (!parsed.get(2).matches(coordRegex)) {
return false;
}
try {
Float.parseFloat(parsed.get(3));
Float.parseFloat(parsed.get(4));
Float.parseFloat(parsed.get(5));
} catch (NumberFormatException e) {
return false;
}
return true;
}
@Override
public Location getLocation(Entity e) {
return this.location;
}
@Override
public boolean isValid() {
return this.isValid;
}
@Override
public void setDestination(JavaPlugin plugin, String dest) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
List<String> parsed = Arrays.asList(dest.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (parsed.size() != 6) {
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifer())) {
this.isValid = false;
return;
}
if (!((MultiverseCore) plugin).isMVWorld(parsed.get(1))) {
this.isValid = false;
return;
}
this.location = new Location(((MultiverseCore) plugin).getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
if (!parsed.get(2).matches(this.coordRegex)) {
this.isValid = false;
return;
}
double[] coords = new double[3];
String[] coordString = parsed.get(2).split(",");
for (int i = 0; i < 3; i++) {
try {
coords[i] = Double.parseDouble(coordString[i]);
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
}
this.location.setX(coords[0]);
this.location.setY(coords[1]);
this.location.setZ(coords[2]);
try {
this.location.setPitch(Float.parseFloat(parsed.get(3)));
this.location.setYaw(Float.parseFloat(parsed.get(4)));
this.speed = Math.abs(Float.parseFloat(parsed.get(5)));
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
this.isValid = true;
}
@Override
public String getType() {
return "Cannon!";
}
@Override
public String getName() {
return "Cannon (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":" +
this.location.getPitch() + ":" + this.location.getYaw() + ":" + this.speed + ")";
}
public void setDestination(Location location, double speed) {
if (location != null) {
this.location = location;
this.speed = Math.abs(speed);
this.isValid = true;
}
this.isValid = false;
}
@Override
public String toString() {
if (isValid) {
return "ca:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
}
return "i:Invalid Destination";
}
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
}
@@ -0,0 +1,82 @@
package com.onarandombox.utils;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
public class DebugLog {
private FileHandler fh;
private Logger log;
/**
* Creates a new debug logger.
*
* @param logger The name of the logger.
* @param file The file to log to.
*/
public DebugLog(String logger, String file) {
this.log = Logger.getLogger(logger);
try {
this.fh = new FileHandler(file, true);
this.log.setUseParentHandlers(false);
for (Handler handler : this.log.getHandlers()) {
this.log.removeHandler(handler);
}
this.log.addHandler(this.fh);
this.log.setLevel(Level.ALL);
this.fh.setFormatter(new LogFormatter());
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Log a message at a certain level
*
* @param level
* @param msg
*/
public void log(Level level, String msg) {
this.log.log(level, msg);
}
private class LogFormatter extends Formatter {
private final SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Override
public String format(LogRecord record) {
StringBuilder builder = new StringBuilder();
Throwable ex = record.getThrown();
builder.append(this.date.format(record.getMillis()));
builder.append(" [");
builder.append(record.getLevel().getLocalizedName().toUpperCase());
builder.append("] ");
builder.append(record.getMessage());
builder.append('\n');
if (ex != null) {
StringWriter writer = new StringWriter();
ex.printStackTrace(new PrintWriter(writer));
builder.append(writer);
}
return builder.toString();
}
}
public void close() {
this.fh.close();
}
}
@@ -0,0 +1,46 @@
package com.onarandombox.utils;
import java.util.HashMap;
import java.util.Map;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class DestinationFactory {
private MultiverseCore plugin;
private Map<String, Class<? extends MVDestination>> destList;
public DestinationFactory(MultiverseCore plugin) {
this.plugin = plugin;
this.destList = new HashMap<String, Class<? extends MVDestination>>();
}
public MVDestination getDestination(String dest) {
String idenChar = "";
if (dest.split(":").length > 1) {
idenChar = dest.split(":")[0];
}
if (this.destList.containsKey(idenChar)) {
Class<? extends MVDestination> myClass = this.destList.get(idenChar);
try {
MVDestination mydest = myClass.newInstance();
if (!mydest.isThisType((MultiverseCore) this.plugin, dest)) {
return new InvalidDestination();
}
mydest.setDestination(this.plugin, dest);
return mydest;
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
return new InvalidDestination();
}
public boolean registerDestinationType(Class<? extends MVDestination> c, String identifier) {
if (this.destList.containsKey(identifier)) {
return false;
}
this.destList.put(identifier, c);
return true;
}
}
@@ -0,0 +1,165 @@
package com.onarandombox.utils;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class ExactDestination implements MVDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
@Override
public String getIdentifer() {
return "e";
}
public Vector getVelocity() {
return new Vector(0,0,0);
}
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 3 || parsed.size() == 5)) {
return false;
}
// If it's not an Exact type
if (!parsed.get(0).equalsIgnoreCase("e")) {
return false;
}
// If it's not a MV world
if (!((MultiverseCore) plugin).isMVWorld(parsed.get(1))) {
return false;
}
if (!parsed.get(2).matches(coordRegex)) {
return false;
}
// This is 1 now, because we've removed 2
if (parsed.size() == 3) {
return true;
}
try {
Float.parseFloat(parsed.get(3));
Float.parseFloat(parsed.get(4));
} catch (NumberFormatException e) {
return false;
}
return true;
}
@Override
public Location getLocation(Entity e) {
return this.location;
}
@Override
public boolean isValid() {
return this.isValid;
}
@Override
public void setDestination(JavaPlugin plugin, String dest) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
List<String> parsed = Arrays.asList(dest.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 3 || parsed.size() == 5)) {
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifer())) {
this.isValid = false;
return;
}
if (!((MultiverseCore) plugin).isMVWorld(parsed.get(1))) {
this.isValid = false;
return;
}
this.location = new Location(((MultiverseCore) plugin).getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
if (!parsed.get(2).matches(this.coordRegex)) {
this.isValid = false;
return;
}
double[] coords = new double[3];
String[] coordString = parsed.get(2).split(",");
for (int i = 0; i < 3; i++) {
try {
coords[i] = Double.parseDouble(coordString[i]);
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
}
this.location.setX(coords[0]);
this.location.setY(coords[1]);
this.location.setZ(coords[2]);
if (parsed.size() == 3) {
this.isValid = true;
return;
}
try {
this.location.setPitch(Float.parseFloat(parsed.get(3)));
this.location.setYaw(Float.parseFloat(parsed.get(4)));
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
this.isValid = true;
}
@Override
public String getType() {
return "Exact";
}
@Override
public String getName() {
return "Exact (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ")";
}
public void setDestination(Location location) {
if (location != null) {
this.location = location;
this.isValid = true;
}
this.isValid = false;
}
@Override
public String toString() {
if (isValid) {
return "e:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw();
}
return "i:Invalid Destination";
}
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
}
@@ -0,0 +1,37 @@
package com.onarandombox.utils;
import org.bukkit.ChatColor;
public class FancyColorScheme {
private ChatColor headerColor;
private ChatColor mainColor;
private ChatColor altColor;
private ChatColor defContentColor;
public FancyColorScheme(ChatColor header, ChatColor main, ChatColor alt, ChatColor defaultColor) {
this.headerColor = header;
this.mainColor = main;
this.altColor = alt;
this.defContentColor = defaultColor;
}
public ChatColor getHeader() {
return this.headerColor;
}
public ChatColor getMain() {
return this.mainColor;
}
public ChatColor getAlt() {
return this.altColor;
}
public ChatColor getDefault() {
return this.defContentColor;
}
public ChatColor getMain(boolean main) {
return main ? this.getMain() : this.getAlt();
}
}
@@ -0,0 +1,22 @@
package com.onarandombox.utils;
public class FancyHeader implements FancyText {
private FancyColorScheme colors;
private String text;
public FancyHeader(String text, FancyColorScheme scheme) {
this.colors = scheme;
this.text = text;
}
@Override
public String getFancyText() {
return colors.getHeader() + "--- " + text + colors.getHeader() + " ---";
}
public void appendText(String string) {
this.text += string;
}
}
@@ -0,0 +1,34 @@
package com.onarandombox.utils;
public class FancyMessage implements FancyText {
private String title;
private String message;
private boolean main = true;
private FancyColorScheme colors;
/**
* Allows easy creation of an alternating colored list
* @param title
* @param message
*/
public FancyMessage(String title, String message, FancyColorScheme scheme) {
this.title = title;
this.message = message;
this.colors = scheme;
}
public void setColorMain() {
this.main = true;
}
public void setColorAlt() {
this.main = false;
}
@Override
public String getFancyText() {
return this.colors.getMain(this.main) + this.title + this.colors.getDefault() + message;
}
public void setAltColor(boolean altColor) {
this.main = !altColor;
}
public void setMainColor(boolean mainColor) {
this.main = mainColor;
}
}
@@ -0,0 +1,5 @@
package com.onarandombox.utils;
public interface FancyText {
public String getFancyText();
}
@@ -0,0 +1,59 @@
package com.onarandombox.utils;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class InvalidDestination implements MVDestination {
@Override
public String getIdentifer() {
return "i";
}
@Override
public boolean isThisType(JavaPlugin plugin, String dest) {
return false;
}
@Override
public Location getLocation(Entity e) {
return null;
}
@Override
public boolean isValid() {
return false;
}
@Override
public void setDestination(JavaPlugin plugin, String dest) {
// Nothing needed, it's invalid.
}
@Override
public String getType() {
return ChatColor.RED + "Invalid Destination";
}
@Override
public String getName() {
return ChatColor.RED + "Invalid Destination";
}
@Override
public String toString() {
return "i:Invalid Destination";
}
@Override
public String getRequiredPermission() {
return null;
}
public Vector getVelocity() {
return new Vector(0,0,0);
}
}
@@ -0,0 +1,164 @@
package com.onarandombox.utils;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
public class LocationManipulation {
private static Map<String, Integer> orientationInts = new HashMap<String, Integer>();
static {
orientationInts.put("n", 180);
orientationInts.put("ne", 225);
orientationInts.put("e", 270);
orientationInts.put("se", 315);
orientationInts.put("s", 0);
orientationInts.put("sw", 45);
orientationInts.put("w", 90);
orientationInts.put("nw", 135);
}
/**
* Convert a Location into a Colon separated string to allow us to store it in text.
*
* @param location
* @return
*/
public String locationToString(Location location) {
StringBuilder l = new StringBuilder();
l.append(location.getBlockX() + ":");
l.append(location.getBlockY() + ":");
l.append(location.getBlockZ() + ":");
l.append(location.getYaw() + ":");
l.append(location.getPitch());
return l.toString();
}
/**
* Convert a String to a Location.
*
* @param world
* @param xStr
* @param yStr
* @param zStr
* @param yawStr
* @param pitchStr
* @return
*/
public Location stringToLocation(World world, String xStr, String yStr, String zStr, String yawStr, String pitchStr) {
double x = Double.parseDouble(xStr);
double y = Double.parseDouble(yStr);
double z = Double.parseDouble(zStr);
float yaw = Float.valueOf(yawStr).floatValue();
float pitch = Float.valueOf(pitchStr).floatValue();
return new Location(world, x, y, z, yaw, pitch);
}
/**
* Convert a Location to XYZ Coordinates.
*
* @param l
* @return
*/
public String strCoords(Location l) {
String result = "";
result += "X: " + l.getBlockX() + " ";
result += "Y: " + l.getBlockY() + " ";
result += "Z: " + l.getBlockZ() + " ";
return result;
}
/**
* Return the NESW Direction a Location is facing.
*
* @param location
* @return
*/
public static String getDirection(Location location) {
double r = (location.getYaw() % 360) + 180;
// Remember, these numbers are every 45 degrees with a 22.5 offset, to detect boundaries.
String dir;
if (r < 22.5)
dir = "n";
else if (r < 67.5)
dir = "ne";
else if (r < 112.5)
dir = "e";
else if (r < 157.5)
dir = "se";
else if (r < 202.5)
dir = "s";
else if (r < 247.5)
dir = "sw";
else if (r < 292.5)
dir = "w";
else if (r < 337.5)
dir = "nw";
else
dir = "n";
return dir;
}
public static float getYaw(String orientation) {
if (orientation == null) {
return 0;
}
if (orientationInts.containsKey(orientation.toLowerCase())) {
return orientationInts.get(orientation.toLowerCase());
}
return 0;
}
public static float getSpeed(Vector v) {
return (float) Math.sqrt(v.getX() * v.getX() + v.getZ() * v.getZ());
}
// X, Y, Z
// -W/+E,0, -N/+S
public static Vector getTranslatedVector(Vector v, String direction) {
if (direction == null) {
return v;
}
float speed = getSpeed(v);
float halfSpeed = (float) (speed / 2.0);
// TODO: Mathmatacize this:
if (direction.equalsIgnoreCase("n")) {
return new Vector(0, 0, -1 * speed);
} else if (direction.equalsIgnoreCase("ne")) {
return new Vector(halfSpeed, 0, -1 * halfSpeed);
} else if (direction.equalsIgnoreCase("e")) {
return new Vector(speed, 0, 0);
} else if (direction.equalsIgnoreCase("se")) {
return new Vector(halfSpeed, 0, halfSpeed);
} else if (direction.equalsIgnoreCase("s")) {
return new Vector(0, 0, speed);
} else if (direction.equalsIgnoreCase("sw")) {
return new Vector(-1 * halfSpeed, 0, halfSpeed);
} else if (direction.equalsIgnoreCase("w")) {
return new Vector(-1 * speed, 0, 0);
} else if (direction.equalsIgnoreCase("nw")) {
return new Vector(-1 * halfSpeed, 0, -1 * halfSpeed);
}
return v;
}
/**
* Returns the next Location that an entity is traveling at
*
* @param v
* @return
*/
public static Location getNextBlock(Vehicle v) {
Vector vector = v.getVelocity();
Location location = v.getLocation();
int x = vector.getX() < 0 ? vector.getX() == 0 ? 0 : -1 : 1;
int z = vector.getZ() < 0 ? vector.getZ() == 0 ? 0 : -1 : 1;
return location.add(x, 0, z);
}
}
@@ -0,0 +1,19 @@
package com.onarandombox.utils;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public interface MVDestination {
public String getIdentifer();
public boolean isThisType(JavaPlugin plugin, String dest);
public Location getLocation(Entity e);
public boolean isValid();
public void setDestination(JavaPlugin plugin, String dest);
public String getType();
public String getName();
public String toString();
public String getRequiredPermission();
public Vector getVelocity();
}
@@ -0,0 +1,89 @@
package com.onarandombox.utils;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class PlayerDestination implements MVDestination {
String player;
private boolean isValid;
private JavaPlugin plugin;
@Override
public String getIdentifer() {
return "pl";
}
@Override
public boolean isThisType(JavaPlugin plugin, String dest) {
String[] items = dest.split(":");
if (items.length != 2) {
return false;
}
if (!items[0].equalsIgnoreCase("pl")) {
return false;
}
return true;
}
@Override
public Location getLocation(Entity e) {
Player p = plugin.getServer().getPlayer(this.player);
Player plLoc = null;
if (e instanceof Player) {
plLoc = (Player) e;
} else if (e.getPassenger() instanceof Player) {
plLoc = (Player) e.getPassenger();
}
if (p != null && plLoc != null && !plLoc.getName().equalsIgnoreCase(p.getName())) {
return p.getLocation();
}
return null;
}
@Override
public boolean isValid() {
return this.isValid;
}
@Override
public void setDestination(JavaPlugin plugin, String dest) {
String[] items = dest.split(":");
if (items.length != 2) {
this.isValid = false;
}
if (!items[0].equalsIgnoreCase("pl")) {
this.isValid = false;
}
this.isValid = true;
this.player = items[1];
this.plugin = plugin;
}
@Override
public String getType() {
return "Player";
}
@Override
public String getName() {
return this.player;
}
@Override
public String toString() {
return "pl:" + this.player;
}
@Override
public String getRequiredPermission() {
return "";
}
public Vector getVelocity() {
return new Vector(0,0,0);
}
}
@@ -0,0 +1,122 @@
package com.onarandombox.utils;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class PurgeWorlds {
MultiverseCore plugin;
public PurgeWorlds(MultiverseCore plugin) {
this.plugin = plugin;
}
/**
* Synchronizes the given world with it's settings
*/
public void purgeWorlds(CommandSender sender, List<MVWorld> worlds) {
if (worlds == null || worlds.isEmpty()) {
return;
}
for (MVWorld world : worlds) {
this.purgeWorld(sender, world);
}
}
/**
* Convince method for clearing all the animals that do not belong according to the config.
*
* @param sender
* @param world
*/
public void purgeWorld(CommandSender sender, MVWorld world) {
if (world == null) {
return;
}
ArrayList<String> allMobs = new ArrayList<String>(world.getAnimalList());
allMobs.addAll(world.getMonsterList());
purgeWorld(sender, world, allMobs, !world.allowAnimalSpawning(), !world.allowMonsterSpawning());
}
public void purgeWorld(CommandSender sender, MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters) {
if (mvworld == null) {
return;
}
World world = this.plugin.getServer().getWorld(mvworld.getName());
if (world == null) {
return;
}
int entitiesKilled = 0;
for (Entity e : world.getEntities()) {
// Check against Monsters
if (killMonster(mvworld, e, thingsToKill, negateMonsters)) {
entitiesKilled++;
continue;
}
// Check against Animals
if (this.killCreature(mvworld, e, thingsToKill, negateAnimals)) {
entitiesKilled++;
continue;
}
}
if (sender != null) {
sender.sendMessage(entitiesKilled + " entities purged from the world '" + world.getName() + "'");
}
}
private boolean killCreature(MVWorld mvworld, Entity e, List<String> creaturesToKill, boolean negate) {
String entityName = e.toString().replaceAll("Craft", "").toUpperCase();
if (e instanceof Squid || e instanceof Animals) {
if (creaturesToKill.contains(entityName) || creaturesToKill.contains("ALL") || creaturesToKill.contains("ANIMALS")) {
if (!negate) {
e.remove();
return true;
}
} else {
if (negate) {
e.remove();
return true;
}
}
}
return false;
}
/**
* Will kill the monster if it's in the list UNLESS the NEGATE boolean is set, then it will kill it if it's NOT
*
* @param mvworld
* @param e
* @param creaturesToKill
* @param negate
* @return
*/
private boolean killMonster(MVWorld mvworld, Entity e, List<String> creaturesToKill, boolean negate) {
String entityName = e.toString().replaceAll("Craft", "").toUpperCase();
if (e instanceof Slime || e instanceof Monster || e instanceof Ghast) {
if (creaturesToKill.contains(entityName) || creaturesToKill.contains("ALL") || creaturesToKill.contains("MONSTERS")) {
if (!negate) {
e.remove();
return true;
}
} else {
if (negate) {
e.remove();
return true;
}
}
}
return false;
}
}
@@ -0,0 +1,99 @@
package com.onarandombox.utils;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Logger;
import java.util.regex.Pattern;
public class UpdateChecker {
public static final Logger log = Logger.getLogger("Minecraft");
public Timer timer = new Timer(); // Create a new Timer.
private String name; // Hold the Plugins Name.
private String cversion; // Hold the Plugins Current Version.
public UpdateChecker(String name, String version) {
this.name = name;
this.cversion = version;
int delay = 0; // No Delay, fire the first check instantly.
int period = 1800; // Delay 30 Minutes
this.timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
checkUpdate();
}
}, delay * 1000, period * 1000);
}
public void checkUpdate() {
try {
URL url = new URL("http://bukkit.onarandombox.com/multiverse/version.php?n=" + URLEncoder.encode(this.name, "UTF-8") + "&v=" + this.cversion);
URLConnection conn = url.openConnection();
conn.setReadTimeout(2000); // 2000 = 2 Seconds.
int code = ((HttpURLConnection) conn).getResponseCode();
if (code != 200) {
return;
}
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String version = null;
while ((line = rd.readLine()) != null) {
if (version == null) {
version = line;
}
}
if (version == null) {
rd.close();
return;
}
String v1 = normalisedVersion(version);
String v2 = normalisedVersion(this.cversion);
int compare = v1.compareTo(v2);
if (compare > 0) {
log.info("[" + this.name + "]" + " - Update Available (" + version + ")");
}
rd.close();
} catch (Exception e) {
// No need to alert the user of any error here... it's not important.
}
}
/**
* Convert the given Version String to a Normalised Version String so we can compare it.
*
* @param version
* @return
*/
public static String normalisedVersion(String version) {
return normalisedVersion(version, ".", 4);
}
public static String normalisedVersion(String version, String sep, int maxWidth) {
String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version);
StringBuilder sb = new StringBuilder();
for (String s : split) {
sb.append(String.format("%" + maxWidth + 's', s));
}
return sb.toString();
}
}
@@ -0,0 +1,112 @@
package com.onarandombox.utils;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class WorldDestination implements MVDestination {
private boolean isValid;
private MVWorld world;
float yaw = -1;
String direction = "";
@Override
public String getIdentifer() {
return "w";
}
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
String[] items = destination.split(":");
if (items.length > 3) {
return false;
}
if (items.length == 1 && ((MultiverseCore) plugin).isMVWorld(items[0])) {
// This case is: world
return true;
}
if (items.length == 2 && ((MultiverseCore) plugin).isMVWorld(items[0])) {
// This case is: world:n
return true;
} else if (items[0].equalsIgnoreCase("w") && ((MultiverseCore) plugin).isMVWorld(items[1])) {
// This case is: w:world
// and w:world:ne
return true;
}
return false;
}
@Override
public Location getLocation(Entity e) {
Location spawnLoc = this.world.getCBWorld().getSpawnLocation();
if (this.yaw >= 0) {
// Only modify the yaw if its set.
spawnLoc.setYaw(this.yaw);
}
spawnLoc.add(.5, 0, .5);
return spawnLoc;
}
@Override
public boolean isValid() {
return this.isValid;
}
@Override
public void setDestination(JavaPlugin plugin, String dest) {
String[] items = dest.split(":");
if (items.length > 3) {
isValid = false;
return;
}
if (items.length == 1 && ((MultiverseCore) plugin).isMVWorld(items[0])) {
isValid = true;
this.world = ((MultiverseCore) plugin).getMVWorld(items[0]);
return;
}
if (items.length == 2 && ((MultiverseCore) plugin).isMVWorld(items[0])) {
this.world = ((MultiverseCore) plugin).getMVWorld(items[0]);
this.yaw = LocationManipulation.getYaw(items[1]);
return;
}
if (items[0].equalsIgnoreCase("w") && ((MultiverseCore) plugin).isMVWorld(items[1])) {
this.world = ((MultiverseCore) plugin).getMVWorld(items[1]);
isValid = true;
if (items.length == 3) {
this.yaw = LocationManipulation.getYaw(items[2]);
}
}
}
@Override
public String getType() {
return "World";
}
@Override
public String getName() {
return this.world.getColoredWorldString();
}
@Override
public String toString() {
if(direction.length() > 0 && yaw >= 0) {
return this.world.getCBWorld().getName() + ":"+this.direction;
}
return this.world.getCBWorld().getName();
}
@Override
public String getRequiredPermission() {
return "multiverse.access."+this.world.getName();
}
public Vector getVelocity() {
return new Vector(0,0,0);
}
}
+35
View File
@@ -0,0 +1,35 @@
# !!!This only applies to worlds being handled by Multiverse!!!
# If you don't see it using /mvlist this setting WILL HAVE NO EFFECT
# How long to leave in between sending a message to the player. (NOT YET IMPLEMENTED)
# In Milliseconds - Default is '5000' which is 5 Seconds.
messagecooldown: 5000
# How fast are people allowed to use /MVTP (NOT YET IMPLEMENTED)
# In Milliseconds - Default is '5000' which is 5 Seconds.
teleportcooldown: 5000
# If this is set to true, we will prefix the chat with
# a colorful world alias if it's present. If not, we simply
# show the world's name in white. If this is false Multiverse
# won't touch your chat
worldnameprefix: true
# If Multiverse does not find permissions should it automatically fall back to
# people defined in ops.txt? Remember, if you use ops based permissions
# the awesome Multiverse devs get to decide which commands require op!
# (Which is why we highly recommend a permissions plugin! You shouldn't trust us this much...)
opfallback: true
# If you have a world(s) that has monsters = false, and you want to disable the built
# in autohealing, set this to true. This will have NO EFFECT if monsters = true for a given world.
disableautoheal: false
# This will use the old style of PVP prevention so you can have zones of PVP
# Players will be notified when they punch/shoot and it's not allowed.
fakepvp: false
# This just signifies the version number so we can see what version of config you have.
# NEVER TOUCH THIS VALUE
version: 2.1
+44
View File
@@ -0,0 +1,44 @@
worlds:
#############################################
### - Examples & Explanation of Settings- ###
#############################################
##worlds:
## default: ## This world is called 'default'
## environment: NORMAL ## Created with a NORMAL environment.
## animals:
## spawn: true ## We want animals to Spawn.
## exceptions: ## We want all animals to spawn so we won't make any exceptions.
## monsters:
## spawn: true ## We want monsters to Spawn.
## exceptions: 'CREEPER' ## But we don't want Creepers to spawn as they destroy peoples homes and valuables.
## pvp: true ## We wan't PVP to be enabled so players can fight each other.
## worldBlacklist: '' ## We are not blacklisting any worlds so this allows Players to teleport to this world from all other worlds.
## playerBlacklist: '' ## We are not blacklisting any players or groups so anyone can enter this world.
## playerWhitelist: '' ## Because we have not blacklisted anyone we do not have to Whitelist someone.
##
## creative: ## This world is called 'creative'
## environment: NORMAL ## Created with a NORMAL environment.
## animals:
## spawn: true ## We want animals to spawn.
## exceptions: ## We want all animals to spawn so we won't make any exceptions.
## monsters:
## spawn: false ## We don't want monsters to Spawn because this is a Creative World.
## enforced: true ## We want to enforce this rule, this means any Monster that was alive during world load/creation will be removed. No monsters can inhabit this world.
## exceptions: ## We don't want to make any exceptions to this.
## pvp: false ## We want to disable PVP because this world is for creativeness only.
## worldBlacklist: '' ## We are not blacklisting any worlds so this allows Players to teleport to this world from all other worlds.
## playerBlacklist: 'g:Griefers' ## We don't want to allow the group 'Griefers' into the World.
## playerWhitelist: 'g:Artists' ## We want to allow the group 'Artists' to enter this World.
##
## nether: ## This world is called 'nether'
## environment: NETHER ## Created with a NETHER environment.
## animals:
## spawn: true ## We want animals to spawn.
## monsters:
## spawn: true ## We want monsters to spawn.
## pvp: true ## We want to enable PVP on this World.
## worldBlacklist: '' ## We are not blacklisting any worlds so this allows Players to teleport to this world from all other worlds.
## playerBlacklist: '' ## We are not blacklisting any players or groups so anyone can enter this world.
## playerWhitelist: '' ## Because we have not blacklisted anyone we do not have to Whitelist someone.
+184
View File
@@ -0,0 +1,184 @@
name: Multiverse-Core
main: com.onarandombox.MultiverseCore.MultiverseCore
authors: ['Rigby', 'fernferret']
version: maven-version-number
commands:
mv:
description: Generic Multiverse Command
usage: /<command>
mvcreate:
description: World create command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
mvc:
description: World create command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
mvimport:
description: World import command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
mvim:
description: World import command
usage: |
/<command> <world> <environment>
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
mvremove:
description: World remove command
usage: |
/<command> <world>
mvdelete:
description: World delete command
usage: |
/<command> <world>
mvunload:
description: World unload command
usage: |
/<command> <world>
mvmodify:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmset:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmadd:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmremove:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvmclear:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvm:
description: Modify the settings of an existing world
usage: |
/<command> <world> <option>:<value>
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
mvtp:
description: Command to teleport between Worlds
usage: |
/<command> <world>[:spawn]
Example: /<command> creative - Teleports you to the relevant location in the 'creative' world.
Example: /<command> creative:spawn - Teleports you to the spawn of the 'creative' world.
mvlist:
description: Print list of loaded Worlds
usage: |
/<command> [environment]
Example: /<command> NETHER - Shows all NETHER Worlds.
Example: /<command> NORMAL - Shows all NORMAL Worlds.
mvl:
description: Print list of loaded Worlds
usage: |
/<command> [environment]
Example: /<command> NETHER - Shows all NETHER Worlds.
Example: /<command> NORMAL - Shows all NORMAL Worlds.
mvsetspawn:
description: Set the spawn area for a particular world
usage: /<command> -- Sets the spawn area of the current world to your location.
mvset:
description: Set the spawn area for a particular world
usage: /<command> -- Sets the spawn area of the current world to your location.
mvss:
description: Set the spawn area for a particular world
usage: /<command> -- Sets the spawn area of the current world to your location.
mvspawn:
description: Teleport to the spawn area
usage: /<command> -- Teleports you to the spawn area of your current world.
mvs:
description: Teleport to the spawn area
usage: /<command> -- Teleports you to the spawn area of your current world.
mvcoord:
description: Display World, Coordinates, Direction & Compression for a world.
usage: |
/<command> [world]
/<command> -- Shows the relevant coordinates in your current world.
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
mvc:
description: Display World, Coordinates, Direction & Compression for a world.
usage: |
/<command> [world]
/<command> -- Shows the relevant coordinates in your current world.
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
mvwho:
description: Display online users per world.
usage: |
/<command> [world]
/<command> -- Shows who is online in each world.
/<command> creative -- Shows who is online in the 'creative' world.
mvw:
description: Display online users per world.
usage: |
/<command> [world]
/<command> -- Shows who is online in each world.
/<command> creative -- Shows who is online in the 'creative' world.
mvreload:
description: Reload Configuration files.
usage: /<command>
mvr:
description: Reload Configuration files.
usage: /<command>
mvpurge:
description: Purge the targetted world of creatures.
usage: |
/<command> [world] [creatures]
/<command> -- Purges the players world of all creatures.
/<command> creative * -- Purges the creative world of all Creatures.
/<command> creative creeper -- Purges the creative world of all CREEPERS.
mvconfirm:
description: Confirms sensitive decisions like deleting a world.
usage: |
/<command>
mvinfo:
description: Gets world info.
usage: |
/<command> [world]
mvi:
description: Gets world info.
usage: |
/<command> [world]
mvenv:
description: Tells the user all possible world types.
usage: |
/<command>
mvv:
description: Prints out version invo.
usage: |
/<command>
mvversion:
description: Prints out version invo.
usage: |
/<command>
mvco:
description: Prints out version invo.
usage: |
/<command>
mvh:
description: Prints out version invo.
usage: |
/<command>
mvsearch:
description: Prints out version invo.
usage: |
/<command>
mvhelp:
description: Prints out version invo.
usage: |
/<command>
-226
View File
@@ -1,226 +0,0 @@
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
body {
font-size: 13px;
line-height: 1.5;
font-family: 'Helvetica Neue', Helvetica, Arial, serif;
color: #000;
}
a {
color: #d5000d;
font-weight: bold;
}
header {
padding-top: 35px;
padding-bottom: 10px;
}
header h1 {
font-weight: bold;
letter-spacing: -1px;
font-size: 48px;
color: #303030;
line-height: 1.2;
}
header h2 {
letter-spacing: -1px;
font-size: 24px;
color: #aaa;
font-weight: normal;
line-height: 1.3;
}
#downloads {
display: none;
}
#main_content {
padding-top: 20px;
}
code, pre {
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal;
color: #222;
margin-bottom: 30px;
font-size: 12px;
}
code {
padding: 0 3px;
}
pre {
border: solid 1px #ddd;
padding: 20px;
overflow: auto;
}
pre code {
padding: 0;
}
ul, ol, dl {
margin-bottom: 20px;
}
/* COMMON STYLES */
table {
width: 100%;
border: 1px solid #ebebeb;
}
th {
font-weight: 500;
}
td {
border: 1px solid #ebebeb;
text-align: center;
font-weight: 300;
}
form {
background: #f2f2f2;
padding: 20px;
}
/* GENERAL ELEMENT TYPE STYLES */
h1 {
font-size: 2.8em;
}
h2 {
font-size: 22px;
font-weight: bold;
color: #303030;
margin-bottom: 8px;
}
h3 {
color: #d5000d;
font-size: 18px;
font-weight: bold;
margin-bottom: 8px;
}
h4 {
font-size: 16px;
color: #303030;
font-weight: bold;
}
h5 {
font-size: 1em;
color: #303030;
}
h6 {
font-size: .8em;
color: #303030;
}
p {
font-weight: 300;
margin-bottom: 20px;
}
a {
text-decoration: none;
}
p a {
font-weight: 400;
}
blockquote {
font-size: 1.6em;
border-left: 10px solid #e9e9e9;
margin-bottom: 20px;
padding: 0 0 0 30px;
}
ul li {
list-style: disc inside;
padding-left: 20px;
}
ol li {
list-style: decimal inside;
padding-left: 3px;
}
dl dd {
font-style: italic;
font-weight: 100;
}
footer {
margin-top: 40px;
padding-top: 20px;
padding-bottom: 30px;
font-size: 13px;
color: #aaa;
}
footer a {
color: #666;
}
/* MISC */
.clearfix:after {
clear: both;
content: '.';
display: block;
visibility: hidden;
height: 0;
}
.clearfix {display: inline-block;}
* html .clearfix {height: 1%;}
.clearfix {display: block;}
-69
View File
@@ -1,69 +0,0 @@
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kn { font-weight: bold } /* Keyword.Namespace */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
.type-csharp .highlight .k { color: #0000FF }
.type-csharp .highlight .kt { color: #0000FF }
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
.type-csharp .highlight .nc { color: #2B91AF }
.type-csharp .highlight .nn { color: #000000 }
.type-csharp .highlight .s { color: #A31515 }
.type-csharp .highlight .sc { color: #A31515 }
-371
View File
@@ -1,371 +0,0 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* LAYOUT STYLES */
body {
font-size: 1em;
line-height: 1.5;
background: #e7e7e7 url(../images/body-bg.png) 0 0 repeat;
font-family: 'Helvetica Neue', Helvetica, Arial, serif;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
color: #6d6d6d;
}
a {
color: #d5000d;
}
a:hover {
color: #c5000c;
}
header {
padding-top: 35px;
padding-bottom: 25px;
}
header h1 {
font-family: 'Chivo', 'Helvetica Neue', Helvetica, Arial, serif; font-weight: 900;
letter-spacing: -1px;
font-size: 48px;
color: #303030;
line-height: 1.2;
}
header h2 {
letter-spacing: -1px;
font-size: 24px;
color: #aaa;
font-weight: normal;
line-height: 1.3;
}
#container {
background: transparent url(../images/highlight-bg.jpg) 50% 0 no-repeat;
min-height: 595px;
}
.inner {
width: 620px;
margin: 0 auto;
}
#container .inner img {
max-width: 100%;
}
#downloads {
margin-bottom: 40px;
}
a.button {
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
border-radius: 30px;
border-top: solid 1px #cbcbcb;
border-left: solid 1px #b7b7b7;
border-right: solid 1px #b7b7b7;
border-bottom: solid 1px #b3b3b3;
color: #303030;
line-height: 25px;
font-weight: bold;
font-size: 15px;
padding: 12px 8px 12px 8px;
display: block;
float: left;
width: 179px;
margin-right: 14px;
background: #fdfdfd; /* Old browsers */
background: -moz-linear-gradient(top, #fdfdfd 0%, #f2f2f2 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fdfdfd), color-stop(100%,#f2f2f2)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fdfdfd 0%,#f2f2f2 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fdfdfd 0%,#f2f2f2 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #fdfdfd 0%,#f2f2f2 100%); /* IE10+ */
background: linear-gradient(top, #fdfdfd 0%,#f2f2f2 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fdfdfd', endColorstr='#f2f2f2',GradientType=0 ); /* IE6-9 */
-webkit-box-shadow: 10px 10px 5px #888;
-moz-box-shadow: 10px 10px 5px #888;
box-shadow: 0px 1px 5px #e8e8e8;
}
a.button:hover {
border-top: solid 1px #b7b7b7;
border-left: solid 1px #b3b3b3;
border-right: solid 1px #b3b3b3;
border-bottom: solid 1px #b3b3b3;
background: #fafafa; /* Old browsers */
background: -moz-linear-gradient(top, #fdfdfd 0%, #f6f6f6 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fdfdfd), color-stop(100%,#f6f6f6)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fdfdfd 0%,#f6f6f6 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fdfdfd 0%,#f6f6f6 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #fdfdfd 0%,#f6f6f6 100%); /* IE10+ */
background: linear-gradient(top, #fdfdfd 0%,#f6f6f6, 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fdfdfd', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
}
a.button span {
padding-left: 50px;
display: block;
height: 23px;
}
#download-zip span {
background: transparent url(../images/zip-icon.png) 12px 50% no-repeat;
}
#download-tar-gz span {
background: transparent url(../images/tar-gz-icon.png) 12px 50% no-repeat;
}
#view-on-github span {
background: transparent url(../images/octocat-icon.png) 12px 50% no-repeat;
}
#view-on-github {
margin-right: 0;
}
code, pre {
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal;
color: #222;
margin-bottom: 30px;
font-size: 14px;
}
code {
background-color: #f2f2f2;
border: solid 1px #ddd;
padding: 0 3px;
}
pre {
padding: 20px;
background: #303030;
color: #f2f2f2;
text-shadow: none;
overflow: auto;
}
pre code {
color: #f2f2f2;
background-color: #303030;
border: none;
padding: 0;
}
ul, ol, dl {
margin-bottom: 20px;
}
/* COMMON STYLES */
hr {
height: 1px;
line-height: 1px;
margin-top: 1em;
padding-bottom: 1em;
border: none;
background: transparent url('../images/hr.png') 50% 0 no-repeat;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
table {
width: 100%;
border: 1px solid #ebebeb;
}
th {
font-weight: 500;
}
td {
border: 1px solid #ebebeb;
text-align: center;
font-weight: 300;
}
form {
background: #f2f2f2;
padding: 20px;
}
/* GENERAL ELEMENT TYPE STYLES */
h1 {
font-size: 32px;
}
h2 {
font-size: 22px;
font-weight: bold;
color: #303030;
margin-bottom: 8px;
}
h3 {
color: #d5000d;
font-size: 18px;
font-weight: bold;
margin-bottom: 8px;
}
h4 {
font-size: 16px;
color: #303030;
font-weight: bold;
}
h5 {
font-size: 1em;
color: #303030;
}
h6 {
font-size: .8em;
color: #303030;
}
p {
font-weight: 300;
margin-bottom: 20px;
}
a {
text-decoration: none;
}
p a {
font-weight: 400;
}
blockquote {
font-size: 1.6em;
border-left: 10px solid #e9e9e9;
margin-bottom: 20px;
padding: 0 0 0 30px;
}
ul li {
list-style: disc inside;
padding-left: 20px;
}
ol li {
list-style: decimal inside;
padding-left: 3px;
}
dl dt {
color: #303030;
}
footer {
background: transparent url('../images/hr.png') 0 0 no-repeat;
margin-top: 40px;
padding-top: 20px;
padding-bottom: 30px;
font-size: 13px;
color: #aaa;
}
footer a {
color: #666;
}
footer a:hover {
color: #444;
}
/* MISC */
.clearfix:after {
clear: both;
content: '.';
display: block;
visibility: hidden;
height: 0;
}
.clearfix {display: inline-block;}
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* #Media Queries
================================================== */
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) {}
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {}
/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 767px) {
header {
padding-top: 10px;
padding-bottom: 10px;
}
#downloads {
margin-bottom: 25px;
}
#download-zip, #download-tar-gz {
display: none;
}
.inner {
width: 94%;
margin: 0 auto;
}
}
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) {}
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@media only screen and (max-width: 479px) {}