Compare commits

...
Author SHA1 Message Date
KHobbits 1e34a396cd Change starter kit to default to stone tools 2012-03-05 15:51:15 +00:00
KHobbits ba96117f55 Temp fix to disable version check on R7 2012-03-05 14:17:09 +00:00
KHobbits 96b217cbe8 Craftbukkit/Bukkit R7 2012-03-05 08:41:19 +00:00
md_5 0dd5c0370e I dont think free noteblocks are a good idea 2012-03-05 08:37:16 +00:00
KHobbits bdf32cde9e Missed one. 2012-03-05 08:37:15 +00:00
KHobbits e91ed60441 Fixing spawnmob count. 2012-03-05 08:37:15 +00:00
KHobbits 8577202f48 Add listgroups as TL key 2012-03-05 08:37:15 +00:00
KHobbits 7819b9d2f0 Apply colors to group tags. 2012-03-05 08:37:15 +00:00
KHobbits 15c0565923 Build custom mob list /spawnmob 2012-03-05 08:37:14 +00:00
KHobbits 2b25ca2932 CME 2012-03-05 08:37:14 +00:00
KHobbits c7a6677d52 Adding starter/newbie kit to EssentialsSpawn
Optimization to EssentialsSpawn join event.
2012-03-05 08:37:14 +00:00
KHobbits c3d5b32986 Extra command alias. 2012-03-05 08:37:14 +00:00
KHobbits cbfb524195 Allow more currency customization.
Added currency key to messages.
2012-03-05 08:37:14 +00:00
KHobbits b16a1f7237 Adding option to modify all users balances (including offline) /eco reset ** <amount> 2012-03-05 08:37:14 +00:00
KHobbits e28f1b1be3 Half-revert double backflip. 10 points.
(op prefix changes that md-5 broke, thinking I broke op prefixes)
2012-03-05 08:37:14 +00:00
md_5 b512a243e7 Fix op colours, which KHobbits broke! 2012-03-05 08:37:13 +00:00
Chris Ward 873c9880dd Cleanup
Signed-off-by: Chris Ward <chris@chrisgward.com>
2012-03-05 08:35:48 +00:00
Chris Ward e6736e48a5 Cleanup
Signed-off-by: Chris Ward <chris@chrisgward.com>
2012-03-05 08:35:48 +00:00
KHobbits caf598f55b Capital case for formatting. 2012-03-05 08:35:48 +00:00
KHobbits 619e099a04 Force all kits to lowercase. 2012-03-05 08:35:48 +00:00
KHobbits faba1e3604 *make it look like i'm doing something* 2012-03-05 08:35:48 +00:00
KHobbits 7cb728b15f I think switches are better. 2012-03-05 08:35:48 +00:00
KHobbits 3e3c7f0d54 Only update displayname on world change, not every teleport. 2012-03-05 08:35:48 +00:00
KHobbits a45c19a08b Extra command aliases 2012-03-05 08:35:47 +00:00
KHobbits eb74a1de9c Make the antioch message optional. 2012-03-05 08:35:47 +00:00
KHobbits 8450734cf1 Entity event cleanup 2012-03-05 08:35:47 +00:00
KHobbits 016299a1dd Shouldn't really be canceling events at priority monitor, oops. 2012-03-05 08:35:47 +00:00
KHobbits d27ff9abb6 Don't think we need animation event anymore. 2012-03-05 08:35:47 +00:00
Iaccidentally cdf5d45483 update messages.properties for the new bukkit download link (ci.bukkit,org no longer works) 2012-03-05 08:35:46 +00:00
KHobbits 5622882602 Merge branch 'master' of github.com:essentials/Essentials 2012-03-01 22:37:15 +00:00
KHobbits b3d3928db8 Kit sign cleanup 2012-03-01 22:36:51 +00:00
snowleo 6df3b9008a update inventory 2012-03-01 23:23:23 +01:00
snowleo c36ca65e09 Bukkit broke this sign :( 2012-03-01 23:10:12 +01:00
KHobbits 2e788802fe Fix kit timers resetting on server restart. 2012-03-01 22:04:50 +00:00
KHobbits b0552019f5 Fix version matching. 2012-03-01 21:47:01 +00:00
snowleo dae69622a5 Merge branch 'refs/heads/master' into release 2012-03-01 19:08:52 +01:00
snowleo 696b930fb2 EntityType instead of CreatureType 2012-03-01 19:05:50 +01:00
snowleo e43a62f992 Requires #1988 because of the new Inventory stuff 2012-03-01 19:05:50 +01:00
snowleo 02c1cb05c7 Updated to R6 2012-03-01 19:05:50 +01:00
snowleo b44d738867 CB# 1988 B# 1360 2012-03-01 19:05:49 +01:00
md_5 e1818f7e62 Separate config sections evenly 2012-03-01 19:05:47 +01:00
md_5 e5081db7e4 Remove old, unwanted manifest.mf files 2012-03-01 19:05:47 +01:00
ElgarL ba346bd797 Make 'manload' reload the config correctly. 2012-03-01 19:05:47 +01:00
KHobbits 0670ece7f3 Updating Bukkit: CB #1858, B #1334 2012-03-01 19:05:47 +01:00
snowleo a8da3eebd7 Merge remote-tracking branch 'origin/groupmanager' 2012-03-01 17:33:25 +01:00
snowleo 056303b53c EntityType instead of CreatureType 2012-03-01 17:33:09 +01:00
snowleo 454f7d30de Requires #1988 because of the new Inventory stuff 2012-03-01 16:17:40 +01:00
snowleo 6d1c270976 Updated to R6 2012-03-01 16:16:05 +01:00
snowleo d1001274bb CB# 1988 B# 1360 2012-03-01 16:16:05 +01:00
md_5 3099855562 Merge remote-tracking branch 'origin/master' 2012-03-01 16:23:21 +11:00
md_5 3f26d4ad98 Separate config sections evenly 2012-03-01 14:40:57 +11:00
md_5 bae337cc49 Remove old, unwanted manifest.mf files 2012-03-01 12:27:59 +11:00
ElgarL 3823e7a108 Make 'manload' reload the config correctly. 2012-02-28 10:46:10 +00:00
KHobbits 1c2221f52f Adding option to log all eco api transactions. 2012-02-28 02:45:03 +00:00
KHobbits 1b780a4364 Prevent EssSpawn trying to handle spawning of jailed players. 2012-02-28 02:45:03 +00:00
KHobbits ac3e65a829 Change jail listener to catch respawn at Highest 2012-02-28 02:45:03 +00:00
KHobbits 332f19177e Allow people to hit exactly 'min money'. 2012-02-28 02:45:03 +00:00
KHobbits 6ab57b9abe Cleanup. 2012-02-28 02:45:03 +00:00
KHobbits 862f3aad59 Adjustments to negative eco give/take. 2012-02-28 02:45:03 +00:00
KHobbits e277acf80e Display users new balance on /eco give/take. 2012-02-28 02:45:02 +00:00
KHobbits 9f893e68e9 Add Minimum Balance, to allow people to manage overdrafts. 2012-02-28 02:45:02 +00:00
KHobbits 833a5b2b55 Adding option to log all eco api transactions. 2012-02-27 15:31:43 +00:00
KHobbits 340f0c68eb Prevent EssSpawn trying to handle spawning of jailed players. 2012-02-27 03:40:18 +00:00
KHobbits a5e3182dad Change jail listener to catch respawn at Highest 2012-02-27 03:24:58 +00:00
KHobbits 10ae9c3aa2 Allow people to hit exactly 'min money'. 2012-02-26 05:10:04 +00:00
KHobbits bcf903de92 Cleanup. 2012-02-26 05:06:03 +00:00
KHobbits ad08d27504 Adjustments to negative eco give/take. 2012-02-26 05:01:40 +00:00
KHobbits d24f77dbd5 Display users new balance on /eco give/take. 2012-02-26 04:27:29 +00:00
KHobbits a5b38ce1a4 Add Minimum Balance, to allow people to manage overdrafts. 2012-02-26 04:15:14 +00:00
KHobbits 5d048d2c1d Updating Bukkit: CB #1858, B #1334 2012-02-25 17:57:26 +00:00
KHobbits 13d3cc3306 Lowering min bukkit to r4 - 1838, this build should still be compatible. 2012-02-25 17:40:00 +00:00
KHobbits 9f02fb4dd4 Merge branch 'master' into release 2012-02-25 17:22:39 +00:00
KHobbits 07baa6e611 Merge remote branch 'remotes/origin/groupmanager' 2012-02-25 17:22:01 +00:00
ElgarL 50bd5869bf Prevent promoting players to, and demoting to GlobalGroups. 2012-02-25 09:29:54 +00:00
ElgarL fa49fc91d2 Prevent adding inheritances to globalgroups. These are permissions
collections, not player groups.
2012-02-25 09:22:54 +00:00
KHobbits 28f478dd04 Write to user files less, on money update. 2012-02-23 17:25:00 +00:00
KHobbits 6fb8dad0ec Balance top now has server total on first line.
Balance top will update ess balance backup if using register/vault eco.
2012-02-23 15:17:23 +00:00
KHobbits 9f605e9a88 Fixing upgrade script to allow powertool upgrade. 2012-02-23 14:49:23 +00:00
KHobbits e5b91dae73 Fixing kits for new config classes. 2012-02-22 12:32:51 +00:00
KHobbits e1749fecd1 Extra command aliases. 2012-02-22 01:29:37 +00:00
KHobbits 358edff798 Powertools dispatch commands as delayed tasks (should reduce any conflict issues). 2012-02-22 00:23:04 +00:00
KHobbits 34f13ba89c Switch powertools to use different event.
Reduce multiple triggering of powertool events.
Abort event when used with powertool.
2012-02-22 00:11:21 +00:00
KHobbits 945ba6f8ab Fix powertools with new config format. 2012-02-22 00:10:13 +00:00
KHobbits 46f05ee92f Check to see if home section exists. 2012-02-21 22:19:56 +00:00
KHobbits 6d46fc66ce Fixing home list. 2012-02-21 22:12:37 +00:00
KHobbits ed7fe9213f Fix /sudo message display. 2012-02-21 21:39:25 +00:00
ElgarL 9c68cbae72 Removed BukkitPermsOverride as this is now the default with bukkit
handling child nodes.
2012-02-21 18:40:54 +00:00
ElgarL c0df771539 Update for Bukkit R5 compatability.
Removed some unused variables.
2012-02-21 18:38:08 +00:00
snowleo 9bd0c33fef Never give our user object to other plugins! 2012-02-21 18:41:27 +01:00
snowleo cf7da7a83f Merge branch 'refs/heads/groupmanager' 2012-02-21 17:34:45 +01:00
snowleo f46948249e Updated Essentials to work with R5 2012-02-21 17:33:46 +01:00
snowleo 3b81593ebb CB#1952
B#1330
2012-02-21 16:47:25 +01:00
KHobbits 8042cefd3d Merge branch 'master' into release 2012-02-19 01:20:50 +00:00
KHobbits 514f07ce57 Add bPerm2 support for chat prefixes. 2012-02-18 22:47:38 +00:00
KHobbits 4f4d9f6209 Little bit of extra info in the default /einfo file 2012-02-18 22:08:18 +00:00
KHobbits 3077ea4ef1 Re-allow colours in newb welcome messages. 2012-02-18 21:34:05 +00:00
KHobbits 945ae71480 Adding full keyword support for newb join message.
Also adding {ADDRESS} and {USERNAME} as new keywords.
2012-02-18 21:09:18 +00:00
ElgarL 3d1c0fd157 A command of '/manload' with no world arguments now performs a full
reload of GM.
2012-02-18 09:05:28 +00:00
KHobbits fab9688abb Don't try to use old bPerms API if it is not available. 2012-02-16 23:44:13 +00:00
KHobbits b2dbb3f9e3 Fixing being charged twice for /back. 2012-02-16 16:57:50 +00:00
KHobbits 16a0f44b4d Merge remote branch 'remotes/origin/master' into release 2012-02-15 19:09:02 +00:00
md_5 7633b136e3 Its a good idea to actually register the listeners 2012-02-15 19:55:41 +11:00
md_5 0252d756f6 Make Essentials Update use new Listener system, and fix a few general mistakes, including that of the config 2012-02-15 19:34:46 +11:00
md_5 ad05516fd5 Fix formatting in the config.yml and plugin.yml files. Add a new author. 2012-02-15 17:57:53 +11:00
md_5 6d127012d8 Add all the new R4 methods 2012-02-15 17:53:47 +11:00
md_5 c064da9af8 Update to 1.1-R4 2012-02-15 17:44:35 +11:00
md_5 d05f2d7a32 Remove dropItems from the inventory work around 2012-02-15 17:21:28 +11:00
ElgarL 3fc6bb4e4f comment name change 2012-02-15 06:16:33 +00:00
ElgarL 59679e0423 Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent
as it's all handled in PlayerChangedWorldEvent.
This also means we no longer update permissions before we change
worlds.
2012-02-15 06:15:31 +00:00
KHobbits 1a2acb43ae Merge branch 'master' into release 2012-02-14 23:56:02 +00:00
KHobbits f0c0ee1a8d /spawnmob - Only list mobs you have permission to spawn. 2012-02-14 23:55:29 +00:00
snowleo 3c98718387 Don't return null, throw an exception 2012-02-14 20:30:06 +01:00
snowleo cfdb2a36c1 Merge pull request #49 from Iaccidentally/patch-2
fix typo in config.yml (another one)
2012-02-14 11:21:52 -08:00
Iaccidentally 3b7d194902 fix typo in config.yml (another one) 2012-02-14 14:21:07 -05:00
snowleo 72d514d52f Merge pull request #48 from Iaccidentally/patch-1
fix typo in config.yml
2012-02-14 11:18:03 -08:00
Iaccidentally 9fe119e720 fix typo in config.yml 2012-02-14 14:16:34 -05:00
ElgarL 4a5c431163 Depreciate PlayerTeleportEvent as it's all handled in
PlayerChangedWorldEvent.
2012-02-14 13:01:39 +00:00
snowleo a6ac333a74 Less sanitizing for more performance 2012-02-13 21:32:05 +01:00
KHobbits bc2578b788 Caching regex return in user cleanup.
(Pushing this for testing purposes).
2012-02-13 19:40:33 +00:00
KHobbits 36d07cb539 Merge branch 'master' into release 2012-02-13 17:35:05 +00:00
KHobbits effe0d5ec5 Merge remote branch 'remotes/origin/groupmanager' 2012-02-13 17:24:32 +00:00
KHobbits 0ab2e745cf Merge branch 'master' of github.com:essentials/Essentials 2012-02-13 17:17:14 +00:00
KHobbits 57a2ef08d4 Allow charges for different mob types in /spawner 2012-02-13 17:16:27 +00:00
KHobbits 2699e02f96 Add per warp command costs
Make warp other commands charge the commander, not the warped.
2012-02-13 17:09:07 +00:00
md_5 62cd219b4e Clean up the CommandException stack traces so they appear as if Essentials was never there. 2012-02-12 08:19:24 +11:00
KHobbits 2d56de1483 Update trade signs properly, and visibly handle full signs. 2012-02-11 21:15:26 +00:00
KHobbits bbc6da5106 Merge pull request #46 from krinsdeath/master
Added Privileges to known Permissions plugins
2012-02-11 12:12:59 -08:00
KHobbits b0d06ce6ed Refactoring tpaccept perm check to include tpaall. 2012-02-11 20:10:19 +00:00
KHobbits de1554cb68 Merge pull request #45 from Wolvereness/master
Fix /tpaccept permission check
Refactoring to follow.
2012-02-11 12:06:42 -08:00
Jeff Wardian c890ea8f87 Added PrivilegesHandler.java;
Implemented privileges in PermissionsHandler.java;

Fixed PrivilegesHandler.canBuild();
2012-02-11 10:06:18 -08:00
ElgarL c0517c1203 Change Service registration to register WorldsHolder instead of
AnjoPermissionsHandler. This is the correct entry point for all data.
2012-02-11 10:36:55 +00:00
Wolvereness 9efd0eb6f9 Fix exploit with /tpaccept if sender no longer has permission 2012-02-09 23:14:57 -06:00
KHobbits f0ee026fb9 Allow colour codes in /ping 2012-02-09 22:13:00 +00:00
KHobbits b3fc790000 New Permission: essentials.sudo.exempt
If a user has this perm, they cannot be controlled.
2012-02-09 22:11:46 +00:00
KHobbits 83f9209bcc Optional argument to /ping [message]- Message to be echo'd.
Possible use in scripts, checking for lag, /sudo, etc.
2012-02-09 22:02:24 +00:00
KHobbits 691a0ef4ce Fixing silly typo - Fixes shout costs. 2012-02-09 02:11:36 +00:00
ElgarL 97bd49e598 Add some commenting 2012-02-05 16:41:34 +00:00
ElgarL e93e50f6d2 Fix world mirroring so it correctly creates data files and data sources
for partially mirrored worlds.
Fixed world mirroring so it returns the correct data for the
requested world
2012-02-05 16:30:58 +00:00
ElgarL 76ba5caeec Prevent getAllPlayersPermissions() processing a group more than once.
Improves performance when using complex inheritance structures.
2012-02-02 18:10:35 +00:00
KHobbits 6ca1cdec4f Merge branch 'master' into release 2012-02-02 11:41:18 +00:00
KHobbits 86a1dda46c Make it so ops can build, even if they don't have the matching permission. 2012-02-02 10:43:17 +00:00
KHobbits 4326ce0d4a Force minimum CB version to 1846, don't want people on #1840 due to big bugs. 2012-02-02 10:32:18 +00:00
KHobbits 3ff1f4adbb Fixing repair to not repair items with datavalues, unless they actually have a durability. 2012-02-02 10:27:35 +00:00
KHobbits 492c4e8521 Craftbukkit #1846 Bukkit #1211 2012-02-02 10:27:09 +00:00
KHobbits e3f3fe84ea Recover from broken config files, but keep a backup of the old one for purpose of data recovery. 2012-02-02 09:48:56 +00:00
KHobbits 6e2ac3b56e Extend valid characters to be a little less strict. 2012-02-02 09:37:30 +00:00
KHobbits 5c19e71858 Sanitize mail for untoward characters.
Prevent a user error from terminating essentials timer task.
2012-02-02 09:26:36 +00:00
ElgarL a0103afde3 fix setGroup to only block superperms update if update is false. 2012-02-02 02:41:10 +00:00
ElgarL dbf30740fb Fix a bug with getWorldData return the main world data for all mirrors,
instead of the worlds parent data.
2012-02-02 02:01:04 +00:00
KHobbits 92fa415848 More info, and less severe warning on jail error. 2012-01-31 08:33:14 +00:00
KHobbits 2942ef40f3 Update jails to new event system. 2012-01-31 08:06:50 +00:00
ElgarL 3f02bcd702 Catch all errors in badly formatted groups. 2012-01-31 03:16:34 +00:00
ElgarL fe050dd725 Track the 'onPlayerChangeWorld' event as some teleports seem to not be
triggering a world move.
2012-01-30 17:08:55 +00:00
ElgarL 5b4966c888 Auto sort permissions on load to speed up population of superperms.
Negating a parent node after adding all nodes with * will now
correctly remove all child nodes of that parent before populating
superperms.
	  eg.
	      - '*'
	      - -vanish.*
	      - vanish.standard
2012-01-30 14:41:19 +00:00
KHobbits e2abf05a27 Merge branch 'master' into release 2012-01-30 05:36:03 +00:00
KHobbits 8500542e93 Remove invalid item spawn blacklist warning during startup. 2012-01-29 23:36:27 +00:00
KHobbits d9e6f2975a Merge branch 'master' into release 2012-01-29 21:44:30 +00:00
KHobbits 2f1d9ad82c Prevent /home bed, if the bed was later destroyed. 2012-01-29 21:44:15 +00:00
KHobbits d8ac3587ac Merge branch 'master' into release 2012-01-29 21:39:05 +00:00
ElgarL 2c8aa20542 .project change for Eclipse Build tool 2012-01-29 21:37:50 +00:00
KHobbits a2418a68d9 Fixing Kill/suicide in creative mode. 2012-01-29 21:37:38 +00:00
KHobbits 85c4fbdf4f Merge branch 'master' into release 2012-01-29 21:20:56 +00:00
KHobbits dff8f541fe New craftbukkit
CB 1840, B 1208
2012-01-29 21:06:55 +00:00
KHobbits d0a5656fa4 Merge remote branch 'remotes/origin/groupmanager' 2012-01-29 20:57:54 +00:00
KHobbits bc76e87366 Fix boolean fail in /r offline checking. 2012-01-29 20:57:17 +00:00
ElgarL bf9a67a2e4 updating .gitignore 2012-01-29 11:04:52 +00:00
ElgarL 95885e46c9 Fix players retaining permissions when demoted. 2012-01-29 10:54:24 +00:00
KHobbits 5a7f38fa29 Merge branch 'master' into release 2012-01-29 05:00:04 +00:00
KHobbits 6a5fefb102 Optional second argument to /tpaccept, it will only accept the request if the sender matched that string. 2012-01-29 04:59:30 +00:00
KHobbits c47c008871 Added kit note.
Fixes #1276
2012-01-29 03:26:44 +00:00
KHobbits a31f5e219d Kill people the proper way.
Test #1410
2012-01-29 03:23:38 +00:00
KHobbits 9ee78bdaec Switch /near priority to check for int first.
Test #1269
2012-01-29 03:09:59 +00:00
KHobbits 735f9ce212 Make sure player is online when sending a /reply. 2012-01-29 02:57:52 +00:00
KHobbits 417148f5da Merge branch 'master' into release 2012-01-29 01:45:40 +00:00
KHobbits 8f0350570e Merge remote branch 'remotes/origin/groupmanager' 2012-01-29 01:45:03 +00:00
KHobbits 27365d1f1b Prevent disabled sign creation (if any of essentials signs are enabled) 2012-01-29 01:42:55 +00:00
KHobbits ebb3a77430 Fix sign list format. 2012-01-29 01:38:24 +00:00
KHobbits b3252168f6 Disable all signs by default. 2012-01-29 01:27:04 +00:00
KHobbits e1abdbdd37 Added options to enable each sign type 2012-01-29 01:12:38 +00:00
ElgarL 3deff2afe7 silly formatting change to test gitbot 2012-01-28 18:01:17 +00:00
KHobbits a85cbdd505 Merge branch 'master' into release 2012-01-28 12:59:15 +00:00
KHobbits c6aa34076a Merge remote branch 'remotes/origin/groupmanager' 2012-01-28 12:58:37 +00:00
ElgarL 92f83dfe73 fix for an iterator error if there is only one element in the array. 2012-01-28 11:59:54 +00:00
ElgarL 00057eaca4 Fixed a bug when pushing superperms in the wrong order. 2012-01-28 11:47:39 +00:00
KHobbits 2f96c9763f Only list bed home if it is set. 2012-01-28 01:39:51 +00:00
KHobbits 137b60c5f2 Allow space as well as : in /delhome 2012-01-28 01:32:15 +00:00
KHobbits 292b7b0546 Stop users from using /sethome bed 2012-01-28 01:09:02 +00:00
KHobbits d1d31e9769 If bed home is set, give priority when spawning. 2012-01-28 00:57:08 +00:00
KHobbits f7c6759433 Check bed still exist, for bed homes. 2012-01-28 00:49:22 +00:00
KHobbits 5137502646 Switch website URL's to point at wiki. 2012-01-28 00:20:46 +00:00
ElgarL 9ff8b69282 Properly fix inherited negated nodes. 2012-01-27 13:09:11 +00:00
ElgarL 7f269187c5 do not allow inherited permissions to negate higher perms. 2012-01-27 12:38:00 +00:00
KHobbits 6d34a2aa17 Merge branch 'master' of github.com:essentials/Essentials 2012-01-26 21:21:35 +00:00
KHobbits 9b58b2b9c0 Revert emergency listener to old style
Stops peoples world world burning down if they throw in 2.8, on a 1.0 server.
2012-01-26 21:21:13 +00:00
snowleo b4d91978c7 Merge branch 'refs/heads/master' into release 2012-01-26 04:51:10 +01:00
snowleo 8aa260ee34 Minor fix to french translation 2012-01-26 04:49:26 +01:00
Léa Gris 25976edc2b i18n added to command nuke 2012-01-26 04:46:00 +01:00
Léa Gris 8e9094a3ef Updated translations to Essentials Dev2.7.191 2012-01-26 04:45:16 +01:00
KHobbits 16bde87982 Merge branch 'master' into release 2012-01-26 00:31:05 +00:00
KHobbits b8944d0b25 Set min bukkit to 1818 - RB 2012-01-26 00:30:33 +00:00
KHobbits 69209eeb2f Merge remote branch 'remotes/origin/groupmanager' 2012-01-26 00:28:10 +00:00
ElgarL 746eb353a2 Fixed an infinite loop error when using '/manudel' on a logged in
player. It caused setDefaultGroup to trigger a bukkit update when no GM
User existed yet.
2012-01-25 23:44:14 +00:00
ElgarL 3708f2b3bb Trap errors in fetching the mirrors map. 2012-01-25 22:43:07 +00:00
ElgarL e563405a7d Check for a null player object in the PlayerTeleportEvent. 2012-01-25 22:35:24 +00:00
ElgarL ae2cf3d95c Fixed subgroups (I broke earlier). 2012-01-25 22:33:22 +00:00
ementalo 270533652b Merge branch 'master' into release 2012-01-25 14:29:05 +00:00
paul.aston 324dd05c97 CB #1818
RB #1200
2012-01-25 14:23:46 +00:00
Paul A. 2a0c3eebbc Merge pull request #43 from essentials/groupmanager
Fix trying to modify an unmodifiable collection breaking superperms.
2012-01-24 17:29:08 -08:00
ElgarL e1660d47ba Fix trying to modify an unmodifiable collection breaking superperms. 2012-01-25 01:20:44 +00:00
KHobbits 03d640260d Merge branch 'master' into release 2012-01-25 00:04:08 +00:00
KHobbits da3a6af92d Merge remote branch 'remotes/origin/groupmanager' 2012-01-25 00:02:15 +00:00
ementalo 593cb8d56e Don't try to spawn users who have disconnected before we have a chance to spawn them 2012-01-24 22:43:33 +00:00
ElgarL f40f5f880b Fix typo/wording in changelog
Allow negation to the * permission node when populating superperms.
2012-01-24 19:41:22 +00:00
ElgarL 8390594682 Allow negations with the * permission node when population superperms. 2012-01-24 19:38:22 +00:00
ElgarL a13740f638 Fix hasOwnData to return a correct result with new mirroring system 2012-01-24 15:37:21 +00:00
ElgarL 5f19cbf17b Fixed isInList 2012-01-24 15:35:20 +00:00
ElgarL 145b0be2f3 addSubGroup now returns a boolean for success/failure.
'/manuaddsub' now correctly reports if it was able to add the sub
group.
2012-01-24 14:21:07 +00:00
ElgarL 1dab4f95dd Added recursive loop detection for World mirroring (you may not set the
main world as a mirror of another).
Fixed fetching world data so it no longer returns the mirrored world
for groups. Each world data holder now points to the correct data set,
so can be returned as an object.
2012-01-24 14:08:53 +00:00
snowleo f27b2290dc Merge branch 'refs/heads/master' into release 2012-01-24 03:43:49 +01:00
snowleo 0ea41d9169 Merge branch 'refs/heads/groupmanager' 2012-01-24 03:43:17 +01:00
ementalo f93769dd1d Add new permission essentials.protect.alerts.notrigger
If user has this permisson they do not trigger EssProtect block alerts
2012-01-23 15:48:56 +00:00
ElgarL 125ea7c701 Fixed infinite loop error on player join.
Optimized code to only update the player logging in instead of all
players online.
2012-01-22 23:46:26 +00:00
ElgarL 6e03ea7b7d Separated all events to be independent classes. 2012-01-21 20:18:40 +00:00
ElgarL 9041596384 Fixed a random null error upon a player portaling. 2012-01-21 19:09:08 +00:00
KHobbits efda9beece Merge branch 'master' into release 2012-01-21 17:19:12 +00:00
ElgarL 4b61ac9043 Update to new Bukkit Event system.
Update GroupManagerBridge for new event system.
2012-01-21 11:47:08 +00:00
KHobbits 72edfacfb8 Catching throwable leads to madness, lets do this safely. 2012-01-21 00:19:13 +00:00
KHobbits aa88205d95 Catch errors too, incase the class doesn't exist. 2012-01-21 00:01:43 +00:00
KHobbits 8d441a4cc7 Messages Cleanup 2012-01-20 23:13:37 +00:00
KHobbits 766935871f If vault throws an exception, it should not be enabled. 2012-01-20 23:04:43 +00:00
KHobbits f5d65371b2 Adding translation keys for [L] and [Spy] 2012-01-20 22:57:35 +00:00
KHobbits 662749be8b Check shout/question messages are longer than 1 character. 2012-01-20 22:54:47 +00:00
snowleo e46fe381b4 Removing load info, bucket displays that now. 2012-01-20 05:52:35 +01:00
snowleo 04a43eb5d0 New Event code for EssentialsSpawn 2012-01-20 05:34:28 +01:00
snowleo 792f70efa5 Update for new CraftBukkit Event Code
EssentialsSpawn can't be updated yet, because the new event system lacks dynamic priorities.
2012-01-20 05:20:37 +01:00
snowleo 46298ae858 CB#1791 2012-01-20 04:09:35 +01:00
KHobbits d08b1a5089 Fix EssChat displayname error. 2012-01-19 15:51:55 +00:00
KHobbits e015cad131 Merge remote branch 'remotes/origin/groupmanager' 2012-01-19 15:34:00 +00:00
KHobbits 008f0d595f Fix Lombok include. 2012-01-19 15:08:37 +00:00
ElgarL 7ee3919175 Fixed text when adding a subgroup to not say the player was moved. 2012-01-19 13:08:57 +00:00
snowleo 2560bdca4a Update of Lombok, fixes memory leak in Netbeans 2012-01-19 13:17:05 +01:00
ElgarL 16d537bd6c Remove debug spam 2012-01-19 12:08:39 +00:00
snowleo 5f04d1867c Cache MessageFormats for Chat 2012-01-19 02:03:20 +01:00
KHobbits a10f6850e5 Compiled regex is faster. 2012-01-18 23:35:30 +00:00
KHobbits 36bc1adf83 Make sure to clean the chatStore. 2012-01-18 23:08:40 +00:00
KHobbits cd8cc63113 Reduce duplicate calls in EssentialsChat
Should cut the time down a little.
2012-01-18 22:53:39 +00:00
KHobbits 947bee98a0 Merge remote branch 'remotes/origin/groupmanager' 2012-01-18 20:04:50 +00:00
ElgarL 9c052b5178 Better optimize assembling of a players permissions and allow the * node
to populate all registered superperms.
2012-01-18 16:39:12 +00:00
ElgarL 64af5b465d Added a tidy error message for invalid permission entries in
GlobalGroups.
2012-01-18 01:25:25 +00:00
KHobbits 5c1d49fd0e Merge remote branch 'remotes/origin/groupmanager' 2012-01-17 23:50:05 +00:00
KHobbits 79a13e97a2 Merge remote branch 'remotes/origin/groupmanager' 2012-01-17 23:49:38 +00:00
ElgarL 89c41b0508 v 1.9:
Optimize populating Bukkit perms so we no longer calculate the
child
nodes (Bukkit already does this).
2012-01-17 18:03:16 +00:00
KHobbits e7fd26ee64 Merge branch 'master' of github.com:essentials/Essentials 2012-01-17 17:40:22 +00:00
KHobbits 8fc6684290 Auto Update GM Version 2012-01-17 17:24:22 +00:00
snowleo a66ffd8921 Shorter names for enchantment signs. 2012-01-17 01:45:03 +01:00
KHobbits 1f2c669eca Stripping vanilla colour from /helpop and /mail
Adding support for &k in EssChat
Adding support for colour in /msg and /r - New perm: essentials.msg.color
2012-01-16 20:25:36 +00:00
KHobbits 1d5a09a03e Merge branch 'master' of github.com:essentials/Essentials 2012-01-16 19:42:37 +00:00
KHobbits 4435121c84 Stripping vanilla colours from /msg 2012-01-16 19:42:15 +00:00
snowleo 813e66b4f2 Fix /nick command colors 2012-01-16 20:38:53 +01:00
snowleo 26d63f3666 Strip colors from chat, if the user does not have the permission. 2012-01-16 20:29:55 +01:00
KHobbits 0fb07d4cc1 Removing debugging message from player login. 2012-01-16 18:58:44 +00:00
snowleo cd2f819c29 Cleanup 2012-01-16 19:11:41 +01:00
KHobbits 149ce7d74d Adding support for Vault as a fallback economy method. 2012-01-16 18:00:43 +00:00
KHobbits c7c7e5e4ce Merge remote branch 'remotes/origin/master' into release 2012-01-16 12:43:09 +00:00
snowleo f26cccb663 Optimize TextInput to cache motd and info textfiles. 2012-01-16 04:51:27 +01:00
snowleo 81ec87d893 Revert changes to Usermap 2012-01-16 02:12:20 +01:00
snowleo 91563e9dca Optimize Break in Protect 2012-01-16 01:55:04 +01:00
snowleo 359ea194b8 Speed improvements for Move and Interact Event. 2012-01-16 00:50:52 +01:00
ElgarL 1a0b03db4d Removed '- bukkit.command' form the globalgroups permission nodes. 2012-01-15 01:43:42 +00:00
snowleo c860b1c668 Reload less 2012-01-14 23:25:52 +01:00
snowleo c584d74852 Temporary fix for Spawns and Jails when Worlds are loaded after Essentials.
This will be replaced by BetterLocation fix in 3.0 branch.
2012-01-14 23:13:58 +01:00
KHobbits 6e82419c15 Allowing use of aliases in help/info/motd, for command suggestions.
Test #1441
2012-01-14 16:53:18 +00:00
KHobbits 3f6b9586b4 Fixing double charges on /home
Test #1426
2012-01-14 16:42:53 +00:00
KHobbits 29d4e09983 Fixing {WorldDate}
Test #1353
2012-01-14 16:36:19 +00:00
KHobbits f61f80164d Merge branch 'master' into release 2012-01-14 15:52:55 +00:00
KHobbits f0def90301 Merge remote branch 'remotes/origin/groupmanager' 2012-01-14 15:52:22 +00:00
ElgarL d0e5685ac0 Catch NullPointerErrors generated by blank permission nodes. 2012-01-14 15:48:55 +00:00
KHobbits 856cef3286 Update Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java 2012-01-14 15:04:16 +00:00
KHobbits d16fef9f7f Merge branch 'master' into release
~ GM needs testing before release ~
2012-01-14 13:16:33 +00:00
KHobbits 43f1c0f89d Removing debugging messages. 2012-01-13 22:50:48 +00:00
KHobbits 256d202d50 Adjusting default spawn behavior.
Moving option in config file.
2012-01-13 22:41:47 +00:00
snowleo 4884bed117 Merge branch 'refs/heads/groupmanager' 2012-01-13 01:38:54 +01:00
snowleo 3fdde2f764 Add new eggs to items.csv 2012-01-12 23:56:39 +01:00
snowleo 390b17f0d8 Min Bukkit version is 1713 now 2012-01-12 23:43:11 +01:00
snowleo fe9d5645f6 Added the new Enchantments 2012-01-12 23:42:04 +01:00
snowleo eb5c88ef08 Netbeans 7.1 stuff 2012-01-12 23:37:39 +01:00
snowleo 6eea852b1d CB#1713 B#1136 2012-01-12 23:36:45 +01:00
ElgarL 768c92e5bf Major, MAJOR changes to support partial/full world mirroring.
You can now mirror groups.yml, users.yml or both files between
different worlds.
2012-01-11 05:51:40 +00:00
ElgarL 2a478fe03d Optimize fetching of Mirrored world data. 2012-01-10 18:40:34 +00:00
ElgarL 58057a771d Changed over to a reflection method for populating superperms as Bukkit
lags when you handle permissions one at a time.
2012-01-09 02:00:58 +00:00
ElgarL 4c485f3147 Fix 'manucheckp' to correctly report if a permission is available from
GroupManager or Bukkit.
2012-01-05 19:43:30 +00:00
ElgarL 7726fd0081 Reload GlobalGroups when you perform a world load.
Changed GlobalGroups to save/load before local groups in the
scheduled data saving/loading
2012-01-03 02:04:48 +00:00
snowleo 9a568992f1 Merge pull request #42 from jjkoletar/patch-1
No sending to all players, must specify target.
2012-01-01 16:38:05 -08:00
Jeremy 283dc9b3c1 No sending to all players, must specify target. 2012-01-01 18:18:29 -06:00
ElgarL 3aba996e97 Changed the way events are raised to prevent variable corruption. 2011-12-29 14:52:42 +00:00
ElgarL 69847af08a Decreased ranks of default users so idiots who don't remove them can't
get 'hacked' when in offline mode.
2011-12-22 17:01:10 +00:00
ElgarL debcf4714a Delayed GroupManager events so Superperms will be fully updated before
plugins receive the events.
2011-12-20 17:21:55 +00:00
snowleo 791e8f2d14 Only info not a warning if a file is missing 2011-12-20 12:24:59 +01:00
snowleo 5d4f22ad84 Correctly match release and non release versions of bukkit. 2011-12-20 12:20:12 +01:00
snowleo 31e80ba698 Fix sending our player object to other plugins. 2011-12-20 11:57:22 +01:00
ElgarL a2202439bb Expanded GlobalGroups.yml and Groups.yml to include Towny permissions. 2011-12-19 19:22:04 +00:00
ElgarL 7c8c40c790 manpromote and mandemote now correctly sent the notification to the
console if the command was issued there.
2011-12-19 15:44:27 +00:00
snowleo abd86347c7 Always return an offlineplayer object with the name, that the user wants. 2011-12-19 12:57:09 +01:00
snowleo 5bb7d82fca Fix double names in /balancetop and show display name in balancetop 2011-12-19 12:39:23 +01:00
ElgarL afe8ecd3df Fixed a typo 2011-12-18 15:21:56 +00:00
ElgarL 244673e1fb Fixed manucheckp on group (missed it in last commit) 2011-12-18 14:35:14 +00:00
ElgarL de40f7f556 Fixed 'manucheckp' returning a null for the searched node when it's a
group/subgroup.
2011-12-18 14:26:00 +00:00
ElgarL ac77bbb0b4 Changed ServicesManager registration to lowest from normal. 2011-12-18 04:25:54 +00:00
ElgarL 815a9dcca2 Removed op permissions from admins in the default GloblaGroups.yml. 2011-12-14 16:24:47 +00:00
195 changed files with 4943 additions and 2597 deletions

No files matched your search

+3 -1
View File
@@ -37,4 +37,6 @@
/WebPush/apikey.php
/WebPush/nbproject/private
/.idea
*.iml
*.iml
/EssentialsGroupManager/bin
/EssentialsGroupManager/.externalToolBuilders
+9
View File
@@ -922,6 +922,14 @@ is divided into following sections:
-->
<target depends="init" if="have.sources" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
<and>
<isset property="endorsed.classpath.cmd.line.arg"/>
<not>
<equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
</not>
</and>
</condition>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
@@ -933,6 +941,7 @@ is divided into following sections:
<include name="**/*.java"/>
<exclude name="*.java"/>
</fileset>
<arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
</javadoc>
<copy todir="${dist.javadoc.dir}">
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+2 -2
View File
@@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.44.1.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=51b33957
nbproject/build-impl.xml.script.CRC32=c8376938
nbproject/build-impl.xml.stylesheet.CRC32=c12040a1@1.47.1.46
nbproject/build-impl.xml.script.CRC32=c5170bed
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
+9
View File
@@ -873,6 +873,14 @@ is divided into following sections:
-->
<target depends="init" if="have.sources" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
<and>
<isset property="endorsed.classpath.cmd.line.arg"/>
<not>
<equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
</not>
</and>
</condition>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
@@ -884,6 +892,7 @@ is divided into following sections:
<include name="**/*.java"/>
<exclude name="*.java"/>
</fileset>
<arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
</javadoc>
<copy todir="${dist.javadoc.dir}">
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+2 -2
View File
@@ -4,8 +4,8 @@ build.xml.stylesheet.CRC32=28e38971@1.38.2.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=a830bc14
nbproject/build-impl.xml.script.CRC32=40df7eaf
nbproject/build-impl.xml.stylesheet.CRC32=c12040a1@1.47.1.46
nbproject/build-impl.xml.script.CRC32=a9f8842a
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
nbproject/profiler-build-impl.xml.data.CRC32=ab78ce15
nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1
+9 -3
View File
@@ -66,16 +66,19 @@ endorsed.classpath=
excludes=
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
file.reference.bPermissions.jar=../lib/bPermissions.jar
file.reference.bpermissions2.jar=../lib/bpermissions2.jar
file.reference.bukkit.jar=../lib/bukkit.jar
file.reference.craftbukkit.jar=../lib/craftbukkit.jar
file.reference.iCo4.jar=../lib/iCo4.jar
file.reference.iCo5.jar=../lib/iCo5.jar
file.reference.iCo6.jar=../lib/iCo6.jar
file.reference.lombok-0.10.1.jar=../lib/lombok-0.10.1.jar
file.reference.lombok.jar=../lib/lombok-0.10.8.jar
file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
file.reference.Permissions3.jar=../lib/Permissions3.jar
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
file.reference.Privileges.jar=..\\lib\\Privileges.jar
file.reference.Vault.jar=../lib/Vault.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
@@ -90,10 +93,13 @@ javac.classpath=\
${file.reference.PermissionsEx.jar}:\
${file.reference.bPermissions.jar}:\
${file.reference.PermissionsBukkit-1.2.jar}:\
${file.reference.lombok-0.10.1.jar}:\
${file.reference.lombok.jar}:\
${reference.EssentialsGroupManager.jar}:\
${file.reference.bukkit.jar}:\
${file.reference.craftbukkit.jar}
${file.reference.craftbukkit.jar}:\
${file.reference.Vault.jar}:\
${file.reference.Privileges.jar}:\
${file.reference.bpermissions2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
@@ -54,6 +54,12 @@ public class Enchantments
ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH);
ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER);
ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER);
ENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE);
ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE);
ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE);
ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE);
}
public static Enchantment getByName(String name) {
@@ -24,7 +24,6 @@ import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.commands.NoChargeException;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import com.earth2me.essentials.craftbukkit.ItemDupeFix;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import com.earth2me.essentials.signs.SignBlockListener;
@@ -33,23 +32,29 @@ import com.earth2me.essentials.signs.SignPlayerListener;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.InvalidDescriptionException;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
@@ -61,7 +66,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
public static final int BUKKIT_VERSION = 1597;
public static final int BUKKIT_VERSION = 1988;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
@@ -124,11 +129,11 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
}
}
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-R[0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
if (versionMatch.matches())
{
final int versionNumber = Integer.parseInt(versionMatch.group(4));
if (versionNumber < BUKKIT_VERSION)
final int versionNumber = Integer.parseInt(versionMatch.group(1));
if (versionNumber < BUKKIT_VERSION && versionNumber > 100)
{
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
@@ -179,14 +184,14 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.SEVERE, _("essentialsHelp1"));
}
LOGGER.log(Level.SEVERE, exception.toString());
pm.registerEvent(Type.PLAYER_JOIN, new PlayerListener()
pm.registerEvents(new Listener()
{
@Override
public void onPlayerJoin(PlayerJoinEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onPlayerJoin(final PlayerJoinEvent event)
{
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
}
}, Priority.Low, this);
}, this);
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials failed to load, read the log file.");
@@ -198,63 +203,40 @@ public class Essentials extends JavaPlugin implements IEssentials
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this);
pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this);
pm.registerEvents(serverListener, this);
confList.add(serverListener);
final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
pm.registerEvent(Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Lowest, this);
pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_LOGIN, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this);
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Low, this);
pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this);
pm.registerEvents(playerListener, this);
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
pm.registerEvents(blockListener, this);
final SignBlockListener signBlockListener = new SignBlockListener(this);
pm.registerEvent(Type.SIGN_CHANGE, signBlockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_PLACE, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BREAK, signBlockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_IGNITE, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BURN, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_PISTON_EXTEND, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_PISTON_RETRACT, signBlockListener, Priority.Low, this);
pm.registerEvents(signBlockListener, this);
final SignPlayerListener signPlayerListener = new SignPlayerListener(this);
pm.registerEvent(Type.PLAYER_INTERACT, signPlayerListener, Priority.Low, this);
pm.registerEvents(signPlayerListener, this);
final SignEntityListener signEntityListener = new SignEntityListener(this);
pm.registerEvent(Type.ENTITY_EXPLODE, signEntityListener, Priority.Low, this);
pm.registerEvent(Type.ENDERMAN_PICKUP, signEntityListener, Priority.Low, this);
pm.registerEvents(signEntityListener, this);
final EssentialsEntityListener entityListener = new EssentialsEntityListener(this);
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_COMBUST, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_DEATH, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.FOOD_LEVEL_CHANGE, entityListener, Priority.Lowest, this);
pm.registerEvents(entityListener, this);
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
pm.registerEvents(worldListener, this);
//TODO: Check if this should be here, and not above before reload()
jails = new Jails(this);
confList.add(jails);
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
pm.registerEvents(tntListener, this);
final EssentialsTimer timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
Economy.setEss(this);
execTimer.mark("RegListeners");
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors())));
final String timeroutput = execTimer.end();
if (getSettings().isDebug())
{
@@ -300,7 +282,29 @@ public class Essentials extends JavaPlugin implements IEssentials
if (pc != null)
{
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
return pc.execute(sender, commandLabel, args);
try
{
return pc.execute(sender, commandLabel, args);
}
catch (final Exception ex)
{
final ArrayList<StackTraceElement> elements = new ArrayList<StackTraceElement>(Arrays.asList(ex.getStackTrace()));
elements.remove(0);
final ArrayList<StackTraceElement> toRemove = new ArrayList<StackTraceElement>();
for (final StackTraceElement e : elements)
{
if (e.getClassName().equals("com.earth2me.essentials.Essentials"))
{
toRemove.add(e);
}
}
elements.removeAll(toRemove);
final StackTraceElement[] trace = elements.toArray(new StackTraceElement[elements.size()]);
ex.setStackTrace(trace);
ex.printStackTrace();
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
return true;
}
}
}
@@ -440,7 +444,12 @@ public class Essentials extends JavaPlugin implements IEssentials
}
if (base instanceof String)
{
return userMap.getUser((String)base);
final User user = userMap.getUser((String)base);
if (user != null && user.getBase() instanceof OfflinePlayer)
{
((OfflinePlayer)user.getBase()).setName((String)base);
}
return user;
}
return null;
}
@@ -472,7 +481,12 @@ public class Essentials extends JavaPlugin implements IEssentials
@Override
public User getOfflineUser(final String name)
{
return userMap.getUser(name);
final User user = userMap.getUser(name);
if (user != null && user.getBase() instanceof OfflinePlayer)
{
((OfflinePlayer)user.getBase()).setName(name);
}
return user;
}
@Override
@@ -585,4 +599,46 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return i18n;
}
private static class EssentialsWorldListener implements Listener, Runnable {
private transient final IEssentials ess;
public EssentialsWorldListener(final IEssentials ess)
{
this.ess = ess;
}
@EventHandler(priority = EventPriority.LOW)
public void onWorldLoad(final WorldLoadEvent event)
{
ess.getJails().onReload();
ess.getWarps().reloadConfig();
for (IConf iConf : ((Essentials)ess).confList)
{
if (iConf instanceof IEssentialsModule) {
iConf.reloadConfig();
}
}
}
@EventHandler(priority = EventPriority.LOW)
public void onWorldUnload(final WorldUnloadEvent event)
{
ess.getJails().onReload();
ess.getWarps().reloadConfig();
for (IConf iConf : ((Essentials)ess).confList)
{
if (iConf instanceof IEssentialsModule) {
iConf.reloadConfig();
}
}
}
@Override
public void run()
{
ess.reload();
}
}
}
@@ -1,25 +1,24 @@
package com.earth2me.essentials;
import java.util.logging.Logger;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
public class EssentialsBlockListener extends BlockListener
public class EssentialsBlockListener implements Listener
{
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
private final transient IEssentials ess;
public EssentialsBlockListener(IEssentials ess)
public EssentialsBlockListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
public void onBlockPlace(BlockPlaceEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled())
{
@@ -33,7 +32,7 @@ public class EssentialsBlockListener extends BlockListener
{
return;
}
boolean unlimitedForUser = user.hasUnlimited(is);
final boolean unlimitedForUser = user.hasUnlimited(is);
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
{
ess.scheduleSyncDelayedTask(
@@ -3,7 +3,6 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
@@ -12,12 +11,14 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.config.Configuration;
public class EssentialsConf extends Configuration
public class EssentialsConf extends YamlConfiguration
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient File configFile;
@@ -26,15 +27,10 @@ public class EssentialsConf extends Configuration
public EssentialsConf(final File configFile)
{
super(configFile);
super();
this.configFile = configFile;
if (this.root == null)
{
this.root = new HashMap<String, Object>();
}
}
@Override
public void load()
{
configFile = configFile.getAbsoluteFile();
@@ -105,19 +101,24 @@ public class EssentialsConf extends Configuration
}
}
try
{
super.load();
super.load(configFile);
}
catch (RuntimeException e)
catch (FileNotFoundException ex)
{
LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString());
throw e;
LOGGER.log(Level.SEVERE, null, ex);
}
if (this.root == null)
catch (IOException ex)
{
this.root = new HashMap<String, Object>();
LOGGER.log(Level.SEVERE, null, ex);
}
catch (InvalidConfigurationException ex)
{
File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis());
configFile.renameTo(broken);
LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
}
}
@@ -192,7 +193,7 @@ public class EssentialsConf extends Configuration
public boolean hasProperty(final String path)
{
return getProperty(path) != null;
return isSet(path);
}
public Location getLocation(final String path, final Server server) throws Exception
@@ -217,24 +218,25 @@ public class EssentialsConf extends Configuration
public void setProperty(final String path, final Location loc)
{
setProperty((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
setProperty((path == null ? "" : path + ".") + "x", loc.getX());
setProperty((path == null ? "" : path + ".") + "y", loc.getY());
setProperty((path == null ? "" : path + ".") + "z", loc.getZ());
setProperty((path == null ? "" : path + ".") + "yaw", loc.getYaw());
setProperty((path == null ? "" : path + ".") + "pitch", loc.getPitch());
set((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
set((path == null ? "" : path + ".") + "x", loc.getX());
set((path == null ? "" : path + ".") + "y", loc.getY());
set((path == null ? "" : path + ".") + "z", loc.getZ());
set((path == null ? "" : path + ".") + "yaw", loc.getYaw());
set((path == null ? "" : path + ".") + "pitch", loc.getPitch());
}
@Override
public ItemStack getItemStack(final String path)
{
final ItemStack stack = new ItemStack(
Material.valueOf(getString(path + ".type", "AIR")),
getInt(path + ".amount", 1),
(short)getInt(path + ".damage", 0));
final List<String> enchants = getKeys(path + ".enchant");
final ConfigurationSection enchants = getConfigurationSection(path + ".enchant");
if (enchants != null)
{
for (String enchant : enchants)
for (String enchant : enchants.getKeys(false))
{
final Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH));
if (enchantment == null)
@@ -270,14 +272,14 @@ public class EssentialsConf extends Configuration
}
// getData().getData() is broken
//map.put("data", stack.getDurability());
setProperty(path, map);
set(path, map);
}
public long getLong(final String path, final long def)
{
try
{
final Number num = (Number)getProperty(path);
final Number num = (Number)get(path);
return num == null ? def : num.longValue();
}
catch (ClassCastException ex)
@@ -291,7 +293,7 @@ public class EssentialsConf extends Configuration
{
try
{
Number num = (Number)getProperty(path);
Number num = (Number)get(path);
return num == null ? def : num.doubleValue();
}
catch (ClassCastException ex)
@@ -299,4 +301,27 @@ public class EssentialsConf extends Configuration
return def;
}
}
public void save() {
try
{
save(configFile);
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, null, ex);
}
}
public Object getProperty(String path) {
return get(path);
}
public void setProperty(String path, Object object) {
set(path, object);
}
public void removeProperty(String path) {
set(path, null);
}
}
@@ -2,19 +2,20 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.*;
import org.bukkit.inventory.ItemStack;
public class EssentialsEntityListener extends EntityListener
public class EssentialsEntityListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final IEssentials ess;
public EssentialsEntityListener(IEssentials ess)
@@ -22,48 +23,48 @@ public class EssentialsEntityListener extends EntityListener
this.ess = ess;
}
@Override
public void onEntityDamage(EntityDamageEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(final EntityDamageByEntityEvent event)
{
if (event instanceof EntityDamageByEntityEvent)
final Entity eAttack = event.getDamager();
final Entity eDefend = event.getEntity();
if (eDefend instanceof Player && eAttack instanceof Player)
{
EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
Entity eAttack = edEvent.getDamager();
Entity eDefend = edEvent.getEntity();
if (eDefend instanceof Player && eAttack instanceof Player)
final User defender = ess.getUser(eDefend);
final User attacker = ess.getUser(eAttack);
attacker.updateActivity(true);
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())
{
User defender = ess.getUser(eDefend);
User attacker = ess.getUser(eAttack);
attacker.updateActivity(true);
ItemStack is = attacker.getItemInHand();
List<String> commandList = attacker.getPowertool(is);
if (commandList != null && !commandList.isEmpty())
for (String command : commandList)
{
for (String command : commandList)
if (command != null && !command.isEmpty())
{
if (command != null && !command.isEmpty())
{
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
event.setCancelled(true);
return;
}
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
event.setCancelled(true);
return;
}
}
}
if (eDefend instanceof Animals && eAttack instanceof Player)
}
else if (eDefend instanceof Animals && eAttack instanceof Player)
{
final User player = ess.getUser(eAttack);
final ItemStack hand = player.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET)
{
User player = ess.getUser(eAttack);
ItemStack hand = player.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET) {
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
player.updateInventory();
event.setCancelled(true);
}
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
player.updateInventory();
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(final EntityDamageEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
final Player player = (Player)event.getEntity();
@@ -73,8 +74,8 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
public void onEntityCombust(EntityCombustEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityCombust(final EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
@@ -82,27 +83,23 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
public void onEntityDeath(final EntityDeathEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerDeathEvent(final PlayerDeathEvent event)
{
if (event instanceof PlayerDeathEvent)
final User user = ess.getUser(event.getEntity());
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
final PlayerDeathEvent pdevent = (PlayerDeathEvent)event;
final User user = ess.getUser(pdevent.getEntity());
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
user.setLastLocation();
user.sendMessage(_("backAfterDeath"));
}
if (!ess.getSettings().areDeathMessagesEnabled())
{
pdevent.setDeathMessage("");
}
user.setLastLocation();
user.sendMessage(_("backAfterDeath"));
}
if (!ess.getSettings().areDeathMessagesEnabled())
{
event.setDeathMessage("");
}
}
@Override
public void onFoodLevelChange(FoodLevelChangeEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onFoodLevelChange(final FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
@@ -110,8 +107,8 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
public void onEntityRegainHealth(EntityRegainHealthEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
&& ess.getUser(event.getEntity()).isAfk() && ess.getSettings().getFreezeAfkPlayers())
@@ -1,7 +1,6 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.craftbukkit.SetBed;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
@@ -17,15 +16,17 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
public class EssentialsPlayerListener extends PlayerListener
public class EssentialsPlayerListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient Server server;
@@ -37,7 +38,7 @@ public class EssentialsPlayerListener extends PlayerListener
this.server = parent.getServer();
}
@Override
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -48,7 +49,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -74,7 +75,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerMove(final PlayerMoveEvent event)
{
if (event.isCancelled())
@@ -108,7 +109,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -125,7 +126,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.dispose();
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
ess.getBackup().onPlayerJoin();
@@ -178,14 +179,19 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerLogin(final PlayerLoginEvent event)
{
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
switch (event.getResult())
{
LOGGER.log(Level.INFO, "Disconnecting user " + event.getPlayer().toString() + " due to " + event.getResult().toString());
case ALLOWED:
case KICK_FULL:
case KICK_BANNED:
break;
default:
return;
}
User user = ess.getUser(event.getPlayer());
user.setNPC(false);
@@ -194,7 +200,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.checkMuteTimeout(currentTime);
user.checkJailTimeout(currentTime);
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
if (!banExpired && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
{
final String banReason = user.getBanReason();
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : _("defaultBanReason"));
@@ -225,41 +231,36 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
public void onPlayerTeleport(PlayerTeleportEvent event)
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if (event.isCancelled())
{
return;
}
final User user = ess.getUser(event.getPlayer());
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
if ((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND) && ess.getSettings().registerBackInListener())
{
final User user = ess.getUser(event.getPlayer());
user.setLastLocation();
}
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
updateCompass(user);
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
{
final User user = ess.getUser(event.getPlayer());
final ItemStack is = new ItemStack(Material.EGG, 1);
if (user.hasUnlimited(is))
final ItemStack stack = new ItemStack(Material.EGG, 1);
if (user.hasUnlimited(stack))
{
user.getInventory().addItem(is);
user.getInventory().addItem(stack);
user.updateInventory();
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -277,52 +278,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
public void onPlayerAnimation(final PlayerAnimationEvent event)
{
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
usePowertools(event);
}
private void usePowertools(final PlayerAnimationEvent event)
{
if (event.getAnimationType() != PlayerAnimationType.ARM_SWING)
{
return;
}
final User user = ess.getUser(event.getPlayer());
final ItemStack is = user.getItemInHand();
if (is == null || is.getType() == Material.AIR || !user.arePowerToolsEnabled())
{
return;
}
final List<String> commandList = user.getPowertool(is);
if (commandList == null || commandList.isEmpty())
{
return;
}
// We need to loop through each command and execute
for (String command : commandList)
{
if (command.matches(".*\\{player\\}.*"))
{
//user.sendMessage("Click a player to use this command");
continue;
}
else if (command.startsWith("c:"))
{
user.chat(command.substring(2));
}
else
{
user.getServer().dispatchCommand(event.getPlayer(), command);
}
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
{
if (event.isCancelled())
@@ -336,7 +292,7 @@ public class EssentialsPlayerListener extends PlayerListener
{
for (Player player : ess.getServer().getOnlinePlayers())
{
User spyer = ess.getUser(player);
final User spyer = ess.getUser(player);
if (spyer.isSocialSpyEnabled() && !user.equals(spyer))
{
player.sendMessage(user.getDisplayName() + " : " + event.getMessage());
@@ -349,12 +305,18 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
{
final User user = ess.getUser(event.getPlayer());
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
updateCompass(user);
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
{
User user = ess.getUser(event.getPlayer());
if (user.isGodModeEnabledRaw())
{
user.sendMessage(_("noGodWorldWarning"));
@@ -362,26 +324,84 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled())
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
switch (event.getAction())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
}
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
SetBed.setBed(event.getPlayer(), event.getClickedBlock());
case RIGHT_CLICK_BLOCK:
if (event.isCancelled())
{
return;
}
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
}
break;
case LEFT_CLICK_AIR:
case LEFT_CLICK_BLOCK:
if (user.hasPowerTools() && user.arePowerToolsEnabled())
{
if (usePowertools(user))
{
event.setCancelled(true);
}
}
break;
default:
break;
}
}
@Override
public void onPlayerPickupItem(PlayerPickupItemEvent event)
private boolean usePowertools(final User user)
{
final ItemStack is = user.getItemInHand();
int id;
if (is == null || (id = is.getTypeId()) == 0)
{
return false;
}
final List<String> commandList = user.getPowertool(id);
if (commandList == null || commandList.isEmpty())
{
return false;
}
boolean used = false;
// We need to loop through each command and execute
for (final String command : commandList)
{
if (command.matches(".*\\{player\\}.*"))
{
//user.sendMessage("Click a player to use this command");
continue;
}
else if (command.startsWith("c:"))
{
used = true;
user.chat(command.substring(2));
}
else
{
used = true;
ess.scheduleSyncDelayedTask(
new Runnable()
{
@Override
public void run()
{
user.getServer().dispatchCommand(user.getBase(), command);
}
});
}
}
return used;
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerPickupItem(final PlayerPickupItemEvent event)
{
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
{
@@ -1,34 +1,34 @@
package com.earth2me.essentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
public class EssentialsPluginListener extends ServerListener implements IConf
public class EssentialsPluginListener implements Listener, IConf
{
private final transient IEssentials ess;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
public EssentialsPluginListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(final PluginEnableEvent event)
{
ess.getPermissionsHandler().checkPermissions();
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
{
LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(final PluginDisableEvent event)
{
ess.getPermissionsHandler().checkPermissions();
@@ -37,7 +37,7 @@ public class EssentialsPluginListener extends ServerListener implements IConf
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
{
ess.getPaymentMethod().reset();
LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
ess.getLogger().log(Level.INFO, "Payment method was disabled. No longer accepting payments.");
}
}
@@ -3,6 +3,7 @@ package com.earth2me.essentials;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.entity.Player;
@@ -22,10 +23,17 @@ public class EssentialsTimer implements Runnable
final long currentTime = System.currentTimeMillis();
for (Player player : ess.getServer().getOnlinePlayers())
{
final User user = ess.getUser(player);
onlineUsers.add(user);
user.setLastOnlineActivity(currentTime);
user.checkActivity();
try
{
final User user = ess.getUser(player);
onlineUsers.add(user);
user.setLastOnlineActivity(currentTime);
user.checkActivity();
}
catch (Exception e)
{
ess.getLogger().log(Level.WARNING, "EssentialsTimer Error:", e);
}
}
final Iterator<User> iterator = onlineUsers.iterator();
@@ -95,7 +95,7 @@ public class EssentialsUpgrade
}
final EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
List<String> lines = conf.getStringList(name, null);
List<String> lines = conf.getStringList(name);
if (lines != null && !lines.isEmpty())
{
if (!file.createNewFile())
@@ -271,18 +271,18 @@ public class EssentialsUpgrade
if (config.hasProperty("powertools"))
{
@SuppressWarnings("unchecked")
final Map<Integer, Object> powertools = (Map<Integer, Object>)config.getProperty("powertools");
final Map<String, Object> powertools = config.getConfigurationSection("powertools").getValues(false);
if (powertools == null)
{
continue;
}
for (Map.Entry<Integer, Object> entry : powertools.entrySet())
for (Map.Entry<String, Object> entry : powertools.entrySet())
{
if (entry.getValue() instanceof String)
{
List<String> temp = new ArrayList<String>();
temp.add((String)entry.getValue());
((Map<Integer, Object>)powertools).put(entry.getKey(), temp);
((Map<String, Object>)powertools).put(entry.getKey(), temp);
}
}
config.save();
@@ -332,7 +332,7 @@ public class EssentialsUpgrade
config.setProperty("homes.home", defloc);
}
List<String> worlds = config.getKeys("home.worlds");
Set<String> worlds = config.getConfigurationSection("home.worlds").getKeys(false);
Location loc;
String worldName;
@@ -381,7 +381,7 @@ public class EssentialsUpgrade
}
final EssentialsConf usersConfig = new EssentialsConf(usersFile);
usersConfig.load();
for (String username : usersConfig.getKeys(null))
for (String username : usersConfig.getKeys(false))
{
final User user = new User(new OfflinePlayer(username, ess), ess);
final String nickname = usersConfig.getString(username + ".nickname");
@@ -389,7 +389,7 @@ public class EssentialsUpgrade
{
user.setNickname(nickname);
}
final List<String> mails = usersConfig.getStringList(username + ".mail", null);
final List<String> mails = usersConfig.getStringList(username + ".mail");
if (mails != null && !mails.isEmpty())
{
user.setMails(mails);
@@ -701,7 +701,7 @@ public class EssentialsUpgrade
if (!config.hasProperty("spawns"))
{
final Spawns spawns = new Spawns();
List<String> keys = config.getKeys();
Set<String> keys = config.getKeys(false);
for (String group : keys)
{
Location loc = getFakeLocation(config, group);
@@ -748,7 +748,7 @@ public class EssentialsUpgrade
if (!config.hasProperty("jails"))
{
final com.earth2me.essentials.settings.Jails jails = new com.earth2me.essentials.settings.Jails();
List<String> keys = config.getKeys();
Set<String> keys = config.getKeys(false);
for (String jailName : keys)
{
Location loc = getFakeLocation(config, jailName);
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
/**
* @deprecated This will be moved to the api package soon
*/
@@ -1,28 +1,32 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.textreader.IText;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.event.EventPriority;
public interface ISettings extends IConf
{
boolean areSignsDisabled();
String format(String format, IUser user);
String getAnnounceNewPlayerFormat(IUser user);
IText getAnnounceNewPlayerFormat();
boolean getAnnounceNewPlayers();
String getNewPlayerKit();
String getBackupCommand();
long getBackupInterval();
String getChatFormat(String group);
MessageFormat getChatFormat(String group);
int getChatRadius();
@@ -33,14 +37,14 @@ public interface ISettings extends IConf
String getCurrencySymbol();
int getOversizedStackSize();
int getDefaultStackSize();
double getHealCooldown();
Object getKit(String name);
Map<String, Object> getKit(String name);
Map<String, Object> getKits();
ConfigurationSection getKits();
String getLocale();
@@ -64,7 +68,7 @@ public interface ISettings extends IConf
boolean getRespawnAtHome();
List getMultipleHomes();
Set getMultipleHomes();
int getHomeLimit(String set);
@@ -100,6 +104,8 @@ public interface ISettings extends IConf
List<Integer> itemSpawnBlacklist();
List<EssentialsSign> enabledSigns();
boolean permissionBasedItemSpawn();
boolean showNonEssCommandsInHelp();
@@ -112,8 +118,12 @@ public interface ISettings extends IConf
double getMaxMoney();
double getMinMoney();
boolean isEcoLogEnabled();
boolean isEcoLogUpdateEnabled();
boolean removeGodOnDisconnect();
boolean changeDisplayName();
@@ -139,18 +149,18 @@ public interface ISettings extends IConf
public void setDebug(boolean debug);
Set<String> getNoGodWorlds();
boolean getUpdateBedAtDaytime();
boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
boolean registerBackInListener();
public boolean getDisableItemPickupWhileAfk();
boolean getDisableItemPickupWhileAfk();
EventPriority getRespawnPriority();
public Priority getRespawnPriority();
long getTpaAcceptCancellation();
}
@@ -32,6 +32,8 @@ public interface IUser extends Player
void takeMoney(double value);
void giveMoney(double value);
boolean canAfford(double value);
String getGroup();
@@ -1,18 +1,24 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IJails;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*;
import org.bukkit.event.player.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.plugin.PluginManager;
@@ -33,13 +39,8 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
final PluginManager pluginManager = ess.getServer().getPluginManager();
final JailBlockListener blockListener = new JailBlockListener();
final JailPlayerListener playerListener = new JailPlayerListener();
pluginManager.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Low, ess);
pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess);
pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess);
pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess);
pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess);
pluginManager.registerEvents(blockListener, ess);
pluginManager.registerEvents(playerListener, ess);
}
@Override
@@ -146,9 +147,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
private class JailBlockListener extends BlockListener
private class JailBlockListener implements Listener
{
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockBreak(final BlockBreakEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -158,7 +159,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(final BlockPlaceEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -168,7 +169,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockDamage(final BlockDamageEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -180,9 +181,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
private class JailPlayerListener extends PlayerListener
private class JailPlayerListener implements Listener
{
@Override
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -192,7 +193,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -207,11 +208,18 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
}
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -226,12 +234,19 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
}
}
user.sendMessage(_("jailMessage"));
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -246,7 +261,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
}
}
user.sendMessage(_("jailMessage"));
}
@@ -1,10 +1,12 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import static com.earth2me.essentials.I18n.capitalCase;
import com.earth2me.essentials.commands.NoChargeException;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import java.util.*;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@@ -15,16 +17,16 @@ public class Kit
{
try
{
final Map<String, Object> kits = ess.getSettings().getKits();
final ConfigurationSection kits = ess.getSettings().getKits();
final StringBuilder list = new StringBuilder();
for (String kiteItem : kits.keySet())
for (String kiteItem : kits.getKeys(false))
{
if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
{
list.append(" ").append(kiteItem);
list.append(" ").append(capitalCase(kiteItem));
}
}
return list.toString();
return list.toString().trim();
}
catch (Exception ex)
{
@@ -59,11 +61,16 @@ public class Kit
}
}
public static List<String> getItems(final User user, final Map<String, Object> els) throws Exception
public static List<String> getItems(final User user, final Map<String, Object> kit) throws Exception
{
if (kit == null)
{
throw new Exception(_("kitError2"));
}
try
{
return (List<String>)els.get("items");
return (List<String>)kit.get("items");
}
catch (Exception e)
{
+30 -29
View File
@@ -1,6 +1,7 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -9,40 +10,40 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public enum Mob
{
CHICKEN("Chicken", Enemies.FRIENDLY, CreatureType.CHICKEN),
COW("Cow", Enemies.FRIENDLY, CreatureType.COW),
CREEPER("Creeper", Enemies.ENEMY, CreatureType.CREEPER),
GHAST("Ghast", Enemies.ENEMY, CreatureType.GHAST),
GIANT("Giant", Enemies.ENEMY, CreatureType.GIANT),
PIG("Pig", Enemies.FRIENDLY, CreatureType.PIG),
PIGZOMB("PigZombie", Enemies.NEUTRAL, CreatureType.PIG_ZOMBIE),
SHEEP("Sheep", Enemies.FRIENDLY, "", CreatureType.SHEEP),
SKELETON("Skeleton", Enemies.ENEMY, CreatureType.SKELETON),
SLIME("Slime", Enemies.ENEMY, CreatureType.SLIME),
SPIDER("Spider", Enemies.ENEMY, CreatureType.SPIDER),
SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID),
ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE),
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF),
CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER),
ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN),
SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH),
ENDERDRAGON("EnderDragon", Enemies.ENEMY, CreatureType.ENDER_DRAGON),
VILLAGER("Villager", Enemies.FRIENDLY, CreatureType.VILLAGER),
BLAZE("Blaze", Enemies.ENEMY, CreatureType.BLAZE),
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, CreatureType.MUSHROOM_COW),
MAGMACUBE("MagmaCube", Enemies.ENEMY, CreatureType.MAGMA_CUBE),
SNOWMAN("Snowman", Enemies.FRIENDLY, "", CreatureType.SNOWMAN);
CHICKEN("Chicken", Enemies.FRIENDLY, EntityType.CHICKEN),
COW("Cow", Enemies.FRIENDLY, EntityType.COW),
CREEPER("Creeper", Enemies.ENEMY, EntityType.CREEPER),
GHAST("Ghast", Enemies.ENEMY, EntityType.GHAST),
GIANT("Giant", Enemies.ENEMY, EntityType.GIANT),
PIG("Pig", Enemies.FRIENDLY, EntityType.PIG),
PIGZOMB("PigZombie", Enemies.NEUTRAL, EntityType.PIG_ZOMBIE),
SHEEP("Sheep", Enemies.FRIENDLY, "", EntityType.SHEEP),
SKELETON("Skeleton", Enemies.ENEMY, EntityType.SKELETON),
SLIME("Slime", Enemies.ENEMY, EntityType.SLIME),
SPIDER("Spider", Enemies.ENEMY, EntityType.SPIDER),
SQUID("Squid", Enemies.FRIENDLY, EntityType.SQUID),
ZOMBIE("Zombie", Enemies.ENEMY, EntityType.ZOMBIE),
WOLF("Wolf", Enemies.NEUTRAL, EntityType.WOLF),
CAVESPIDER("CaveSpider", Enemies.ENEMY, EntityType.CAVE_SPIDER),
ENDERMAN("Enderman", Enemies.ENEMY, "", EntityType.ENDERMAN),
SILVERFISH("Silverfish", Enemies.ENEMY, "", EntityType.SILVERFISH),
ENDERDRAGON("EnderDragon", Enemies.ENEMY, EntityType.ENDER_DRAGON),
VILLAGER("Villager", Enemies.FRIENDLY, EntityType.VILLAGER),
BLAZE("Blaze", Enemies.ENEMY, EntityType.BLAZE),
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, EntityType.MUSHROOM_COW),
MAGMACUBE("MagmaCube", Enemies.ENEMY, EntityType.MAGMA_CUBE),
SNOWMAN("Snowman", Enemies.FRIENDLY, "", EntityType.SNOWMAN);
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s, CreatureType type)
private Mob(String n, Enemies en, String s, EntityType type)
{
this.suffix = s;
this.name = n;
@@ -50,7 +51,7 @@ public enum Mob
this.bukkitType = type;
}
private Mob(String n, Enemies en, CreatureType type)
private Mob(String n, Enemies en, EntityType type)
{
this.name = n;
this.type = en;
@@ -59,7 +60,7 @@ public enum Mob
public String suffix = "s";
final public String name;
final public Enemies type;
final private CreatureType bukkitType;
final private EntityType bukkitType;
private static final Map<String, Mob> hashMap = new HashMap<String, Mob>();
static
@@ -71,7 +72,7 @@ public enum Mob
}
public static Set<String> getMobList() {
return hashMap.keySet();
return Collections.unmodifiableSet(hashMap.keySet());
}
public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException
@@ -99,7 +100,7 @@ public enum Mob
final protected String type;
}
public CreatureType getType()
public EntityType getType()
{
return bukkitType;
}
@@ -1,36 +1,39 @@
package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
import static com.earth2me.essentials.I18n._;
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import lombok.Delegate;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.conversations.Conversation;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.InventoryView.Property;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
public class OfflinePlayer implements Player
{
private final transient IEssentials ess;
private Location location = new Location(null, 0, 0, 0, 0, 0);
private World world;
private UUID uniqueId = UUID.randomUUID();
private transient Location location = new Location(null, 0, 0, 0, 0, 0);
private transient World world;
private final transient UUID uniqueId = UUID.randomUUID();
@Delegate(types = org.bukkit.OfflinePlayer.class)
private final org.bukkit.OfflinePlayer base;
private transient org.bukkit.OfflinePlayer base;
public OfflinePlayer(final String name, final IEssentials ess)
{
@@ -173,11 +176,6 @@ public class OfflinePlayer implements Player
return false;
}
public boolean isPlayer()
{
return false;
}
@Override
public int getRemainingAir()
{
@@ -667,18 +665,6 @@ public class OfflinePlayer implements Player
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getExperience()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setExperience(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getLevel()
{
@@ -739,12 +725,6 @@ public class OfflinePlayer implements Player
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getBedSpawnLocation()
{
return OfflineBedLocation.getBedLocation(base.getName(), ess);
}
@Override
public boolean isSprinting()
{
@@ -822,4 +802,229 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
void setName(final String name)
{
if (!this.base.getName().equalsIgnoreCase(name))
{
this.base = ess.getServer().getOfflinePlayer(name);
}
}
@Override
public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> getListeningPluginChannels()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setAllowFlight(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean getAllowFlight()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setBedSpawnLocation(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void playEffect(EntityEffect ee)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void hidePlayer(Player player)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void showPlayer(Player player)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean canSee(Player player)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addPotionEffect(PotionEffect pe)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addPotionEffect(PotionEffect pe, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addPotionEffects(Collection<PotionEffect> clctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasPotionEffect(PotionEffectType pet)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removePotionEffect(PotionEffectType pet)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Collection<PotionEffect> getActivePotionEffects()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T extends Projectile> T launchProjectile(Class<? extends T> arg0)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public EntityType getType()
{
return EntityType.PLAYER;
}
@Override
public <T> void playEffect(Location lctn, Effect effect, T t)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean setWindowProperty(Property prprt, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView getOpenInventory()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openInventory(Inventory invntr)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openWorkbench(Location lctn, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openEnchanting(Location lctn, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void openInventory(InventoryView iv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void closeInventory()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ItemStack getItemOnCursor()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setItemOnCursor(ItemStack is)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setMetadata(String string, MetadataValue mv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<MetadataValue> getMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeMetadata(String string, Plugin plugin)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isConversing()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void acceptConversationInput(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean beginConversation(Conversation c)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void abandonConversation(Conversation c)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void sendMessage(String[] strings)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
@@ -2,12 +2,19 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.signs.Signs;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.SimpleTextInput;
import java.io.File;
import java.text.MessageFormat;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
@@ -38,15 +45,15 @@ public class Settings implements ISettings
}
@Override
public List<String> getMultipleHomes()
public Set<String> getMultipleHomes()
{
return config.getKeys("sethome-multiple");
return config.getConfigurationSection("sethome-multiple").getKeys(false);
}
@Override
public int getHomeLimit(final User user)
{
final List<String> homeList = getMultipleHomes();
final Set<String> homeList = getMultipleHomes();
if (homeList == null)
{
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
@@ -109,7 +116,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandDisabled(String label)
{
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("disabled-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -129,7 +136,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("restricted-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -143,7 +150,7 @@ public class Settings implements ISettings
@Override
public boolean isPlayerCommand(String label)
{
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("player-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -157,9 +164,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandOverridden(String name)
{
List<String> defaultList = new ArrayList<String>(1);
defaultList.add("god");
for (String c : config.getStringList("overridden-commands", defaultList))
for (String c : config.getStringList("overridden-commands"))
{
if (!c.equalsIgnoreCase(name))
{
@@ -204,25 +209,45 @@ public class Settings implements ISettings
{
return config.getDouble("heal-cooldown", 0);
}
private ConfigurationSection kits;
@Override
public Object getKit(String name)
public ConfigurationSection _getKits()
{
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
for (Map.Entry<String, Object> entry : kits.entrySet())
if (config.isConfigurationSection("kits"))
{
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
final ConfigurationSection section = config.getConfigurationSection("kits");
final ConfigurationSection newSection = new MemoryConfiguration();
for (String kitItem : section.getKeys(false))
{
return entry.getValue();
if (section.isConfigurationSection(kitItem))
{
newSection.set(kitItem.toLowerCase(Locale.ENGLISH), section.getConfigurationSection(kitItem));
}
}
return newSection;
}
return null;
}
@Override
public Map<String, Object> getKits()
public ConfigurationSection getKits()
{
return (Map<String, Object>)config.getProperty("kits");
return kits;
}
@Override
public Map<String, Object> getKit(String name)
{
name = name.replace('.', '_').replace('/', '_');
if (config.isConfigurationSection("kits"))
{
final ConfigurationSection kits = getKits();
if (kits.isConfigurationSection(name))
{
return kits.getConfigurationSection(name).getValues(true);
}
}
return null;
}
@Override
@@ -247,7 +272,7 @@ public class Settings implements ISettings
{
}
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
return ChatColor.getByChar(colorName);
}
@Override
@@ -277,7 +302,7 @@ public class Settings implements ISettings
@Override
public boolean areSignsDisabled()
{
return config.getBoolean("signs-disabled", false);
return enabledSigns.isEmpty();
}
@Override
@@ -291,12 +316,27 @@ public class Settings implements ISettings
{
return config.getString("backup.command", null);
}
private Map<String, MessageFormat> chatFormats = new HashMap<String, MessageFormat>();
@Override
public String getChatFormat(String group)
public MessageFormat getChatFormat(String group)
{
return config.getString("chat.group-formats." + (group == null ? "Default" : group),
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
MessageFormat mFormat = chatFormats.get(group);
if (mFormat == null)
{
String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
format = Util.replaceColor(format);
format = format.replace("{DISPLAYNAME}", "%1$s");
format = format.replace("{GROUP}", "{0}");
format = format.replace("{MESSAGE}", "%2$s");
format = format.replace("{WORLDNAME}", "{1}");
format = format.replace("{SHORTWORLDNAME}", "{2}");
format = format.replaceAll("\\{(\\D*)\\}", "\\[$1\\]");
mFormat = new MessageFormat(format);
chatFormats.put(group, mFormat);
}
return mFormat;
}
@Override
@@ -306,15 +346,15 @@ public class Settings implements ISettings
}
@Override
public String getAnnounceNewPlayerFormat(IUser user)
public IText getAnnounceNewPlayerFormat()
{
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
return new SimpleTextInput(Util.replaceColor(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
}
@Override
public String format(String format, IUser user)
public String getNewPlayerKit()
{
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
return config.getString("newbies.kit", "");
}
@Override
@@ -339,13 +379,28 @@ public class Settings implements ISettings
public void reloadConfig()
{
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
enabledSigns = _getEnabledSigns();
itemSpawnBl = _getItemSpawnBlacklist();
kits = _getKits();
chatFormats.clear();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@Override
public List<Integer> itemSpawnBlacklist()
{
return itemSpawnBl;
}
private List<Integer> _getItemSpawnBlacklist()
{
final List<Integer> epItemSpwn = new ArrayList<Integer>();
if (ess.getItemDb() == null)
{
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
return epItemSpwn;
}
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
{
itemName = itemName.trim();
@@ -353,11 +408,10 @@ public class Settings implements ISettings
{
continue;
}
ItemStack is;
try
{
is = ess.getItemDb().get(itemName);
epItemSpwn.add(is.getTypeId());
final ItemStack iStack = ess.getItemDb().get(itemName);
epItemSpwn.add(iStack.getTypeId());
}
catch (Exception ex)
{
@@ -366,6 +420,36 @@ public class Settings implements ISettings
}
return epItemSpwn;
}
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
@Override
public List<EssentialsSign> enabledSigns()
{
return enabledSigns;
}
private List<EssentialsSign> _getEnabledSigns()
{
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
for (String signName : config.getStringList("enabledSigns"))
{
signName = signName.trim().toUpperCase(Locale.ENGLISH);
if (signName.isEmpty())
{
continue;
}
try
{
newSigns.add(Signs.valueOf(signName).getSign());
}
catch (Exception ex)
{
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
}
}
return newSigns;
}
@Override
public boolean spawnIfNoHome()
@@ -476,6 +560,22 @@ public class Settings implements ISettings
}
return max;
}
private final static double MINMONEY = -10000000000000.0;
@Override
public double getMinMoney()
{
double min = config.getDouble("min-money", MINMONEY);
if (min > 0)
{
min = -min;
}
if (min < MINMONEY)
{
min = MINMONEY;
}
return min;
}
@Override
public boolean isEcoLogEnabled()
@@ -483,6 +583,12 @@ public class Settings implements ISettings
return config.getBoolean("economy-log-enabled", false);
}
@Override
public boolean isEcoLogUpdateEnabled()
{
return config.getBoolean("economy-log-update-enabled", false);
}
@Override
public boolean removeGodOnDisconnect()
{
@@ -542,7 +648,7 @@ public class Settings implements ISettings
{
return config.getBoolean("death-messages", true);
}
Set<String> noGodWorlds = new HashSet<String>();
private Set<String> noGodWorlds = new HashSet<String>();
@Override
public Set<String> getNoGodWorlds()
@@ -581,35 +687,35 @@ public class Settings implements ISettings
}
@Override
public Priority getRespawnPriority()
public EventPriority getRespawnPriority()
{
String priority = config.getString("respawn-listener-priority", "normal").toLowerCase(Locale.ENGLISH);
if ("lowest".equals(priority))
{
return Priority.Lowest;
return EventPriority.LOWEST;
}
if ("low".equals(priority))
{
return Priority.Low;
return EventPriority.LOW;
}
if ("normal".equals(priority))
{
return Priority.Normal;
return EventPriority.NORMAL;
}
if ("high".equals(priority))
{
return Priority.High;
return EventPriority.HIGH;
}
if ("highest".equals(priority))
{
return Priority.Highest;
return EventPriority.HIGHEST;
}
return Priority.Normal;
return EventPriority.NORMAL;
}
@Override
public long getTpaAcceptCancellation()
{
return config.getLong("tpa-accept-cancellation", 0);
return config.getLong("tpa-accept-cancellation", 0);
}
}
@@ -2,11 +2,13 @@ package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.FakeExplosion;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
public class TNTExplodeListener extends EntityListener implements Runnable
public class TNTExplodeListener implements Listener, Runnable
{
private final transient IEssentials ess;
private transient boolean enabled = false;
@@ -33,7 +35,7 @@ public class TNTExplodeListener extends EntityListener implements Runnable
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
if (!enabled)
@@ -13,6 +13,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
@@ -38,7 +39,7 @@ public class Trade
{
this(null, null, items, null, ess);
}
public Trade(final int exp, final IEssentials ess)
{
this(null, null, null, exp, ess);
@@ -79,9 +80,10 @@ public class Trade
{
throw new ChargeException(_("notEnoughMoney"));
}
if (exp != null && exp > 0
&& SetExpFix.getTotalExperience(user) < exp) {
if (exp != null && exp > 0
&& SetExpFix.getTotalExperience(user) < exp)
{
throw new ChargeException(_("notEnoughExperience"));
}
}
@@ -103,9 +105,25 @@ public class Trade
if (dropItems)
{
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
final Location loc = user.getLocation();
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
final int maxStackSize = itemStack.getType().getMaxStackSize();
final int stacks = itemStack.getAmount() / maxStackSize;
final int leftover = itemStack.getAmount() % maxStackSize;
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
for (int i = 0; i < stacks; i++)
{
final ItemStack stack = itemStack.clone();
stack.setAmount(maxStackSize);
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
}
if (leftover > 0)
{
final ItemStack stack = itemStack.clone();
stack.setAmount(leftover);
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
}
}
}
else
@@ -125,8 +143,7 @@ public class Trade
{
if (getMoney() != null)
{
final double mon = user.getMoney();
if (mon < getMoney() && getMoney() > 0 && !user.isAuthorized("essentials.eco.loan"))
if (!user.canAfford(getMoney()) && getMoney() > 0)
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -145,9 +162,8 @@ public class Trade
&& !user.isAuthorized("essentials.nocommandcost.all")
&& !user.isAuthorized("essentials.nocommandcost." + command))
{
final double mon = user.getMoney();
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
if (mon < cost && cost > 0 && !user.isAuthorized("essentials.eco.loan"))
if (!user.canAfford(cost) && cost > 0)
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -173,7 +189,7 @@ public class Trade
{
return itemStack;
}
public Integer getExperience()
{
return exp;
@@ -182,7 +198,8 @@ public class Trade
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
{
if (!ess.getSettings().isEcoLogEnabled())
if ((loc == null && !ess.getSettings().isEcoLogUpdateEnabled())
|| (loc != null && !ess.getSettings().isEcoLogEnabled()))
{
return;
}
+106 -74
View File
@@ -7,7 +7,6 @@ import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -23,34 +22,37 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
private transient long lastOnlineActivity;
private transient long lastActivity = System.currentTimeMillis();
private boolean hidden = false;
private transient Location afkPosition;
private transient Location afkPosition = null;
private static final Logger logger = Logger.getLogger("Minecraft");
User(final Player base, final IEssentials ess)
{
super(base, ess);
teleport = new Teleport(this, ess);
afkPosition = getLocation();
if (isAfk())
{
afkPosition = getLocation();
}
}
User update(final Player base)
{
setBase(base);
return this;
}
@Override
public boolean isAuthorized(final IEssentialsCommand cmd)
{
return isAuthorized(cmd, "essentials.");
}
@Override
public boolean isAuthorized(final IEssentialsCommand cmd, final String permissionPrefix)
{
return isAuthorized(permissionPrefix + (cmd.getName().equals("r") ? "msg" : cmd.getName()));
}
@Override
public boolean isAuthorized(final String node)
{
@@ -58,20 +60,20 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
return false;
}
if (isOp())
{
return true;
}
if (isJailed())
{
return false;
}
return ess.getPermissionsHandler().hasPermission(base, node);
}
public void healCooldown() throws Exception
{
final Calendar now = new GregorianCalendar();
@@ -89,13 +91,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
setLastHealTimestamp(now.getTimeInMillis());
}
@Override
public void giveMoney(final double value)
{
giveMoney(value, null);
}
public void giveMoney(final double value, final CommandSender initiator)
{
if (value == 0)
@@ -103,13 +105,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return;
}
setMoney(getMoney() + value);
sendMessage(_("addedToAccount", Util.formatCurrency(value, ess)));
sendMessage(_("addedToAccount", Util.displayCurrency(value, ess)));
if (initiator != null)
{
initiator.sendMessage(_("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
initiator.sendMessage(_("addedToOthersAccount", Util.displayCurrency(value, ess), this.getDisplayName(), Util.displayCurrency(getMoney(), ess)));
}
}
public void payUser(final User reciever, final double value) throws Exception
{
if (value == 0)
@@ -120,21 +122,21 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
setMoney(getMoney() - value);
reciever.setMoney(reciever.getMoney() + value);
sendMessage(_("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
reciever.sendMessage(_("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
sendMessage(_("moneySentTo", Util.displayCurrency(value, ess), reciever.getDisplayName()));
reciever.sendMessage(_("moneyRecievedFrom", Util.displayCurrency(value, ess), getDisplayName()));
}
else
{
throw new Exception(_("notEnoughMoney"));
}
}
@Override
public void takeMoney(final double value)
{
takeMoney(value, null);
}
public void takeMoney(final double value, final CommandSender initiator)
{
if (value == 0)
@@ -142,42 +144,51 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return;
}
setMoney(getMoney() - value);
sendMessage(_("takenFromAccount", Util.formatCurrency(value, ess)));
sendMessage(_("takenFromAccount", Util.displayCurrency(value, ess)));
if (initiator != null)
{
initiator.sendMessage(_("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
initiator.sendMessage(_("takenFromOthersAccount", Util.displayCurrency(value, ess), this.getDisplayName(), Util.displayCurrency(getMoney(), ess)));
}
}
public boolean canAfford(final double cost)
{
final double mon = getMoney();
return mon >= cost || isAuthorized("essentials.eco.loan");
return canAfford(cost, true);
}
public boolean canAfford(final double cost, final boolean permcheck)
{
final double mon = getMoney();
if (!permcheck || isAuthorized("essentials.eco.loan"))
{
return (mon - cost) >= ess.getSettings().getMinMoney();
}
return cost <= mon;
}
public void dispose()
{
this.base = new OfflinePlayer(getName(), ess);
}
@Override
public void setReplyTo(final CommandSender user)
{
replyTo = user;
}
@Override
public CommandSender getReplyTo()
{
return replyTo;
}
@Override
public int compareTo(final User other)
{
return Util.stripColor(this.getDisplayName()).compareToIgnoreCase(Util.stripColor(other.getDisplayName()));
}
@Override
public boolean equals(final Object object)
{
@@ -186,59 +197,59 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return false;
}
return this.getName().equalsIgnoreCase(((User)object).getName());
}
@Override
public int hashCode()
{
return this.getName().hashCode();
}
public Boolean canSpawnItem(final int itemId)
{
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
}
public Location getHome() throws Exception
{
return getHome(getHomes().get(0));
}
public void setHome()
{
setHome("home", getLocation());
}
public void setHome(final String name)
{
setHome(name, getLocation());
}
@Override
public void setLastLocation()
{
setLastLocation(getLocation());
}
public void requestTeleport(final User player, final boolean here)
{
teleportRequestTime = System.currentTimeMillis();
teleportRequester = player;
teleportRequestHere = here;
}
public User getTeleportRequest()
{
return teleportRequester;
}
public boolean isTeleportRequestHere()
{
return teleportRequestHere;
}
public String getNick(boolean addprefixsuffix)
public String getNick(final boolean addprefixsuffix)
{
final StringBuilder nickname = new StringBuilder();
final String nick = getNickname();
@@ -250,28 +261,31 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
nickname.append(ess.getSettings().getNicknamePrefix()).append(nick);
}
if (isOp())
if (addprefixsuffix && isOp())
{
try
{
nickname.insert(0, ess.getSettings().getOperatorColor().toString());
nickname.append("§f");
final String opPrefix = ess.getSettings().getOperatorColor().toString();
if (opPrefix.length() > 0) {
nickname.insert(0, opPrefix);
nickname.append("§f");
}
}
catch (Exception e)
{
}
}
if (addprefixsuffix && ess.getSettings().addPrefixSuffix())
{
if (!ess.getSettings().disablePrefix())
{
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
nickname.insert(0, prefix);
}
if (!ess.getSettings().disableSuffix())
{
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
nickname.append(suffix);
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
{
@@ -283,10 +297,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
nickname.append("§f");
}
}
return nickname.toString();
}
public void setDisplayNick()
{
String name = getNick(true);
@@ -308,7 +322,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
logger.log(Level.INFO, "Playerlist for " + name + " was not updated. Use a shorter displayname prefix.");
}
}
@Override
public String getDisplayName()
{
@@ -318,22 +332,23 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
}
@Override
public Teleport getTeleport()
{
return teleport;
}
public long getLastOnlineActivity()
{
return lastOnlineActivity;
}
public void setLastOnlineActivity(final long timestamp)
{
lastOnlineActivity = timestamp;
}
@Override
public double getMoney()
{
@@ -355,7 +370,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
return super.getMoney();
}
@Override
public void setMoney(final double value)
{
@@ -376,8 +391,17 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
super.setMoney(value);
Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
}
public void updateMoneyCache(final double value)
{
if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value)
{
super.setMoney(value);
}
}
@Override
public void setAfk(final boolean set)
{
@@ -386,9 +410,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
afkPosition = getLocation();
}
else if (!set && isAfk())
{
afkPosition = null;
}
super.setAfk(set);
}
@Override
public boolean toggleAfk()
{
@@ -396,13 +424,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : now);
return now;
}
@Override
public boolean isHidden()
{
return hidden;
}
public void setHidden(final boolean hidden)
{
this.hidden = hidden;
@@ -453,7 +481,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
return false;
}
public void updateActivity(final boolean broadcast)
{
if (isAfk())
@@ -466,7 +494,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
lastActivity = System.currentTimeMillis();
}
public void checkActivity()
{
final long autoafkkick = ess.getSettings().getAutoAfkKick();
@@ -476,8 +504,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0);
lastActivity = 0;
kickPlayer(kickReason);
for (Player player : ess.getServer().getOnlinePlayers())
{
final User user = ess.getUser(player);
@@ -497,12 +525,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
}
public Location getAfkPosition()
{
return afkPosition;
}
@Override
public boolean toggleGodModeEnabled()
{
@@ -512,36 +540,40 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
return super.toggleGodModeEnabled();
}
@Override
public boolean isGodModeEnabled()
{
return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(getLocation().getWorld().getName()))
|| (isAfk() && ess.getSettings().getFreezeAfkPlayers());
}
public boolean isGodModeEnabledRaw()
{
return super.isGodModeEnabled();
}
public String getGroup()
{
return ess.getPermissionsHandler().getGroup(base);
}
public boolean inGroup(final String group)
{
return ess.getPermissionsHandler().inGroup(base, group);
}
public boolean canBuild()
{
if (isOp())
{
return true;
}
return ess.getPermissionsHandler().canBuild(base, getGroup());
}
public long getTeleportRequestTime()
{
return teleportRequestTime;
}
}
}
@@ -44,7 +44,7 @@ public abstract class UserData extends PlayerExtension implements IConf
savedInventory = _getSavedInventory();
teleportEnabled = getTeleportEnabled();
ignoredPlayers = getIgnoredPlayers();
godmode = getGodModeEnabled();
godmode = _getGodModeEnabled();
muted = getMuted();
muteTimeout = _getMuteTimeout();
jailed = getJailed();
@@ -53,12 +53,12 @@ public abstract class UserData extends PlayerExtension implements IConf
lastLogout = _getLastLogout();
lastLoginAddress = _getLastLoginAddress();
afk = getAfk();
newplayer = getNew();
geolocation = _getGeoLocation();
isSocialSpyEnabled = _isSocialSpyEnabled();
isNPC = _isNPC();
arePowerToolsEnabled = _arePowerToolsEnabled();
kitTimestamps = _getKitTimestamps();
nickname = _getNickname();
}
private double money;
@@ -95,17 +95,11 @@ public abstract class UserData extends PlayerExtension implements IConf
private Map<String, Object> _getHomes()
{
Object o = config.getProperty("homes");
if (o instanceof Map)
if (config.isConfigurationSection("homes"))
{
return (Map<String, Object>)o;
return config.getConfigurationSection("homes").getValues(false);
}
else
{
return new HashMap<String, Object>();
}
return new HashMap<String, Object>();
}
public Location getHome(String name) throws Exception
@@ -196,13 +190,21 @@ public abstract class UserData extends PlayerExtension implements IConf
return false;
}
public String getNickname()
private String nickname;
public String _getNickname()
{
return config.getString("nickname");
}
public String getNickname()
{
return nickname;
}
public void setNickname(String nick)
{
nickname = nick;
config.setProperty("nickname", nick);
config.save();
}
@@ -210,7 +212,7 @@ public abstract class UserData extends PlayerExtension implements IConf
private List<Integer> _getUnlimited()
{
return config.getIntList("unlimited", new ArrayList<Integer>());
return config.getIntegerList("unlimited");
}
public List<Integer> getUnlimited()
@@ -236,22 +238,15 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("unlimited", unlimited);
config.save();
}
private Map<Integer, Object> powertools;
private Map<String, Object> powertools;
@SuppressWarnings("unchecked")
private Map<Integer, Object> _getPowertools()
private Map<String, Object> _getPowertools()
{
Object o = config.getProperty("powertools");
if (o instanceof Map)
if (config.isConfigurationSection("powertools"))
{
return (Map<Integer, Object>)o;
return config.getConfigurationSection("powertools").getValues(false);
}
else
{
return new HashMap<Integer, Object>();
}
return new HashMap<String, Object>();
}
public void clearAllPowertools()
@@ -263,18 +258,23 @@ public abstract class UserData extends PlayerExtension implements IConf
public List<String> getPowertool(ItemStack stack)
{
return (List<String>)powertools.get(stack.getTypeId());
return (List<String>)powertools.get("" + stack.getTypeId());
}
public List<String> getPowertool(int id)
{
return (List<String>)powertools.get("" + id);
}
public void setPowertool(ItemStack stack, List<String> commandList)
{
if (commandList == null || commandList.isEmpty())
{
powertools.remove(stack.getTypeId());
powertools.remove("" + stack.getTypeId());
}
else
{
powertools.put(stack.getTypeId(), commandList);
powertools.put("" + stack.getTypeId(), commandList);
}
config.setProperty("powertools", powertools);
config.save();
@@ -379,7 +379,7 @@ public abstract class UserData extends PlayerExtension implements IConf
private List<String> _getMails()
{
return config.getStringList("mail", new ArrayList<String>());
return config.getStringList("mail");
}
public List<String> getMails()
@@ -487,7 +487,7 @@ public abstract class UserData extends PlayerExtension implements IConf
public List<String> getIgnoredPlayers()
{
return config.getStringList("ignore", new ArrayList<String>());
return config.getStringList("ignore");
}
public void setIgnoredPlayers(List<String> players)
@@ -524,7 +524,7 @@ public abstract class UserData extends PlayerExtension implements IConf
}
private boolean godmode;
private boolean getGodModeEnabled()
private boolean _getGodModeEnabled()
{
return config.getBoolean("godmode", false);
}
@@ -735,23 +735,6 @@ public abstract class UserData extends PlayerExtension implements IConf
return ret;
}
private boolean newplayer;
private boolean getNew()
{
return config.getBoolean("newplayer", true);
}
public boolean isNew()
{
return newplayer;
}
public void setNew(boolean set)
{
newplayer = set;
config.setProperty("newplayer", set);
config.save();
}
private String geolocation;
private String _getGeoLocation()
@@ -843,16 +826,12 @@ public abstract class UserData extends PlayerExtension implements IConf
private Map<String, Object> _getKitTimestamps()
{
final Object map = config.getProperty("timestamps.kits");
if (map instanceof Map)
if (config.isConfigurationSection("timestamps.kits"))
{
return (Map<String, Object>)map;
}
else
{
return new HashMap<String, Object>();
return config.getConfigurationSection("timestamps.kits").getValues(false);
}
return new HashMap<String, Object>();
}
public Long getKitTimestamp(final String name)
@@ -6,7 +6,6 @@ import com.google.common.cache.CacheLoader;
import com.google.common.util.concurrent.UncheckedExecutionException;
import java.io.File;
import java.util.Collections;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.ExecutionException;
@@ -47,7 +46,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
continue;
}
final String name = string.substring(0, string.length() - 4);
keys.add(name.toLowerCase(Locale.ENGLISH));
keys.add(Util.sanitizeFileName(name));
}
}
});
@@ -55,14 +54,14 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public boolean userExists(final String name)
{
return keys.contains(name.toLowerCase(Locale.ENGLISH));
return keys.contains(Util.sanitizeFileName(name));
}
public User getUser(final String name)
{
try
{
return users.get(name.toLowerCase(Locale.ENGLISH));
return users.get(name);
}
catch (ExecutionException ex)
{
@@ -77,18 +76,31 @@ public class UserMap extends CacheLoader<String, User> implements IConf
@Override
public User load(final String name) throws Exception
{
String sanitizedName = Util.sanitizeFileName(name);
if (!sanitizedName.equals(name))
{
User user = getUser(sanitizedName);
if (user == null)
{
throw new Exception("User not found!");
}
else
{
return user;
}
}
for (Player player : ess.getServer().getOnlinePlayers())
{
if (player.getName().equalsIgnoreCase(name))
{
keys.add(name.toLowerCase(Locale.ENGLISH));
keys.add(sanitizedName);
return new User(player, ess);
}
}
final File userFile = getUserFile(name);
final File userFile = getUserFile2(sanitizedName);
if (userFile.exists())
{
keys.add(name.toLowerCase(Locale.ENGLISH));
keys.add(sanitizedName);
return new User(new OfflinePlayer(name, ess), ess);
}
throw new Exception("User not found!");
@@ -102,8 +114,9 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public void removeUser(final String name)
{
keys.remove(name.toLowerCase(Locale.ENGLISH));
users.invalidate(name.toLowerCase(Locale.ENGLISH));
keys.remove(Util.sanitizeFileName(name));
users.invalidate(Util.sanitizeFileName(name));
users.invalidate(name);
}
public Set<String> getAllUniqueUsers()
@@ -115,10 +128,15 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
return keys.size();
}
public File getUserFile(final String name)
{
return getUserFile2(Util.sanitizeFileName(name));
}
private File getUserFile2(final String name)
{
final File userFolder = new File(ess.getDataFolder(), "userdata");
return new File(userFolder, Util.sanitizeFileName(name) + ".yml");
return new File(userFolder, name + ".yml");
}
}
@@ -21,10 +21,18 @@ public class Util
{
}
private final static Logger logger = Logger.getLogger("Minecraft");
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
public static String sanitizeFileName(String name)
public static String sanitizeFileName(final String name)
{
return name.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9]", "_");
final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
return newName;
}
public static String sanitizeString(final String string)
{
return INVALIDCHARS.matcher(string).replaceAll("");
}
public static String formatDateDiff(long date)
@@ -414,11 +422,11 @@ public class Util
}
return is;
}
private static DecimalFormat df = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
public static String formatCurrency(final double value, final IEssentials ess)
public static String formatAsCurrency(final double value)
{
String str = ess.getSettings().getCurrencySymbol() + df.format(value);
String str = dFormat.format(value);
if (str.endsWith(".00"))
{
str = str.substring(0, str.length() - 3);
@@ -426,6 +434,16 @@ public class Util
return str;
}
public static String displayCurrency(final double value, final IEssentials ess)
{
return _("currency", ess.getSettings().getCurrencySymbol(), formatAsCurrency(value));
}
public static String shortCurrency(final double value, final IEssentials ess)
{
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
}
public static double roundDouble(final double d)
{
return Math.round(d * 100.0) / 100.0;
@@ -477,7 +495,8 @@ public class Util
}
return buf.toString();
}
private static transient final Pattern COLOR_PATTERN = Pattern.compile("(?i)\u00A7[0-9A-F]");
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-FKa-fk]");
private static transient final Pattern EASY_COLOR_PATTERN = Pattern.compile("&([0-9a-fk])");
public static String stripColor(final String input)
{
@@ -486,6 +505,16 @@ public class Util
return null;
}
return COLOR_PATTERN.matcher(input).replaceAll("");
return VANILLA_COLOR_PATTERN.matcher(input).replaceAll("");
}
public static String replaceColor(final String input)
{
if (input == null)
{
return null;
}
return EASY_COLOR_PATTERN.matcher(input).replaceAll("\u00a7$1");
}
}
@@ -115,6 +115,10 @@ public final class Economy
{
throw new UserDoesNotExistException(name);
}
if (balance < ess.getSettings().getMinMoney())
{
throw new NoLoanPermittedException();
}
if (balance < 0.0 && !user.isAuthorized("essentials.eco.loan"))
{
throw new NoLoanPermittedException();
@@ -245,7 +249,7 @@ public final class Economy
{
throw new RuntimeException(noCallBeforeLoad);
}
return Util.formatCurrency(amount, ess);
return Util.displayCurrency(amount, ess);
}
/**
@@ -17,8 +17,11 @@ public class Commandantioch extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
if (args.length > 0)
{
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
}
final Location loc = Util.getTarget(user);
loc.getWorld().spawn(loc, TNTPrimed.class);
@@ -20,5 +20,6 @@ public class Commandback extends EssentialsCommand
charge.isAffordableFor(user);
user.sendMessage(_("backUsageMsg"));
user.getTeleport().back(charge);
throw new NoChargeException();
}
}
@@ -21,7 +21,7 @@ public class Commandbalance extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
sender.sendMessage(_("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
}
@Override
@@ -32,6 +32,6 @@ public class Commandbalance extends EssentialsCommand
|| user.isAuthorized("essentials.balance.other"))
? user
: getPlayer(server, args, 0, true)).getMoney();
user.sendMessage(_("balance", Util.formatCurrency(bal, ess)));
user.sendMessage(_("balance", Util.displayCurrency(bal, ess)));
}
}
@@ -105,14 +105,18 @@ public class Commandbalancetop extends EssentialsCommand
{
if (force || cacheage <= System.currentTimeMillis() - CACHETIME)
{
cache.getLines().clear();
cache.getLines().clear();
final Map<String, Double> balances = new HashMap<String, Double>();
double totalMoney = 0d;
for (String u : ess.getUserMap().getAllUniqueUsers())
{
final User user = ess.getUserMap().getUser(u);
if (user != null)
{
balances.put(u, user.getMoney());
final double userMoney = user.getMoney();
user.updateMoneyCache(userMoney);
totalMoney += userMoney;
balances.put(user.getDisplayName(), userMoney);
}
}
@@ -125,10 +129,12 @@ public class Commandbalancetop extends EssentialsCommand
return -entry1.getValue().compareTo(entry2.getValue());
}
});
cache.getLines().add(_("serverTotal", Util.displayCurrency(totalMoney, ess)));
int pos = 1;
for (Map.Entry<String, Double> entry : sortedEntries)
{
cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.formatCurrency(entry.getValue(), ess));
cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.displayCurrency(entry.getValue(), ess));
pos++;
}
cacheage = System.currentTimeMillis();
@@ -15,7 +15,7 @@ public class Commanddelhome extends EssentialsCommand
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
public void run(final Server server, final CommandSender sender, final String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
@@ -24,7 +24,18 @@ public class Commanddelhome extends EssentialsCommand
User user = ess.getUser(sender);
String name;
final String[] expandedArg = args[0].split(":");
String[] expandedArg;
//Allowing both formats /sethome khobbits house | /sethome khobbits:house
final String[] nameParts = args[0].split(":");
if (nameParts[0].length() != args[0].length())
{
expandedArg = nameParts;
}
else
{
expandedArg = args;
}
if (expandedArg.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others")))
{
@@ -41,9 +52,7 @@ public class Commanddelhome extends EssentialsCommand
}
//TODO: Think up a nice error message
/*
* if (name.equalsIgnoreCase("bed")) {
* throw new Exception("You cannot remove the vanilla home point");
* }
* if (name.equalsIgnoreCase("bed")) { throw new Exception("You cannot remove the vanilla home point"); }
*/
user.delHome(name.toLowerCase(Locale.ENGLISH));
sender.sendMessage(_("deleteHome", name));
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import java.util.Locale;
import org.bukkit.Server;
@@ -33,7 +34,31 @@ public class Commandeco extends EssentialsCommand
throw new NotEnoughArgumentsException(ex);
}
if (args[1].contentEquals("*"))
if (args[1].contentEquals("**"))
{
for (String sUser : ess.getUserMap().getAllUniqueUsers())
{
final User player = ess.getUser(sUser);
switch (cmd)
{
case GIVE:
player.giveMoney(amount);
break;
case TAKE:
if (player.canAfford(amount, false))
{
player.takeMoney(amount);
}
break;
case RESET:
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
break;
}
}
}
else if (args[1].contentEquals("*"))
{
for (Player onlinePlayer : server.getOnlinePlayers())
{
@@ -45,6 +70,10 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
if (!player.canAfford(amount, false))
{
throw new Exception(_("notEnoughMoney"));
}
player.takeMoney(amount);
break;
@@ -64,6 +93,10 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
if (!player.canAfford(amount, false))
{
throw new Exception(_("notEnoughMoney"));
}
player.takeMoney(amount, sender);
break;
@@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@@ -35,6 +36,10 @@ public class Commandessentials extends EssentialsCommand
{
run_nya(server, sender, commandLabel, args);
}
else if (args[0].equalsIgnoreCase("moo"))
{
run_moo(server, sender, commandLabel, args);
}
else {
run_reload(server, sender, commandLabel, args);
}
@@ -112,7 +117,7 @@ public class Commandessentials extends EssentialsCommand
if (loc.getBlock().getTypeId() == 0)
{
noteBlocks.put(player, loc.getBlock());
loc.getBlock().setType(Material.NOTE_BLOCK);
player.sendBlockChange(loc, Material.NOTE_BLOCK, (byte)0);
}
}
taskid = ess.scheduleSyncRepeatingTask(new Runnable()
@@ -144,7 +149,6 @@ public class Commandessentials extends EssentialsCommand
}
}
}, 20, 2);
return;
}
private void stopTune()
@@ -159,4 +163,12 @@ public class Commandessentials extends EssentialsCommand
}
noteBlocks.clear();
}
private void run_moo(final Server server, final CommandSender sender, final String command, final String args[])
{
if(sender instanceof ConsoleCommandSender)
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
else
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
}
}
@@ -41,7 +41,7 @@ public class Commandhelp extends EssentialsCommand
output = new KeywordReplacer(input, user, ess);
}
final TextPager pager = new TextPager(output);
pager.showPage(pageStr, chapterPageStr, "help", user);
pager.showPage(pageStr, chapterPageStr, commandLabel, user);
}
@Override
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@@ -22,7 +23,7 @@ public class Commandhelpop extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final String message = _("helpOp", user.getDisplayName(), getFinalArg(args, 0));
final String message = _("helpOp", user.getDisplayName(), Util.stripColor(getFinalArg(args, 0)));
logger.log(Level.INFO, message);
for (Player onlinePlayer : server.getOnlinePlayers())
{
@@ -7,6 +7,7 @@ import com.earth2me.essentials.Util;
import java.util.List;
import java.util.Locale;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -47,27 +48,31 @@ public class Commandhome extends EssentialsCommand
if ("bed".equalsIgnoreCase(homeName))
{
final Location bed = player.getBedSpawnLocation();
if (bed != null)
if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK)
{
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
return;
throw new NoChargeException();
}
}
user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge);
}
catch (NotEnoughArgumentsException e)
{
Location bed = player.getBedSpawnLocation();
if (bed != null && bed.getBlock().getType() != Material.BED_BLOCK)
{
bed = null;
}
final List<String> homes = player.getHomes();
if (homes.isEmpty() && player.equals(user))
{
final Location bed = player.getBedSpawnLocation();
if (bed != null)
{
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
return;
throw new NoChargeException();
}
user.getTeleport().respawn(charge, TeleportCause.COMMAND);
return;
}
else if (homes.isEmpty())
{
@@ -76,11 +81,13 @@ public class Commandhome extends EssentialsCommand
else if (homes.size() == 1 && player.equals(user))
{
user.getTeleport().home(player, homes.get(0), charge);
return;
}
else
{
homes.add("bed");
if (bed != null)
{
homes.add("bed");
}
user.sendMessage(_("homes", Util.joinList(homes)));
}
}
@@ -21,6 +21,6 @@ public class Commandinfo extends EssentialsCommand
final IText input = new TextInput(sender, "info", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "info", sender);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender);
}
}
@@ -10,7 +10,7 @@ public class Commanditemdb extends EssentialsCommand
{
public Commanditemdb()
{
super("find");
super("itemdb");
}
@Override
@@ -31,6 +31,7 @@ public class Commandkill extends EssentialsCommand
continue;
}
matchPlayer.damage(1000);
matchPlayer.setHealth(0);
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
}
@@ -125,7 +125,7 @@ public class Commandkillall extends EssentialsCommand
{
if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob)
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -135,7 +135,7 @@ public class Commandkillall extends EssentialsCommand
{
if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime)
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -143,14 +143,14 @@ public class Commandkillall extends EssentialsCommand
}
else if (all)
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
}
else if (entityClass != null && entityClass.isAssignableFrom(entity.getClass()))
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -32,22 +32,22 @@ public class Commandkit extends EssentialsCommand
else
{
final String kitName = args[0].toLowerCase(Locale.ENGLISH);
final Object kit = ess.getSettings().getKit(kitName);
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
if (!user.isAuthorized("essentials.kit." + kitName))
{
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
}
final Map<String, Object> els = (Map<String, Object>)kit;
final List<String> items = Kit.getItems(user, els);
Kit.checkTime(user, kitName, els);
final List<String> items = Kit.getItems(user, kit);
Kit.checkTime(user, kitName, kit);
final Trade charge = new Trade("kit-" + kitName, ess);
charge.isAffordableFor(user);
Kit.expandItems(ess, user, items);
charge.charge(user);
user.sendMessage(_("kitGive", kitName));
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.*;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -72,7 +73,7 @@ public class Commandlist extends EssentialsCommand
for (String group : groups)
{
final StringBuilder groupString = new StringBuilder();
groupString.append(group).append(": ");
groupString.append(_("listGroupTag",Util.replaceColor(group)));
final List<User> users = sort.get(group);
Collections.sort(users);
boolean first = true;
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Server;
@@ -39,7 +40,7 @@ public class Commandmail extends EssentialsCommand
{
if (!user.isAuthorized("essentials.mail.send"))
{
throw new Exception(_("noPerm","essentials.mail.send"));
throw new Exception(_("noPerm", "essentials.mail.send"));
}
Player player = server.getPlayer(args[1]);
@@ -58,7 +59,8 @@ public class Commandmail extends EssentialsCommand
}
if (!u.isIgnoredPlayer(user.getName()))
{
u.addMail(user.getName() + ": " + getFinalArg(args, 2));
final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2)));
u.addMail(user.getName() + ": " + mail);
}
user.sendMessage(_("mailSent"));
return;
@@ -67,9 +69,9 @@ public class Commandmail extends EssentialsCommand
{
if (!user.isAuthorized("essentials.mail.sendall"))
{
throw new Exception(_("noPerm","essentials.mail.sendall"));
throw new Exception(_("noPerm", "essentials.mail.sendall"));
}
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + getFinalArg(args, 1)));
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1))));
user.sendMessage(_("mailSent"));
return;
}
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
@@ -28,8 +29,12 @@ public class Commandme extends EssentialsCommand
String message = getFinalArg(args, 0);
if (user.isAuthorized("essentials.chat.color"))
{
message = message.replaceAll("&([0-9a-f])", "§$1");
message = Util.replaceColor(message);
}
else {
message = Util.stripColor(message);
}
ess.broadcastMessage(user, _("action", user.getDisplayName(), message));
}
@@ -21,6 +21,6 @@ public class Commandmotd extends EssentialsCommand
final IText input = new TextInput(sender, "motd", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "motd", sender);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, commandLabel, sender);
}
}
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -25,6 +26,7 @@ public class Commandmsg extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
String message = getFinalArg(args, 1);
if (sender instanceof Player)
{
User user = ess.getUser(sender);
@@ -32,13 +34,24 @@ public class Commandmsg extends EssentialsCommand
{
throw new Exception(_("voiceSilenced"));
}
if (user.isAuthorized("essentials.msg.color"))
{
message = Util.replaceColor(message);
}
else
{
message = Util.stripColor(message);
}
}
else
{
message = Util.replaceColor(message);
}
String message = getFinalArg(args, 1);
String translatedMe = _("me");
final String translatedMe = _("me");
IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
if (args[0].equalsIgnoreCase(Console.NAME))
{
@@ -50,38 +63,38 @@ public class Commandmsg extends EssentialsCommand
return;
}
List<Player> matches = server.matchPlayer(args[0]);
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
if (matches.isEmpty())
if (matchedPlayers.isEmpty())
{
throw new Exception(_("playerNotFound"));
}
int i = 0;
for (Player p : matches)
for (Player matchedPlayer : matchedPlayers)
{
final User u = ess.getUser(p);
final User u = ess.getUser(matchedPlayer);
if (u.isHidden())
{
i++;
}
}
if (i == matches.size())
if (i == matchedPlayers.size())
{
throw new Exception(_("playerNotFound"));
}
for (Player p : matches)
for (Player matchedPlayer : matchedPlayers)
{
sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
final User u = ess.getUser(p);
if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
final User matchedUser = ess.getUser(matchedPlayer);
if (sender instanceof Player && (matchedUser.isIgnoredPlayer(((Player)sender).getName()) || matchedUser.isHidden()))
{
continue;
}
p.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(p));
ess.getUser(p).setReplyTo(sender);
matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(matchedPlayer));
ess.getUser(matchedPlayer).setReplyTo(sender);
}
}
}
@@ -15,40 +15,40 @@ public class Commandnear extends EssentialsCommand
{
super("near");
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
long radius = 200;
User otherUser = null;
if (args.length > 0)
{
try
{
otherUser = getPlayer(server, args, 0);
radius = Long.parseLong(args[0]);
}
catch (Exception ex)
catch (NumberFormatException e)
{
try
{
radius = Long.parseLong(args[0]);
otherUser = getPlayer(server, args, 0);
}
catch (Exception ex)
{
}
}
if (args.length > 1 && otherUser != null)
{
try
{
radius = Long.parseLong(args[1]);
}
catch (NumberFormatException e)
{
}
}
}
if (args.length > 1 && otherUser != null)
{
try
{
radius = Long.parseLong(args[1]);
}
catch (NumberFormatException e)
{
}
}
if (otherUser == null || user.isAuthorized("essentials.near.others"))
{
user.sendMessage(_("nearbyPlayers", getLocal(server, otherUser == null ? user : otherUser, radius)));
@@ -58,20 +58,15 @@ public class Commandnear extends EssentialsCommand
user.sendMessage(_("noAccessCommand"));
}
}
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
User otherUser = null;
if (args.length > 0)
{
otherUser = getPlayer(server, args, 0);
}
else
if (args.length == 0)
{
throw new NotEnoughArgumentsException();
}
final User otherUser = getPlayer(server, args, 0);
long radius = 200;
if (args.length > 1)
{
@@ -85,14 +80,14 @@ public class Commandnear extends EssentialsCommand
}
sender.sendMessage(_("nearbyPlayers", getLocal(server, otherUser, radius)));
}
private String getLocal(final Server server, final User user, final long radius)
{
final Location loc = user.getLocation();
final World world = loc.getWorld();
final StringBuilder output = new StringBuilder();
final long radiusSquared = radius * radius;
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
@@ -103,7 +98,7 @@ public class Commandnear extends EssentialsCommand
{
continue;
}
final long delta = (long)playerLoc.distanceSquared(loc);
if (delta < radiusSquared)
{
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -65,9 +66,10 @@ public class Commandnick extends EssentialsCommand
{
if (user == null || user.isAuthorized("essentials.nick.color"))
{
return nick.replace('&', '\u00a7').replace("\u00a7\u00a7", "&");
return nick.replace('&', '\u00a7').replaceAll("\u00a7+k", "");
} else {
return Util.stripColor(nick);
}
return nick;
}
private void resetAllNicknames(final Server server)
@@ -86,7 +88,7 @@ public class Commandnick extends EssentialsCommand
private void setNickname(final Server server, final User target, final String nick) throws Exception
{
if (nick.matches("[^a-zA-Z_0-9]"))
if (!nick.matches("^[a-zA-Z_0-9\u00a7]+$"))
{
throw new Exception(_("nickNamesAlpha"));
}
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -43,7 +44,7 @@ public class Commandnuke extends EssentialsCommand
{
continue;
}
player.sendMessage("May death rain upon them");
player.sendMessage(_("nuke"));
final Location loc = player.getLocation();
final World world = loc.getWorld();
for (int x = -10; x <= 10; x += 5)
@@ -21,6 +21,11 @@ public class Commandpay extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
if (args[0] == "")
{
throw new NotEnoughArgumentsException("You need to specify a player to pay.");
}
double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
@@ -1,8 +1,9 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandping extends EssentialsCommand
@@ -13,8 +14,16 @@ public class Commandping extends EssentialsCommand
}
@Override
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
player.sendMessage(_("pong"));
if (args.length < 1)
{
sender.sendMessage(_("pong"));
}
else
{
sender.sendMessage(Util.replaceColor(getFinalArg(args, 0)));
}
}
}
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,13 +25,35 @@ public class Commandr extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final String message = getFinalArg(args, 0);
final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
String message = getFinalArg(args, 0);
IReplyTo replyTo;
String senderName;
if (sender instanceof Player)
{
User user = ess.getUser(sender);
if (user.isAuthorized("essentials.msg.color"))
{
message = Util.replaceColor(message);
}
else
{
message = Util.stripColor(message);
}
replyTo = user;
senderName = user.getDisplayName();
}
else
{
message = Util.replaceColor(message);
replyTo = Console.getConsoleReplyTo();
senderName = Console.NAME;
}
final CommandSender target = replyTo.getReplyTo();
final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME;
if (target == null)
if (target == null || ((target instanceof Player) && !((Player)target).isOnline()))
{
throw new Exception(_("foreverAlone"));
}
@@ -80,7 +80,7 @@ public class Commandrepair extends EssentialsCommand
private void repairItem(final ItemStack item) throws Exception
{
final Material material = Material.getMaterial(item.getTypeId());
if (material.isBlock() || material.getMaxDurability() < 0)
if (material.isBlock() || material.getMaxDurability() < 1)
{
throw new Exception(_("repairInvalidType"));
}
@@ -160,8 +160,8 @@ public class Commandsell extends EssentialsCommand
user.updateInventory();
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
user.giveMoney(worth * amount);
user.sendMessage(_("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth, ess)));
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
user.sendMessage(_("itemSold", Util.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth, ess)));
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth * amount, ess), amount, Util.displayCurrency(worth, ess)));
}
}
@@ -29,6 +29,9 @@ public class Commandsethome extends EssentialsCommand
{
if (user.isAuthorized("essentials.sethome.multiple"))
{
if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH))) {
throw new NotEnoughArgumentsException();
}
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getHomeLimit(user))
|| (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
{
@@ -63,6 +66,9 @@ public class Commandsethome extends EssentialsCommand
{
name = "home";
}
if ("bed".equals(name.toLowerCase(Locale.ENGLISH))) {
throw new NotEnoughArgumentsException();
}
usersHome.setHome(name, user.getLocation());
}
}
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
@@ -9,6 +10,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
public class Commandspawner extends EssentialsCommand
@@ -47,11 +49,14 @@ public class Commandspawner extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase()))
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("unableToSpawnMob"));
}
((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess);
charge.isAffordableFor(user);
((CreatureSpawner)target.getBlock().getState()).setSpawnedType(mob.getType());
charge.charge(user);
user.sendMessage(_("setSpawner", mob.name));
}
catch (Throwable ex)
@@ -5,8 +5,7 @@ import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Mob.MobException;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import java.util.Random;
import java.util.*;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -26,7 +25,20 @@ public class Commandspawnmob extends EssentialsCommand
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList())));
final Set<String> mobList = Mob.getMobList();
final Set<String> availableList = new HashSet<String>();
for (String mob : mobList)
{
if (user.isAuthorized("essentials.spawnmob." + mob.toLowerCase()))
{
availableList.add(mob);
}
}
if (availableList.isEmpty())
{
availableList.add(_("none"));
}
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(availableList)));
}
@@ -79,7 +91,7 @@ public class Commandspawnmob extends EssentialsCommand
User otherUser = null;
if (args.length >= 3)
{
otherUser = getPlayer(ess.getServer(), args, 2);
otherUser = getPlayer(ess.getServer(), args, 2);
}
final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
final Location sloc = Util.getSafeDestination(loc);
@@ -163,7 +175,7 @@ public class Commandspawnmob extends EssentialsCommand
changeMobData(mobMount.getType(), spawnedMount, mountData, user);
}
}
user.sendMessage(args[1] + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
user.sendMessage(mobCount + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
}
catch (MobException e1)
{
@@ -184,9 +196,9 @@ public class Commandspawnmob extends EssentialsCommand
}
}
private void changeMobData(final CreatureType type, final Entity spawned, final String data, final User user) throws Exception
private void changeMobData(final EntityType type, final Entity spawned, final String data, final User user) throws Exception
{
if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE)
if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE)
{
try
{
@@ -197,18 +209,18 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("slimeMalformedSize"), e);
}
}
if ((type == CreatureType.SHEEP
|| type == CreatureType.COW
|| type == CreatureType.MUSHROOM_COW
|| type == CreatureType.CHICKEN
|| type == CreatureType.PIG
|| type == CreatureType.WOLF)
if ((type == EntityType.SHEEP
|| type == EntityType.COW
|| type == EntityType.MUSHROOM_COW
|| type == EntityType.CHICKEN
|| type == EntityType.PIG
|| type == EntityType.WOLF)
&& data.equalsIgnoreCase("baby"))
{
((Animals)spawned).setAge(-24000);
return;
}
if (type == CreatureType.SHEEP)
if (type == EntityType.SHEEP)
{
if (data.toLowerCase(Locale.ENGLISH).contains("baby"))
{
@@ -233,7 +245,7 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("sheepMalformedColor"), e);
}
}
if (type == CreatureType.WOLF
if (type == EntityType.WOLF
&& data.toLowerCase(Locale.ENGLISH).startsWith("tamed"))
{
final Wolf wolf = ((Wolf)spawned);
@@ -245,7 +257,7 @@ public class Commandspawnmob extends EssentialsCommand
((Animals)spawned).setAge(-24000);
}
}
if (type == CreatureType.WOLF
if (type == EntityType.WOLF
&& data.toLowerCase(Locale.ENGLISH).startsWith("angry"))
{
((Wolf)spawned).setAngry(true);
@@ -254,7 +266,7 @@ public class Commandspawnmob extends EssentialsCommand
((Animals)spawned).setAge(-24000);
}
}
if (type == CreatureType.CREEPER && data.equalsIgnoreCase("powered"))
if (type == EntityType.CREEPER && data.equalsIgnoreCase("powered"))
{
((Creeper)spawned).setPowered(true);
}
@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
@@ -30,7 +31,13 @@ public class Commandsudo extends EssentialsCommand
}
//TODO: Translate this.
sender.sendMessage("Running the command as " + user.getDisplayName());
if (user.isAuthorized("essentials.sudo.exempt"))
{
throw new Exception("You cannot sudo this user");
}
//TODO: Translate this.
sender.sendMessage("Forcing " + user.getDisplayName() + " to run: /" + command + " " + getFinalArg(arguments, 0));
final PluginCommand execCommand = ess.getServer().getPluginCommand(command);
if (execCommand != null)
@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.event.entity.EntityDamageEvent;
public class Commandsuicide extends EssentialsCommand
@@ -15,9 +16,11 @@ public class Commandsuicide extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, 1000);
server.getPluginManager().callEvent(ede);
user.damage(1000);
user.setHealth(0);
user.sendMessage(_("suicideMessage"));
ess.broadcastMessage(user,
_("suicideSuccess", user.getDisplayName()));
ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName()));
}
}
@@ -22,7 +22,14 @@ public class Commandtpaccept extends EssentialsCommand
final User target = user.getTeleportRequest();
if (target == null
|| target.getBase() instanceof OfflinePlayer
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere"))
|| (!user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall"))
)
{
throw new Exception(_("noPendingRequest"));
}
if (args.length > 0 && !target.getName().contains(args[0]))
{
throw new Exception(_("noPendingRequest"));
}
@@ -8,6 +8,7 @@ import com.earth2me.essentials.Warps;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -44,10 +45,10 @@ public class Commandwarp extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
warpUser(otherUser, args[0]);
warpUser(user, otherUser, args[0]);
throw new NoChargeException();
}
warpUser(user, args[0]);
warpUser(user, user, args[0]);
throw new NoChargeException();
}
}
@@ -65,7 +66,7 @@ public class Commandwarp extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
warpUser(otherUser, args[0]);
otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
throw new NoChargeException();
}
@@ -112,17 +113,12 @@ public class Commandwarp extends EssentialsCommand
}
}
private void warpUser(final User user, final String name) throws Exception
private void warpUser(final User owner, final User user, final String name) throws Exception
{
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
if (ess.getSettings().getPerWarpPermission())
final Trade charge = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess);
charge.isAffordableFor(owner);
if (ess.getSettings().getPerWarpPermission() && !owner.isAuthorized("essentials.warp." + name))
{
if (user.isAuthorized("essentials.warp." + name))
{
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
return;
}
throw new Exception(_("warpUsePermission"));
}
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
@@ -60,7 +60,7 @@ public class Commandwhois extends EssentialsCommand
sender.sendMessage(_("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
if (!ess.getSettings().isEcoDisabled())
{
sender.sendMessage(_("whoisMoney", Util.formatCurrency(user.getMoney(), ess)));
sender.sendMessage(_("whoisMoney", Util.displayCurrency(user.getMoney(), ess)));
}
sender.sendMessage(user.isAfk()
? _("whoisStatusAway")
@@ -51,14 +51,14 @@ public class Commandworth extends EssentialsCommand
? _("worthMeta",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
iStack.getDurability(),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess))
Util.displayCurrency(worth, ess))
: _("worth",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess)));
Util.displayCurrency(worth, ess)));
}
@Override
@@ -95,14 +95,14 @@ public class Commandworth extends EssentialsCommand
? _("worthMeta",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
iStack.getDurability(),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess))
Util.displayCurrency(worth, ess))
: _("worth",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess)));
Util.displayCurrency(worth, ess)));
}
}
@@ -1,8 +1,13 @@
package com.earth2me.essentials.craftbukkit;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@@ -187,4 +192,34 @@ public class FakeInventory implements Inventory
items[i] = null;
}
}
@Override
public List<HumanEntity> getViewers()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getTitle()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryType getType()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryHolder getHolder()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ListIterator<ItemStack> iterator()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
@@ -1,7 +1,9 @@
package com.earth2me.essentials.craftbukkit;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.*;
import org.bukkit.block.Biome;
@@ -10,6 +12,8 @@ import org.bukkit.entity.*;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
@@ -228,12 +232,6 @@ public class FakeWorld implements World
return name;
}
@Override
public long getId()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getSpawnLocation()
{
@@ -521,4 +519,112 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... types)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public WorldType getWorldType()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> getListeningPluginChannels()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean canGenerateStructures()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getTicksPerAnimalSpawns()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTicksPerAnimalSpawns(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getTicksPerMonsterSpawns()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTicksPerMonsterSpawns(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> type)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Collection<Entity> getEntitiesByClasses(Class<?>... types)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public LivingEntity spawnCreature(Location arg0, EntityType arg1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> void playEffect(Location lctn, Effect effect, T t)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> void playEffect(Location lctn, Effect effect, T t, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setMetadata(String string, MetadataValue mv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<MetadataValue> getMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeMetadata(String string, Plugin plugin)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
@@ -1,17 +1,12 @@
package com.earth2me.essentials.craftbukkit;
import com.earth2me.essentials.craftbukkit.FakeInventory;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/*
* This class can be removed when
* https://github.com/Bukkit/CraftBukkit/pull/193
* is accepted to CraftBukkit
* This class can be removed when https://github.com/Bukkit/CraftBukkit/pull/193 is accepted to CraftBukkit
*/
public final class InventoryWorkaround
@@ -47,7 +42,7 @@ public final class InventoryWorkaround
{
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
}
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
{
if (item == null)
@@ -93,10 +88,9 @@ public final class InventoryWorkaround
{
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
/* TODO: some optimization
* - Create a 'firstPartial' with a 'fromIndex'
* - Record the lastPartial per Material
* - Cache firstEmpty result
/*
* TODO: some optimization - Create a 'firstPartial' with a 'fromIndex' - Record the lastPartial per Material -
* Cache firstEmpty result
*/
// combine items
@@ -175,7 +169,7 @@ public final class InventoryWorkaround
final int amount = item.getAmount();
final int partialAmount = partialItem.getAmount();
// Check if it fully fits
if (amount + partialAmount <= maxAmount)
{
@@ -325,25 +319,4 @@ public final class InventoryWorkaround
}
return leftover.isEmpty();
}
public static Item[] dropItem(final Location loc, final ItemStack itm)
{
final int maxStackSize = itm.getType().getMaxStackSize();
final int stacks = itm.getAmount() / maxStackSize;
final int leftover = itm.getAmount() % maxStackSize;
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
for (int i = 0; i < stacks; i++)
{
final ItemStack stack = itm.clone();
stack.setAmount(maxStackSize);
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
}
if (leftover > 0)
{
final ItemStack stack = itm.clone();
stack.setAmount(leftover);
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
}
return itemStacks;
}
}
@@ -1,25 +0,0 @@
package com.earth2me.essentials.craftbukkit;
import net.minecraft.server.EntityPlayer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerTeleportEvent;
public class ItemDupeFix extends PlayerListener
{
@Override
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if (event.isCancelled())
{
return;
}
final CraftPlayer player = (CraftPlayer)event.getPlayer();
final EntityPlayer entity = player.getHandle();
if (entity.activeContainer != entity.defaultContainer)
{
entity.closeInventory();
}
}
}
@@ -1,25 +0,0 @@
package com.earth2me.essentials.craftbukkit;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.ChunkCoordinates;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class SetBed
{
public static void setBed(final Player player, final Block block)
{
try
{
final CraftPlayer cplayer = (CraftPlayer)player;
cplayer.getHandle().a(new ChunkCoordinates(block.getX(), block.getY(), block.getZ()));
}
catch (Throwable ex)
{
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
}
@@ -1,46 +0,0 @@
package com.earth2me.essentials.craftbukkit;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.IInventory;
import net.minecraft.server.PlayerInventory;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class ShowInventory
{
public static void showEmptyInventory(final Player player)
{
try
{
final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle()));
inv.clear();
entityPlayer.a((IInventory)inv.getInventory());
}
catch (Throwable ex)
{
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
public static void showFilledInventory(final Player player, final ItemStack stack)
{
try
{
final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle()));
inv.clear();
InventoryWorkaround.addItem(inv, true, stack);
entityPlayer.a((IInventory)inv.getInventory());
}
catch (Throwable ex)
{
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
}
@@ -0,0 +1,62 @@
package com.earth2me.essentials.perm;
import de.bananaco.bpermissions.api.ApiLayer;
import de.bananaco.bpermissions.api.World;
import de.bananaco.bpermissions.api.WorldManager;
import de.bananaco.bpermissions.api.util.Calculable;
import de.bananaco.bpermissions.api.util.CalculableType;
import java.util.Arrays;
import java.util.List;
import org.bukkit.entity.Player;
public class BPermissions2Handler extends SuperpermsHandler
{
public BPermissions2Handler()
{
}
@Override
public String getGroup(final Player base)
{
final List<String> groups = getGroups(base);
if (groups == null || groups.isEmpty())
{
return null;
}
return groups.get(0);
}
@Override
public List<String> getGroups(final Player base)
{
final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
return Arrays.asList(groups);
}
@Override
public boolean inGroup(final Player base, final String group)
{
return ApiLayer.hasGroup(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
}
@Override
public boolean canBuild(final Player base, final String group)
{
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
}
@Override
public String getPrefix(final Player base)
{
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
}
@Override
public String getSuffix(final Player base)
{
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
}
}
@@ -1,5 +1,6 @@
package com.earth2me.essentials.perm;
import com.earth2me.essentials.Util;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
@@ -111,17 +112,6 @@ public class PermissionsHandler implements IPermissionsHandler
return;
}
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
if (bPermPlugin != null && bPermPlugin.isEnabled())
{
if (!(handler instanceof BPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
handler = new BPermissionsHandler();
}
return;
}
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
if (GMplugin != null && GMplugin.isEnabled())
{
@@ -144,6 +134,38 @@ public class PermissionsHandler implements IPermissionsHandler
return;
}
final Plugin privPlugin = pluginManager.getPlugin("Privileges");
if (privPlugin != null && privPlugin.isEnabled())
{
if (!(handler instanceof PrivilegesHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using Privileges based permissions.");
handler = new PrivilegesHandler(privPlugin);
}
return;
}
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
if (bPermPlugin != null && bPermPlugin.isEnabled())
{
final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
if (Util.isInt(bVer) && Integer.parseInt(bVer) < 284)
{
if (!(handler instanceof BPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
handler = new BPermissionsHandler();
}
return;
}
if (!(handler instanceof BPermissions2Handler))
{
LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
handler = new BPermissions2Handler();
}
return;
}
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
if (permPlugin != null && permPlugin.isEnabled())
{
@@ -0,0 +1,61 @@
package com.earth2me.essentials.perm;
import java.util.ArrayList;
import java.util.List;
import net.krinsoft.privileges.Privileges;
import net.krinsoft.privileges.groups.Group;
import net.krinsoft.privileges.groups.GroupManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class PrivilegesHandler extends SuperpermsHandler
{
private final transient Privileges plugin;
private final GroupManager manager;
public PrivilegesHandler(final Plugin plugin)
{
this.plugin = (Privileges) plugin;
this.manager = this.plugin.getGroupManager();
}
@Override
public String getGroup(final Player base)
{
Group group = manager.getGroup(base);
if (group == null)
{
return null;
}
return group.getName();
}
@Override
public List<String> getGroups(final Player base)
{
Group group = manager.getGroup(base);
if (group == null)
{
return new ArrayList<String>();
}
return group.getGroupTree();
}
@Override
public boolean inGroup(final Player base, final String group)
{
Group pGroup = manager.getGroup(base);
if (pGroup == null)
{
return false;
}
return pGroup.isMemberOf(group);
}
@Override
public boolean canBuild(Player base, String group)
{
return base.hasPermission("essentials.build") || base.hasPermission("privileges.build");
}
}
@@ -27,7 +27,7 @@ public class SuperpermsHandler implements IPermissionsHandler
@Override
public boolean inGroup(final Player base, final String group)
{
return false;
return hasPermission(base, "group." + group);
}
@Override
@@ -7,23 +7,23 @@ import org.bukkit.plugin.PluginManager;
/**
* The <code>Methods</code> initializes Methods that utilize the Method interface
* based on a "first come, first served" basis.
* The
* <code>Methods</code> initializes Methods that utilize the Method interface based on a "first come, first served"
* basis.
*
* Allowing you to check whether a payment method exists or not.
*
* Methods also allows you to set a preferred method of payment before it captures
* payment plugins in the initialization process.
* Methods also allows you to set a preferred method of payment before it captures payment plugins in the initialization
* process.
*
* in <code>bukkit.yml</code>:
* <blockquote><pre>
* in
* <code>bukkit.yml</code>: <blockquote><pre>
* economy:
* preferred: "iConomy"
* </pre></blockquote>
*
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun)
* @copyright: Copyright (C) 2011
* @license: AOL license <http://aol.nexua.org>
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license
* <http://aol.nexua.org>
*/
public class Methods
{
@@ -52,6 +52,7 @@ public class Methods
addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
addMethod("Currency", new com.earth2me.essentials.register.payment.methods.MCUR());
Dependencies.add("MultiCurrency");
addMethod("Vault", new com.earth2me.essentials.register.payment.methods.VaultEco());
}
/**
@@ -78,6 +79,7 @@ public class Methods
/**
* Use to get version of Register plugin
*
* @return version
*/
public static String getVersion()
@@ -86,10 +88,11 @@ public class Methods
}
/**
* Returns an array of payment method names that have been loaded
* through the <code>_init</code> method.
* Returns an array of payment method names that have been loaded through the
* <code>_init</code> method.
*
* @return <code>Set<String></code> - Array of payment methods that are loaded.
* @return
* <code>Set<String></code> - Array of payment methods that are loaded.
* @see #setMethod(org.bukkit.plugin.Plugin)
*/
public static Set<String> getDependencies()
@@ -98,8 +101,8 @@ public class Methods
}
/**
* Interprets Plugin class data to verify whether it is compatible with an existing payment
* method to use for payments and other various economic activity.
* Interprets Plugin class data to verify whether it is compatible with an existing payment method to use for
* payments and other various economic activity.
*
* @param plugin Plugin data from bukkit, Internal Class file.
* @return Method <em>or</em> Null
@@ -127,7 +130,8 @@ public class Methods
/**
* Verifies if Register has set a payment method for usage yet.
*
* @return <code>boolean</code>
* @return
* <code>boolean</code>
* @see #setMethod(org.bukkit.plugin.Plugin)
* @see #checkDisabled(org.bukkit.plugin.Plugin)
*/
@@ -137,11 +141,11 @@ public class Methods
}
/**
* Checks Plugin Class against a multitude of checks to verify it's usability
* as a payment method.
* Checks Plugin Class against a multitude of checks to verify it's usability as a payment method.
*
* @param <code>PluginManager</code> the plugin manager for the server
* @return <code>boolean</code> True on success, False on failure.
* @return
* <code>boolean</code> True on success, False on failure.
*/
public static boolean setMethod(PluginManager manager)
{
@@ -242,7 +246,8 @@ public class Methods
/**
* Sets the preferred economy
*
* @return <code>boolean</code>
* @return
* <code>boolean</code>
*/
public static boolean setPreferred(String check)
{
@@ -258,7 +263,9 @@ public class Methods
/**
* Grab the existing and initialized (hopefully) Method Class.
*
* @return <code>Method</code> <em>or</em> <code>Null</code>
* @return
* <code>Method</code> <em>or</em>
* <code>Null</code>
*/
public static Method getMethod()
{
@@ -266,11 +273,11 @@ public class Methods
}
/**
* Verify is a plugin is disabled, only does this if we there is an existing payment
* method initialized in Register.
* Verify is a plugin is disabled, only does this if we there is an existing payment method initialized in Register.
*
* @param method Plugin data from bukkit, Internal Class file.
* @return <code>boolean</code>
* @return
* <code>boolean</code>
*/
public static boolean checkDisabled(Plugin method)
{
@@ -0,0 +1,339 @@
package com.earth2me.essentials.register.payment.methods;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import com.earth2me.essentials.register.payment.Method;
public class VaultEco implements Method
{
private Vault vault;
private Economy economy;
@Override
public Vault getPlugin()
{
return this.vault;
}
@Override
public boolean createAccount(String name, Double amount)
{
if (hasAccount(name))
{
return false;
}
return false;
}
@Override
public String getName()
{
return this.vault.getDescription().getName().concat(" - Economy: ").concat(economy == null ? "NoEco" : economy.getName());
}
@Override
public String getVersion()
{
return this.vault.getDescription().getVersion();
}
@Override
public int fractionalDigits()
{
return 0;
}
@Override
public String format(double amount)
{
return this.economy.format(amount);
}
@Override
public boolean hasBanks()
{
return this.economy.hasBankSupport();
}
@Override
public boolean hasBank(String bank)
{
return this.economy.getBanks().contains(bank);
}
@Override
public boolean hasAccount(String name)
{
return this.economy.hasAccount(name);
}
@Override
public boolean hasBankAccount(String bank, String name)
{
return this.economy.isBankOwner(bank, name).transactionSuccess()
|| this.economy.isBankMember(bank, name).transactionSuccess();
}
@Override
public boolean createAccount(String name)
{
return this.economy.createBank(name, "").transactionSuccess();
}
public boolean createAccount(String name, double balance)
{
if (!this.economy.createBank(name, "").transactionSuccess())
{
return false;
}
return this.economy.bankDeposit(name, balance).transactionSuccess();
}
@Override
public MethodAccount getAccount(String name)
{
if (!hasAccount(name))
{
return null;
}
return new VaultAccount(name, this.economy);
}
@Override
public MethodBankAccount getBankAccount(String bank, String name)
{
if (!hasBankAccount(bank, name))
{
return null;
}
return new VaultBankAccount(bank, economy);
}
@Override
public boolean isCompatible(Plugin plugin)
{
try
{
RegisteredServiceProvider<Economy> ecoPlugin = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
return plugin instanceof Vault && ecoPlugin != null && !ecoPlugin.getProvider().getName().equals("Essentials Economy");
}
catch (LinkageError e)
{
return false;
}
catch (Exception e)
{
return false;
}
}
@Override
public void setPlugin(Plugin plugin)
{
this.vault = (Vault)plugin;
RegisteredServiceProvider<Economy> economyProvider = this.vault.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null)
{
this.economy = economyProvider.getProvider();
}
}
public class VaultAccount implements MethodAccount
{
private final String name;
private final Economy economy;
public VaultAccount(String name, Economy economy)
{
this.name = name;
this.economy = economy;
}
@Override
public double balance()
{
return this.economy.getBalance(this.name);
}
@Override
public boolean set(double amount)
{
if (!this.economy.withdrawPlayer(this.name, this.balance()).transactionSuccess())
{
return false;
}
if (amount == 0)
{
return true;
}
return this.economy.depositPlayer(this.name, amount).transactionSuccess();
}
@Override
public boolean add(double amount)
{
return this.economy.depositPlayer(this.name, amount).transactionSuccess();
}
@Override
public boolean subtract(double amount)
{
return this.economy.withdrawPlayer(this.name, amount).transactionSuccess();
}
@Override
public boolean multiply(double amount)
{
double balance = this.balance();
return this.set(balance * amount);
}
@Override
public boolean divide(double amount)
{
double balance = this.balance();
return this.set(balance / amount);
}
@Override
public boolean hasEnough(double amount)
{
return (this.balance() >= amount);
}
@Override
public boolean hasOver(double amount)
{
return (this.balance() > amount);
}
@Override
public boolean hasUnder(double amount)
{
return (this.balance() < amount);
}
@Override
public boolean isNegative()
{
return (this.balance() < 0);
}
@Override
public boolean remove()
{
return this.set(0.0);
}
}
public class VaultBankAccount implements MethodBankAccount
{
private final String bank;
private final Economy economy;
public VaultBankAccount(String bank, Economy economy)
{
this.bank = bank;
this.economy = economy;
}
@Override
public String getBankName()
{
return this.bank;
}
@Override
public int getBankId()
{
return -1;
}
@Override
public double balance()
{
return this.economy.bankBalance(this.bank).balance;
}
@Override
public boolean set(double amount)
{
if (!this.economy.bankWithdraw(this.bank, this.balance()).transactionSuccess())
{
return false;
}
if (amount == 0)
{
return true;
}
return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
}
@Override
public boolean add(double amount)
{
return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
}
@Override
public boolean subtract(double amount)
{
return this.economy.bankWithdraw(this.bank, amount).transactionSuccess();
}
@Override
public boolean multiply(double amount)
{
double balance = this.balance();
return this.set(balance * amount);
}
@Override
public boolean divide(double amount)
{
double balance = this.balance();
return this.set(balance / amount);
}
@Override
public boolean hasEnough(double amount)
{
return (this.balance() >= amount);
}
@Override
public boolean hasOver(double amount)
{
return (this.balance() > amount);
}
@Override
public boolean hasUnder(double amount)
{
return (this.balance() < amount);
}
@Override
public boolean isNegative()
{
return (this.balance() < 0);
}
@Override
public boolean remove()
{
return this.set(0.0);
}
}
}
@@ -266,7 +266,7 @@ public class EssentialsSign
final Double money = trade.getMoney();
if (money != null)
{
sign.setLine(index, Util.formatCurrency(money, ess));
sign.setLine(index, Util.shortCurrency(money, ess));
}
}
@@ -8,10 +8,13 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
public class SignBlockListener extends BlockListener
public class SignBlockListener implements Listener
{
private final transient IEssentials ess;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
@@ -21,7 +24,7 @@ public class SignBlockListener extends BlockListener
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -41,9 +44,9 @@ public class SignBlockListener extends BlockListener
if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
{
final Sign csign = (Sign)block.getState();
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (csign.getLine(0).equalsIgnoreCase(sign.getSuccessName())
&& !sign.onSignBreak(block, player, ess))
{
@@ -59,9 +62,8 @@ public class SignBlockListener extends BlockListener
LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign.");
return true;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, player, ess))
{
@@ -73,7 +75,7 @@ public class SignBlockListener extends BlockListener
return false;
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onSignChange(final SignChangeEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -105,7 +107,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -139,7 +141,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockBurn(final BlockBurnEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -156,9 +158,8 @@ public class SignBlockListener extends BlockListener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBurn(block, ess))
{
@@ -168,7 +169,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockIgnite(final BlockIgniteEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -185,9 +186,8 @@ public class SignBlockListener extends BlockListener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockIgnite(block, ess))
{
@@ -197,7 +197,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPistonExtend(final BlockPistonExtendEvent event)
{
for (Block block : event.getBlocks())
@@ -210,9 +210,8 @@ public class SignBlockListener extends BlockListener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockPush(block, ess))
{
@@ -223,7 +222,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPistonRetract(final BlockPistonRetractEvent event)
{
if (event.isSticky())
@@ -237,9 +236,8 @@ public class SignBlockListener extends BlockListener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockPush(block, ess))
{
@@ -2,7 +2,6 @@ package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.ShowInventory;
public class SignDisposal extends EssentialsSign
@@ -15,7 +14,10 @@ public class SignDisposal extends EssentialsSign
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess)
{
ShowInventory.showEmptyInventory(player.getBase());
player.sendMessage("Bukkit broke this sign :(");
//TODO: wait for a fix in bukkit
//Problem: Items can be duplicated
//player.getBase().openInventory(ess.getServer().createInventory(player, 36));
return true;
}
}
@@ -3,12 +3,14 @@ package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.entity.EndermanPickupEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
public class SignEntityListener extends EntityListener
public class SignEntityListener implements Listener
{
private final transient IEssentials ess;
@@ -17,7 +19,7 @@ public class SignEntityListener extends EntityListener
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
for (Block block : event.blockList())
@@ -30,9 +32,8 @@ public class SignEntityListener extends EntityListener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType()))
{
event.setCancelled(!sign.onBlockExplode(block, ess));
@@ -42,8 +43,8 @@ public class SignEntityListener extends EntityListener
}
}
@Override
public void onEndermanPickup(EndermanPickupEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{
@@ -59,9 +60,8 @@ public class SignEntityListener extends EntityListener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, ess))
{
@@ -4,8 +4,10 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.ShowInventory;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -32,8 +34,15 @@ public class SignFree extends EssentialsSign
throw new SignException(_("cantSpawnItem", "Air"));
}
item.setAmount(item.getType().getMaxStackSize() * 9 * 4);
ShowInventory.showFilledInventory(player.getBase(), item);
item.setAmount(item.getType().getMaxStackSize());
InventoryWorkaround.addItem(player.getInventory(), true, item);
player.sendMessage("Item added to your inventory.");
player.updateInventory();
//TODO: wait for a fix in bukkit
//Problem: Items can be duplicated
//Inventory i = ess.getServer().createInventory(player, InventoryType.CHEST);
//i.addItem(item);
//player.openInventory(i);
Trade.log("Sign", "Free", "Interact", username, null, username, new Trade(item, ess), sign.getBlock().getLocation(), ess);
return true;
}
@@ -17,7 +17,7 @@ public class SignKit extends EssentialsSign
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
validateTrade(sign, 3, ess);
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH);
if (kitName.isEmpty())
@@ -56,10 +56,9 @@ public class SignKit extends EssentialsSign
charge.isAffordableFor(player);
try
{
final Object kit = ess.getSettings().getKit(kitName);
final Map<String, Object> els = (Map<String, Object>)kit;
final List<String> items = Kit.getItems(player, els);
Kit.expandItems(ess, player, items);
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
final List<String> items = Kit.getItems(player, kit);
Kit.expandItems(ess, player, items);
charge.charge(player);
}
catch (Exception ex)
@@ -4,22 +4,24 @@ import com.earth2me.essentials.IEssentials;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
public class SignPlayerListener extends PlayerListener
public class SignPlayerListener implements Listener
{
private final transient IEssentials ess;
public SignPlayerListener(IEssentials ess)
public SignPlayerListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
public void onPlayerInteract(PlayerInteractEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{
@@ -39,9 +41,8 @@ public class SignPlayerListener extends PlayerListener
return;
}
final Sign csign = (Sign)block.getState();
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (csign.getLine(0).equalsIgnoreCase(sign.getSuccessName()))
{
sign.onSignInteract(block, event.getPlayer(), ess);
@@ -52,9 +53,8 @@ public class SignPlayerListener extends PlayerListener
}
else
{
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockInteract(block, event.getPlayer(), ess))
{
@@ -129,7 +129,7 @@ public class SignProtection extends EssentialsSign
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
{
final BlockSign sign = new BlockSign(block);
if (sign.getLine(0).equalsIgnoreCase(this.getSuccessName()))
if (sign.getLine(0).equals(this.getSuccessName()))
{
return checkProtectionSign(sign, user, username);
}
@@ -36,7 +36,7 @@ public class SignTrade extends EssentialsSign
try
{
stored = getTrade(sign, 1, true, true, ess);
substractAmount(sign, 1, stored, ess);
subtractAmount(sign, 1, stored, ess);
stored.pay(player);
}
catch (SignException e)
@@ -53,12 +53,14 @@ public class SignTrade extends EssentialsSign
final Trade charge = getTrade(sign, 1, false, false, ess);
final Trade trade = getTrade(sign, 2, false, true, ess);
charge.isAffordableFor(player);
addAmount(sign, 1, charge, ess);
subtractAmount(sign, 2, trade, ess);
if (!trade.pay(player, false))
{
subtractAmount(sign, 1, charge, ess);
addAmount(sign, 2, trade, ess);
throw new ChargeException("Full inventory");
}
substractAmount(sign, 2, trade, ess);
addAmount(sign, 1, charge, ess);
charge.charge(player);
Trade.log("Sign", "Trade", "Interact", sign.getLine(3), charge, username, trade, sign.getBlock().getLocation(), ess);
}
@@ -133,11 +135,11 @@ public class SignTrade extends EssentialsSign
final Double money = getMoney(split[0]);
if (money != null)
{
if (Util.formatCurrency(money, ess).length() * 2 > 15)
if (Util.shortCurrency(money, ess).length() * 2 > 15)
{
throw new SignException("Line can be too long!");
}
sign.setLine(index, Util.formatCurrency(money, ess) + ":0");
sign.setLine(index, Util.shortCurrency(money, ess) + ":0");
return;
}
}
@@ -153,7 +155,7 @@ public class SignTrade extends EssentialsSign
{
throw new SignException(_("moreThanZero"));
}
sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1));
sign.setLine(index, Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount, ess).substring(1));
return;
}
}
@@ -256,7 +258,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(_("invalidSignLine", index + 1));
}
protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
protected final void subtractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
{
final Double money = trade.getMoney();
if (money != null)
@@ -294,6 +296,7 @@ public class SignTrade extends EssentialsSign
}
}
//TODO: Translate these exceptions.
private void changeAmount(final ISign sign, final int index, final double value, final IEssentials ess) throws SignException
{
@@ -310,10 +313,10 @@ public class SignTrade extends EssentialsSign
final Double amount = getDouble(split[1]);
if (money != null && amount != null)
{
final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
final String newline = Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount + value, ess).substring(1);
if (newline.length() > 15)
{
throw new SignException("Line too long!");
throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -329,7 +332,7 @@ public class SignTrade extends EssentialsSign
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
if (newline.length() > 15)
{
throw new SignException("Line too long!");
throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -343,7 +346,7 @@ public class SignTrade extends EssentialsSign
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
if (newline.length() > 15)
{
throw new SignException("Line too long!");
throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -30,9 +30,9 @@ public class HelpInput implements IText
try
{
final PluginDescriptionFile desc = p.getDescription();
final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands();
final Map<String, Map<String, Object>> cmds = desc.getCommands();
pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH);
for (Map.Entry<String, HashMap<String, Object>> k : cmds.entrySet())
for (Map.Entry<String, Map<String, Object>> k : cmds.entrySet())
{
try
{
@@ -57,7 +57,7 @@ public class HelpInput implements IText
{
if (ess.getSettings().showNonEssCommandsInHelp())
{
final HashMap<String, Object> value = k.getValue();
final Map<String, Object> value = k.getValue();
Object permissions = null;
if (value.containsKey(PERMISSION))
{
@@ -4,6 +4,7 @@ import com.earth2me.essentials.DescParseTickFormat;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -16,32 +17,36 @@ import org.bukkit.plugin.Plugin;
public class KeywordReplacer implements IText
{
private final transient IText input;
private final transient List<String> replaced;
private final transient IEssentials ess;
public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess)
{
this.input = input;
this.replaced = new ArrayList<String>(this.input.getLines().size());
this.ess = ess;
replaceKeywords(sender);
}
private void replaceKeywords(final CommandSender sender)
{
String displayName, ipAddress, balance, mails, world;
String worlds, online, unique, playerlist, date, time;
String worldTime12, worldTime24, worldDate, plugins;
String version;
String userName, address, version;
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
displayName = user.getDisplayName();
userName = user.getName();
ipAddress = user.getAddress().getAddress().toString();
address = user.getAddress().toString();
balance = Double.toString(user.getMoney());
mails = Integer.toString(user.getMails().size());
world = user.getLocation().getWorld().getName();
worldTime12 = DescParseTickFormat.format12(user.getWorld().getTime());
worldTime24 = DescParseTickFormat.format24(user.getWorld().getTime());
worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld().getTime()));
worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld().getFullTime()));
}
else
{
@@ -98,14 +103,18 @@ public class KeywordReplacer implements IText
date = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(new Date());
time = DateFormat.getTimeInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(new Date());
version = ess.getServer().getVersion();
for (int i = 0; i < input.getLines().size(); i++)
{
String line = input.getLines().get(i);
line = line.replace("{PLAYER}", displayName);
line = line.replace("{DISPLAYNAME}", displayName);
line = line.replace("{USERNAME}", displayName);
line = line.replace("{IP}", ipAddress);
line = line.replace("{ADDRESS}", ipAddress);
line = line.replace("{BALANCE}", balance);
line = line.replace("{MAILS}", mails);
line = line.replace("{WORLD}", world);
@@ -120,14 +129,14 @@ public class KeywordReplacer implements IText
line = line.replace("{WORLDDATE}", worldDate);
line = line.replace("{PLUGINS}", plugins);
line = line.replace("{VERSION}", version);
input.getLines().set(i, line);
replaced.add(line);
}
}
@Override
public List<String> getLines()
{
return input.getLines();
return replaced;
}
@Override
@@ -0,0 +1,35 @@
package com.earth2me.essentials.textreader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class SimpleTextInput implements IText
{
private final transient List<String> lines = new ArrayList<String>();
public SimpleTextInput (final String input) {
lines.add(input);
}
@Override
public List<String> getLines()
{
return lines;
}
@Override
public List<String> getChapters()
{
return Collections.emptyList();
}
@Override
public Map<String, Integer> getBookmarks()
{
return Collections.emptyMap();
}
}
@@ -0,0 +1,31 @@
package com.earth2me.essentials.textreader;
import org.bukkit.command.CommandSender;
public class SimpleTextPager
{
private final transient IText text;
public SimpleTextPager(final IText text)
{
this.text = text;
}
public void showPage(final CommandSender sender)
{
for (String line : text.getLines())
{
sender.sendMessage(line);
}
}
public String getString(int line)
{
if (text.getLines().size() < line)
{
return null;
}
return text.getLines().get(line);
}
}
@@ -4,6 +4,7 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.io.*;
import java.lang.ref.SoftReference;
import java.util.*;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -11,9 +12,11 @@ import org.bukkit.entity.Player;
public class TextInput implements IText
{
private final transient List<String> lines = new ArrayList<String>();
private final transient List<String> chapters = new ArrayList<String>();
private final transient Map<String, Integer> bookmarks = new HashMap<String, Integer>();
private final transient List<String> lines;
private final transient List<String> chapters;
private final transient Map<String, Integer> bookmarks;
private final transient long lastChange;
private final static HashMap<String, SoftReference<TextInput>> cache = new HashMap<String, SoftReference<TextInput>>();
public TextInput(final CommandSender sender, final String filename, final boolean createFile, final IEssentials ess) throws IOException
{
@@ -34,33 +37,62 @@ public class TextInput implements IText
}
if (file.exists())
{
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try
lastChange = file.lastModified();
boolean readFromfile;
synchronized (cache)
{
int lineNumber = 0;
while (bufferedReader.ready())
final SoftReference<TextInput> inputRef = cache.get(file.getName());
TextInput input;
if (inputRef == null || (input = inputRef.get()) == null || input.lastChange < lastChange)
{
final String line = bufferedReader.readLine();
if (line == null)
{
break;
}
if (line.length() > 0 && line.charAt(0) == '#')
{
bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-f]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '§').replace("§§", "&"));
}
lines.add(line.replace('&', '§').replace("§§", "&"));
lineNumber++;
lines = new ArrayList<String>();
chapters = new ArrayList<String>();
bookmarks = new HashMap<String, Integer>();
cache.put(file.getName(), new SoftReference<TextInput>(this));
readFromfile = true;
}
else
{
lines = Collections.unmodifiableList(input.getLines());
chapters = Collections.unmodifiableList(input.getChapters());
bookmarks = Collections.unmodifiableMap(input.getBookmarks());
readFromfile = false;
}
}
finally
if (readFromfile)
{
bufferedReader.close();
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try
{
int lineNumber = 0;
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine();
if (line == null)
{
break;
}
if (line.length() > 0 && line.charAt(0) == '#')
{
bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-f]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '§').replace("§§", "&"));
}
lines.add(line.replace('&', '§').replace("§§", "&"));
lineNumber++;
}
}
finally
{
bufferedReader.close();
}
}
}
else
{
lastChange = 0;
lines = Collections.emptyList();
chapters = Collections.emptyList();
bookmarks = Collections.emptyMap();
if (createFile)
{
final InputStream input = ess.getResource(filename + ".txt");
@@ -68,8 +100,7 @@ public class TextInput implements IText
try
{
final byte[] buffer = new byte[1024];
int length = 0;
length = input.read(buffer);
int length = input.read(buffer);
while (length > 0)
{
output.write(buffer, 0, length);
@@ -196,4 +196,15 @@ public class User extends UserBase implements IUser
unlock();
}
}
@Override
public boolean canAfford(final double cost)
{
final double mon = getMoney();
if (isAuthorized("essentials.eco.loan"))
{
return (mon - cost) >= ess.getSettings().getMinMoney();
}
return cost <= mon;
}
}
+65 -33
View File
@@ -18,8 +18,6 @@
# - CraftBukkit and Permissions have been updated: CraftBukkit and Essentials almost always line up, but sometimes other plugins fall behind CraftBukkit's multiple daily updates
# - You have saved the document as UTF-8, NOT the default, ANSI
############################################################
# +------------------------------------------------------+ #
# | Essentials (Global) | #
@@ -157,17 +155,45 @@ player-commands:
- xmpp
# Note: All items MUST be followed by a quantity!
# All kit names should be lower case, and will be treated as lower in permissions/costs.
# Times are measured in seconds.
kits:
tools:
dtools:
delay: 10
items:
- 277 1
- 278 1
- 279 1
tools:
delay: 10
items:
- 272 1
- 273 1
- 274 1
- 275 1
# Disable all signs
signs-disabled: false
# Essentials Sign Control
# See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these.
# To enable signs, remove # symbol. To disable all signs, comment/remove each sign.
# We recommend not enabling chest protection signs if you don't intend to use them, (or are using LWC/Lockette).
enabledSigns:
#- balance
#- buy
#- sell
#- trade
#- free
#- disposal
#- warp
#- kit
#- mail
#- enchant
#- gamemode
#- heal
#- spawnmob
#- time
#- weather
#- protection
# Backup runs a command while saving is disabled
backup:
@@ -253,28 +279,25 @@ register-back-in-listener: false
# +------------------------------------------------------+ #
############################################################
# When users die, should they respawn at their first home, instead of the spawnpoint or bed?
respawn-at-home: false
# If no home is set send you to bed or spawn when /home is used
# If no home is set, send players to spawn when /home is used
spawn-if-no-home: true
# Allows people to set their bed at daytime
update-bed-at-daytime: true
# Allow players to have multiple homes.
# Players need essentials.sethome.multiple before they can have more than 1 home, default to 'default' below.
# Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip
# People with essentials.sethome.multiple.unlimited are not limited by these numbers.
sethome-multiple:
# essentials.sethome.multiple
default: 3
# essentials.sethome.multiple.vip
vip: 5
# essentials.sethome.multiple.staff
staff: 10
#Set timeout in seconds for players to accept tpa before request is cancelled.
#Set to 0 for no timeout
# Set timeout in seconds for players to accept tpa before request is cancelled.
# Set to 0 for no timeout
tpa-accept-cancellation: 0
############################################################
@@ -295,7 +318,7 @@ command-costs:
#example: 1000
# /kit tools costs $1500 PER USE
#kit-tools: 1500
# Set this to a currency symbol you want to use.
currency-symbol: '$'
@@ -303,6 +326,10 @@ currency-symbol: '$'
# The amount is always limited to 10 trillions because of the limitations of a java double
max-money: 10000000000000
# Set the minimum amount of money a player can have
# Setting this to 0, will disable overdrafts/loans compeltely. Users need 'essentials.eco.loan' perm to go below 0.
min-money: -10000000000000
# Enable this to log all interactions with trade/buy/sell signs and sell command
economy-log-enabled: false
@@ -317,7 +344,7 @@ non-ess-in-help: true
# Hide plugins which dont give a permission
# You can override a true value here for a single plugin by adding a permission to a user/group.
# The indervidual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.
# The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.
# You can use negitive permissions to remove access to just a single plugins help if the following is enabled.
hide-permissionless-help: true
@@ -328,30 +355,28 @@ hide-permissionless-help: true
############################################################
chat:
# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.
# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
# Or with essentials.chat.question can override this by prefixing text with a question mark (?)
# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
radius: 0
# Chat formatting can be done in two ways, you can either define a standard format for all chat
# Or you can give a group specific chat format, to give some extra variation.
# If set to the default chat format which "should" be compatible with ichat.
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
format: '<{DISPLAYNAME}> {MESSAGE}'
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
group-formats:
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
# If your using group formats make sure to remove the '#' to allow the setting to be read.
############################################################
# +------------------------------------------------------+ #
# | EssentialsProtect | #
@@ -382,13 +407,13 @@ protect:
# Which blocks should people be prevented from placing
placement: 10,11,46,327
# Which items should people be prevented from using
usage: 327
# Which blocks should people be prevented from breaking
break:
# Which blocks should not be pushed by pistons
piston:
@@ -442,12 +467,12 @@ protect:
mushroom_cow: false
magma_cube: false
snowman: false
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
creeper:
max-height: -1
# Protect various blocks.
protect:
# Protect all signs
@@ -463,7 +488,7 @@ protect:
# Prevent placing blocks above protected rails, this is to stop a potential griefing
prevent-block-on-rails: false
# Store blocks / signs in memory before writing
memstore: false
@@ -492,22 +517,21 @@ protect:
# Burn, baby, burn! Should fire damage be disabled?
firedmg: false
# Should the damage after hit by a lightning be disabled?
lightning: false
# Should people with build: false in permissions be allowed to build
# Set true to disable building for those people
build: true
# Should people with build: false in permissions be allowed to use items
# Set true to disable useing for those people
# Set true to disable using for those people
use: true
# Should we tell people they are not allowed to build
warn-on-build-disallow: true
# Disable weather options
weather:
storm: false
@@ -526,14 +550,22 @@ newbies:
# If not, set to ''
#announce-format: ''
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
# When we spawn for the first time, which spawnpoint do we use?
# Set to "none" if you want to use the spawn point of the world.
spawnpoint: newbies
# Do we want to give users anything on first join? Set to '' to disable
# This kit will be given reguardless of cost, and permissions.
#kit: ''
kit: tools
# Set this to lowest, if you want Multiverse to handle the respawning
# Set this to normal, if you want EssentialsSpawn to handle the respawning
# Set this to high, if you want EssentialsSpawn to handle the respawning
# Set this to highest, if you want to force EssentialsSpawn to handle the respawning
respawn-listener-priority: normal
respawn-listener-priority: high
# When users die, should they respawn at their first home or bed, instead of the spawnpoint?
respawn-at-home: false
# End of File <-- No seriously, you're done with configuration.
+7
View File
@@ -7,6 +7,10 @@ Name it info_username.txt or info_groupname.txt
This also works with motd and rules.
Extra pages:
Type /info Colours
Type /info Tags
It can contain chapters like the Chapter1 below:
#Chapter1
@@ -25,7 +29,9 @@ Minecraft colors:
#Tags
PLAYER: {PLAYER}
USERNAME: {PLAYER}
IP: {IP}
ADDRESS: {ADDRESS}
BALANCE: {BALANCE}
MAILS: {MAILS}
WORLD: {WORLD}
@@ -39,3 +45,4 @@ WORLDTIME12: {WORLDTIME12}
WORLDTIME24: {WORLDTIME24}
WORLDDATE: {WORLDDATE}
PLUGINS: {PLUGINS}
VERSION: {VERSION}
+24
View File
@@ -2429,6 +2429,30 @@ glisteringmelon,382,0
shiningmelon,382,0
gmelon,382,0
smelon,382,0
creeperegg,383,50
skeletonegg,383,51
spideregg,383,52
giantegg,383,53
zombieegg,383,54
slimeegg,383,55
ghastegg,383,56
zombiepigmanegg,383,57
pigmanegg,383,57
endermanegg,383,58
cavespideregg,383,59
silverfishegg,383,60
blazeegg,383,61
lavaslimeegg,383,62
magmacubeegg,383,63
pigegg,383,90
sheepegg,383,91
cowegg,383,92
chickenegg,383,93
squidegg,383,94
wolfegg,383,95
mooshroomegg,383,96
mushroomcowegg,383,96
villageregg,383,120
goldmusicrecord,2256,0
goldmusicdisk,2256,0
goldmusiccd,2256,0
1 #version: TeamCity
2429 shiningmelon,382,0
2430 gmelon,382,0
2431 smelon,382,0
2432 creeperegg,383,50
2433 skeletonegg,383,51
2434 spideregg,383,52
2435 giantegg,383,53
2436 zombieegg,383,54
2437 slimeegg,383,55
2438 ghastegg,383,56
2439 zombiepigmanegg,383,57
2440 pigmanegg,383,57
2441 endermanegg,383,58
2442 cavespideregg,383,59
2443 silverfishegg,383,60
2444 blazeegg,383,61
2445 lavaslimeegg,383,62
2446 magmacubeegg,383,63
2447 pigegg,383,90
2448 sheepegg,383,91
2449 cowegg,383,92
2450 chickenegg,383,93
2451 squidegg,383,94
2452 wolfegg,383,95
2453 mooshroomegg,383,96
2454 mushroomcowegg,383,96
2455 villageregg,383,120
2456 goldmusicrecord,2256,0
2457 goldmusicdisk,2256,0
2458 goldmusiccd,2256,0
+12 -7
View File
@@ -4,7 +4,7 @@
# by:
action=* {0} {1}
addedToAccount=\u00a7a{0} has been added to your account.
addedToOthersAccount=\u00a7a{0} has been added to {1} account.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=broke:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3}
alertPlaced=placed:
@@ -33,6 +33,8 @@ canTalkAgain=\u00a77You can talk again
cantFindGeoIpDB=Can''t find GeoIP database!
cantReadGeoIpDB=Failed to read GeoIP database!
cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Command {0} failed:
commandHelpFailedForPlugin=Error getting help for: {0}
commandNotLoaded=\u00a7cCommand {0} is improperly loaded.
@@ -47,6 +49,7 @@ couldNotFindTemplate=Could not find template {0}
creatingConfigFromTemplate=Creating config from template: {0}
creatingEmptyConfig=Creating empty config: {0}
creative=creative
currency={0}{1}
day=day
days=days
defaultBanReason=The Ban Hammer has spoken!
@@ -167,9 +170,9 @@ lightningUse=\u00a77Smiting {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Failed to load warp {0}
loadinfo=Loaded {0} build {1} by: {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cTo mark your mail as read, type /mail clear
mailCleared=\u00a77Mail Cleared!
@@ -237,6 +240,7 @@ notRecommendedBukkit= * ! * Bukkit version is not the recommended build for Esse
notSupportedYet=Not supported yet.
nothingInHand = \u00a7cYou have nothing in your hand.
now=now
nuke=May death rain upon them
numberRequired=A number goes there, silly.
onlyDayNight=/time only supports day/night.
onlyPlayers=Only in-game players can use {0}.
@@ -291,13 +295,15 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request.
requestDenied=\u00a77Teleport request denied.
requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Request sent to {0}\u00a77.
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error occurred when trying to return player to jail.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=second
seconds=seconds
seenOffline=Player {0} is offline since {1}
seenOnline=Player {0} is online since {1}
serverFull=Server is full
serverTotal=Server Total: {0}
setSpawner=Changed spawner type to {0}
sheepMalformedColor=Malformed color.
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -314,7 +320,7 @@ suicideMessage=\u00a77Goodbye Cruel World...
suicideSuccess= \u00a77{0} took their own life
survival=survival
takenFromAccount=\u00a7c{0} has been taken from your account.
takenFromOthersAccount=\u00a7c{0} has been taken from {1} account.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Teleporting request sent to all players...
teleportAll=\u00a77Teleporting all players...
teleportAtoB=\u00a77{0}\u00a77 teleported you to {1}\u00a77.
@@ -322,6 +328,7 @@ teleportDisabled={0} has teleportation disabled.
teleportHereRequest=\u00a7c{0}\u00a7c has requested that you teleport to them.
teleportNewPlayerError=Failed to teleport new player
teleportRequest=\u00a7c{0}\u00a7c has requested to teleport to you.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleporting to top.
teleportationCommencing=\u00a77Teleportation commencing...
teleportationDisabled=\u00a77Teleportation disabled.
@@ -402,5 +409,3 @@ year=year
years=years
youAreHealed=\u00a77You have been healed.
youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
+12 -7
View File
@@ -4,7 +4,7 @@
# by: Dysp, dysperen@gmail.com
action=* {0} {1}
addedToAccount=\u00a7a{0} er blevet tilf\u00f8jet til din konto.
addedToOthersAccount=\u00a7a{0} er blevet tilf\u00f8jet til {1} konto.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=\u00f8delagde:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} ved: {3}
alertPlaced=placerede:
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Teleporterer til tidligere placering.
backupFinished=Backup sluttet
backupStarted=Backup startet
balance=\u00a77Saldo: {0}
balanceTop=\u00a77 Top saldoer ({0})
balanceTop=\u00a77Top saldoer ({0})
banExempt=\u00a7cDu kan ikke banne den p\u00e5g\u00e6ldende spiller.
banIpAddress=\u00a77Bannede IP addresse
bannedIpsFileError=Fejl i afl\u00e6sning af banned-ips.txt
@@ -33,6 +33,8 @@ canTalkAgain=\u00a77Du kan nu snakke igen.
cantFindGeoIpDB=Kan ikke finde GeoIP database!
cantReadGeoIpDB=Fejl ved afl\u00e6sning af GeoIP database!
cantSpawnItem=\u00a7cDu har ikke tilladelse til at skabe tingen.{0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Kommandoen {0} fejlede:
commandHelpFailedForPlugin=Fejl ved hentning af hj\u00e6lp til: {0}
commandNotLoaded=\u00a7cKommando {0} er ikke indl\u00e6st korrekt.
@@ -47,6 +49,7 @@ couldNotFindTemplate=Kunne ikke finde skabelon {0}
creatingConfigFromTemplate=Opretter config fra skabelon: {0}
creatingEmptyConfig=Opretter tom config: {0}
creative=creative
currency={0}{1}
day=dag
days=dage
defaultBanReason=Banhammeren har talt!
@@ -167,9 +170,9 @@ lightningUse=\u00a77Kaster lyn efter {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Der er \u00a7c{0}\u00a79 ud af maksimum\u00a7c{1}\u00a79 spillere online.
listAmountHidden = \u00a79Der er \u00a7c{0}\u00a77/{1}\u00a79 ud af maksimum \u00a7c{2}\u00a79 spillere online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Kunne ikke l\u00c3\u00a6se warp {0}
loadinfo=Loadede {0} build {1} af {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cFor at markere din flaskepost som l\u00e6st, skriv /mail clear
mailCleared=\u00a77Flaskepot ryddet!
@@ -237,6 +240,7 @@ notRecommendedBukkit=* ! * Bukkit version er ikke den anbefalede build til Essen
notSupportedYet=Ikke underst\u00f8ttet endnu.
nothingInHand = \u00a7cDu har intet i din h\u00c3\u00a5nd.
now=nu
nuke=May death rain upon them
numberRequired=Et nummer skal v\u00e6re, din tardo.
onlyDayNight=/time underst\u00f8tter kun day/night.
onlyPlayers=Kun in-game spillere kan bruge {0}.
@@ -291,13 +295,15 @@ requestAcceptedFrom=\u00a77{0} accepterede din anmodning om teleport.
requestDenied=\u00a77Anmodning om teleport afvist.
requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport.
requestSent=\u00a77Anmodning sendt til {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=sekund
seconds=sekunder
seenOffline=Spilleren {0} har v\u00c3\u00a6ret offline i {1}
seenOnline=Spilleren {0} har v\u00c3\u00a6ret online i {1}
serverFull=Serveren er sgu fuld. Den b\u00c3\u00b8r melde sig til AA.
serverTotal=Server Total: {0}
setSpawner=\u00c3\u0086ndrede spawner type til {0}
sheepMalformedColor=Forkert farve. (Korrekt oversat?)
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -314,7 +320,7 @@ suicideMessage=\u00a77Farvel grusomme verden...
suicideSuccess= \u00a77{0} tog sit eget liv
survival=survival
takenFromAccount=\u00a7c{0} er blevet taget fra din konto.
takenFromOthersAccount=\u00a7c{0} er blevet taget fra {1}''s konto.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Anmodning om teleport er sendt til alle spillere.
teleportAll=\u00a77Teleporterer alle spillere...
teleportAtoB=\u00a77{0}\u00a77 teleporterede dig til {1}\u00a77.
@@ -322,6 +328,7 @@ teleportDisabled={0} har ikke teleportation aktiveret.
teleportHereRequest=\u00a7c{0}\u00a7c har anmodet om, at du teleporterer dig til ham/hende.
teleportNewPlayerError=Fejlede ved teleportering af ny spiller
teleportRequest=\u00a7c{0}\u00a7c har anmodet om at teleportere til dig.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleporterer til toppen.
teleportationCommencing=\u00a77Teleport begynder...
teleportationDisabled=\u00a77Teleport deaktiveret.
@@ -402,5 +409,3 @@ year=\u00e5r
years=\u00e5r
youAreHealed=\u00a77Du er blevet healed. Halleluja!
youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
+12 -7
View File
@@ -4,7 +4,7 @@
# by:
action=* {0} {1}
addedToAccount=\u00a7a{0} wurden zu deiner Geldb\u00f6rse hinzugef\u00fcgt.
addedToOthersAccount=\u00a7a{0} wurden zu {1}s Konto hinzugef\u00fcgt.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=zerst\u00f6rt:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} bei: {3}
alertPlaced=platziert:
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Kehre zur letzten Position zur\u00fcck.
backupFinished=Backup beendet
backupStarted=Backup gestartet
balance=\u00a77Geldb\u00f6rse: {0}
balanceTop=\u00a77 Top Guthaben ({0})
balanceTop=\u00a77Top Guthaben ({0})
banExempt=\u00a7cDu kannst diesen Spieler nicht sperren.
banIpAddress=\u00a77IP-Adresse gesperrt.
bannedIpsFileError=Fehler beim Lesen von banned-ips.txt
@@ -33,6 +33,8 @@ canTalkAgain=\u00a77Du kannst wieder sprechen.
cantFindGeoIpDB=Kann GeoIP-Datenbank nicht finden!
cantReadGeoIpDB=Fehler beim Einlesen der GeoIP-Datenbank!
cantSpawnItem=\u00a7cDu darfst {0} nicht erzeugen.
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Befehl {0} scheiterte:
commandHelpFailedForPlugin=Fehler beim Abrufen der Hilfe f\u00fcr: {0}
commandNotLoaded=\u00a7cBefehl {0} ist nicht richtig geladen.
@@ -47,6 +49,7 @@ couldNotFindTemplate=Vorlage {0} konnte nicht gefunden werden.
creatingConfigFromTemplate=Erstelle Konfiguration aus Vorlage: {0}
creatingEmptyConfig=Erstelle leere Konfiguration: {0}
creative=creative
currency={0}{1}
day=Tag
days=Tage
defaultBanReason=Der Bann-Hammer hat gesprochen!
@@ -167,9 +170,9 @@ lightningUse=\u00a77Peinige {0}
listAfkTag = \u00a77[Inaktiv]\u00a7f
listAmount = \u00a79Es sind \u00a7c{0}\u00a79 von maximal \u00a7c{1}\u00a79 Spielern online.
listAmountHidden = \u00a79Es sind \u00a7c{0}\u00a77/{1}\u00a79 von maximal \u00a7c{2}\u00a79 Spielern online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[Versteckt]\u00a7f
loadWarpError=Fehler beim Laden von Warp-Punkt {0}
loadinfo=Plugin {0} Version {1} geladen, erstellt von {2}, \u00fcbersetzt von snowleo
localFormat=Lokal: <{0}> {1}
mailClear=\u00a7cUm deine Nachrichten zu l\u00f6schen, schreibe /mail clear
mailCleared=\u00a77Nachrichten gel\u00f6scht!
@@ -237,6 +240,7 @@ notRecommendedBukkit=* ! * Die verwendete Bukkit-Version ist nicht f\u00fcr Esse
notSupportedYet=Noch nicht verf\u00fcgbar.
nothingInHand = \u00a7cYou have nothing in your hand.
now=jetzt
nuke=May death rain upon them
numberRequired=Ein Zahl wird ben\u00f6tigt.
onlyDayNight=/time unterst\u00fctzt nur day und night.
onlyPlayers=Nur Spieler k\u00f6nnen {0} benutzen.
@@ -291,13 +295,15 @@ requestAcceptedFrom=\u00a77{0} hat deine Teleportierungsanfrage angenommen.
requestDenied=\u00a77Teleportierungsanfrage verweigert.
requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt.
requestSent=\u00a77Anfrage gesendet an {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=Sekunde
seconds=Sekunden
seenOffline=Spieler {0} ist offline seit {1}
seenOnline=Spieler {0} ist online seit {1}
serverFull=Server ist voll
serverTotal=Server Total: {0}
setSpawner=\u00c4ndere Mob-Spawner zu {0}
sheepMalformedColor=Ung\u00fcltige Farbe.
shoutFormat=\u00a77[Schrei]\u00a7f {0}
@@ -314,7 +320,7 @@ suicideMessage=\u00a77Lebewohl grausame Welt...
suicideSuccess= \u00a77{0} hat sich das Leben genommen.
survival=survival
takenFromAccount=\u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen.
takenFromOthersAccount=\u00a7c{0} wurde von {1} wurde Rechnung getragen.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Teleportierungsanfrage zu allen Spielern gesendet...
teleportAll=\u00a77Teleportiere alle Spieler...
teleportAtoB=\u00a77{0}\u00a77 teleportiert dich zu {1}\u00a77.
@@ -322,6 +328,7 @@ teleportDisabled={0} verweigert die Teleportierung.
teleportHereRequest=\u00a7c{0}\u00a7c fragt, ob du dich zu ihm teleportierst.
teleportNewPlayerError=Fehler beim Teleportieren eines neuen Spielers
teleportRequest=\u00a7c{0}\u00a7c fragt, ob er sich zu dir teleportieren darf.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleportiere nach oben.
teleportationCommencing=\u00a77Teleportierung gestartet...
teleportationDisabled=\u00a77Teleportierung deaktiviert.
@@ -402,5 +409,3 @@ year=Jahr
years=Jahre
youAreHealed=\u00a77Du wurdest geheilt.
youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
Loaded 100 of 195 files, more files were not shown because too many files have changed in this diff. Show more