Compare commits

..
815 Commits
Author SHA1 Message Date
main() d65cc8215c Testing... 2012-05-03 17:05:17 +02:00
main() c6feb127de Rewritten for SerializationConfig
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/MVWorld.java
	src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java
2012-05-03 16:47:11 +02:00
main() 21a3eeacc8 That's the way it should be. 2012-05-03 16:20:59 +02:00
main() 48768b5d6c Now all properties are settable ingame. (bugfix) 2012-05-02 16:25:40 +02:00
main() 96294c092c Wrong default value... 2012-05-01 19:10:51 +02:00
main() 9a3fde2f13 Saving keepSpawnInMemory to config file 2012-05-01 19:08:07 +02:00
main() 6520a31938 Fixed spawnlocation migration 2012-05-01 18:52:05 +02:00
main() f1779c9e68 Shame on me. -.- 2012-05-01 18:46:47 +02:00
main() 9cc35d7b12 public 2012-05-01 18:08:51 +02:00
main() 02347e05d8 Fixed UOE when temporarily saving the NullLocation to the config 2012-05-01 17:43:05 +02:00
main() a4196a901a Fixed spawn location loading 2012-05-01 17:00:05 +02:00
main() 9b2dd0d6c9 Forgot some values, fixed allowweather migration 2012-05-01 16:49:40 +02:00
Jeremy Wood 0efb28be19 Properly close all input/output streams! 2012-05-01 10:47:20 -04:00
main() 5d9941d073 Why is 'null' deserialized to "null" instead of null!? 2012-05-01 15:31:10 +02:00
main() 82cfbaba4e Fixed NPE in migrateWorldConfigs() 2012-05-01 12:48:45 +02:00
main() 9868c66cdb Added migrators. Needs testing. 2012-05-01 12:42:48 +02:00
main() 3a32857683 MethodLength deserves only a warning and why should we count empty lines!? 2012-05-01 12:42:01 +02:00
main() d7a3e1839e Should fix environment, seed and generator-issues. 2012-05-01 12:23:04 +02:00
main() 1496d940bf Merge pull request #547 from Multiverse/mvworld-plus-serializationconfig-equals-awesome
MVWorld + SerializationConfig = Awesome
2012-04-30 13:54:37 -07:00
main() 77480915a1 Merge branch 'master' of github.com:Multiverse/Multiverse-Core into allow-flight 2012-04-30 14:31:06 +02:00
Jeremy Wood bd57ec19d2 Now building against Bukkit 1.2.5-R1.0 2012-04-18 14:58:05 -03:00
Jeremy Wood da54f9769b Stop giving up immediately on the first failed file deletion and continue deleting files recursively. 2012-04-06 14:54:48 -04:00
Jeremy Wood 2e4b814d6d Added one extra tidbit of logging for GameMode enforcement. 2012-04-03 12:00:02 -04:00
Eric Stokes 3f93fb3648 Add new param to the PTPE, Don't die if we don't find or can't access bukkit.yml 2012-03-18 17:26:24 -06:00
main() 176e729a87 Ignoring TestWorldCreation.
TestInstanceCreator.tearDown() doesn't remove 'fish.world' correctly from the worlds.yml (fixed in mvworld-plus-serializationconfig-equals-awesome)
*cough* @FernFerret *cough*
2012-03-17 12:32:55 +01:00
main() 62f79e7592 Disabled Spout support because we aren't using it 2012-03-17 12:27:50 +01:00
main() f60f770b98 Fixed #578
Another iPhone-commit...
2012-03-16 07:33:35 +01:00
Eric Stokes 3c434d18e3 Bump AllPay Version 2012-03-13 22:24:49 -06:00
Eric Stokes c9b52c81a6 Add some neat debug to Permissions 2012-03-12 20:58:58 -06:00
Eric Stokes 5be6ea2766 Use the fromstring in entity type 2012-03-10 10:29:44 -07:00
main() 98f5e1e4ee This IS fixed! 2012-03-10 17:41:53 +01:00
main() de6fc6481e Merge branch 'master' into mvworld-plus-serializationconfig-equals-awesome
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java
2012-03-10 14:03:04 +01:00
main() dcc6b828a8 Unused imports. 2012-03-10 13:59:04 +01:00
Eric Stokes 7da91f7875 Fix NPE with players and purging, Update AP and CH 2012-03-10 00:32:26 -07:00
Eric Stokes d84f930a54 Fix purging removing the player entity
...and lots of other bad stuff...
2012-03-09 23:45:10 -07:00
main() bdd5e8bd91 Now shortening the URL in /mvv using bit.ly! 2012-03-08 17:59:25 +01:00
main() d1280a9031 Some fixes + added tests. 2012-03-07 19:59:20 +01:00
main() 08b8f01c44 Bugfix: We shouldn't check access-perms if enforceaccess is off! 2012-03-04 20:38:26 +01:00
main() fd227960b9 Now correctly saving worlds 2012-03-04 20:21:42 +01:00
main() 0efc0b965b Fixed removeWorldFromConfig(String). 2012-03-04 19:53:40 +01:00
main() bbe134bd1a Dots in world-names are now possible! :D 2012-03-04 19:36:14 +01:00
main() 91f7debb08 MVWorld + SerializationConfig = Awesome
Yes, I did it.
2012-03-04 16:08:09 +01:00
main() 871a601e37 General cleanup. 2012-03-03 17:07:07 +01:00
main() bd7ad20b7b Fixed the tests.
Why is this option even on by default...
2012-03-02 21:22:12 +01:00
main() 873d878252 Build fixed. Bukkit, I hate breaking changes!
However, this is not tested *at all*. Try it if you're brave enough ^^
2012-03-01 16:55:37 +01:00
main() 8c63cac4c5 I'm walking...
(Yes, I'm doing this on my iPhone)
Should fix #530.
2012-03-01 13:12:09 +01:00
main() c233b74c98 Merge branch 'master' into allow-flight
Conflicts:
	src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java
2012-02-26 16:50:02 +01:00
main() 283913010f Now using SerializationConfig v1.3 2012-02-26 16:45:23 +01:00
main() 109582335b Missing javadoc. 2012-02-25 14:59:33 +01:00
main() 3f09fbd710 Fixed the world-purger using the names from the new EntiyType-enum.
Closes #478.
Should fix #482.
Poor sheep.
2012-02-25 14:48:36 +01:00
main() ccb96ead10 Nasty bugs are nasty. 2012-02-25 13:11:21 +01:00
Eric Stokes 5c48899d92 Add initial support for enforcing access better 2012-02-23 20:15:10 -07:00
Eric Stokes 5f5d7084fa Add **much** better mv check command 2012-02-22 20:22:37 -07:00
Eric Stokes 7b9c26d40a Cleanup logging a bit, state when core is allowing players to access 2012-02-21 17:45:29 -07:00
Eric Stokes 0c96da48f9 Allow Spawner eggs to override settings 2012-02-21 16:58:36 -07:00
Eric Stokes fbbe031b2c Fix for method deprecations in R5 2012-02-21 05:25:59 -07:00
main() 868ac57a4a Removed TODOs in deprecated classes. There's nothing left to be done there. 2012-02-06 19:25:34 +01:00
main() 7c21a114db Fixed a bug in the info-command.
Information about the player's current world was shown when he entered an invalid world-name.
2012-02-06 17:19:51 +01:00
main() e7573d3bd7 Rewrote the who-command. Fixes #467. 2012-02-06 17:19:50 +01:00
main() 772d5a222d Unused import... 2012-02-06 17:19:44 +01:00
Eric Stokes 9eaca3e093 Bump to 2.4 2012-02-05 21:57:31 -07:00
Eric Stokes 2eb61af76f Remove Structures and Types from import
Fixes #466
2012-02-05 20:32:09 -07:00
Eric Stokes ad9d4e41ff Remove EGG, that's for chickens, silly. 2012-02-05 00:10:36 -07:00
Eric Stokes 6a2e0e5810 Fix Portals being blocked in End
This Fixes #463
This is caused by a bug in Bukkit/Bukkit@b2364780cb see line 38 of EntityCreatePortalEvent
2012-02-04 23:46:40 -07:00
Eric Stokes a9c6582487 Fix bypass perms. Fixes #443
I had a typo and didn't add the parent perms :(

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

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

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

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

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

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

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

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

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

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

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

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

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

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
# Eclipse stuff
/.classpath
/.project
/.settings
/.checkstyle
# netbeans
/nbproject
# we use maven!
/build.xml
# maven
/target
# vim
.*.sw[a-p]
# various other potential build files
/build
/bin
/dist
/manifest.mf
/world
# Mac filesystem dust
*.DS_Store
# intellij
*.iml
*.ipr
*.iws
.idea/
# Fern's utils
uploadtoserver.sh
# Testing files:
debug.log
# Doxygen
/docs/html
debug.txt
+15
View File
@@ -0,0 +1,15 @@
Building
========
Simply build the source with maven:
$ mvn install
More details are available on the [build instructions wiki page](https://github.com/Multiverse/Multiverse-Core/wiki/Building).
License
=======
Copyright (c) 2011, The Multiverse Team All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the The Multiverse Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+1813
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+143
View File
@@ -0,0 +1,143 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Multiverse 2 Copyright (c) the Multiverse Team 2011. ~
~ Multiverse 2 is licensed under the BSD License. ~
~ For more information please check the README.md file included ~
~ with this project. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!-- Future reference: valid severity values are 'ignore', 'info', 'warning', 'error' -->
<module name="Checker">
<module name="JavadocPackage">
<property name="allowLegacy" value="true"/>
</module>
<module name="NewlineAtEndOfFile" />
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline">
<property name="message" value="Line has trailing spaces."/>
<property name="format" value="\s+$"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
</module>
<module name="TreeWalker">
<!-- Make suppression possible -->
<module name="FileContentsHolder"/>
<!-- Actual checks -->
<module name="LineLength">
<property name="max" value="160"/>
<property name="severity" value="warning"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="package"/><!-- We don't need javadoc for private methods -->
<property name="tokens" value="METHOD_DEF"/><!-- We don't need javadoc for constructors -->
</module>
<module name="JavadocType"/>
<module name="JavadocVariable">
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
</module>
<module name="JavadocStyle"/>
<module name="WriteTag">
<property name="tag" value="@author"/>
<property name="tagFormat" value="\S"/>
<property name="severity" value="ignore"/>
<property name="tagSeverity" value="warning"/>
</module>
<module name="ConstantName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
<property name="excludes" value="com.onarandombox.MultiverseCore.utils,com.onarandombox.MultiverseCore.configuration,com.onarandombox.MultiverseCore.commands,com.onarandombox.MultiverseCore.destination"/>
</module>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<module name="MethodLength">
<property name="severity" value="warning"/>
<property name="countEmpty" value="false"/>
</module>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter">
<property name="severity" value="warning"/>
</module>
<module name="WhitespaceAround">
<property name="severity" value="warning"/>
</module>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Don't like errors for `final` missing
<module name="DesignForExtension"/>
<module name="FinalClass"/>
-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>
<module name="ArrayTypeStyle"/>
<!-- Don't like errors for `final` missing
<module name="FinalParameters"/>
-->
<module name="TodoComment">
<property name="severity" value="info"/>
</module>
<module name="UpperEll"/>
<module name="Indentation"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
</module>
</module>
View File
Whitespace-only changes.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

-71
View File
@@ -1,71 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link href='https://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>Multiverse-Core by Multiverse</title>
</head>
<body>
<div id="container">
<div class="inner">
<header>
<h1>Multiverse-core</h1>
<h2>The original Bukkit Multi-World Plugin! </h2>
</header>
<section id="downloads" class="clearfix">
<a href="https://github.com/Multiverse/Multiverse-Core/zipball/master" id="download-zip" class="button"><span>Download .zip</span></a>
<a href="https://github.com/Multiverse/Multiverse-Core/tarball/master" id="download-tar-gz" class="button"><span>Download .tar.gz</span></a>
<a href="https://github.com/Multiverse/Multiverse-Core" id="view-on-github" class="button"><span>View on GitHub</span></a>
</section>
<hr>
<section id="main_content">
<h3>Welcome to GitHub Pages.</h3>
<p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:</p>
<pre><code>$ cd your_repo_root/repo_name
$ git fetch origin
$ git checkout gh-pages
</code></pre>
<p>If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.</p>
<h3>Designer Templates</h3>
<p>We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.</p>
<h3>Rather Drive Stick?</h3>
<p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
<h3>Authors and Contributors</h3>
<p>You can <a href="https://github.com/blog/821" class="user-mention">@mention</a> a GitHub username to generate a link to their profile. The resulting <code>&lt;a&gt;</code> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
<h3>Support or Contact</h3>
<p>Having trouble with Pages? Check out the documentation at <a href="http://help.github.com/pages">http://help.github.com/pages</a> or contact <a href="mailto:support@github.com">support@github.com</a> and we’ll help you sort it out.</p>
</section>
<footer>
Multiverse-core is maintained by <a href="https://github.com/Multiverse">Multiverse</a><br>
This page was generated by <a href="http://pages.github.com">GitHub Pages</a>. Tactile theme by <a href="http://twitter.com/jasonlong">Jason Long</a>.
</footer>
</div>
</div>
</body>
</html>
-1
View File
@@ -1 +0,0 @@
console.log('This would be the main JS file.');
-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"}
+265
View File
@@ -0,0 +1,265 @@
<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.4</version>
<name>Multiverse-Core</name>
<description>World Management Plugin</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>UNKNOWN</project.build.number>
</properties>
<repositories>
<repository>
<id>onarandombox</id>
<url>http://repo.onarandombox.com/content/groups/public</url>
</repository>
<repository>
<id>Bukkit Official</id>
<url>http://repo.bukkit.org/content/repositories/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<ciManagement>
<system>jenkins</system>
<url>http://ci.onarandombox.com</url>
</ciManagement>
<!-- Profiles are used to detect whether this is a local or Jenkins build
and adjust the build number accordingly -->
<profiles>
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<project.build.number>${env.BUILD_NUMBER}</project.build.number>
</properties>
</profile>
</profiles>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.3.8</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}-b${project.build.number}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<!-- Jar Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifestEntries>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- Maven Source Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<excludes>
<exclude>**/TestCommandSender.java</exclude>
<exclude>**/TestInstanceCreator.java</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.11</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
<configuration>
<enableRulesSummary>true</enableRulesSummary>
<configLocation>${project.basedir}/config/mv_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>me.main__.util:SerializationConfig</include>
<include>com.fernferret.allpay:AllPay</include>
<include>com.pneumaticraft.commandhandler:CommandHandler</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.fernferret.allpay</pattern>
<shadedPattern>com.fernferret.allpay.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>me.main__.util</pattern>
<shadedPattern>me.main__.util.multiverse</shadedPattern>
</relocation>
<relocation>
<pattern>com.pneumaticraft.commandhandler</pattern>
<shadedPattern>com.pneumaticraft.commandhandler.multiverse</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Bukkit Dependency -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.2.5-R1.0</version>
<!-- If you want the lates, use this -->
<!-- <version>LATEST</version> -->
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Bukkit Dependency -->
<!-- Start of Spout (disabled because we aren't using it)
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutpluginapi</artifactId>
<version>dev-SNAPSHOT</version>
</dependency>
End of Spout -->
<!-- SerializationConfig Dependency -->
<dependency>
<groupId>me.main__.util</groupId>
<artifactId>SerializationConfig</artifactId>
<version>1.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of SerializationConfig Dependency -->
<!-- Start of AllPay Dependency -->
<dependency>
<groupId>com.fernferret.allpay</groupId>
<artifactId>AllPay</artifactId>
<version>10</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of AllPay Dependency -->
<!-- Start of CommandHandler Dependency -->
<dependency>
<groupId>com.pneumaticraft.commandhandler</groupId>
<artifactId>CommandHandler</artifactId>
<version>7</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End of CommandHandler Dependency -->
<!-- Start of Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<version>1.4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.4.9</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<!-- End of Test Dependencies -->
</dependencies>
<distributionManagement>
<repository>
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/content/repositories/multiverse</url>
</repository>
</distributionManagement>
</project>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,257 @@
package com.onarandombox.MultiverseCore;
import java.util.Map;
import com.onarandombox.MultiverseCore.api.MultiverseCoreConfig;
import me.main__.util.SerializationConfig.NoSuchPropertyException;
import me.main__.util.SerializationConfig.Property;
import me.main__.util.SerializationConfig.SerializationConfig;
/**
* Our configuration.
*/
public class MultiverseCoreConfiguration extends SerializationConfig implements MultiverseCoreConfig {
private static MultiverseCoreConfiguration instance;
/**
* Sets the statically saved instance.
* @param instance The new instance.
*/
public static void setInstance(MultiverseCoreConfiguration instance) {
MultiverseCoreConfiguration.instance = instance;
}
/**
* Gets the statically saved instance.
* @return The statically saved instance.
*/
public static MultiverseCoreConfiguration getInstance() {
if (instance == null)
throw new IllegalStateException("The instance wasn't set!");
return instance;
}
@Property
private boolean enforceaccess;
@Property
private boolean prefixchat;
@Property
private boolean teleportintercept;
@Property
private boolean firstspawnoverride;
@Property
private boolean displaypermerrors;
@Property
private int globaldebug;
@Property
private int messagecooldown;
@Property
private double version;
@Property
private String firstspawnworld;
@Property
private int teleportcooldown;
public MultiverseCoreConfiguration() {
super();
MultiverseCoreConfiguration.setInstance(this);
}
public MultiverseCoreConfiguration(Map<String, Object> values) {
super(values);
MultiverseCoreConfiguration.setInstance(this);
}
/**
* {@inheritDoc}
*/
@Override
public void setDefaults() {
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
enforceaccess = false;
prefixchat = true;
teleportintercept = true;
firstspawnoverride = true;
displaypermerrors = true;
globaldebug = 0;
messagecooldown = 5000;
teleportcooldown = 1000;
this.version = 2.9;
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
}
/**
* {@inheritDoc}
*/
@Override
public boolean setConfigProperty(String property, String value) {
try {
return this.setProperty(property, value, true);
} catch (NoSuchPropertyException e) {
return false;
}
}
// And here we go:
/**
* {@inheritDoc}
*/
@Override
public boolean getEnforceAccess() {
return this.enforceaccess;
}
/**
* {@inheritDoc}
*/
@Override
public void setEnforceAccess(boolean enforceAccess) {
this.enforceaccess = enforceAccess;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getPrefixChat() {
return this.prefixchat;
}
/**
* {@inheritDoc}
*/
@Override
public void setPrefixChat(boolean prefixChat) {
this.prefixchat = prefixChat;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getTeleportIntercept() {
return this.teleportintercept;
}
/**
* {@inheritDoc}
*/
@Override
public void setTeleportIntercept(boolean teleportIntercept) {
this.teleportintercept = teleportIntercept;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getFirstSpawnOverride() {
return this.firstspawnoverride;
}
/**
* {@inheritDoc}
*/
@Override
public void setFirstSpawnOverride(boolean firstSpawnOverride) {
this.firstspawnoverride = firstSpawnOverride;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getDisplayPermErrors() {
return this.displaypermerrors;
}
/**
* {@inheritDoc}
*/
@Override
public void setDisplayPermErrors(boolean displayPermErrors) {
this.displaypermerrors = displayPermErrors;
}
/**
* {@inheritDoc}
*/
@Override
public int getGlobalDebug() {
return this.globaldebug;
}
/**
* {@inheritDoc}
*/
@Override
public void setGlobalDebug(int globalDebug) {
this.globaldebug = globalDebug;
}
/**
* {@inheritDoc}
*/
@Override
public int getMessageCooldown() {
return this.messagecooldown;
}
/**
* {@inheritDoc}
*/
@Override
public void setMessageCooldown(int messageCooldown) {
this.messagecooldown = messageCooldown;
}
/**
* {@inheritDoc}
*/
@Override
public double getVersion() {
return this.version;
}
/**
* {@inheritDoc}
*/
@Override
public void setVersion(int version) {
this.version = version;
}
/**
* {@inheritDoc}
*/
@Override
public String getFirstSpawnWorld() {
return this.firstspawnworld;
}
/**
* {@inheritDoc}
*/
@Override
public void setFirstSpawnWorld(String firstSpawnWorld) {
this.firstspawnworld = firstSpawnWorld;
}
/**
* {@inheritDoc}
*/
@Override
public int getTeleportCooldown() {
return this.teleportcooldown;
}
/**
* {@inheritDoc}
*/
@Override
public void setTeleportCooldown(int teleportCooldown) {
this.teleportcooldown = teleportCooldown;
}
}
@@ -0,0 +1,72 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Vehicle;
/**
* Used to get block/location-related information.
*/
public interface BlockSafety {
/**
* This function checks whether the block at the given coordinates are above air or not.
* @param l The {@link Location} of the block.
* @return True if the block at that {@link Location} is above air.
*/
boolean isBlockAboveAir(Location l);
/**
* Checks if a player can spawn safely at the given coordinates.
* @param world The {@link World}.
* @param x The x-coordinate.
* @param y The y-coordinate.
* @param z The z-coordinate.
* @return True if a player can spawn safely at the given coordinates.
*/
boolean playerCanSpawnHereSafely(World world, double x, double y, double z);
/**
* This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air
* etc. This also ensures there is enough space for a player to spawn!
*
* @param l The {@link Location}
* @return Whether the player can spawn safely at the given {@link Location}
*/
boolean playerCanSpawnHereSafely(Location l);
/**
* Gets the location of the top block at the specified {@link Location}.
* @param l Any {@link Location}.
* @return The {@link Location} of the top-block.
*/
Location getTopBlock(Location l);
/**
* Gets the location of the top block at the specified {@link Location}.
* @param l Any {@link Location}.
* @return The {@link Location} of the top-block.
*/
Location getBottomBlock(Location l);
/**
* Checks if an entity would be on track at the specified {@link Location}.
* @param l The {@link Location}.
* @return True if an entity would be on tracks at the specified {@link Location}.
*/
boolean isEntitiyOnTrack(Location l);
/**
* Checks if the specified {@link Minecart} can spawn safely.
* @param cart The {@link Minecart}.
* @return True if the minecart can spawn safely.
*/
boolean canSpawnCartSafely(Minecart cart);
/**
* Checks if the specified {@link Vehicle} can spawn safely.
* @param vehicle The {@link Vehicle}.
* @return True if the vehicle can spawn safely.
*/
boolean canSpawnVehicleSafely(Vehicle vehicle);
}
@@ -0,0 +1,225 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.fernferret.allpay.AllPay;
import com.fernferret.allpay.GenericBank;
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
import com.onarandombox.MultiverseCore.utils.*;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
/**
* Multiverse 2 Core API
* <p>
* This API contains a bunch of useful things you can get out of Multiverse in general!
*/
public interface Core {
/**
* Gets the Multiverse config file.
*
* @return The Multiverse config file.
* @deprecated Don't modify the config-file manually!
*/
@Deprecated
FileConfiguration getMVConfiguration();
/**
* Gets the Banking system that Multiverse-Core has hooked into.
*
* @return A {@link GenericBank} that can be used for payments.
*/
GenericBank getBank();
/**
* Reloads the Multiverse Configuration files:
* worlds.yml and config.yml.
*/
void loadConfigs();
/**
* Gets the Multiverse message system. This allows you to send messages
* to users at specified intervals.
*
* @return The loaded {@link MultiverseMessaging}.
*/
MultiverseMessaging getMessaging();
/**
* Gets the {@link MVPlayerSession} for the given player.
* This will also create a player session if one does not exist
* for a player.
*
* @param player The player's session to grab.
*
* @return The corresponding {@link MVPlayerSession}.
*/
MVPlayerSession getPlayerSession(Player player);
/**
* Gets the instantiated Safe-T-Teleporter for performing
* safe teleports.
*
* @return A non-null {@link SafeTTeleporter}.
*
* @deprecated Use {@link #getSafeTTeleporter()} instead.
*/
@Deprecated
com.onarandombox.MultiverseCore.utils.SafeTTeleporter getTeleporter();
/**
* Multiverse uses an advanced permissions setup, this object
* simplifies getting/setting permissions.
*
* @return A non-null {@link MVPermissions}.
*/
MVPermissions getMVPerms();
/**
* Multiverse uses {@link CommandHandler} to make adding and using commands
* a piece of cake.
*
* @return A non-null {@link CommandHandler}.
*/
CommandHandler getCommandHandler();
/**
* Gets the factory class responsible for loading many different destinations
* on demand.
*
* @return A valid {@link DestinationFactory}.
*/
DestinationFactory getDestFactory();
/**
* Gets the primary class responsible for managing Multiverse Worlds.
*
* @return {@link WorldManager}.
*/
MVWorldManager getMVWorldManager();
/**
* Saves all configs.
*
* @return Whether the config was successfully saved
*/
boolean saveMVConfigs();
/**
* Gets the {@link AnchorManager}.
*
* @return The {@link AnchorManager}
*/
AnchorManager getAnchorManager();
/**
* Used by queued commands to regenerate a world on a delay.
*
* @param name Name of the world to regenerate
* @param useNewSeed If a new seed should be used
* @param randomSeed IF the new seed should be random
* @param seed The seed of the world.
*
* @return True if success, false if fail.
*/
Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed);
/**
* Sets the {@link GenericBank}-Bank AllPay is using.
*
* @param bank The new {@link GenericBank}
*/
void setBank(GenericBank bank);
/**
* Gets this plugin's {@link AllPay}-Banker.
*
* @return An {@link AllPay}-Banker
*/
AllPay getBanker();
/**
* Decrements the number of plugins that have specifically hooked into core.
*/
void decrementPluginCount();
/**
* Increments the number of plugins that have specifically hooked into core.
*/
void incrementPluginCount();
/**
* Returns the number of plugins that have specifically hooked into core.
*
* @return The number if plugins that have hooked into core.
*/
int getPluginCount();
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @return The readable authors-{@link String}
*/
String getAuthors();
/**
* Gets the {@link BlockSafety} this {@link Core} is using.
* @return The {@link BlockSafety} this {@link Core} is using.
* @see BlockSafety
* @see SimpleBlockSafety
*/
BlockSafety getBlockSafety();
/**
* Sets the {@link BlockSafety} this {@link Core} is using.
* @param blockSafety The new {@link BlockSafety}.
* @see BlockSafety
* @see SimpleBlockSafety
*/
void setBlockSafety(BlockSafety blockSafety);
/**
* Gets the {@link LocationManipulation} this {@link Core} is using.
* @return The {@link LocationManipulation} this {@link Core} is using.
* @see LocationManipulation
* @see SimpleLocationManipulation
*/
LocationManipulation getLocationManipulation();
/**
* Sets the {@link LocationManipulation} this {@link Core} is using.
* @param locationManipulation The new {@link LocationManipulation}.
* @see LocationManipulation
* @see SimpleLocationManipulation
*/
void setLocationManipulation(LocationManipulation locationManipulation);
/**
* Gets the {@link SafeTTeleporter} this {@link Core} is using.
* @return The {@link SafeTTeleporter} this {@link Core} is using.
* @see SafeTTeleporter
* @see SimpleSafeTTeleporter
*/
SafeTTeleporter getSafeTTeleporter();
/**
* Sets the {@link SafeTTeleporter} this {@link Core} is using.
* @param safeTTeleporter The new {@link SafeTTeleporter}.
* @see SafeTTeleporter
* @see SimpleSafeTTeleporter
*/
void setSafeTTeleporter(SafeTTeleporter safeTTeleporter);
/**
* Gets the {@link MultiverseCoreConfig}.
* @return The configuration.
*/
MultiverseCoreConfig getMVConfig();
}
@@ -0,0 +1,20 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
/**
* A fancy text.
*/
public interface FancyText {
/**
* Gets the {@link String}-representation of this {@link FancyText}.
*
* @return The {@link String}-representation of this {@link FancyText}.
*/
String getFancyText();
}
@@ -0,0 +1,99 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
/**
* Used to manipulate locations.
*/
public interface LocationManipulation {
/**
* Convert a Location into a Colon separated string to allow us to store it in text.
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding String2Loc function is {@link #stringToLocation}
*
* @param location The Location to save.
* @return The location as a string in this format: WORLD:x,y,z:yaw:pitch
*/
String locationToString(Location location);
/**
* This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
*
* @param l The location to round to the block location
* @return A rounded location.
*/
Location getBlockLocation(Location l);
/**
* Returns a new location from a given string. The format is as follows:
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding Location2String function is {@link #stringToLocation}
*
* @param locationString The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
* @return A new location defined by the string or null if the string was invalid.
*/
Location stringToLocation(String locationString);
/**
* Returns a colored string with the coords.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoords(Location l);
/**
* Converts a location to a printable readable formatted string including pitch/yaw.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoordsRaw(Location l);
/**
* Return the NESW Direction a Location is facing.
*
* @param location The {@link Location}
* @return The NESW Direction
*/
String getDirection(Location location);
/**
* Returns the float yaw position for the given cardinal direction.
*
* @param orientation The cardinal direction
* @return The yaw
*/
float getYaw(String orientation);
/**
* Returns a speed float from a given vector.
*
* @param v The {@link Vector}
* @return The speed
*/
float getSpeed(Vector v);
/**
* Returns a translated vector from the given direction.
*
* @param v The old {@link Vector}
* @param direction The new direction
* @return The translated {@link Vector}
*/
Vector getTranslatedVector(Vector v, String direction);
/**
* Returns the next Location that a {@link Vehicle} is traveling at.
*
* @param v The {@link Vehicle}
* @return The {@link Location}
*/
Location getNextBlock(Vehicle v);
}
@@ -0,0 +1,30 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Server;
import java.util.logging.Level;
/** A simple API to require plugins to have a log method. */
public interface LoggablePlugin {
/**
* Logs a message at the specified level.
*
* @param level The Log-{@link Level}.
* @param msg The message to log.
*/
void log(Level level, String msg);
/**
* Gets the server instance that this plugin is attached to.
*
* @return A {@link Server} instance.
*/
Server getServer();
}
@@ -0,0 +1,141 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A destination API for Multiverse
* Any plugin can add these to MV and when they are, any action that uses them (portals, MVTP, etc.) can use them!
*/
public interface MVDestination {
/**
* Returns the identifier or prefix that is required for this destination.
* <p>
* Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
* Please check the wiki when adding a custom destination!
*
* @return The identifier or prefix that is required for this destination.
*/
String getIdentifier();
/**
* Allows you to determine if a Destination is valid for the type it thinks it is.
* <p>
* An example of this would be the exact destination. A valid string would be: e:0,0,0 where an invalid one would
* be e:1:2:3. The first string would return true the second would return false. This is simply a convenience
* method
* and does not even NEED to be called, but it's highly recommended if you're teleporting, but it's mainly for
* Multiverse Internal use.
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*
* @return True if the destination is valid, false if not.
*/
boolean isThisType(JavaPlugin plugin, String destination);
/**
* Returns the location a specific entity will spawn at when being teleported to this Destination.
* <p>
* To just retrieve the location as it is stored you can just pass null, but be warned some destinations may return
* null back to you if you do this. It is always safer to pass an actual entity. This is used so things like
* minecarts can be teleported.
* <p>
* Do not forget to use {@link #getVelocity()} as destinations can use this too!
*
* @param entity The entity to be teleported.
*
* @return The location of the entity.
*/
Location getLocation(Entity entity);
/**
* Returns the velocity vector for this destination.
* <p>
* Plugins wishing to fully support MVDestinations MUST implement this.
*
* @return A vector representing the speed/direction the player should travel when arriving
*/
Vector getVelocity();
/**
* Sets the destination string.
* <p>
* This should be used when you want to tell this destination object about a change in where it should take people.
* The destination param should be match the result from {@link #getIdentifier()}. A valid example would be that if
* {@link #getIdentifier()} returned "ow" our destination string could be "ow:TownCenter" but could not be
* "p:HomePortal"
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*/
void setDestination(JavaPlugin plugin, String destination);
/**
* Returns true if the destination is valid and players will be taken to it.
* <p>
* Even if destinations are in the correct format (p:MyPortal) MyPortal may not exist, and therefore this would
* return false.
*
* @return True if the destination is valid; false if not.
*/
boolean isValid();
/**
* Gives you a general friendly description of the type of destination.
* <p>
* For example, the PlayerDestination sets this to "Player". You can use this to show where a player will be taken.
*
* @return A friendly string description of the type of destination.
*/
String getType();
/**
* Gives you a specific name of the destination.
* <p>
* For example, the PlayerDestination sets this to The Player's Name.
*
* @return A friendly string stating the name of the destination.
*/
String getName();
/**
* Returns a string that can easily be saved in the config that contains all the details needed to rebuild this
* destination.
* <p>
* ex: e:0,0,0:50:50
*
* @return The savable config string.
*/
String toString();
/**
* Returns the permissions string required to go here.
* <p>
* ex: multiverse.access.world
* <p>
* NOTE: This is NOT the permission to use the teleport command.
*
* @return the permissions string required to go here.
*/
String getRequiredPermission();
/**
* Should the Multiverse SafeTeleporter be used?
* <p>
* If not, MV will blindly take people to the location specified.
*
* @return True if the SafeTeleporter will be used, false if not.
*/
boolean useSafeTeleporter();
}
@@ -0,0 +1,52 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
/**
* This interface is implemented by every official Multiverse-plugin.
*/
public interface MVPlugin extends LoggablePlugin {
/**
* Adds This plugin's version information to the buffer and returns the new string.
*
* @param buffer The string that contains Core and all other MV plugins' versions.
*
* @return A modified buffer that contains this MVPlugin's version information.
*
* @deprecated This is now deprecated, nobody needs it any longer.
* All version info-dumping is now done with {@link MVVersionEvent}.
*/
@Deprecated
String dumpVersionInfo(String buffer);
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link MultiverseCore}.
*/
MultiverseCore getCore();
/**
* Sets the reference to MultiverseCore.
*
* @param core A valid {@link MultiverseCore}.
*/
void setCore(MultiverseCore core);
/**
* Allows Multiverse or a plugin to query another Multiverse plugin to see what version its protocol is. This
* number
* should change when something will break the code.
*
* @return The Integer protocol version.
*/
int getProtocolVersion();
}
@@ -0,0 +1,248 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.utils.PurgeWorlds;
import com.onarandombox.MultiverseCore.utils.SimpleWorldPurger;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldType;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.generator.ChunkGenerator;
import java.io.File;
import java.util.Collection;
import java.util.List;
/**
* Multiverse 2 World Manager API
* <p>
* This API contains all of the world managing
* functions that your heart desires!
*/
public interface MVWorldManager {
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator);
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator, boolean useSpawnAdjust);
/**
* Remove the world from the Multiverse list, from the
* config and deletes the folder.
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
boolean deleteWorld(String name);
/**
* Remove the world from the Multiverse list, from the
* config if wanted, and deletes the folder.
*
* @param name The name of the world to remove
* @param removeConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeConfig);
/**
* Unload a world from Multiverse.
*
* @param name Name of the world to unload
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name);
/**
* Loads the world. Only use this if the world has been
* unloaded with {@link #unloadWorld(String)}.
*
* @param name The name of the world to load
* @return True if success, false if failure.
*/
boolean loadWorld(String name);
/**
* Removes all players from the specified world.
*
* @param name World to remove players from.
*/
void removePlayersFromWorld(String name);
/**
* Test if a given chunk generator is valid.
*
* @param generator The generator name.
* @param generatorID The generator id.
* @param worldName The worldName to use as the default.
* @return A {@link ChunkGenerator} or null
*/
ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName);
/**
* Returns a list of all the worlds Multiverse knows about.
*
* @return A list of {@link MultiverseWorld}.
*/
Collection<MultiverseWorld> getMVWorlds();
/**
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
* This will search name AND alias.
*
* @param name The name or alias of the world to get.
* @return A {@link MultiverseWorld} or null.
*/
MultiverseWorld getMVWorld(String name);
/**
* Returns a {@link MultiverseWorld} if it exists, and null if it does not.
*
* @param world The Bukkit world to check.
* @return A {@link MultiverseWorld} or null.
*/
MultiverseWorld getMVWorld(World world);
/**
* Checks to see if the given name is a valid {@link MultiverseWorld}.
*
* @param name The name or alias of the world to check.
* @return True if the world exists, false if not.
*/
boolean isMVWorld(String name);
/**
* Checks to see if the given world is a valid {@link MultiverseWorld}.
*
* @param world The Bukkit world to check.
* @return True if the world has been loaded into MV2, false if not.
*/
boolean isMVWorld(World world);
/**
* Load the Worlds & Settings from the configuration file.
*
* @param forceLoad If set to true, this will perform a total
* reset and not just load new worlds.
*/
void loadWorlds(boolean forceLoad);
/**
* Loads the Worlds & Settings for any worlds that bukkit loaded before us.
* <p>
* This way people will _always_ have some worlds in the list.
*/
void loadDefaultWorlds();
/**
* Return the World Purger.
*
* @return A valid {@link PurgeWorlds}.
* @deprecated {@link PurgeWorlds} is deprecated!
*/
@Deprecated
PurgeWorlds getWorldPurger();
/**
* Gets the {@link WorldPurger}.
* <p>
* TODO: Remove {@link #getWorldPurger()} and replace it with this method.
* @return The {@link WorldPurger} this {@link MVWorldManager} is using.
* @see WorldPurger
* @see SimpleWorldPurger
*/
WorldPurger getTheWorldPurger();
/**
* Gets the world players will spawn in on first join.
* Currently this always returns worlds.get(0) from Bukkit.
*
* @return A Multiverse world that players will spawn in or null if no MV world has been set.
*/
MultiverseWorld getSpawnWorld();
/**
* Gets the list of worlds in the config, but unloaded.
*
* @return A List of worlds as strings.
*/
List<String> getUnloadedWorlds();
/**
* This method populates an internal list and needs to be called after multiverse initialization.
*/
void getDefaultWorldGenerators();
/**
* Load the config from a file.
*
* @param file The file to load.
* @return A loaded configuration.
*/
FileConfiguration loadWorldConfig(File file);
/**
* Saves the world config to disk.
*
* @return True if success, false if fail.
*/
boolean saveWorldsConfig();
/**
* Remove the world from the Multiverse list and from the config.
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
boolean removeWorldFromConfig(String name);
/**
* Sets the initial spawn world for new players.
*
* @param world The World new players should spawn in.
*/
void setFirstSpawnWorld(String world);
/**
* Gets the world players should spawn in first.
*
* @return The {@link MultiverseWorld} new players should spawn in.
*/
MultiverseWorld getFirstSpawnWorld();
}
@@ -0,0 +1,136 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
/**
* The configuration of MultiverseCore.
*/
public interface MultiverseCoreConfig extends ConfigurationSerializable {
/**
* Sets a property using a {@link String}.
* @param property The name of the property.
* @param value The value.
* @return True on success, false if the operation failed.
*/
boolean setConfigProperty(String property, String value);
/**
* Sets portalCooldown.
* @param portalCooldown The new value.
*/
void setTeleportCooldown(int portalCooldown);
/**
* Gets portalCooldown.
* @return portalCooldown.
*/
int getTeleportCooldown();
/**
* Sets firstSpawnWorld.
* @param firstSpawnWorld The new value.
*/
void setFirstSpawnWorld(String firstSpawnWorld);
/**
* Gets firstSpawnWorld.
* @return firstSpawnWorld.
*/
String getFirstSpawnWorld();
/**
* Sets version.
* @param version The new value.
*/
void setVersion(int version);
/**
* Gets version.
* @return version.
*/
double getVersion();
/**
* Sets messageCooldown.
* @param messageCooldown The new value.
*/
void setMessageCooldown(int messageCooldown);
/**
* Gets messageCooldown.
* @return messageCooldown.
*/
int getMessageCooldown();
/**
* Sets globalDebug.
* @param globalDebug The new value.
*/
void setGlobalDebug(int globalDebug);
/**
* Gets globalDebug.
* @return globalDebug.
*/
int getGlobalDebug();
/**
* Sets displayPermErrors.
* @param displayPermErrors The new value.
*/
void setDisplayPermErrors(boolean displayPermErrors);
/**
* Gets displayPermErrors.
* @return displayPermErrors.
*/
boolean getDisplayPermErrors();
/**
* Sets firstSpawnOverride.
* @param firstSpawnOverride The new value.
*/
void setFirstSpawnOverride(boolean firstSpawnOverride);
/**
* Gets firstSpawnOverride.
* @return firstSpawnOverride.
*/
boolean getFirstSpawnOverride();
/**
* Sets teleportIntercept.
* @param teleportIntercept The new value.
*/
void setTeleportIntercept(boolean teleportIntercept);
/**
* Gets teleportIntercept.
* @return teleportIntercept.
*/
boolean getTeleportIntercept();
/**
* Sets prefixChat.
* @param prefixChat The new value.
*/
void setPrefixChat(boolean prefixChat);
/**
* Gets prefixChat.
* @return prefixChat.
*/
boolean getPrefixChat();
/**
* Sets enforceAccess.
* @param enforceAccess The new value.
*/
void setEnforceAccess(boolean enforceAccess);
/**
* Gets enforceAccess.
* @return enforceAccess.
*/
boolean getEnforceAccess();
}
@@ -0,0 +1,56 @@
package com.onarandombox.MultiverseCore.api;
import java.util.Collection;
import org.bukkit.command.CommandSender;
/**
* Multiverse-messaging.
*/
public interface MultiverseMessaging {
/**
* Sets the message-cooldown.
* @param milliseconds The new message-cooldown in milliseconds.
*/
void setCooldown(int milliseconds);
/**
* Sends a message to the specified sender if the cooldown has passed.
*
* @param sender The person/console to send the message to.
* @param message The message to send.
* @param ignoreCooldown If true this message will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
boolean sendMessage(CommandSender sender, String message, boolean ignoreCooldown);
/**
* Sends a group of messages to the specified sender if the cooldown has passed.
* This method is needed, since sending many messages in quick succession would violate
* the cooldown.
*
* @param sender The person/console to send the message to.
* @param messages The messages to send.
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
boolean sendMessages(CommandSender sender, String[] messages, boolean ignoreCooldown);
/**
* Sends a group of messages to the specified sender if the cooldown has passed.
* This method is needed, since sending many messages in quick succession would violate
* the cooldown.
*
* @param sender The person/console to send the message to.
* @param messages The messages to send.
* @param ignoreCooldown If true these messages will always be sent. Useful for things like menus
* @return true if the message was sent, false if not.
*/
boolean sendMessages(CommandSender sender, Collection<String> messages, boolean ignoreCooldown);
/**
* Gets the message-cooldown.
* @return The message-cooldown.
*/
int getCooldown();
}
@@ -0,0 +1,678 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.enums.AllowedPortalType;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import java.util.List;
/**
* The API for a Multiverse Handled World.
*/
public interface MultiverseWorld {
/**
* Returns the Bukkit world object that this world describes.
*
* @return A {@link World}
*/
World getCBWorld();
/**
* Gets the name of this world. The name cannot be changed.
* <p>
* Note for plugin developers: Usually {@link #getAlias()}
* is what you want to use instead of this method.
*
* @return The name of the world as a String.
*/
String getName();
/**
* Gets the type of this world. As of 1.2 this will be:
* FLAT, NORMAL or VERSION_1_1
* <p>
* This is <b>not</b> the generator.
*
* @return The Type of this world.
*/
WorldType getWorldType();
/**
* Gets the environment of this world.
*
* @return A {@link org.bukkit.World.Environment}.
*/
World.Environment getEnvironment();
/**
* Sets the environment of a world.
* <p>
* Note: This will ONLY take effect once the world is unloaded/reloaded.
*
* @param environment A {@link org.bukkit.World.Environment}.
*/
void setEnvironment(World.Environment environment);
/**
* Gets the difficulty of this world.
*
* @return The difficulty of this world.
*/
Difficulty getDifficulty();
/**
* Sets the difficulty of this world and returns true if success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. {@code PEACEFUL}
*
* @param difficulty The difficulty to set the world to as a string.
* @return True if success, false if the provided string
* could not be translated to a difficulty.
* @deprecated Use {@link #setDifficulty(Difficulty)} or, if you have to
* pass a string, use {@link #setPropertyValue(String, String)} instead.
*/
@Deprecated
boolean setDifficulty(String difficulty);
/**
* Sets the difficulty of this world and returns {@code true} on success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. PEACEFUL
*
* @param difficulty The new difficulty.
* @return True if success, false if the operation failed... for whatever reason.
*/
boolean setDifficulty(Difficulty difficulty);
/**
* Gets the world seed of this world.
*
* @return The Long version of the seed.
*/
long getSeed();
/**
* Sets the seed of this world.
*
* @param seed A Long that is the seed.
*/
void setSeed(long seed);
/**
* Gets the generator of this world.
*
* @return The name of the generator.
*/
String getGenerator();
/**
* Sets the generator of this world.
*
* @param generator The new generator's name.
*/
void setGenerator(String generator);
/**
* Gets the help-message for a property.
* @param property The name of the property.
* @return The help-message.
* @throws PropertyDoesNotExistException Thrown if the property was not found.
*/
String getPropertyHelp(String property) throws PropertyDoesNotExistException;
/**
* Gets a property as {@link String}.
*
* @param property The name of a world property to get.
* @return The string-representation of that property.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
String getPropertyValue(String property) throws PropertyDoesNotExistException;
/**
* Sets a property to a given value.
*
* @param property The name of a world property to set.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was set, false if not.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
/**
* Gets the actual MVConfigProperty from this world.
* It will throw a PropertyDoesNotExistException if the property is not found.
*
* @param property The name of a world property to get.
* @param expected The type of the expected property. Use Object.class if this doesn't matter for you.
* @param <T> The type of the expected property.
*
* @return A valid MVWorldProperty.
*
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
* @deprecated We don't use {@link com.onarandombox.MultiverseCore.configuration.MVConfigProperty} any longer!
*/
@Deprecated
<T> com.onarandombox.MultiverseCore.configuration.MVConfigProperty<T> getProperty(String property, Class<T> expected) throws PropertyDoesNotExistException;
// old config
/**
* Adds the property to the given value.
* It will throw a PropertyDoesNotExistException if the property is not found.
*
* @param property The name of a world property to set.
* @param value A value in string representation, it will be parsed to the correct type.
* @param sender The sender who wants this value to be set.
* @return True if the value was set, false if not.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
* @deprecated Use {@link #setPropertyValue(String, String)} instead.
*/
@Deprecated
boolean setProperty(String property, String value, CommandSender sender) throws PropertyDoesNotExistException;
/**
* Adds a value to the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to add a value to.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was added, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean addToVariable(String property, String value);
/**
* Removes a value from the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to remove a value
* from.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was removed, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean removeFromVariable(String property, String value);
/**
* Removes all values from the given property. The property must be a {@link com.onarandombox.MultiverseCore.enums.AddProperties}.
*
* @param property The name of a {@link com.onarandombox.MultiverseCore.enums.AddProperties} to clear.
* @return True if it was cleared, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean clearVariable(String property);
/**
* Clears a list property (sets it to []).
*
* @param property The property to clear.
* @return True if success, false if fail.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean clearList(String property);
// end of old config stuff
// permission stuff
/**
* Gets the lowercased name of the world. This method is required, since the permissables
* lowercase all permissions when recalculating.
* <p>
* Note: This also means if a user has worlds named: world and WORLD, that they can both
* exist, and both be teleported to independently, but their permissions **cannot** be
* uniqueified at this time. See bug report #.
*
* @return The lowercased name of the world.
*/
String getPermissibleName();
/**
* Gets the permission required to enter this world.
*
* @return The permission required to be exempt from charges to/from this world.
*/
Permission getAccessPermission();
/**
* Gets the permission required to be exempt when entering.
*
* @return The permission required to be exempt when entering.
*/
Permission getExemptPermission();
// end of permission stuff
/**
* Gets the alias of this world.
* <p>
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
*
* @return The alias of the world as a String.
*/
String getAlias();
/**
* Sets the alias of the world.
*
* @param alias A string that is the new alias.
*/
void setAlias(String alias);
/**
* Gets the color that this world's name/alias will display as.
*
* @return The color of this world.
*/
ChatColor getColor();
/**
* Sets the color that this world's name/alias will display as.
*
* @param color A valid color name.
* @return True if the color was set, false if not.
*/
boolean setColor(String color);
/**
* Tells you if someone entered a valid color.
*
* @param color A string that may translate to a color.
* @return True if it is a color, false if not.
*
* @deprecated This has been moved: {@link com.onarandombox.MultiverseCore.enums.EnglishChatColor#isValidAliasColor(String)}
*/
@Deprecated
boolean isValidAliasColor(String color);
/**
* Returns a very nicely colored string (using Alias and Color if they are set).
*
* @return A nicely colored string.
*/
String getColoredWorldString();
// animals&monster stuff
/**
* Gets whether or not animals are allowed to spawn in this world.
*
* @return True if ANY animal can, false if no animals can spawn.
*/
boolean canAnimalsSpawn();
/**
* Sets whether or not animals can spawn.
* If there are values in {@link #getAnimalList()} and this is false,
* those animals become the exceptions, and will spawn
*
* @param allowAnimalSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowAnimalSpawn(boolean allowAnimalSpawn);
/**
* Returns a list of animals. This list always negates the {@link #canAnimalsSpawn()} result.
*
* @return A list of animals that will spawn if {@link #canAnimalsSpawn()} is false.
*/
List<String> getAnimalList();
/**
* Gets whether or not monsters are allowed to spawn in this world.
*
* @return True if ANY monster can, false if no monsters can spawn.
*/
boolean canMonstersSpawn();
/**
* Sets whether or not monsters can spawn.
* If there are values in {@link #getMonsterList()} and this is false,
* those monsters become the exceptions, and will spawn
*
* @param allowMonsterSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowMonsterSpawn(boolean allowMonsterSpawn);
/**
* Returns a list of monsters. This list always negates the {@link #canMonstersSpawn()} result.
*
* @return A list of monsters that will spawn if {@link #canMonstersSpawn()} is false.
*/
List<String> getMonsterList();
// end of animal&monster stuff
/**
* Gets whether or not PVP is enabled in this world in some form (fake or not).
*
* @return True if players can take damage from other players.
*/
boolean isPVPEnabled();
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode.
*
* @param pvpMode True to enable PVP damage, false to disable it.
*/
void setPVPMode(boolean pvpMode);
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
*
* @return True if this world has fakepvp on
* @deprecated This is deprecated.
*/
@Deprecated
boolean getFakePVP();
/**
* Gets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @return True if the world will be hidden, false if not.
*/
boolean isHidden();
/**
* Sets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @param hidden Set
*/
void setHidden(boolean hidden);
/**
* Gets whether weather is enabled in this world.
*
* @return True if weather events will occur, false if not.
*/
boolean isWeatherEnabled();
/**
* Sets whether or not there will be weather events in a given world.
* If set to false, Multiverse will disable the weather in the world immediately.
*
* @param enableWeather True if weather events should occur in a world, false if not.
*/
void setEnableWeather(boolean enableWeather);
/**
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
*
* @return True if CraftBukkit is keeping spawn chunks in memory.
*/
boolean isKeepingSpawnInMemory();
/**
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
* If not, CraftBukkit will attempt to free memory when players have not used that world.
* This will not happen immediately.
*
* @param keepSpawnInMemory If true, CraftBukkit will keep the spawn chunks loaded in memory.
*/
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
/**
* Gets the spawn location of this world.
*
* @return The spawn location of this world.
*/
Location getSpawnLocation();
/**
* Sets the spawn location for a world.
*
* @param spawnLocation The spawn location for a world.
*/
void setSpawnLocation(Location spawnLocation);
/**
* Gets whether or not the hunger level of players will go down in a world.
*
* @return True if it will go down, false if it will remain steady.
*/
boolean getHunger();
/**
* Sets whether or not the hunger level of players will go down in a world.
*
* @param hungerEnabled True if hunger will go down, false to keep it at
* the level they entered a world with.
*/
void setHunger(boolean hungerEnabled);
/**
* Gets the GameMode of this world.
*
* @return The GameMode of this world.
*/
GameMode getGameMode();
/**
* Sets the game mode of this world.
*
* @param gameMode A valid game mode string (either
* an int ex. 0 or a string ex. creative).
* @return True if the game mode was successfully changed, false if not.
* @deprecated Use {@link #setGameMode(GameMode)} instead. If you have to
* pass a string, use {@link #setPropertyValue(String, String)}.
*/
@Deprecated
boolean setGameMode(String gameMode);
/**
* Sets the game mode of this world.
*
* @param gameMode The new {@link GameMode}.
* @return True if the game mode was successfully changed, false if not.
*/
boolean setGameMode(GameMode gameMode);
/**
* Gets the amount of currency it requires to enter this world.
*
* @return The amount it costs to enter this world.
*/
double getPrice();
/**
* Sets the price for entry to this world.
* You can think of this like an amount.
* The type can be set with {@link #setCurrency(int)}
*
* @param price The Amount of money/item to enter the world.
*/
void setPrice(double price);
/**
* Gets the Type of currency that will be used when users enter this world.
*
* @return The Type of currency that will be used when users enter this world.
*/
int getCurrency();
/**
* Sets the type of item that will be required given the price is not 0.
* Use -1 to use an AllPay economy, or any valid itemid
*
* @param item The Type of currency that will be used when users enter this world.
*/
void setCurrency(int item);
/**
* Gets the world players will respawn in if they die in this one.
*
* @return A world that exists on the server.
*/
World getRespawnToWorld();
/**
* Sets the world players will respawn in if they die in this one.
* Returns true upon success, false upon failure.
*
* @param respawnWorld The name of a world that exists on the server.
* @return True if respawnWorld existed, false if not.
*/
boolean setRespawnToWorld(String respawnWorld);
/**
* Gets the scaling value of this world.Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @return This world's non-negative, non-zero scale.
*/
double getScaling();
/**
* Sets the scale of this world. Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @param scaling A scaling value, cannot be negative or 0.
* @return Whether the scale was set successfully.
*/
boolean setScaling(double scaling);
/**
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @return True if the world should heal (default), false if not.
*/
boolean getAutoHeal();
/**
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @param heal True if the world will heal.
*/
void setAutoHeal(boolean heal);
/**
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @return True if Multiverse should adjust the spawn, false if not.
*/
boolean getAdjustSpawn();
/**
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @param adjust True if multiverse should adjust the spawn, false if not.
*/
void setAdjustSpawn(boolean adjust);
/**
* Gets whether or not Multiverse should auto-load this world.
*
* @return True if Multiverse should auto-load this world.
*/
boolean getAutoLoad();
/**
* Sets whether or not Multiverse should auto-load this world.
* <p>
* True is default.
*
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
*/
void setAutoLoad(boolean autoLoad);
/**
* Gets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
*
* @return True if players dying in this world should respawn at their bed.
*/
boolean getBedRespawn();
/**
* Sets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
* <p>
* True is default.
*
* @param autoLoad True if players dying in this world respawn at their bed.
*/
void setBedRespawn(boolean autoLoad);
/**
* Same as {@link #getTime()}, but returns a string.
* @return The time as a short string: 12:34pm
*/
String getTime();
/**
* Sets the current time in a world.
* <p>
* This method will take the following formats:
* 11:37am
* 4:30p
* day(morning), night, noon, midnight
*
* @param timeAsString The formatted time to set the world to.
* @return True if the time was set, false if not.
*/
boolean setTime(String timeAsString);
/**
* Sets The types of portals that are allowed in this world.
*
* @param type The type of portals allowed in this world.
*/
void allowPortalMaking(AllowedPortalType type);
/**
* Gets which type(s) of portals are allowed to be constructed in this world.
*
* @return The type of portals that are allowed.
*/
AllowedPortalType getAllowedPortals();
// properties that are not "getter+setter" style
/**
* Gets a list of all the worlds that players CANNOT travel to from this world,
* regardless of their access permissions.
*
* @return A List of world names.
*/
List<String> getWorldBlacklist();
/**
* Gets all the names of all properties that can be SET.
*
* @return All property names, with alternating colors.
*/
String getAllPropertyNames();
/**
* Gets whether or not flight is allowed in this world.
* <p>
* It should be noted that this refers to clientside flying. Creative
* mode will always allow server based flying.
*
* @return True if flight is allowed.
*/
boolean isFlightAllowed();
/**
* Sets whether or not flight is allowed in this world.
* <p>
* It should be noted that this refers to clientside flying. Creative
* mode will always allow server based flying.
*
* @param flightAllowed Wheter or not flight is allowed in this world.
*/
void setFlightAllowed(boolean flightAllowed);
}
@@ -0,0 +1,71 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import com.onarandombox.MultiverseCore.enums.TeleportResult;
/**
* Used to safely teleport people.
*/
public interface SafeTTeleporter {
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @return A safe {@link Location}.
*/
Location getSafeLocation(Location l);
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @param tolerance The tolerance.
* @param radius The radius.
* @return A safe {@link Location}.
*/
Location getSafeLocation(Location l, int tolerance, int radius);
/**
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who performed the teleport command.
* @param teleportee Entity to teleport
* @param d Destination to teleport them to
* @return true for success, false for failure
*/
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, MVDestination d);
/**
* Safely teleport the entity to the Location. This may perform checks to
* see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who issued the teleport command.
* @param teleportee Entity to teleport.
* @param location Location to teleport them to.
* @param safely Should the destination be checked for safety before teleport?
* @return true for success, false for failure.
*/
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location,
boolean safely);
/**
* Returns a safe location for the entity to spawn at.
*
* @param e The entity to spawn
* @param d The MVDestination to take the entity to.
* @return A new location to spawn the entity at.
*/
Location getSafeLocation(Entity e, MVDestination d);
/**
* Finds a portal-block next to the specified {@link Location}.
* @param l The {@link Location}
* @return The next portal-block's {@link Location}.
*/
Location findPortalBlockNextTo(Location l);
}
@@ -0,0 +1,49 @@
package com.onarandombox.MultiverseCore.api;
import java.util.List;
import org.bukkit.command.CommandSender;
/**
* Used to remove animals from worlds that don't belong there.
*/
public interface WorldPurger {
/**
* Synchronizes the given world with it's settings.
*
* @param worlds A list of {@link MultiverseWorld}
*/
void purgeWorlds(List<MultiverseWorld> worlds);
/**
* Convenience method for {@link #purgeWorld(CommandSender, MultiverseWorld, List, boolean, boolean)} that takes the settings from the world-config.
*
* @param world The {@link MultiverseWorld}.
*/
void purgeWorld(MultiverseWorld world);
/**
* Clear all animals/monsters that do not belong to a world according to the config.
*
* @param mvworld The {@link MultiverseWorld}.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
*/
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters);
/**
* Clear all animals/monsters that do not belong to a world according to the config.
*
* @param mvworld The {@link MultiverseWorld}.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
* @param sender The {@link CommandSender} that initiated the action. He will/should be notified.
*/
void purgeWorld(MultiverseWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters, CommandSender sender);
}
@@ -0,0 +1,5 @@
/**
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
* plugins when interacting with Multiverse.
*/
package com.onarandombox.MultiverseCore.api;
@@ -0,0 +1,145 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Allows management of Anchor Destinations.
*/
public class AnchorCommand extends PaginatedCoreCommand<String> {
public AnchorCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create, Delete and Manage Anchor Destinations.");
this.setCommandUsage("/mv anchor " + ChatColor.GREEN + "{name}" + ChatColor.GOLD + " [-d]");
this.setArgRange(0, 2);
this.addKey("mv anchor");
this.addKey("mv anchors");
this.addKey("mvanchor");
this.addKey("mvanchors");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "otherthing");
this.addCommandExample("/mv anchor " + ChatColor.GREEN + "awesomething " + ChatColor.RED + "-d");
this.addCommandExample("/mv anchors ");
this.setPermission("multiverse.core.anchor", "Allows management of Anchor Destinations.", PermissionDefault.OP);
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
private List<String> getFancyAnchorList(Player p) {
List<String> anchorList = new ArrayList<String>();
ChatColor color = ChatColor.GREEN;
for (String anchor : this.plugin.getAnchorManager().getAnchors(p)) {
anchorList.add(color + anchor);
color = (color == ChatColor.GREEN) ? ChatColor.GOLD : ChatColor.GREEN;
}
return anchorList;
}
private void showList(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse Anchor List ]====");
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
FilterObject filterObject = this.getPageAndFilter(args);
List<String> availableAnchors = new ArrayList<String>(this.getFancyAnchorList(p));
if (filterObject.getFilter().length() > 0) {
availableAnchors = this.getFilteredItems(availableAnchors, filterObject.getFilter());
if (availableAnchors.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No anchors matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
} else {
if (availableAnchors.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE + "No anchors were defined.");
return;
}
}
if (!(sender instanceof Player)) {
for (String c : availableAnchors) {
sender.sendMessage(c);
}
return;
}
int totalPages = (int) Math.ceil(availableAnchors.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
} else if (filterObject.getPage() < 1) {
filterObject.setPage(1);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
this.showPage(filterObject.getPage(), sender, availableAnchors);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() == 0) {
this.showList(sender, args);
return;
}
if (args.size() == 1 && (this.getPageAndFilter(args).getPage() != 1 || args.get(0).equals("1"))) {
this.showList(sender, args);
return;
}
if (args.size() == 2 && args.get(1).equalsIgnoreCase("-d")) {
if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) {
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!");
} else {
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "deleted!");
}
return;
}
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to create Anchors.");
return;
}
Player player = (Player) sender;
if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) {
sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!");
} else {
sender.sendMessage("Anchor '" + args.get(0) + "' was " + ChatColor.RED + " NOT " + ChatColor.WHITE + "created!");
}
}
@Override
protected List<String> getFilteredItems(List<String> availableItems, String filter) {
List<String> filtered = new ArrayList<String>();
for (String s : availableItems) {
if (s.matches("(?i).*" + filter + ".*")) {
filtered.add(s);
}
}
return filtered;
}
@Override
protected String getItemText(String item) {
return item;
}
}
@@ -0,0 +1,57 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
import com.onarandombox.MultiverseCore.utils.MVPermissions;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Checks to see if a player can go to a destination.
*/
public class CheckCommand extends MultiverseCommand {
public CheckCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Help you validate your multiverse settings");
this.setCommandUsage("/mv check " + ChatColor.GREEN + "{PLAYER} {DESTINATION}");
this.setArgRange(2, 2);
this.addKey("mv check");
this.addKey("mvcheck");
this.addCommandExample("/mv check " + ChatColor.GREEN + "fernferret " + ChatColor.LIGHT_PURPLE + "w:MyWorld");
this.addCommandExample("/mv check " + ChatColor.GREEN + "Rigby90 " + ChatColor.LIGHT_PURPLE + "p:MyPortal");
this.addCommandExample("/mv check " + ChatColor.GREEN + "lithium3141 " + ChatColor.LIGHT_PURPLE + "ow:WarpName");
this.setPermission("multiverse.core.debug", "Checks to see if a player can go to a destination. Prints debug if false.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Player p = this.plugin.getServer().getPlayer(args.get(0));
if (p == null) {
sender.sendMessage("Could not find player " + ChatColor.GREEN + args.get(0));
sender.sendMessage("Are they online?");
return;
}
MVDestination dest = this.plugin.getDestFactory().getDestination(args.get(1));
if (dest instanceof InvalidDestination) {
sender.sendMessage(String.format("You asked if '%s' could go to %s%s%s,",
args.get(0), ChatColor.GREEN, args.get(0), ChatColor.WHITE));
sender.sendMessage("but I couldn't find a Destination of that name? Did you type it correctly?");
return;
}
MVPermissions perms = this.plugin.getMVPerms();
perms.tellMeWhyICantDoThis(sender, p, dest);
}
}
@@ -0,0 +1,72 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
import java.util.Map;
/**
* Allows you to set Global MV Variables.
*/
public class ConfigCommand extends MultiverseCommand {
public ConfigCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Configuration");
this.setCommandUsage("/mv config " + ChatColor.GREEN + "{PROPERTY} {VALUE}");
this.setArgRange(1, 2);
this.addKey("mv config");
this.addKey("mvconfig");
this.addKey("mv conf");
this.addKey("mvconf");
this.addCommandExample("/mv config show");
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() <= 1) {
StringBuilder builder = new StringBuilder();
Map<String, Object> serializedConfig = this.plugin.getMVConfig().serialize();
for (Map.Entry<String, Object> entry : serializedConfig.entrySet()) {
builder.append(ChatColor.GREEN);
builder.append(entry.getKey());
builder.append(ChatColor.WHITE).append(" = ").append(ChatColor.GOLD);
builder.append(entry.getValue().toString());
builder.append(ChatColor.WHITE).append(", ");
}
String message = builder.toString();
message = message.substring(0, message.length() - 2);
sender.sendMessage(message);
return;
}
if (!this.plugin.getMVConfig().setConfigProperty(args.get(0).toLowerCase(), args.get(1))) {
sender.sendMessage(String.format("%sSetting '%s' to '%s' failed!", ChatColor.RED, args.get(0).toLowerCase(), args.get(1)));
return;
}
// special rule
if (args.get(0).equalsIgnoreCase("firstspawnworld")) {
// Don't forget to set the world!
this.plugin.getMVWorldManager().setFirstSpawnWorld(args.get(1));
}
if (this.plugin.saveMVConfigs()) {
sender.sendMessage(ChatColor.GREEN + "SUCCESS!" + ChatColor.WHITE + " Values were updated successfully!");
this.plugin.loadConfigs();
} else {
sender.sendMessage(ChatColor.RED + "FAIL!" + ChatColor.WHITE + " Check your console for details!");
}
}
}
@@ -0,0 +1,39 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Confirms actions.
*/
public class ConfirmCommand extends MultiverseCommand {
public ConfirmCommand(MultiverseCore plugin) {
super(plugin);
// Any command that is dangerous should require op
this.setName("Confirms a command that could destroy life, the universe and everything.");
this.setCommandUsage("/mv confirm");
this.setArgRange(0, 0);
this.addKey("mvconfirm");
this.addKey("mv confirm");
this.addCommandExample("/mv confirm");
this.setPermission("multiverse.core.confirm", "If you have not been prompted to use this, it will not do anything.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
this.plugin.getCommandHandler().confirmQueuedCommand(sender);
}
}
@@ -0,0 +1,70 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.text.DecimalFormat;
import java.util.List;
/**
* Returns detailed information on the Players where abouts.
*/
public class CoordCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public CoordCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Coordinates");
this.setCommandUsage("/mv coord");
this.setArgRange(0, 0);
this.addKey("mv coord");
this.addKey("mvcoord");
this.addKey("mvco");
this.addCommandExample("/mv coord");
this.setPermission("multiverse.core.coord", "Returns detailed information on the Players where abouts.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
if (sender instanceof Player) {
Player p = (Player) sender;
World world = p.getWorld();
if (!this.worldManager.isMVWorld(world.getName())) {
this.plugin.showNotMVWorldMessage(sender, world.getName());
return;
}
MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName());
p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());
p.sendMessage(ChatColor.AQUA + "Alias: " + mvworld.getColoredWorldString());
p.sendMessage(ChatColor.AQUA + "World Scale: " + ChatColor.WHITE + mvworld.getScaling());
DecimalFormat df = new DecimalFormat();
df.setMinimumFractionDigits(0);
df.setMaximumFractionDigits(2);
p.sendMessage(ChatColor.AQUA + "Coordinates: " + ChatColor.WHITE + plugin.getLocationManipulation().strCoords(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Direction: " + ChatColor.WHITE + plugin.getLocationManipulation().getDirection(p.getLocation()));
p.sendMessage(ChatColor.AQUA + "Block: " + ChatColor.WHITE + Material.getMaterial(world.getBlockTypeIdAt(p.getLocation())));
} else {
sender.sendMessage("This command needs to be used from a Player.");
}
}
}
@@ -0,0 +1,100 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.WorldType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.io.File;
import java.util.List;
/**
* Creates a new world and loads it.
*/
public class CreateCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public CreateCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create World");
this.setCommandUsage(String.format("/mv create %s{NAME} {ENV} %s-s [SEED] -g [GENERATOR[:ID]] -t [WORLDTYPE] [-n] -a [true|false]",
ChatColor.GREEN, ChatColor.GOLD));
this.setArgRange(2, 11); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.addKey("mvcreate");
this.addKey("mvc");
this.addKey("mv create");
this.setPermission("multiverse.core.create", "Creates a new world and loads it.", PermissionDefault.OP);
this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " end");
this.addCommandExample("/mv create " + ChatColor.GOLD + "flatroom" + ChatColor.GREEN + " normal" + ChatColor.AQUA + " -t flat");
this.addCommandExample("/mv create " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -s gargamel");
this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
String env = args.get(1);
String seed = CommandHandler.getFlag("-s", args);
String generator = CommandHandler.getFlag("-g", args);
boolean allowStructures = true;
String structureString = CommandHandler.getFlag("-a", args);
if (structureString != null) {
allowStructures = Boolean.parseBoolean(structureString);
}
String typeString = CommandHandler.getFlag("-t", args);
boolean useSpawnAdjust = true;
for (String s : args) {
if (s.equalsIgnoreCase("-n")) {
useSpawnAdjust = false;
}
}
if (worldFile.exists() || this.worldManager.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 = EnvironmentCommand.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
// If they didn't specify a type, default to NORMAL
if (typeString == null) {
typeString = "NORMAL";
}
WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString);
if (type == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid World Type.");
EnvironmentCommand.showWorldTypes(sender);
return;
}
Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'...");
if (this.worldManager.addWorld(worldName, environment, seed, type, allowStructures, generator, useSpawnAdjust)) {
Command.broadcastCommandMessage(sender, "Complete!");
} else {
Command.broadcastCommandMessage(sender, "FAILED.");
}
}
}
@@ -0,0 +1,65 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
import java.util.logging.Level;
/**
* Enables debug-information.
*/
public class DebugCommand extends MultiverseCommand {
public DebugCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Turn Debug on/off?");
this.setCommandUsage("/mv debug" + ChatColor.GOLD + " [1|2|3|off]");
this.setArgRange(0, 1);
this.addKey("mv debug");
this.addKey("mv d");
this.addKey("mvdebug");
this.addCommandExample("/mv debug " + ChatColor.GOLD + "2");
this.setPermission("multiverse.core.debug", "Spams the console a bunch.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (args.size() == 1) {
if (args.get(0).equalsIgnoreCase("off")) {
plugin.getMVConfig().setGlobalDebug(0);
} else {
try {
int debugLevel = Integer.parseInt(args.get(0));
if (debugLevel > 3 || debugLevel < 0) {
throw new NumberFormatException();
}
plugin.getMVConfig().setGlobalDebug(debugLevel);
} catch (NumberFormatException e) {
sender.sendMessage(ChatColor.RED + "Error" + ChatColor.WHITE
+ " setting debug level. Please use a number 0-3 " + ChatColor.AQUA + "(3 being many many messages!)");
}
}
}
this.displayDebugMode(sender);
}
private void displayDebugMode(CommandSender sender) {
if (plugin.getMVConfig().getGlobalDebug() == 0) {
sender.sendMessage("Multiverse Debug mode is " + ChatColor.RED + "OFF");
} else {
sender.sendMessage("Multiverse Debug mode is " + ChatColor.GREEN + plugin.getMVConfig().getGlobalDebug());
this.plugin.log(Level.FINE, "Multiverse Debug ENABLED");
}
}
}
@@ -0,0 +1,41 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Deletes worlds.
*/
public class DeleteCommand extends MultiverseCommand {
public DeleteCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Delete World");
this.setCommandUsage("/mv delete" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvdelete");
this.addKey("mv delete");
this.addCommandExample("/mv create " + ChatColor.GOLD + "MyWorld");
this.setPermission("multiverse.core.delete", "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Class<?>[] paramTypes = {String.class};
List<Object> objectArgs = new ArrayList<Object>(args);
this.plugin.getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", objectArgs,
paramTypes, ChatColor.GREEN + "World Deleted!", ChatColor.RED + "World could NOT be deleted!");
}
}
@@ -0,0 +1,113 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Lists valid known environments.
*/
public class EnvironmentCommand extends MultiverseCommand {
public EnvironmentCommand(MultiverseCore plugin) {
super(plugin);
this.setName("List Environments");
this.setCommandUsage("/mv env");
this.setArgRange(0, 0);
this.addKey("mvenv");
this.addKey("mv env");
this.addKey("mv type");
this.addKey("mv environment");
this.addKey("mv environments");
this.addCommandExample("/mv env");
this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP);
}
/**
* Shows all valid known environments to a {@link CommandSender}.
*
* @param sender The {@link CommandSender}.
*/
public static void showEnvironments(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
sender.sendMessage(ChatColor.GREEN + "NORMAL");
sender.sendMessage(ChatColor.RED + "NETHER");
sender.sendMessage(ChatColor.AQUA + "END");
}
/**
* Shows all valid known world types to a {@link CommandSender}.
*
* @param sender The {@link CommandSender}.
*/
public static void showWorldTypes(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "Valid World Types are:");
sender.sendMessage(String.format("%sNORMAL%s, %sFLAT %sor %sVERSION_1_1",
ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, ChatColor.WHITE, ChatColor.GOLD));
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
EnvironmentCommand.showEnvironments(sender);
EnvironmentCommand.showWorldTypes(sender);
}
/**
* Converts a {@link String} into a {@link WorldType}.
*
* @param type The WorldType as a {@link String}
* @return The WorldType as a {@link WorldType}
*/
public static WorldType getWorldTypeFromString(String type) {
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
if (type.equalsIgnoreCase("normal"))
type = "NORMAL";
if (type.equalsIgnoreCase("flat"))
type = "FLAT";
try {
// Now that we've converted a potentially unfriendly value
// to a friendly one, get it from the ENUM!
return WorldType.valueOf(type);
} catch (IllegalArgumentException e) {
return null;
}
}
/**
* Converts a {@link String} into an {@link org.bukkit.World.Environment}.
*
* @param env The environment as {@link String}
* @return The environment as {@link org.bukkit.World.Environment}
*/
public static World.Environment getEnvFromString(String env) {
env = env.toUpperCase();
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
if (env.equalsIgnoreCase("HELL") || env.equalsIgnoreCase("NETHER"))
env = "NETHER";
if (env.equalsIgnoreCase("END") || env.equalsIgnoreCase("THEEND") || env.equalsIgnoreCase("STARWARS"))
env = "THE_END";
if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD"))
env = "NORMAL";
try {
// Now that we've converted a potentially unfriendly value
// to a friendly one, get it from the ENUM!
return World.Environment.valueOf(env);
} catch (IllegalArgumentException e) {
return null;
}
}
}
@@ -0,0 +1,60 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
/**
* Returns a list of loaded generator plugins.
*/
public class GeneratorCommand extends MultiverseCommand {
public GeneratorCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Information");
this.setCommandUsage("/mv generators");
this.setArgRange(0, 0);
this.addKey("mv generators");
this.addKey("mvgenerators");
this.addKey("mv gens");
this.addKey("mvgens");
this.addCommandExample("/mv generators");
this.setPermission("multiverse.core.generator", "Returns a list of Loaded Generator Plugins.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
this.plugin.log(Level.INFO, "PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
Plugin[] plugins = this.plugin.getServer().getPluginManager().getPlugins();
List<String> generators = new ArrayList<String>();
for (Plugin p : plugins) {
if (p.isEnabled() && p.getDefaultWorldGenerator("world", "") != null) {
generators.add(p.getDescription().getName());
}
}
sender.sendMessage(ChatColor.AQUA + "--- Loaded Generator Plugins ---");
String loadedGens = "";
boolean altColor = false;
for (String s : generators) {
loadedGens += (altColor ? ChatColor.YELLOW : ChatColor.WHITE) + s + " ";
altColor = !altColor;
}
if (loadedGens.length() == 0) {
loadedGens = ChatColor.RED + "No Generator Plugins found.";
}
sender.sendMessage(loadedGens);
}
}
@@ -0,0 +1,106 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Displays a nice help menu.
*/
public class HelpCommand extends PaginatedCoreCommand<Command> {
public HelpCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Get Help with Multiverse");
this.setCommandUsage("/mv " + ChatColor.GOLD + "[FILTER] [PAGE #]");
this.setArgRange(0, 2);
this.addKey("mv");
this.addKey("mvh");
this.addKey("mvhelp");
this.addKey("mv help");
this.addKey("mvsearch");
this.addKey("mv search");
this.addCommandExample("/mv help ?");
this.setPermission("multiverse.help", "Displays a nice help menu.", PermissionDefault.TRUE);
this.setItemsPerPage(7); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
@Override
protected List<Command> getFilteredItems(List<Command> availableItems, String filter) {
List<Command> filtered = new ArrayList<Command>();
for (Command c : availableItems) {
if (stitchThisString(c.getKeyStrings()).matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandName().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandDesc().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else if (c.getCommandUsage().matches("(?i).*" + filter + ".*")) {
filtered.add(c);
} else {
for (String example : c.getCommandExamples()) {
if (example.matches("(?i).*" + filter + ".*")) {
filtered.add(c);
break;
}
}
}
}
return filtered;
}
@Override
protected String getItemText(Command item) {
return ChatColor.AQUA + item.getCommandUsage();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
FilterObject filterObject = this.getPageAndFilter(args);
List<Command> availableCommands = new ArrayList<Command>(this.plugin.getCommandHandler().getCommands(sender));
if (filterObject.getFilter().length() > 0) {
availableCommands = this.getFilteredItems(availableCommands, filterObject.getFilter());
if (availableCommands.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No commands matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
}
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
for (Command c : availableCommands) {
sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
}
return;
}
int totalPages = (int) Math.ceil(availableCommands.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
this.showPage(filterObject.getPage(), sender, availableCommands);
}
}
@@ -0,0 +1,162 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Imports a new world of the specified type.
*/
public class ImportCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ImportCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Import World");
this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -g [GENERATOR[:ID]] [-n]");
this.setArgRange(1, 5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.addKey("mvimport");
this.addKey("mvim");
this.addKey("mv import");
this.addCommandExample("/mv import " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv import " + ChatColor.GOLD + "hell_world" + ChatColor.GREEN + " nether");
this.addCommandExample("To import a world that uses a generator, you'll need the generator:");
this.addCommandExample("/mv import " + ChatColor.GOLD + "CleanRoom" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " CleanRoomGenerator");
this.setPermission("multiverse.core.import", "Imports a new world of the specified type.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
/**
* A very basic check to see if a folder has a level.dat file.
* If it does, we can safely assume it's a world folder.
*
* @param worldFolder The File that may be a world.
* @return True if it looks like a world, false if not.
*/
private static boolean checkIfIsWorld(File worldFolder) {
if (worldFolder.isDirectory()) {
File[] files = worldFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String name) {
return name.equalsIgnoreCase("level.dat");
}
});
if (files != null && files.length > 0) {
return true;
}
}
return false;
}
private String getPotentialWorlds() {
File worldFolder = this.plugin.getServer().getWorldContainer();
if (worldFolder == null) {
return "";
}
File[] files = worldFolder.listFiles();
String worldList = "";
Collection<MultiverseWorld> worlds = this.worldManager.getMVWorlds();
List<String> worldStrings = new ArrayList<String>();
for (MultiverseWorld world : worlds) {
worldStrings.add(world.getName());
}
for (String world : this.worldManager.getUnloadedWorlds()) {
worldStrings.add(world);
}
ChatColor currColor = ChatColor.WHITE;
for (File file : files) {
if (file.isDirectory() && checkIfIsWorld(file) && !worldStrings.contains(file.getName())) {
worldList += currColor + file.getName() + " ";
if (currColor == ChatColor.WHITE) {
currColor = ChatColor.YELLOW;
} else {
currColor = ChatColor.WHITE;
}
}
}
return worldList;
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) {
String worldList = this.getPotentialWorlds();
if (worldList.length() > 2) {
sender.sendMessage(ChatColor.AQUA + "====[ These look like worlds ]====");
sender.sendMessage(worldList);
} else {
sender.sendMessage(ChatColor.RED + "No potential worlds found. Sorry!");
}
return;
}
// Since we made an exception for the list, we have to make sure they have at least 2 params:
// Note the exception is --list, which is covered above.
if (args.size() == 1) {
this.showHelp(sender);
return;
}
// Make sure we don't already know about this world.
if (this.worldManager.isMVWorld(worldName)) {
sender.sendMessage(ChatColor.GREEN + "Multiverse" + ChatColor.WHITE
+ " already knows about '" + ChatColor.AQUA + worldName + ChatColor.WHITE + "'!");
return;
}
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
String generator = CommandHandler.getFlag("-g", args);
boolean useSpawnAdjust = true;
for (String s : args) {
if (s.equalsIgnoreCase("-n")) {
useSpawnAdjust = false;
}
}
String env = args.get(1);
Environment environment = EnvironmentCommand.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
if (worldFile.exists() && env != null) {
Command.broadcastCommandMessage(sender, String.format("Starting import of world '%s'...", worldName));
if (this.worldManager.addWorld(worldName, environment, null, null, null, generator, useSpawnAdjust))
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Complete!");
else
Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!");
} else if (env == null) {
sender.sendMessage(ChatColor.RED + "FAILED.");
sender.sendMessage("That world environment did not exist.");
sender.sendMessage("For a list of available world types, type: " + ChatColor.AQUA + "/mvenv");
} else {
sender.sendMessage(ChatColor.RED + "FAILED.");
String worldList = this.getPotentialWorlds();
sender.sendMessage("That world folder does not exist. These look like worlds to me:");
sender.sendMessage(worldList);
}
}
}
@@ -0,0 +1,266 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.FancyText;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.utils.FancyColorScheme;
import com.onarandombox.MultiverseCore.utils.FancyHeader;
import com.onarandombox.MultiverseCore.utils.FancyMessage;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
// Will use when we can compile with JDK 6
//import com.sun.xml.internal.ws.util.StringUtils;
/**
* Returns detailed information about a world.
*/
public class InfoCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public InfoCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Information");
this.setCommandUsage("/mv info" + ChatColor.GOLD + " [WORLD] [PAGE]");
this.setArgRange(0, 2);
this.addKey("mvinfo");
this.addKey("mvi");
this.addKey("mv info");
this.addCommandExample("/mv info " + ChatColor.GOLD + "1");
this.addCommandExample("/mv info " + ChatColor.GOLD + "3");
this.setPermission("multiverse.core.info", "Returns detailed information on the world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Check if the command was sent from a Player.
String worldName = "";
int pageNum = 0;
if (args.size() == 0) {
if (sender instanceof Player) {
Player p = (Player) sender;
worldName = p.getWorld().getName();
} else {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
} else if (args.size() == 1) {
if (this.worldManager.isMVWorld(args.get(0))) {
// then we have a world!
worldName = args.get(0);
} else if (this.worldManager.getUnloadedWorlds().contains(args.get(0))) {
sender.sendMessage("That world exists, but it is unloaded!");
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, args.get(0)));
return;
} else {
if (sender instanceof Player) {
Player p = (Player) sender;
worldName = p.getWorld().getName();
try {
pageNum = Integer.parseInt(args.get(0)) - 1;
} catch (NumberFormatException e) {
sender.sendMessage("That world does not exist.");
return;
}
} else {
sender.sendMessage("You must enter a" + ChatColor.LIGHT_PURPLE + " world" + ChatColor.WHITE + " from the console!");
return;
}
}
} else if (args.size() == 2) {
worldName = args.get(0);
try {
pageNum = Integer.parseInt(args.get(1)) - 1;
} catch (NumberFormatException e) {
pageNum = 0;
}
}
if (this.worldManager.isMVWorld(worldName)) {
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
showPage(pageNum, sender, this.buildEntireCommand(this.worldManager.getMVWorld(worldName), p));
} else if (this.worldManager.getUnloadedWorlds().contains(worldName)) {
sender.sendMessage("That world exists, but it is unloaded!");
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, worldName));
} else if (this.plugin.getServer().getWorld(worldName) != null) {
sender.sendMessage("That world exists, but Multiverse does not know about it!");
sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
}
}
private List<List<FancyText>> buildEntireCommand(MultiverseWorld world, Player p) {
List<FancyText> message = new ArrayList<FancyText>();
List<List<FancyText>> worldInfo = new ArrayList<List<FancyText>>();
// Page 1
FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
message.add(new FancyHeader("General Info", colors));
message.add(new FancyMessage("World Name: ", world.getName(), colors));
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
message.add(new FancyMessage("Game Mode: ", world.getGameMode().toString(), colors));
message.add(new FancyMessage("Difficulty: ", world.getDifficulty().toString(), colors));
//message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors));
Location spawn = world.getSpawnLocation();
message.add(new FancyMessage("Spawn Location: ", plugin.getLocationManipulation().strCoords(spawn), colors));
message.add(new FancyMessage("World Scale: ", world.getScaling() + "", colors));
if (world.getPrice() > 0) {
message.add(new FancyMessage("Price to enter this world: ",
this.plugin.getBank().getFormattedAmount(p, world.getPrice(), world.getCurrency()), colors));
} else {
message.add(new FancyMessage("Price to enter this world: ", ChatColor.GREEN + "FREE!", colors));
}
if (world.getRespawnToWorld() != null) {
MultiverseWorld respawn = this.worldManager.getMVWorld(world.getRespawnToWorld());
if (respawn != null) {
message.add(new FancyMessage("Players will respawn in: ", respawn.getColoredWorldString(), colors));
} else {
message.add(new FancyMessage("Players will respawn in: ", ChatColor.RED + "!!INVALID!!", colors));
}
}
worldInfo.add(message);
// Page 2
message = new ArrayList<FancyText>();
message.add(new FancyHeader("More World Settings", colors));
message.add(new FancyMessage("World Type: ", world.getWorldType().toString(), colors));
message.add(new FancyMessage("Structures: ", world.getCBWorld().canGenerateStructures() + "", colors));
message.add(new FancyMessage("Weather: ", world.isWeatherEnabled() + "", colors));
message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
message.add(new FancyMessage("Keep spawn in memory: ", world.isKeepingSpawnInMemory() + "", colors));
message.add(new FancyHeader("PVP Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.isPVPEnabled() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
worldInfo.add(message);
// Page 3
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Monster Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canMonstersSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT "
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
} else {
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
}
} else {
message.add(new FancyMessage("Monsters that CAN spawn: ", world.canMonstersSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
// Page 4
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Animal Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canAnimalsSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT "
+ ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
} else {
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
}
} else {
message.add(new FancyMessage("Animals that CAN spawn: ", world.canAnimalsSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);
return worldInfo;
}
private static String toCommaSeperated(List<String> list) {
if (list == null || list.size() == 0) {
return "";
}
if (list.size() == 1) {
return list.get(0);
}
String result = list.get(0);
for (int i = 1; i < list.size() - 1; i++) {
result += ", " + list.get(i);
}
result += " and " + list.get(list.size() - 1);
return result;
}
/**
* Gets a "positive" or "negative" {@link ChatColor}.
*
* @param positive Whether this {@link ChatColor} should be "positive".
* @return The {@link ChatColor}.
*/
protected ChatColor getChatColor(boolean positive) {
return positive ? ChatColor.GREEN : ChatColor.RED;
}
private static void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
page = page < 0 ? 0 : page;
page = page > doc.size() - 1 ? doc.size() - 1 : page;
boolean altColor = false;
boolean appendedPageNum = false;
if (sender instanceof Player) {
List<FancyText> list = doc.get(page);
for (FancyText fancyT : list) {
if (fancyT instanceof FancyMessage) {
FancyMessage text = (FancyMessage) fancyT;
text.setAltColor(altColor);
altColor = !altColor;
sender.sendMessage(text.getFancyText());
} else if (fancyT instanceof FancyHeader) {
FancyHeader text = (FancyHeader) fancyT;
if (!appendedPageNum) {
text.appendText(ChatColor.DARK_PURPLE + " [ Page " + (page + 1) + " of " + doc.size() + " ]");
appendedPageNum = true;
}
sender.sendMessage(text.getFancyText());
altColor = false;
}
}
} else {
for (List<FancyText> list : doc) {
for (FancyText fancyT : list) {
if (fancyT instanceof FancyMessage) {
FancyMessage text = (FancyMessage) fancyT;
text.setAltColor(altColor);
altColor = !altColor;
sender.sendMessage(text.getFancyText());
} else {
FancyText text = fancyT;
if (appendedPageNum) {
sender.sendMessage(" ");
} else {
appendedPageNum = true;
}
sender.sendMessage(text.getFancyText());
altColor = false;
}
}
}
}
}
}
@@ -0,0 +1,130 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Displays a listing of all worlds that a player can enter.
*/
public class ListCommand extends PaginatedCoreCommand<String> {
public ListCommand(MultiverseCore plugin) {
super(plugin);
this.setName("World Listing");
this.setCommandUsage("/mv list");
this.setArgRange(0, 2);
this.addKey("mvlist");
this.addKey("mvl");
this.addKey("mv list");
this.setPermission("multiverse.core.list.worlds", "Displays a listing of all worlds that you can enter.", PermissionDefault.OP);
this.setItemsPerPage(8); // SUPPRESS CHECKSTYLE: MagicNumberCheck
}
private List<String> getFancyWorldList(Player p) {
List<String> worldList = new ArrayList<String>();
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
continue;
}
ChatColor color = ChatColor.GOLD;
Environment env = world.getEnvironment();
if (env == Environment.NETHER) {
color = ChatColor.RED;
} else if (env == Environment.NORMAL) {
color = ChatColor.GREEN;
} else if (env == Environment.THE_END) {
color = ChatColor.AQUA;
}
StringBuilder builder = new StringBuilder();
builder.append(world.getColoredWorldString()).append(ChatColor.WHITE);
builder.append(" - ").append(color).append(world.getEnvironment());
if (world.isHidden()) {
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.core.modify", true)) {
// Prefix hidden worlds with an "[H]"
worldList.add(ChatColor.GRAY + "[H]" + builder.toString());
}
} else {
worldList.add(builder.toString());
}
}
for (String name : this.plugin.getMVWorldManager().getUnloadedWorlds()) {
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.access." + name, true)) {
worldList.add(ChatColor.GRAY + name + " - UNLOADED");
}
}
return worldList;
}
@Override
protected List<String> getFilteredItems(List<String> availableItems, String filter) {
List<String> filtered = new ArrayList<String>();
for (String s : availableItems) {
if (s.matches("(?i).*" + filter + ".*")) {
filtered.add(s);
}
}
return filtered;
}
@Override
protected String getItemText(String item) {
return item;
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.LIGHT_PURPLE + "====[ Multiverse World List ]====");
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
FilterObject filterObject = this.getPageAndFilter(args);
List<String> availableWorlds = new ArrayList<String>(this.getFancyWorldList(p));
if (filterObject.getFilter().length() > 0) {
availableWorlds = this.getFilteredItems(availableWorlds, filterObject.getFilter());
if (availableWorlds.size() == 0) {
sender.sendMessage(ChatColor.RED + "Sorry... " + ChatColor.WHITE
+ "No worlds matched your filter: " + ChatColor.AQUA + filterObject.getFilter());
return;
}
}
if (!(sender instanceof Player)) {
for (String c : availableWorlds) {
sender.sendMessage(c);
}
return;
}
int totalPages = (int) Math.ceil(availableWorlds.size() / (this.itemsPerPage + 0.0));
if (filterObject.getPage() > totalPages) {
filterObject.setPage(totalPages);
}
sender.sendMessage(ChatColor.AQUA + " Page " + filterObject.getPage() + " of " + totalPages);
this.showPage(filterObject.getPage(), sender, availableWorlds);
}
}
@@ -0,0 +1,42 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Loads a world into Multiverse.
*/
public class LoadCommand extends MultiverseCommand {
public LoadCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Load World");
this.setCommandUsage("/mv load" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvload");
this.addKey("mv load");
this.addCommandExample("/mv load " + ChatColor.GREEN + "MyUnloadedWorld");
this.setPermission("multiverse.core.load", "Loads a world into Multiverse.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.getMVWorldManager().loadWorld(args.get(0))) {
Command.broadcastCommandMessage(sender, "Loaded world '" + args.get(0) + "'!");
} else {
sender.sendMessage("Error trying to load world '" + args.get(0) + "'!");
}
}
}
@@ -0,0 +1,92 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
// This will contain all the properties that support the ADD/REMOVE
// Anything not in here will only support the SET action
/**
* Used to modify various aspects of worlds.
*/
public class ModifyAddCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyAddCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Add a value)");
this.setCommandUsage("/mv modify " + ChatColor.GREEN + "add {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
this.setArgRange(2, 3);
this.addKey("mvm add");
this.addKey("mvmadd");
this.addKey("mv modify add");
this.addKey("mvmodify add");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "add " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.add", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Add, property)) {
sender.sendMessage("Sorry, you can't ADD to " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
return;
}
// TODO fix this
if (world.addToVariable(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA
+ value + ChatColor.WHITE + " was " + ChatColor.GREEN + "added to " + ChatColor.GREEN + property);
} else {
sender.sendMessage(value + " could not be added to " + property);
}
}
}
@@ -0,0 +1,89 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Removes all values from a world-property.
*/
public class ModifyClearCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyClearCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Clear a property)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " clear {PROPERTY}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(1, 2);
this.addKey("mvm clear");
this.addKey("mvmclear");
this.addKey("mv modify clear");
this.addKey("mvmodify clear");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "clear " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.clear",
"Removes all values from a property. This will work on properties that contain lists.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 1 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String property = args.get(0);
if (args.size() == 1) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(1));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Clear, property)) {
sender.sendMessage("Sorry, you can't use CLEAR with " + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/cgB2B");
return;
}
// TODO fix this
if (world.clearList(property)) {
sender.sendMessage(property + " was cleared. It contains 0 values now.");
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + property + ChatColor.WHITE + " was "
+ ChatColor.GREEN + "CLEARED" + ChatColor.WHITE + ". It contains " + ChatColor.LIGHT_PURPLE + "0" + ChatColor.WHITE + " values now.");
} else {
sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GOLD + property
+ ChatColor.WHITE + " was " + ChatColor.GOLD + "NOT" + ChatColor.WHITE + " cleared.");
}
}
}
@@ -0,0 +1,76 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.enums.Action;
import com.onarandombox.MultiverseCore.enums.AddProperties;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Used to modify various aspects of worlds.
*/
public class ModifyCommand extends MultiverseCommand {
public ModifyCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " {set|add|remove|clear} ...");
this.setArgRange(2, 3);
this.addKey("mvm");
this.addKey("mvmodify");
this.addKey("mv modify");
Map<String, Boolean> children = new HashMap<String, Boolean>();
children.put("multiverse.core.modify.add", true);
children.put("multiverse.core.modify.modify", true);
children.put("multiverse.core.modify.clear", true);
children.put("multiverse.core.modify.remove", true);
Permission modify = new Permission("multiverse.core.modify",
"Modify various aspects of worlds. It requires add/set/clear/remove. See the examples below", PermissionDefault.OP, children);
this.addCommandExample(ChatColor.AQUA + "/mv modify set ?");
this.addCommandExample(ChatColor.GREEN + "/mv modify add ?");
this.addCommandExample(ChatColor.BLUE + "/mv modify clear ?");
this.addCommandExample(ChatColor.RED + "/mv modify remove ?");
this.setPermission(modify);
}
/**
* Validates the specified action.
*
* @param action The {@link Action}.
* @param property The property.
* @return Whether this action is valid.
*/
protected static boolean validateAction(Action action, String property) {
if (action != Action.Set) {
try {
AddProperties.valueOf(property);
return true;
} catch (IllegalArgumentException e) {
return false;
}
}
return false;
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// This is just a place holder. The real commands are in:
// ModifyAddCommand
// ModifyRemoveCommand
// ModifySetCommand
// ModifyClearCommand
}
}
@@ -0,0 +1,94 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.Action;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Removes values from a world-property.
*/
public class ModifyRemoveCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifyRemoveCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Remove a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " remove {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(2, 3);
this.addKey("mvm remove");
this.addKey("mvmremove");
this.addKey("mv modify remove");
this.addKey("mvmodify remove");
this.addKey("mvm delete");
this.addKey("mvmdelete");
this.addKey("mv modify delete");
this.addKey("mvmodify delete");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "sheep " + ChatColor.RED + "animals");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "creeper " + ChatColor.RED + "monsters");
this.addCommandExample("/mvm " + ChatColor.GOLD + "remove " + ChatColor.GREEN + "MyWorld " + ChatColor.RED + "worldblacklist");
this.setPermission("multiverse.core.modify.remove", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String value = args.get(0);
String property = args.get(1);
if (args.size() == 2) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if (!ModifyCommand.validateAction(Action.Remove, property)) {
sender.sendMessage("Sorry, you can't REMOVE anything from" + property);
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
return;
}
// TODO fix this
if (world.removeFromVariable(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + value + ChatColor.WHITE
+ " was " + ChatColor.RED + "removed from " + ChatColor.GREEN + property);
} else {
sender.sendMessage(ChatColor.RED + "There was an error removing " + ChatColor.GRAY
+ value + ChatColor.WHITE + " from " + ChatColor.GOLD + property);
}
}
}
@@ -0,0 +1,122 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Used to set world-properties.
*/
public class ModifySetCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public ModifySetCommand(MultiverseCore plugin) {
super(plugin);
this.worldManager = this.plugin.getMVWorldManager();
this.setName("Modify a World (Set a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(1, 3);
this.addKey("mvm set");
this.addKey("mvmset");
this.addKey("mv modify set");
this.addKey("mvmodify set");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "mode " + ChatColor.RED + "creative");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "animals " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "monsters " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "alias " + ChatColor.RED + "MyWorld");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "color " + ChatColor.RED + "green");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "curr " + ChatColor.RED + "3");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "price " + ChatColor.RED + "5");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "scale " + ChatColor.RED + "1.2");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "memory " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "diff " + ChatColor.RED + "hard");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hunger " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "hidden " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "pvp " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "heal " + ChatColor.RED + "true");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "adjustspawn " + ChatColor.RED + "false");
this.addCommandExample("/mvm " + ChatColor.GOLD + "set " + ChatColor.GREEN + "spawn");
this.setPermission("multiverse.core.modify.set", "Modify various aspects of worlds. See the help wiki for how to use this command properly. "
+ "If you do not include a world, the current world will be used.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
// Special case for spawn:
if (args.size() == 1) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to set the" + ChatColor.GREEN + " spawn");
return;
}
if (args.get(0).equalsIgnoreCase("spawn")) {
SetSpawnCommand c = new SetSpawnCommand(this.plugin);
c.setWorldSpawn(sender);
} else {
sender.sendMessage("Spawn is the only param with no" + ChatColor.GREEN + " VALUE");
sender.sendMessage("Type " + ChatColor.GREEN + "/mv modify ?" + ChatColor.WHITE + " For help.");
}
return;
}
// We NEED a world from the command line
Player p = null;
if (sender instanceof Player) {
p = (Player) sender;
}
if (args.size() == 2 && p == null) {
sender.sendMessage("From the command line, WORLD is required.");
sender.sendMessage(this.getCommandDesc());
sender.sendMessage(this.getCommandUsage());
sender.sendMessage("Nothing changed.");
return;
}
MultiverseWorld world;
String value = args.get(1);
String property = args.get(0);
if (args.size() == 2) {
world = this.worldManager.getMVWorld(p.getWorld().getName());
} else {
world = this.worldManager.getMVWorld(args.get(2));
}
if (world == null) {
sender.sendMessage("That world does not exist!");
return;
}
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !EnglishChatColor.isValidAliasColor(value)) {
sender.sendMessage(value + " is not a valid color. Please pick one of the following:");
sender.sendMessage(EnglishChatColor.getAllColors());
return;
}
try {
if (world.setPropertyValue(property, value)) {
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property
+ ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
} else {
sender.sendMessage(ChatColor.RED + world.getPropertyHelp(property));
}
} catch (PropertyDoesNotExistException e) {
sender.sendMessage(ChatColor.RED + "Sorry, You can't set: '" + ChatColor.GRAY + property + ChatColor.RED + "'");
sender.sendMessage("Valid world-properties: " + world.getAllPropertyNames());
}
}
}
@@ -0,0 +1,40 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseMessaging;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
* A generic Multiverse-command.
*/
public abstract class MultiverseCommand extends Command {
/**
* The reference to the core.
*/
protected MultiverseCore plugin;
/**
* The reference to {@link MultiverseMessaging}.
*/
protected MultiverseMessaging messaging;
public MultiverseCommand(MultiverseCore plugin) {
super(plugin);
this.plugin = plugin;
this.messaging = this.plugin.getMessaging();
}
@Override
public abstract void runCommand(CommandSender sender, List<String> args);
}
@@ -0,0 +1,164 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* A generic paginated command.
* @param <T> The type of items on the page.
*/
public abstract class PaginatedCommand<T> extends Command {
private static final int DEFAULT_ITEMS_PER_PAGE = 9;
/**
* The number of items per page.
*/
protected int itemsPerPage = DEFAULT_ITEMS_PER_PAGE;
public PaginatedCommand(JavaPlugin plugin) {
super(plugin);
}
/**
* Set the number of items per page.
*
* @param items The new number of items per page.
*/
protected void setItemsPerPage(int items) {
itemsPerPage = items;
}
/**
* Gets filtered items.
* @param availableItems All available items.
* @param filter The filter-{@link String}.
* @return A list of items that match the filter.
*/
protected abstract List<T> getFilteredItems(List<T> availableItems, String filter);
/**
* Constructs a single string from a list of strings.
*
* @param list The {@link List} of strings.
* @return A single {@link String}.
*/
protected String stitchThisString(List<String> list) {
StringBuilder builder = new StringBuilder();
for (String s : list) {
builder.append(s);
builder.append(' ');
}
return builder.toString();
}
/**
* Shows a page.
*
* @param page The number of the page to show.
* @param sender The {@link CommandSender} that wants to see the page.
* @param cmds The items that should be displayed on the page.
*/
protected void showPage(int page, CommandSender sender, List<T> cmds) {
// Ensure the page is at least 1.
page = (page <= 0) ? 1 : page;
int start = (page - 1) * itemsPerPage;
int end = start + itemsPerPage;
for (int i = start; i < end; i++) {
// For consistancy, print some extra lines if it's a player:
if (i < cmds.size()) {
sender.sendMessage(this.getItemText(cmds.get(i)));
} else if (sender instanceof Player) {
sender.sendMessage(" ");
}
}
}
/**
* Converts an item into a string.
*
* @param item The item.
* @return A {@link String}.
*/
protected abstract String getItemText(T item);
/**
* Constructs a {@link FilterObject} from a {@link List} of arguments.
*
* @param args The {@link List} of arguments.
* @return The {@link FilterObject}.
*/
protected FilterObject getPageAndFilter(List<String> args) {
int page = 1;
String filter = "";
if (args.size() == 0) {
filter = "";
page = 1;
} else if (args.size() == 1) {
try {
page = Integer.parseInt(args.get(0));
} catch (NumberFormatException ex) {
filter = args.get(0);
page = 1;
}
} else if (args.size() == 2) {
filter = args.get(0);
try {
page = Integer.parseInt(args.get(1));
} catch (NumberFormatException ex) {
page = 1;
}
}
return new FilterObject(page, filter);
}
/**
* "Key-Object" containing information about the page and the filter that were requested.
*/
protected class FilterObject {
private Integer page;
private String filter;
public FilterObject(Integer page, String filter) {
this.page = page;
this.filter = filter;
}
/**
* Gets the page.
* @return The page.
*/
public Integer getPage() {
return this.page;
}
/**
* Sets the page.
*
* @param page The new page.
*/
public void setPage(int page) {
this.page = page;
}
/**
* Gets the filter.
* @return The filter.
*/
public String getFilter() {
return this.filter;
}
}
}
@@ -0,0 +1,26 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
/**
* A generic paginated Multiverse-command.
* @param <T> The type of items on the page.
*/
public abstract class PaginatedCoreCommand<T> extends PaginatedCommand<T> {
/**
* The reference to the core.
*/
protected MultiverseCore plugin;
public PaginatedCoreCommand(MultiverseCore plugin) {
super(plugin);
this.plugin = plugin;
}
}
@@ -0,0 +1,92 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.api.WorldPurger;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Removes a type of mob from a world.
*/
public class PurgeCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public PurgeCommand(MultiverseCore plugin) {
super(plugin);
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.addCommandExample("/mv purge " + ChatColor.GREEN + "all");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "all " + ChatColor.GREEN + "all");
this.addCommandExample("/mv purge " + ChatColor.GREEN + "monsters");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "all " + ChatColor.GREEN + "animals");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "MyWorld " + ChatColor.GREEN + "squid");
this.addCommandExample("/mv purge " + ChatColor.GOLD + "MyWorld_nether " + ChatColor.GREEN + "ghast");
this.setPermission("multiverse.core.purge", "Removed the specified type of mob from the specified world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
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.worldManager.isMVWorld(worldName)) {
this.plugin.showNotMVWorldMessage(sender, worldName);
sender.sendMessage("It cannot be purged.");
return;
}
List<MultiverseWorld> worldsToRemoveEntitiesFrom = new ArrayList<MultiverseWorld>();
// Handle all case any user who names a world "all" should know better...
if (worldName.equalsIgnoreCase("all")) {
worldsToRemoveEntitiesFrom.addAll(this.worldManager.getMVWorlds());
} else {
worldsToRemoveEntitiesFrom.add(this.worldManager.getMVWorld(worldName));
}
WorldPurger purger = this.worldManager.getTheWorldPurger();
ArrayList<String> thingsToKill = new ArrayList<String>();
if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
thingsToKill.add(deathName.toUpperCase());
} else {
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
}
for (MultiverseWorld w : worldsToRemoveEntitiesFrom) {
purger.purgeWorld(w, thingsToKill, false, false, sender);
}
}
}
@@ -0,0 +1,53 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Regenerates a world.
*/
public class RegenCommand extends MultiverseCommand {
public RegenCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Regenerates a World");
this.setCommandUsage("/mv regen" + ChatColor.GREEN + " {WORLD}" + ChatColor.GOLD + " [-s [SEED]]");
this.setArgRange(1, 3);
this.addKey("mvregen");
this.addKey("mv regen");
this.addCommandExample("You can use the -s with no args to get a new seed:");
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s");
this.addCommandExample("or specifiy a seed to get that one:");
this.addCommandExample("/mv regen " + ChatColor.GREEN + "MyWorld" + ChatColor.GOLD + " -s" + ChatColor.AQUA + " gargamel");
this.setPermission("multiverse.core.regen", "Regenerates a world on your server. The previous state will be lost "
+ ChatColor.RED + "PERMANENTLY.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
Boolean useseed = (!(args.size() == 1));
Boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s"));
String seed = (args.size() == 3) ? args.get(2) : "";
Class<?>[] paramTypes = {String.class, Boolean.class, Boolean.class, String.class};
List<Object> objectArgs = new ArrayList<Object>();
objectArgs.add(args.get(0));
objectArgs.add(useseed);
objectArgs.add(randomseed);
objectArgs.add(seed);
this.plugin.getCommandHandler().queueCommand(sender, "mvregen", "regenWorld", objectArgs,
paramTypes, ChatColor.GREEN + "World Regenerated!", ChatColor.RED + "World could NOT be regenerated!");
}
}
@@ -0,0 +1,57 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
/**
* Reloads worlds.yml and config.yml.
*/
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.addCommandExample("/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.getAnchorManager().loadAnchors();
this.plugin.getMVWorldManager().loadWorlds(true);
List<String> configsLoaded = new ArrayList<String>();
configsLoaded.add("Multiverse-Core - config.yml");
configsLoaded.add("Multiverse-Core - worlds.yml");
configsLoaded.add("Multiverse-Core - anchors.yml");
// Create the event
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
// Fire it off
this.plugin.getServer().getPluginManager().callEvent(configReload);
for (String s : configReload.getAllConfigsLoaded()) {
sender.sendMessage(s);
}
sender.sendMessage(ChatColor.GREEN + "Reload Complete!");
}
}
@@ -0,0 +1,42 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Unloads a world and removes it from the config.
*/
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.addCommandExample("/mv remove " + ChatColor.GREEN + "MyWorld");
this.setPermission("multiverse.core.remove",
"Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (this.plugin.getMVWorldManager().removeWorldFromConfig(args.get(0))) {
sender.sendMessage("World removed from config!");
} else {
sender.sendMessage("Error trying to remove world from config!");
}
}
}
@@ -0,0 +1,76 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.BlockSafety;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Sets the spawn for a world.
*/
public class SetSpawnCommand extends MultiverseCommand {
public SetSpawnCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Set World Spawn");
this.setCommandUsage("/mv setspawn");
this.setArgRange(0, 0);
this.addKey("mvsetspawn");
this.addKey("mvss");
this.addKey("mv set spawn");
this.addKey("mv setspawn");
this.addKey("mvset spawn");
this.addCommandExample("/mv set spawn");
this.setPermission("multiverse.core.spawn.set", "Sets the spawn for the current world.", PermissionDefault.OP);
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
setWorldSpawn(sender);
}
/**
* Does the actual spawn-setting-work.
*
* @param sender The {@link CommandSender} that's setting the spawn.
*/
protected void setWorldSpawn(CommandSender sender) {
if (sender instanceof Player) {
Player p = (Player) sender;
Location l = p.getLocation();
World w = p.getWorld();
MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName());
if (foundWorld != null) {
foundWorld.setSpawnLocation(p.getLocation());
BlockSafety bs = this.plugin.getBlockSafety();
if (!bs.playerCanSpawnHereSafely(p.getLocation()) && foundWorld.getAdjustSpawn()) {
sender.sendMessage("It looks like that location would normally be unsafe. But I trust you.");
sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world.");
sender.sendMessage("If you want this turned back on just do:");
sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias());
foundWorld.setAdjustSpawn(false);
}
sender.sendMessage("Spawn was set to: " + plugin.getLocationManipulation().strCoords(p.getLocation()));
} else {
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");
}
} else {
sender.sendMessage("You cannot use this command from the console.");
}
}
}
@@ -0,0 +1,42 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Takes the player to the latest bed he's slept in.
*/
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;
}
}
}
@@ -0,0 +1,90 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Teleports a player to the spawn.
*/
public class SpawnCommand extends MultiverseCommand {
public SpawnCommand(MultiverseCore plugin) {
super(plugin);
Permission otherPerm = new Permission("multiverse.core.spawn.other",
"Teleports another player to the spawn of the world they are in.", PermissionDefault.OP);
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.getMVPerms().hasPermission(player, "multiverse.core.spawn.other", true)) {
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.core.spawn.other)");
return;
}
Player target = this.plugin.getServer().getPlayer(args.get(0));
if (target != null) {
target.sendMessage("Teleporting to this world's spawn...");
spawnAccurately(target);
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.getMVPerms().hasPermission(player, "multiverse.core.spawn.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.core.spawn.self)");
return;
}
if (player != null) {
player.sendMessage("Teleporting to this world's spawn...");
spawnAccurately(player);
} else {
sender.sendMessage("From the console, you must provide a PLAYER.");
}
}
}
private void spawnAccurately(Player player) {
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(player.getWorld().getName());
Location spawnLocation;
if (world != null) {
spawnLocation = world.getSpawnLocation();
} else {
spawnLocation = player.getWorld().getSpawnLocation();
}
this.plugin.getSafeTTeleporter().safelyTeleport(player, player, spawnLocation, false);
}
}
@@ -0,0 +1,66 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
/*
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import org.getspout.spoutapi.gui.GenericButton;
import org.getspout.spoutapi.gui.GenericPopup;
import org.getspout.spoutapi.gui.PopupScreen;
import org.getspout.spoutapi.player.SpoutPlayer;
import java.util.List;
/**
* Edit a world with spout.
* /
public class SpoutCommand extends MultiverseCommand {
public SpoutCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Edit World with Spout");
this.setCommandUsage("/mv spout");
this.setArgRange(0, 0);
this.addKey("mv spout");
this.setPermission("multiverse.core.spout", "Edit a world with spout.", PermissionDefault.OP);
this.addCommandExample("/mv spout");
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "This command must be run as a player!");
return;
}
if (plugin.getSpout() == null) {
sender.sendMessage(ChatColor.RED + "You need spout installed on this server to use it with Multiverse!");
return;
}
SpoutPlayer p = (SpoutPlayer) sender;
if (!p.isSpoutCraftEnabled()) {
sender.sendMessage(ChatColor.RED + p.getName() + "You need to be using the Spoutcraft client to run this command!");
return;
}
PopupScreen pop = new GenericPopup();
GenericButton button = new GenericButton("Fish");
// TO-DO maybe use constants for these
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
button.setX(50);
button.setY(50);
button.setWidth(100);
button.setHeight(40);
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
pop.attachWidget(this.plugin, button);
sender.sendMessage(ChatColor.GREEN + "YAY!");
p.getMainScreen().attachPopupScreen(pop);
}
}
*/
@@ -0,0 +1,203 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
import com.onarandombox.MultiverseCore.destination.InvalidDestination;
import com.onarandombox.MultiverseCore.destination.WorldDestination;
import com.onarandombox.MultiverseCore.enums.TeleportResult;
import com.onarandombox.MultiverseCore.event.MVTeleportEvent;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
/**
* Used to teleport players.
*/
public class TeleportCommand extends MultiverseCommand {
private SafeTTeleporter playerTeleporter;
public TeleportCommand(MultiverseCore plugin) {
super(plugin);
Permission menu = new Permission("multiverse.teleport.*", "Allows you to display the teleport menu.", PermissionDefault.OP);
this.setName("Teleport");
this.setCommandUsage("/mv tp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 2);
this.addKey("mvtp");
this.addKey("mv tp");
this.playerTeleporter = this.plugin.getSafeTTeleporter();
this.setPermission(menu);
}
private static final int UNSAFE_TELEPORT_EXPIRE_DELAY = 15;
@Override
public void runCommand(CommandSender sender, List<String> args) {
CommandSender teleporter = sender;
Player teleportee = null;
String destinationName;
if (args.size() == 2) {
teleportee = this.plugin.getServer().getPlayer(args.get(0));
if (teleportee == null) {
this.messaging.sendMessage(sender, String.format("Sorry, I couldn't find player: %s%s",
ChatColor.GOLD, args.get(0)), false);
return;
}
destinationName = args.get(1);
} else {
destinationName = args.get(0);
if (!(sender instanceof Player)) {
this.messaging.sendMessage(sender, String.format("From the console, you must specify a player to teleport"), false);
return;
}
teleportee = (Player) sender;
}
// Special case for cannons:
if (destinationName.matches("(?i)cannon-[\\d]+(\\.[\\d]+)?")) {
String[] cannonSpeed = destinationName.split("-");
try {
double speed = Double.parseDouble(cannonSpeed[1]);
destinationName = "ca:" + teleportee.getWorld().getName() + ":" + teleportee.getLocation().getX()
+ "," + teleportee.getLocation().getY() + "," + teleportee.getLocation().getZ() + ":"
+ teleportee.getLocation().getPitch() + ":" + teleportee.getLocation().getYaw() + ":" + speed;
} catch (Exception e) {
destinationName = "i:invalid";
}
}
DestinationFactory df = this.plugin.getDestFactory();
MVDestination d = df.getDestination(destinationName);
MVTeleportEvent teleportEvent = new MVTeleportEvent(d, teleportee, teleporter, true);
this.plugin.getServer().getPluginManager().callEvent(teleportEvent);
if (teleportEvent.isCancelled()) {
this.plugin.log(Level.FINE, "Someone else cancelled the MVTeleport Event!!!");
return;
}
if (d != null && d instanceof InvalidDestination) {
this.messaging.sendMessage(sender, String.format("Multiverse does not know how to take you to %s%s",
ChatColor.RED, destinationName), false);
return;
}
if (!this.checkSendPermissions(teleporter, teleportee, d)) {
return;
}
if (plugin.getMVConfig().getEnforceAccess() && teleporter != null && !this.plugin.getMVPerms().canEnterDestination(teleporter, d)) {
if (teleportee.equals(teleporter)) {
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
} else {
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD
+ teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
}
return;
} else if (teleporter != null && !this.plugin.getMVPerms().canTravelFromLocation(teleporter, d.getLocation(teleportee))) {
if (teleportee.equals(teleporter)) {
this.messaging.sendMessage(teleporter, String.format("DOH! Doesn't look like you can get to %s%s %sfrom where you are...",
ChatColor.GREEN, d.toString(), ChatColor.WHITE), false);
} else {
this.messaging.sendMessage(teleporter, String.format("DOH! Doesn't look like %s%s %scan get to %sTHERE from where they are...",
ChatColor.GREEN, ((Player) teleporter).getWorld().getName(), ChatColor.WHITE, ChatColor.RED), false);
}
return;
}
// Special check to verify if players are tryint to teleport to the same
// WORLDDestination as the world they're in, that they ALSO have multiverse.core.spawn.self
if (d instanceof WorldDestination) {
World w = d.getLocation(teleportee).getWorld();
if (teleportee.getWorld().equals(w)) {
if (teleporter.equals(teleportee)) {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.core.spawn.self", true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("Sorry you don't have permission to go to the world spawn!"),
String.format("%s (multiverse.core.spawn.self)",
ChatColor.RED) }, false);
return;
}
} else {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.core.spawn.other", true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("Sorry you don't have permission to send %s to the world spawn!",
teleportee.getDisplayName()),
String.format("%s (multiverse.core.spawn.other)",
ChatColor.RED) }, false);
return;
}
}
}
}
if (d.getLocation(teleportee) == null) {
this.messaging.sendMessage(teleporter, "Sorry Boss, I tried everything, but just couldn't teleport ya there!", false);
return;
}
TeleportResult result = this.playerTeleporter.safelyTeleport(teleporter, teleportee, d);
if (result == TeleportResult.FAIL_UNSAFE) {
this.plugin.log(Level.FINE, "Could not teleport " + teleportee.getName()
+ " to " + plugin.getLocationManipulation().strCoordsRaw(d.getLocation(teleportee)));
this.plugin.log(Level.FINE, "Queueing Command");
Class<?>[] paramTypes = { CommandSender.class, Player.class, Location.class };
List<Object> items = new ArrayList<Object>();
items.add(teleporter);
items.add(teleportee);
items.add(d.getLocation(teleportee));
String player = "you";
if (!teleportee.equals(teleporter)) {
player = teleportee.getName();
}
String message = String.format("%sMultiverse %sdid not teleport %s%s%sto %s%s%sbecause it was unsafe.",
ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA, player, ChatColor.WHITE, ChatColor.DARK_AQUA, d.getName(), ChatColor.WHITE);
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items,
paramTypes, message, "Would you like to try anyway?", "", "", UNSAFE_TELEPORT_EXPIRE_DELAY);
}
// else: Player was teleported successfully (or the tp event was fired I should say)
}
private boolean checkSendPermissions(CommandSender teleporter, Player teleportee, MVDestination destination) {
if (teleporter.equals(teleportee)) {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.self." + destination.getIdentifier(), true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("%sYou don't have permission to teleport %syourself %sto a %s%s %sDestination",
ChatColor.WHITE, ChatColor.AQUA, ChatColor.WHITE, ChatColor.RED, destination.getType(), ChatColor.WHITE),
String.format("%s (multiverse.teleport.self.%s)",
ChatColor.RED, destination.getIdentifier()) }, false);
return false;
}
} else {
if (!this.plugin.getMVPerms().hasPermission(teleporter, "multiverse.teleport.other." + destination.getIdentifier(), true)) {
this.messaging.sendMessages(teleporter, new String[]{
String.format("You don't have permission to teleport another player to a %s%s Destination.",
ChatColor.GREEN, destination.getType()),
String.format("%s(multiverse.teleport.other.%s)",
ChatColor.RED, destination.getIdentifier()) }, false);
return false;
}
}
return true;
}
}
@@ -0,0 +1,42 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* Unloads worlds from Multiverse.
*/
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.getMVWorldManager().unloadWorld(args.get(0))) {
Command.broadcastCommandMessage(sender, "Unloaded world '" + args.get(0) + "'!");
} else {
sender.sendMessage("Error trying to unload world '" + args.get(0) + "'!");
}
}
}
@@ -0,0 +1,118 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
import com.onarandombox.MultiverseCore.utils.webpaste.BitlyURLShortener;
import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
import com.onarandombox.MultiverseCore.utils.webpaste.PasteService;
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceFactory;
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceType;
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortener;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
import java.util.logging.Level;
/**
* Dumps version info to the console.
*/
public class VersionCommand extends MultiverseCommand {
private static final URLShortener SHORTENER = new BitlyURLShortener();
public VersionCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Multiverse Version");
this.setCommandUsage("/mv version " + ChatColor.GOLD + "-[pb]");
this.setArgRange(0, 1);
this.addKey("mv version");
this.addKey("mvv");
this.addKey("mvversion");
this.setPermission("multiverse.core.version",
"Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
}
@Override
public void runCommand(final CommandSender sender, final List<String> args) {
// Check if the command was sent from a Player.
if (sender instanceof Player) {
sender.sendMessage("Version info dumped to console. Please check your server logs.");
}
StringBuilder buffer = new StringBuilder();
buffer.append("[Multiverse-Core] Multiverse-Core Version: ").append(this.plugin.getDescription().getVersion()).append('\n');
buffer.append("[Multiverse-Core] Bukkit Version: ").append(this.plugin.getServer().getVersion()).append('\n');
buffer.append("[Multiverse-Core] Loaded Worlds: ").append(this.plugin.getMVWorldManager().getMVWorlds().size()).append('\n');
buffer.append("[Multiverse-Core] Multiverse Plugins Loaded: ").append(this.plugin.getPluginCount()).append('\n');
buffer.append("[Multiverse-Core] Economy being used: ").append(this.plugin.getBank().getEconUsed()).append('\n');
buffer.append("[Multiverse-Core] Permissions Plugin: ").append(this.plugin.getMVPerms().getType()).append('\n');
buffer.append("[Multiverse-Core] Dumping Config Values: (version ")
.append(this.plugin.getMVConfig().getVersion()).append(")").append('\n');
buffer.append("[Multiverse-Core] messagecooldown: ").append(plugin.getMessaging().getCooldown()).append('\n');
buffer.append("[Multiverse-Core] teleportcooldown: ").append(plugin.getMVConfig().getTeleportCooldown()).append('\n');
buffer.append("[Multiverse-Core] worldnameprefix: ").append(plugin.getMVConfig().getPrefixChat()).append('\n');
buffer.append("[Multiverse-Core] enforceaccess: ").append(plugin.getMVConfig().getEnforceAccess()).append('\n');
buffer.append("[Multiverse-Core] displaypermerrors: ").append(plugin.getMVConfig().getDisplayPermErrors()).append('\n');
buffer.append("[Multiverse-Core] teleportintercept: ").append(plugin.getMVConfig().getTeleportIntercept()).append('\n');
buffer.append("[Multiverse-Core] firstspawnoverride: ").append(plugin.getMVConfig().getFirstSpawnOverride()).append('\n');
buffer.append("[Multiverse-Core] firstspawnworld: ").append(plugin.getMVConfig().getFirstSpawnWorld()).append('\n');
buffer.append("[Multiverse-Core] debug: ").append(plugin.getMVConfig().getGlobalDebug()).append('\n');
buffer.append("[Multiverse-Core] Special Code: FRN002").append('\n');
MVVersionEvent versionEvent = new MVVersionEvent(buffer.toString());
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
// log to console
final String data = versionEvent.getVersionInfo();
String[] lines = data.split("\n");
for (String line : lines) {
this.plugin.log(Level.INFO, line);
}
this.plugin.getServer().getScheduler().scheduleAsyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
if (args.size() == 1) {
String pasteUrl;
if (args.get(0).equalsIgnoreCase("-p")) {
pasteUrl = postToService(PasteServiceType.PASTIE, true, data); // private post to pastie
} else if (args.get(0).equalsIgnoreCase("-b")) {
pasteUrl = postToService(PasteServiceType.PASTEBIN, true, data); // private post to pastie
} else {
return;
}
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
plugin.log(Level.INFO, "Version info dumped here: " + pasteUrl);
}
}
});
}
/**
* Send the current contents of this.pasteBinBuffer to a web service.
*
* @param type Service type to send to
* @param isPrivate Should the paste be marked as private.
* @return URL of visible paste
*/
private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData) {
PasteService ps = PasteServiceFactory.getService(type, isPrivate);
try {
return SHORTENER.shorten(ps.postData(ps.encodeData(pasteData), ps.getPostURL()));
} catch (PasteFailedException e) {
System.out.print(e);
return "Error posting to service";
}
}
}
@@ -0,0 +1,106 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import java.util.List;
/**
* States who is in what world.
*/
public class WhoCommand extends MultiverseCommand {
private MVWorldManager worldManager;
public WhoCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Who?");
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD|--all]");
this.setArgRange(0, 1);
this.addKey("mv who");
this.addKey("mvw");
this.addKey("mvwho");
this.addCommandExample("/mv who");
this.addCommandExample(String.format("/mv who %s--all", ChatColor.GREEN));
this.addCommandExample(String.format("/mv who %smyworld", ChatColor.GOLD));
this.setPermission("multiverse.core.list.who", "States who is in what world.", PermissionDefault.OP);
this.worldManager = this.plugin.getMVWorldManager();
}
@Override
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;
}
if (args.size() == 1) {
if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
showAll = true;
} else {
// single world mode
MultiverseWorld world = this.worldManager.getMVWorld(args.get(0));
if (world == null) {
sender.sendMessage(ChatColor.RED + "That world does not exist.");
return;
}
if (!this.plugin.getMVPerms().canEnterWorld(p, world)) {
sender.sendMessage(ChatColor.RED + "You aren't allowed to access to this world!");
return;
}
sender.sendMessage(String.format("%s--- Players in %s%s ---", ChatColor.AQUA,
world.getColoredWorldString(), ChatColor.AQUA));
sender.sendMessage(buildPlayerString(world));
return;
}
}
// multiworld mode
sender.sendMessage(ChatColor.AQUA + "--- Worlds and their players ---");
boolean shownOne = false;
for (MultiverseWorld world : this.worldManager.getMVWorlds()) {
if (this.plugin.getMVPerms().canEnterWorld(p, world)) { // only show world if the player can access it
if (showAll || !world.getCBWorld().getPlayers().isEmpty()) { // either show all or show if the world is not empty
sender.sendMessage(String.format("%s%s - %s", world.getColoredWorldString(), ChatColor.WHITE, buildPlayerString(world)));
shownOne = true;
}
}
}
if (!shownOne) {
sender.sendMessage("No worlds found.");
}
return;
}
private static String buildPlayerString(MultiverseWorld world) {
List<Player> players = world.getCBWorld().getPlayers();
if (players.size() == 0) {
return "No players found.";
} else {
StringBuilder playerBuilder = new StringBuilder();
for (Player player : players) {
playerBuilder.append(player.getDisplayName()).append(", ");
}
String bString = playerBuilder.toString();
return bString.substring(0, bString.length() - 2);
}
}
}
@@ -0,0 +1,4 @@
/**
* This package contains all Commands.
*/
package com.onarandombox.MultiverseCore.commands;
@@ -0,0 +1,66 @@
package com.onarandombox.MultiverseCore.configuration;
import java.util.Map;
import me.main__.util.SerializationConfig.Property;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.configuration.serialization.SerializableAs;
/**
* Entryfee-settings.
*/
@SerializableAs("MVEntryFee")
public class EntryFee extends SerializationConfig {
@Property
private double amount;
@Property
private int currency;
public EntryFee() {
super();
}
public EntryFee(Map<String, Object> values) {
super(values);
}
/**
* {@inheritDoc}
*/
@Override
protected void setDefaults() {
amount = 0D;
currency = -1;
}
/**
* @return the amount
*/
public double getAmount() {
return amount;
}
/**
* @return the currency
*/
public int getCurrency() {
return currency;
}
/**
* Sets the amount.
* @param amount The new value.
*/
public void setAmount(double amount) {
this.amount = amount;
}
/**
* Sets the currency.
* @param currency The new value.
*/
public void setCurrency(int currency) {
this.currency = currency;
}
}
@@ -0,0 +1,37 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.configuration;
/**
* An "active" {@link MVConfigProperty} that uses the specified method to be "actually" set.
* @param <T> The type of the config-property.
* @deprecated This is deprecated.
* @see MVConfigProperty
*/
@Deprecated
public interface MVActiveConfigProperty<T> extends MVConfigProperty<T> {
/**
* Gets the method that will be executed.
*
* @return The name of the method in MVWorld to be called.
*/
String getMethod();
/**
* Sets the method that will be executed.
*
* @param methodName The name of the method in MVWorld to be called.
*/
void setMethod(String methodName);
/**
* Returns the class of the object we're looking at.
* @return the class of the object we're looking at.
*/
Class<?> getPropertyClass();
}
@@ -0,0 +1,69 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.configuration;
/**
* A generic config-property.
*
* @param <T> The type of the config-property.
* @deprecated This is deprecated.
*/
@Deprecated
public interface MVConfigProperty<T> {
/**
* Gets the name of this property.
*
* @return The name of this property.
*/
String getName();
/**
* Gets the value of this property.
*
* @return The value of this property.
*/
T getValue();
/**
* Gets the string representation of this value.
*
* @return The value of this property as a string.
*/
String toString();
/**
* Gets the help string for this.
*
* @return The value of this property as a string.
*/
String getHelp();
/**
* Sets the value of this property.
*
* @param value The T representation of this value.
* @return True the value was successfully set.
*/
boolean setValue(T value);
/**
* This parseValue should be used with strings.
*
* @param value The string representation of the value to set.
*
* @return True if the value was set, false if not.
*/
boolean parseValue(String value);
/**
* Gets the name of the config-node that this {@link MVConfigProperty} is saved as.
*
* @return The name of the config-node that this {@link MVConfigProperty} is saved as.
*/
String getConfigNode();
}
@@ -0,0 +1,98 @@
package com.onarandombox.MultiverseCore.configuration;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs;
/**
* Just like a regular {@link Location}, however {@code world} is usually {@code null}
* or just a weak reference and it implements {@link ConfigurationSerializable}.
*/
@SerializableAs("MVSpawnLocation")
public class SpawnLocation extends Location implements ConfigurationSerializable {
private Reference<World> worldRef;
public SpawnLocation(double x, double y, double z) {
super(null, x, y, z);
}
public SpawnLocation(double x, double y, double z, float yaw, float pitch) {
super(null, x, y, z, yaw, pitch);
}
public SpawnLocation(Location loc) {
this(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
}
/**
* {@inheritDoc}
*/
@Override
public World getWorld() {
return (this.worldRef != null) ? this.worldRef.get() : null;
}
/**
* {@inheritDoc}
*/
@Override
public void setWorld(World world) {
this.worldRef = new WeakReference<World>(world);
}
/**
* {@inheritDoc}
*/
@Override
public Chunk getChunk() {
if ((this.worldRef != null) && (this.worldRef.get() != null))
return this.worldRef.get().getChunkAt(this);
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Block getBlock() {
if ((this.worldRef != null) && (this.worldRef.get() != null))
return this.worldRef.get().getBlockAt(this);
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Map<String, Object> serialize() {
Map<String, Object> serialized = new HashMap<String, Object>(5); // SUPPRESS CHECKSTYLE: MagicNumberCheck
serialized.put("x", this.getX());
serialized.put("y", this.getY());
serialized.put("z", this.getZ());
serialized.put("pitch", this.getPitch());
serialized.put("yaw", this.getYaw());
return serialized;
}
/**
* Let Bukkit be able to deserialize this.
* @param args The map.
* @return The deserialized object.
*/
public static SpawnLocation deserialize(Map<String, Object> args) {
double x = ((Number) args.get("x")).doubleValue();
double y = ((Number) args.get("y")).doubleValue();
double z = ((Number) args.get("z")).doubleValue();
float pitch = ((Number) args.get("pitch")).floatValue();
float yaw = ((Number) args.get("yaw")).floatValue();
return new SpawnLocation(x, y, z, yaw, pitch);
}
}
@@ -0,0 +1,50 @@
package com.onarandombox.MultiverseCore.configuration;
import java.util.Map;
import me.main__.util.SerializationConfig.Property;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.configuration.serialization.SerializableAs;
/**
* Spawning-Settings.
*/
@SerializableAs("MVSpawnSettings")
public class SpawnSettings extends SerializationConfig {
@Property
private SubSpawnSettings animals;
@Property
private SubSpawnSettings monsters;
public SpawnSettings() {
super();
}
public SpawnSettings(Map<String, Object> values) {
super(values);
}
/**
* {@inheritDoc}
*/
@Override
public void setDefaults() {
animals = new SubSpawnSettings();
monsters = new SubSpawnSettings();
}
/**
* @return the animal-settings
*/
public SubSpawnSettings getAnimalSettings() {
return animals;
}
/**
* @return the monster-settings
*/
public SubSpawnSettings getMonsterSettings() {
return monsters;
}
}
@@ -0,0 +1,59 @@
package com.onarandombox.MultiverseCore.configuration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import me.main__.util.SerializationConfig.Property;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.configuration.serialization.SerializableAs;
/**
* SpawnSubSettings.
*/
@SerializableAs("MVSpawnSubSettings")
public class SubSpawnSettings extends SerializationConfig {
@Property
private boolean spawn;
@Property
private List<String> exceptions;
public SubSpawnSettings() {
super();
}
public SubSpawnSettings(Map<String, Object> values) {
super(values);
}
/**
* {@inheritDoc}
*/
@Override
public void setDefaults() {
spawn = true;
exceptions = new ArrayList<String>();
}
/**
* @return spawn
*/
public boolean doSpawn() {
return spawn;
}
/**
* @param spawn The new value.
*/
public void setSpawn(boolean spawn) {
this.spawn = spawn;
}
/**
* @return the exceptions
*/
public List<String> getExceptions() {
return exceptions;
}
}
@@ -0,0 +1,27 @@
package com.onarandombox.MultiverseCore.configuration;
import org.bukkit.Bukkit;
import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.event.MVWorldPropertyChangeEvent;
import me.main__.util.SerializationConfig.ChangeDeniedException;
import me.main__.util.SerializationConfig.ObjectUsingValidator;
/**
* Validates world-property-changes.
* @param <T> The type of the property that should be validated.
*/
public class WorldPropertyValidator<T> extends ObjectUsingValidator<T, MVWorld> {
/**
* {@inheritDoc}
*/
@Override
public T validateChange(String property, T newValue, T oldValue, MVWorld object) throws ChangeDeniedException {
MVWorldPropertyChangeEvent<T> event = new MVWorldPropertyChangeEvent<T>(object, null, property, newValue);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
throw new ChangeDeniedException();
return event.getTheNewValue();
}
}
@@ -0,0 +1,4 @@
/**
* This package contains the Multiverse-configuration.
*/
package com.onarandombox.MultiverseCore.configuration;
@@ -0,0 +1,148 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.util.Arrays;
import java.util.List;
/**
* An anchor-{@link MVDestination}.
*/
public class AnchorDestination implements MVDestination {
private boolean isValid;
private Location location;
private MultiverseCore plugin;
private String name;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "a";
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
this.plugin = (MultiverseCore) plugin;
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: a:name
if (!(parsed.size() == 2)) {
return false;
}
// If it's not an Anchor type
return parsed.get(0).equalsIgnoreCase("a");
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return this.location;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
this.plugin = (MultiverseCore) plugin;
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 2)) {
this.isValid = false;
return;
}
this.name = parsed.get(1);
this.location = this.plugin.getAnchorManager().getAnchorLocation(parsed.get(1));
if (this.location == null) {
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) {
this.isValid = false;
}
this.isValid = true;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Anchor";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Anchor: " + this.name;
}
@Override
public String toString() {
if (isValid) {
return "a:" + this.name;
}
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
// This is an ANCHOR destination, don't safely teleport here.
return false;
}
}
@@ -0,0 +1,119 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A bed-{@link MVDestination}.
*/
public class BedDestination implements MVDestination {
private boolean isValid;
private Location knownBedLoc;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "b";
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
String[] split = destination.split(":");
this.isValid = split.length >= 1 && split.length <= 2 && split[0].equals(this.getIdentifier());
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity entity) {
if (entity instanceof Player) {
this.knownBedLoc = ((Player) entity).getBedSpawnLocation();
return this.knownBedLoc;
}
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector();
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
// Not needed.
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Bed";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Bed";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
if (knownBedLoc != null) {
return "multiverse.access." + knownBedLoc.getWorld().getName();
}
return "";
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
// Bukkit should have already checked this.
return false;
}
@Override
public String toString() {
return "b:playerbed";
}
}
@@ -0,0 +1,227 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.util.Arrays;
import java.util.List;
/**
* A cannon-{@link MVDestination}.
*/
public class CannonDestination implements MVDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
private double speed;
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
double pitchRadians = Math.toRadians(location.getPitch());
double yawRadians = Math.toRadians(location.getYaw());
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);
}
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "ca";
}
// NEED ca:world:x,y,z:pitch:yaw:speed
// so basically 6
private static final int SPLIT_SIZE = 6;
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
List<String> parsed = Arrays.asList(destination.split(":"));
if (parsed.size() != SPLIT_SIZE) {
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).getMVWorldManager().isMVWorld(parsed.get(1))) {
return false;
}
// Verify X,Y,Z are numbers
if (!parsed.get(2).matches(coordRegex)) {
return false;
}
try {
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
Float.parseFloat(parsed.get(3));
Float.parseFloat(parsed.get(4));
Float.parseFloat(parsed.get(5));
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
} catch (NumberFormatException e) {
return false;
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return this.location;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
List<String> parsed = Arrays.asList(destination.split(":"));
if (parsed.size() != SPLIT_SIZE) {
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) {
this.isValid = false;
return;
}
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
this.isValid = false;
return;
}
this.location = new Location(((MultiverseCore) plugin).getMVWorldManager().getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
if (!parsed.get(2).matches(this.coordRegex)) {
this.isValid = false;
return;
}
double[] coords = new double[3];
String[] coordString = parsed.get(2).split(",");
for (int i = 0; i < 3; i++) {
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 {
// BEGIN CHECKSTYLE-SUPPRESSION: MagicNumberCheck
this.location.setPitch(Float.parseFloat(parsed.get(3)));
this.location.setYaw(Float.parseFloat(parsed.get(4)));
this.speed = Math.abs(Float.parseFloat(parsed.get(5)));
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
this.isValid = true;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Cannon!";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Cannon (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":"
+ this.location.getPitch() + ":" + this.location.getYaw() + ":" + this.speed + ")";
}
/**
* Sets this {@link CannonDestination}.
*
* @param location The {@link Location}.
* @param speed The speed.
*/
public void setDestination(Location location, double speed) {
if (location != null) {
this.location = location;
this.speed = Math.abs(speed);
this.isValid = true;
}
this.isValid = false;
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
return false;
}
@Override
public String toString() {
if (isValid) {
return "ca:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
}
return "i:Invalid Destination";
}
}
@@ -0,0 +1,104 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
import com.onarandombox.MultiverseCore.utils.PermissionTools;
import com.pneumaticraft.commandhandler.Command;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** A factory class that will create destinations from specific strings. */
public class DestinationFactory {
private MultiverseCore plugin;
private Map<String, Class<? extends MVDestination>> destList;
private Command teleportCommand;
public DestinationFactory(MultiverseCore plugin) {
this.plugin = plugin;
this.destList = new HashMap<String, Class<? extends MVDestination>>();
List<Command> cmds = this.plugin.getCommandHandler().getAllCommands();
for (Command c : cmds) {
if (c instanceof TeleportCommand) {
this.teleportCommand = c;
}
}
}
/**
* Gets a new destination from a string.
* Returns a new InvalidDestination if the string could not be parsed.
*
* @param destination The destination in string format.
*
* @return A non-null MVDestination
*/
public MVDestination getDestination(String destination) {
String idenChar = "";
if (destination.split(":").length > 1) {
idenChar = destination.split(":")[0];
}
if (this.destList.containsKey(idenChar)) {
Class<? extends MVDestination> myClass = this.destList.get(idenChar);
try {
MVDestination mydest = myClass.newInstance();
if (!mydest.isThisType(this.plugin, destination)) {
return new InvalidDestination();
}
mydest.setDestination(this.plugin, destination);
return mydest;
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
return new InvalidDestination();
}
/**
* Registers a {@link MVDestination}.
*
* @param c The {@link Class} of the {@link MVDestination} to register.
* @param identifier The {@link String}-identifier.
* @return True if the class was successfully registered.
*/
public boolean registerDestinationType(Class<? extends MVDestination> c, String identifier) {
if (this.destList.containsKey(identifier)) {
return false;
}
this.destList.put(identifier, c);
// Special case for world defaults:
if (identifier.equals("")) {
identifier = "w";
}
Permission self = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.self." + identifier);
Permission other = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.other." + identifier);
PermissionTools pt = new PermissionTools(this.plugin);
if (self == null) {
self = new Permission("multiverse.teleport.self." + identifier,
"Permission to teleport yourself for the " + identifier + " destination.", PermissionDefault.OP);
this.plugin.getServer().getPluginManager().addPermission(self);
pt.addToParentPerms("multiverse.teleport.self." + identifier);
}
if (other == null) {
other = new Permission("multiverse.teleport.other." + identifier,
"Permission to teleport others for the " + identifier + " destination.", PermissionDefault.OP);
this.plugin.getServer().getPluginManager().addPermission(other);
pt.addToParentPerms("multiverse.teleport.other." + identifier);
}
this.teleportCommand.addAdditonalPermission(self);
this.teleportCommand.addAdditonalPermission(other);
return true;
}
}
@@ -0,0 +1,222 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.util.Arrays;
import java.util.List;
/**
* An exact {@link MVDestination}.
*/
public class ExactDestination implements MVDestination {
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
private boolean isValid;
private Location location;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "e";
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return false;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 3 || parsed.size() == 5)) { // SUPPRESS CHECKSTYLE: MagicNumberCheck
return false;
}
// If it's not an Exact type
if (!parsed.get(0).equalsIgnoreCase("e")) {
return false;
}
// If it's not a MV world
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
return false;
}
if (!parsed.get(2).matches(coordRegex)) {
return false;
}
// This is 1 now, because we've removed 2
if (parsed.size() == 3) {
return true;
}
try {
Float.parseFloat(parsed.get(3));
Float.parseFloat(parsed.get(4)); // SUPPRESS CHECKSTYLE: MagicNumberCheck
} catch (NumberFormatException e) {
return false;
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return this.location;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
if (!(plugin instanceof MultiverseCore)) {
return;
}
List<String> parsed = Arrays.asList(destination.split(":"));
// Need at least: e:world:x,y,z
// OR e:world:x,y,z:pitch:yaw
// so basically 3 or 5
if (!(parsed.size() == 3 || parsed.size() == 5)) { // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.isValid = false;
return;
}
if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) {
this.isValid = false;
return;
}
if (!((MultiverseCore) plugin).getMVWorldManager().isMVWorld(parsed.get(1))) {
this.isValid = false;
return;
}
this.location = new Location(((MultiverseCore) plugin).getMVWorldManager().getMVWorld(parsed.get(1)).getCBWorld(), 0, 0, 0);
if (!parsed.get(2).matches(this.coordRegex)) {
this.isValid = false;
return;
}
double[] coords = new double[3];
String[] coordString = parsed.get(2).split(",");
for (int i = 0; i < 3; i++) {
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))); // SUPPRESS CHECKSTYLE: MagicNumberCheck
} catch (NumberFormatException e) {
this.isValid = false;
return;
}
this.isValid = true;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Exact";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Exact (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ()
+ ":" + location.getPitch() + ":" + location.getYaw() + ")";
}
/**
* Sets this {@link ExactDestination}.
*
* @param location The {@link Location}.
*/
public void setDestination(Location location) {
if (location != null) {
this.location = location;
this.isValid = true;
}
this.isValid = false;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
if (isValid) {
return "e:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw();
}
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "multiverse.access." + this.location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
// This is an EXACT destination, don't safely teleport here.
return false;
}
}
@@ -0,0 +1,107 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* An invalid {@link MVDestination}.
*/
public class InvalidDestination implements MVDestination {
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "i";
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
// Nothing needed, it's invalid.
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return ChatColor.RED + "Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return ChatColor.RED + "Invalid Destination";
}
@Override
public String toString() {
return "i:Invalid Destination";
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
return false;
}
}
@@ -0,0 +1,137 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.api.MVDestination;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A player-{@link MVDestination}.
*/
public class PlayerDestination implements MVDestination {
private String player;
private boolean isValid;
private JavaPlugin plugin;
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "pl";
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
String[] items = destination.split(":");
if (items.length != 2) {
return false;
}
if (!items[0].equalsIgnoreCase("pl")) {
return false;
}
return true;
}
/**
* {@inheritDoc}
*/
@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) {
return p.getLocation();
}
return null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
String[] items = destination.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;
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "Player";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return this.player;
}
@Override
public String toString() {
return "pl:" + this.player;
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
return "";
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
return true;
}
}
@@ -0,0 +1,173 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.Core;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A world-{@link MVDestination}.
*/
public class WorldDestination implements MVDestination {
private boolean isValid;
private MultiverseWorld world;
private float yaw = -1;
private String direction = "";
/**
* {@inheritDoc}
*/
@Override
public String getIdentifier() {
return "w";
}
/**
* {@inheritDoc}
*/
@Override
public boolean isThisType(JavaPlugin plugin, String destination) {
String[] items = destination.split(":");
if (items.length > 3) {
return false;
}
if (items.length == 1 && ((MultiverseCore) plugin).getMVWorldManager().isMVWorld(items[0])) {
// This case is: world
return true;
}
if (items.length == 2 && ((MultiverseCore) plugin).getMVWorldManager().isMVWorld(items[0])) {
// This case is: world:n
return true;
} else if (items[0].equalsIgnoreCase("w") && ((MultiverseCore) plugin).getMVWorldManager().isMVWorld(items[1])) {
// This case is: w:world
// and w:world:ne
return true;
}
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
Location spawnLoc = getAcurateSpawnLocation(e, this.world);
if (this.yaw >= 0) {
// Only modify the yaw if its set.
spawnLoc.setYaw(this.yaw);
}
return spawnLoc;
}
private static Location getAcurateSpawnLocation(Entity e, MultiverseWorld world) {
if (world != null) {
return world.getSpawnLocation();
} else {
// add 0.5 to x and z to center people
// (spawn location is stored as int meaning that you would spawn in the corner of a block)
return e.getWorld().getSpawnLocation().add(.5, 0, .5);
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid() {
return this.isValid;
}
/**
* {@inheritDoc}
*/
@Override
public void setDestination(JavaPlugin plugin, String destination) {
// TODO Taking a JavaPlugin here is rather useless, if we keep casting it up to MultiverseCore.
// We should change that.
Core core = (Core) plugin;
String[] items = destination.split(":");
if (items.length > 3) {
isValid = false;
return;
}
if (items.length == 1 && ((MultiverseCore) plugin).getMVWorldManager().isMVWorld(items[0])) {
isValid = true;
this.world = core.getMVWorldManager().getMVWorld(items[0]);
return;
}
if (items.length == 2 && ((MultiverseCore) plugin).getMVWorldManager().isMVWorld(items[0])) {
this.world = core.getMVWorldManager().getMVWorld(items[0]);
this.yaw = core.getLocationManipulation().getYaw(items[1]);
return;
}
if (items[0].equalsIgnoreCase("w") && ((MultiverseCore) plugin).getMVWorldManager().isMVWorld(items[1])) {
this.world = ((MultiverseCore) plugin).getMVWorldManager().getMVWorld(items[1]);
isValid = true;
if (items.length == 3) {
this.yaw = core.getLocationManipulation().getYaw(items[2]);
}
}
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "World";
}
/**
* {@inheritDoc}
*/
@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();
}
/**
* {@inheritDoc}
*/
@Override
public String getRequiredPermission() {
// TODO: Potenitally replace spaces wiht tabs for friendlier yaml.
// this.world.getName().replace(" ","_");
return "multiverse.access." + this.world.getName();
}
/**
* {@inheritDoc}
*/
@Override
public Vector getVelocity() {
return new Vector(0, 0, 0);
}
/**
* {@inheritDoc}
*/
@Override
public boolean useSafeTeleporter() {
return true;
}
}
@@ -0,0 +1,4 @@
/**
* This package contains all destination-types.
*/
package com.onarandombox.MultiverseCore.destination;
@@ -0,0 +1,30 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.enums;
/**
* A enum containing all actions that can be used to modify world-properties.
*/
public enum Action {
/**
* Setting a property.
*/
Set,
/**
* Adding something to a list-property.
*/
Add,
/**
* Removing something from a list-property.
*/
Remove,
/**
* Clearing a list-property.
*/
Clear
}
@@ -0,0 +1,26 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.enums;
/**
* An enum containing all list-properties.
*/
public enum AddProperties {
/**
* Worlds that people cannot go to from a world.
*/
worldblacklist,
/**
* Animal-exceptions.
*/
animals,
/**
* Monster-exceptions.
*/
monsters
}
@@ -0,0 +1,46 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.enums;
import org.bukkit.PortalType;
/**
* Custom enum that adds all/none for allowing portal creation.
*/
public enum AllowedPortalType {
/**
* No portals are allowed.
*/
NONE(PortalType.CUSTOM),
/**
* All portal types are allowed.
*/
ALL(PortalType.CUSTOM),
/**
* Only Nether style portals are allowed.
*/
NETHER(PortalType.NETHER),
/**
* Only Ender style portals are allowed.
*/
END(PortalType.ENDER);
private PortalType type;
AllowedPortalType(PortalType type) {
this.type = type;
}
/**
* Gets the text.
* @return The text.
*/
public PortalType getActualPortalType() {
return this.type;
}
}
@@ -0,0 +1,111 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.enums;
import org.bukkit.ChatColor;
/**
* A regular {@link ChatColor} represented by an english string.
*/
public enum EnglishChatColor {
/*
* I know. this is quite ugly.
*/
/** AQUA. */
AQUA("AQUA", ChatColor.AQUA),
/** BLACK. */
BLACK("BLACK", ChatColor.BLACK),
/** BLUE. */
BLUE("BLUE", ChatColor.BLUE),
/** DARKAQUA. */
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
/** DARKBLUE. */
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
/** DARKGRAY. */
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
/** DARKGREEN. */
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
/** DARKPURPLE. */
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
/** DARKRED. */
DARKRED("DARKRED", ChatColor.DARK_RED),
/** GOLD. */
GOLD("GOLD", ChatColor.GOLD),
/** GRAY. */
GRAY("GRAY", ChatColor.GRAY),
/** GREEN. */
GREEN("GREEN", ChatColor.GREEN),
/** LIGHTPURPLE. */
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
/** RED. */
RED("RED", ChatColor.RED),
/** YELLOW. */
YELLOW("YELLOW", ChatColor.YELLOW),
/** WHITE. */
WHITE("WHITE", ChatColor.WHITE);
private ChatColor color;
private String text;
EnglishChatColor(String name, ChatColor color) {
this.color = color;
this.text = name;
}
/**
* Gets the text.
* @return The text.
*/
public String getText() {
return this.text;
}
/**
* Gets the color.
* @return The color as {@link ChatColor}.
*/
public ChatColor getColor() {
return this.color;
}
/**
* Constructs a string containing all available colors.
* @return That {@link String}.
*/
public static String getAllColors() {
String buffer = "";
for (EnglishChatColor c : EnglishChatColor.values()) {
buffer += c.getColor() + c.getText() + " ";
}
return buffer;
}
/**
* Constructs an {@link EnglishChatColor} from a {@link String}.
* @param text The {@link String}.
* @return The {@link EnglishChatColor}.
*/
public static EnglishChatColor fromString(String text) {
if (text != null) {
for (EnglishChatColor c : EnglishChatColor.values()) {
if (text.equalsIgnoreCase(c.text)) {
return c;
}
}
}
return null;
}
/**
* Looks if the given-color name is a valid color.
* @param aliasColor A color-name.
* @return True if the name is a valid color, false if it isn't.
*/
public static boolean isValidAliasColor(String aliasColor) {
return (EnglishChatColor.fromString(aliasColor) != null);
}
}
@@ -0,0 +1,38 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.enums;
/**
* An enum containing possible teleport-results.
*/
public enum TeleportResult {
/**
* Insufficient permissions.
*/
FAIL_PERMISSION,
/**
* The teleport was unsafe.
*/
FAIL_UNSAFE,
/**
* The player was to poor.
*/
FAIL_TOO_POOR,
/**
* The teleport was invalid.
*/
FAIL_INVALID,
/**
* Unknown reason.
*/
FAIL_OTHER,
/**
* The player was successfully teleported.
*/
SUCCESS
}
@@ -0,0 +1,4 @@
/**
* This package contains all enums.
*/
package com.onarandombox.MultiverseCore.enums;
@@ -0,0 +1,58 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.event;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import java.util.List;
/**
* Called when the Multiverse-config should be reloaded.
*/
public class MVConfigReloadEvent extends Event {
private List<String> configsLoaded;
public MVConfigReloadEvent(List<String> configsLoaded) {
this.configsLoaded = configsLoaded;
}
private static final HandlerList HANDLERS = new HandlerList();
/**
* {@inheritDoc}
*/
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
/**
* Gets the handler list. This is required by the event system.
* @return A list of HANDLERS.
*/
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Adds a config to this event.
* @param config The config to add.
*/
public void addConfig(String config) {
this.configsLoaded.add(config);
}
/**
* Gets all loaded configs.
* @return A list of all loaded configs.
*/
public List<String> getAllConfigsLoaded() {
return this.configsLoaded;
}
}
@@ -0,0 +1,93 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.event;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* This event is thrown when a portal is touched.
*/
public class MVPlayerTouchedPortalEvent extends Event implements Cancellable {
private Player p;
private Location l;
private boolean isCancelled;
private boolean canUse = true;
public MVPlayerTouchedPortalEvent(Player p, Location l) {
this.p = p;
this.l = l;
}
private static final HandlerList HANDLERS = new HandlerList();
/**
* {@inheritDoc}
*/
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
/**
* Gets the handler list. This is required by the event system.
* @return A list of HANDLERS.
*/
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Gets the {@link Location} of the portal-block that was touched.
* @return The {@link Location} of the portal-block that was touched.
*/
public Location getBlockTouched() {
return this.l;
}
/**
* Gets the {@link Player} that's touching the portal.
* @return The {@link Player} that's touching the portal.
*/
public Player getPlayer() {
return this.p;
}
/**
* Gets whether or not the player in this event can use this portal.
*
* @return True if the player can use this portal.
*/
public boolean canUseThisPortal() {
return this.canUse;
}
/**
* Sets whether or not the player in this event can use this portal.
* <p>
* Setting this to false will cause the player to bounce back!
*
* @param canUse Whether or not the user can go through this portal.
*/
public void setCanUseThisPortal(boolean canUse) {
this.canUse = canUse;
}
@Override
public boolean isCancelled() {
return this.isCancelled;
}
@Override
public void setCancelled(boolean b) {
this.isCancelled = b;
}
}
@@ -0,0 +1,79 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.event;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when a player is respawning.
*/
public class MVRespawnEvent extends Event {
private Player player;
private Location location;
private String respawnMethod;
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
this.player = p;
this.location = spawningAt;
this.respawnMethod = respawnMethod;
}
private static final HandlerList HANDLERS = new HandlerList();
/**
* {@inheritDoc}
*/
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
/**
* Gets the handler list. This is required by the event system.
* @return A list of HANDLERS.
*/
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Gets the {@link Player} that's respawning.
* @return The {@link Player} that's respawning.
*/
public Player getPlayer() {
return this.player;
}
/**
* Gets the respawn-method.
* @return The respawn-method.
*/
public String getRespawnMethod() {
return this.respawnMethod;
}
/**
* Gets the player's respawn-{@link Location}.
* @return The player's respawn-{@link Location}.
*/
public Location getPlayersRespawnLocation() {
return this.location;
}
/**
* Sets the player's respawn-{@link Location}.
* @param l The new respawn-{@link Location}.
*/
public void setRespawnLocation(Location l) {
this.location = l;
}
}
@@ -0,0 +1,108 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.event;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Event that gets called when a player use the /mvtp command.
*/
public class MVTeleportEvent extends Event implements Cancellable {
private Player teleportee;
private CommandSender teleporter;
private MVDestination dest;
private boolean useSafeTeleport;
private boolean isCancelled;
public MVTeleportEvent(MVDestination dest, Player teleportee, CommandSender teleporter, boolean safeTeleport) {
this.teleportee = teleportee;
this.teleporter = teleporter;
this.dest = dest;
this.useSafeTeleport = safeTeleport;
}
private static final HandlerList HANDLERS = new HandlerList();
/**
* {@inheritDoc}
*/
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
/**
* Gets the handler list. This is required by the event system.
* @return A list of HANDLERS.
*/
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Returns the player who will be teleported by this event.
*
* @return The player who will be teleported by this event.
*/
public Player getTeleportee() {
return this.teleportee;
}
/**
* Returns the location the player was before the teleport.
*
* @return The location the player was before the teleport.
*/
public Location getFrom() {
return this.teleportee.getLocation();
}
/**
* Gets the {@link CommandSender} who requested the Teleport.
*
* @return The {@link CommandSender} who requested the Teleport
*/
public CommandSender getTeleporter() {
return this.teleporter;
}
/**
* Returns the destination that the player will spawn at.
*
* @return The destination the player will spawn at.
*/
public MVDestination getDestination() {
return this.dest;
}
/**
* Looks if this {@link MVTeleportEvent} is using the {@link SafeTTeleporter}.
* @return True if this {@link MVTeleportEvent} is using the {@link SafeTTeleporter}.
*/
public boolean isUsingSafeTTeleporter() {
return useSafeTeleport;
}
@Override
public boolean isCancelled() {
return this.isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.isCancelled = cancel;
}
}
Loaded 100 of 163 files, more files were not shown because too many files have changed in this diff. Show more