1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-09-08 13:40:45 +02:00

Compare commits

...

1289 Commits

Author SHA1 Message Date
KHobbits
d522a4230f Make /god and /god <player> behave the same. 2013-02-09 19:31:31 +00:00
Chris Ward
f17485b112 Merge remote-tracking branch 'origin/groupmanager' into 2.9 2013-02-09 21:55:20 +11:00
ElgarL
1f932434c2 Fix bad Git Merge 2013-02-09 10:51:16 +00:00
Chris Ward
92b0178ca7 Merge pull request #312 from necrodoom/patch-44
update kit link to the new one
2013-02-09 02:48:48 -08:00
Necrodoom
d30c3ca2a6 update kit link to the new one 2013-02-09 12:47:36 +02:00
Chris Ward
fb60272439 Merge pull request #311 from necrodoom/patch-43
fix itemmeta link on kit section
2013-02-09 02:41:01 -08:00
Necrodoom
80ad075f02 fix itemmeta link on kit section 2013-02-09 11:57:32 +02:00
snowleo
3f31dc179b Fix /seen command 2013-02-08 22:26:21 +01:00
snowleo
5b975672e8 Don't overwrite last location on logout
Logout position is saved as logoutlocation now in users yml
2013-02-08 21:22:35 +01:00
snowleo
335d8b7f20 Check if player is still online 2013-02-08 21:18:00 +01:00
snowleo
379e75f3e6 Fix async access to bukkit code 2013-02-08 21:16:21 +01:00
Chris Ward
2ca171a3f4 Merge pull request #304 from necrodoom/patch-40
pull messages.properties changes to messages_en
2013-02-06 22:54:27 -08:00
Necrodoom
8036cc9924 pull messages.properties changes to messages_en 2013-02-06 16:15:18 +02:00
Chris Ward
6442e793a9 Merge pull request #300 from necrodoom/patch-39
add missing puncuation
2013-02-06 02:49:04 -08:00
KHobbits
d745b866c0 Don't block food recovery in god mode. 2013-02-05 23:34:08 +00:00
KHobbits
4493d7d00c Merge pull request #302 from GunfighterJ/patch-9
Prevents flying from being disabled on world teleport if player has esse...
2013-02-05 12:07:36 -08:00
GunfighterJ
631692d763 Prevents flying from being disabled on world teleport if player has essentials.fly 2013-02-05 13:16:27 -06:00
Necrodoom
d0e3c1d946 fix a few errors 2013-02-05 16:45:30 +02:00
Necrodoom
82137e0703 add missing puncuation
probably needs extra reading though before pulling.
2013-02-05 13:57:27 +02:00
KHobbits
a3b2ffdeef Merge pull request #297 from necrodoom/patch-36
fix typo at ID 22
2013-02-05 03:26:19 -08:00
Necrodoom
46fc6c192c fix typo at ID 22 2013-02-05 13:11:36 +02:00
ElgarL
6506c290c8 Revert Necro's change to mancheckw 2013-02-04 13:44:58 +00:00
ElgarL
b1bc73f938 Fix Necrodooms errors for not using an IDE!!!!! 2013-02-04 13:33:06 +00:00
ElgarL
09851acd1b Merge pull request #291 from necrodoom/patch-32
display name instead of path for /mancheckw
2013-02-04 05:29:10 -08:00
ElgarL
df42c9051b Merge pull request #290 from necrodoom/patch-30
Derp - revert incorrect modified line
2013-02-04 05:25:10 -08:00
KHobbits
24c93c11c0 Stylize 'bed' in /home list 2013-02-03 17:30:14 +00:00
Chris Ward
5a13e9bbe5 Merge pull request #294 from necrodoom/patch-35
add common cat type name aliases
2013-02-03 05:16:17 -08:00
Necrodoom
05f337c63c add common cat type name aliases 2013-02-03 15:13:36 +02:00
KHobbits
eea0c9682c We don't need move events if afk interact is disabled. 2013-02-03 05:15:25 +00:00
KHobbits
2f567812d2 Merge pull request #292 from GunfighterJ/2.9
Adds toggle to disable AFK cancel on interactions
2013-02-02 21:11:43 -08:00
GunfighterJ
88c1b785af Adds toggle to disable AFK cancel on interactions 2013-02-02 23:06:09 -06:00
KHobbits
5225fb22f8 Minor comment updates. 2013-02-03 04:14:23 +00:00
Necrodoom
fae5780e09 Update EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java 2013-02-01 16:39:18 +02:00
Necrodoom
7ec65bf213 Update EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java 2013-02-01 16:33:55 +02:00
Necrodoom
d40484d016 Update EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java 2013-02-01 16:33:37 +02:00
Necrodoom
971902ae38 Update EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java 2013-02-01 16:31:58 +02:00
Necrodoom
844be04d75 Derp - revert incorrect modified line 2013-02-01 14:14:46 +02:00
KHobbits
ef01332114 Fix missing 'bed' from home list. 2013-02-01 05:26:17 +00:00
KHobbits
705b193450 Let Bukkit decide if a bedspawn is valid or not.
Bukkit's bed fix forces minimum bukkit change.
2013-02-01 02:59:40 +00:00
KHobbits
20b9111495 [GM] Catch all of the null. 2013-02-01 02:52:41 +00:00
KHobbits
1661eddc02 Make gm API lookup respect offlineperms toggle properly. 2013-02-01 00:01:57 +00:00
KHobbits
15be319d3e Updating groups example 2013-01-31 21:02:38 +00:00
KHobbits
fddbd7a52a Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9
Conflicts:
	EssentialsGroupManager/src/Changelog.txt
2013-01-31 20:38:36 +00:00
Iaccidentally
360e3e8801 cleanup :: fix build 2013-01-31 14:40:33 -05:00
Iaccidentally
4edc39360a Refactor name of ScheduleAsyncDelayedTask to RunTaskAsynchronously 2013-01-31 14:16:09 -05:00
Iaccidentally
cd126264e0 Update to 1.4.7 R1 :: remove calls to ScheduleAsyncDelayedTask, as it is deprecated :: cleanup :: WARNING: This commit may or may not be stable 2013-01-31 14:03:27 -05:00
ElgarL
df0ccb5832 Fix Necrodooms broken code. 2013-01-30 19:55:38 +00:00
ElgarL
8afcd41ab2 Merge pull request #288 from necrodoom/patch-29
config option to allow GM commands in commandblocks
2013-01-30 11:45:27 -08:00
Necrodoom
b8a71761ec update changelog 2013-01-30 19:26:46 +02:00
Necrodoom
738ded7ae5 update commandblock usage deny message 2013-01-30 19:25:35 +02:00
Necrodoom
5535435215 update config description of allow_commmandblocks 2013-01-30 19:14:57 +02:00
Necrodoom
4167dd2590 add allow commandblock check 2013-01-30 18:53:40 +02:00
Necrodoom
623ff0f629 register new config setting 2013-01-30 18:47:19 +02:00
Necrodoom
6e4ba4302f update config.yml to include commandblock change 2013-01-30 18:15:58 +02:00
KHobbits
3d4d616414 What is less than less than one. 2013-01-29 23:59:31 +00:00
KHobbits
d6c91d2d04 Might as well make it all safe. 2013-01-29 23:51:42 +00:00
snowleo
cef8cf7b75 Don't run calls against bucket api in async login thread 2013-01-30 00:26:50 +01:00
snowleo
12786a260e Update /sell command to newer bukkit api 2013-01-29 20:29:03 +01:00
ElgarL
6ea956b11c Doh, actually find what world we want to check properly with mancheckw. 2013-01-29 16:56:03 +00:00
ElgarL
132aa0cc1d Update plugin.yml with the new command 2013-01-29 16:45:23 +00:00
ElgarL
b5733d6597 grammaaahhhh!!! 2013-01-29 16:35:15 +00:00
ElgarL
7fc4a75d4d Added '/mancheckw <world>' to inspect what permission files a world is
referencing.
2013-01-29 16:33:20 +00:00
ElgarL
e9e9efd2d7 Missed an S 2013-01-29 16:15:45 +00:00
ElgarL
9e4493fbb4 Prevent '*' permissions granting the 'groupmanager.noofflineperm'
permission.
2013-01-29 16:14:24 +00:00
ementalo
a64cb31211 Revert "Merge pull request #286 from GunfighterJ/2.9"
This reverts commit 57de3f3ed2, reversing
changes made to 76d1ea5cab.
2013-01-29 10:25:01 +00:00
Iaccidentally
57de3f3ed2 Merge pull request #286 from GunfighterJ/2.9
Ignore itemmeta on selling
2013-01-28 21:13:41 -08:00
GunfighterJ
74b63a6f2d Ignore itemmeta on sell 2013-01-28 23:11:43 -06:00
ElgarL
faad91849d Add support for BukkitForge using 'overworld' as the main world name. 2013-01-28 04:13:16 +00:00
GunfighterJ
ce7d83adb6 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-27 14:20:59 -06:00
KHobbits
76d1ea5cab Minor /ci tweak. 2013-01-27 17:22:43 +00:00
KHobbits
9fb42375b8 Cleanup /ci addition. 2013-01-27 17:10:07 +00:00
GunfighterJ
2a7f3c6525 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-27 10:44:13 -06:00
KHobbits
c65353350f Merge pull request #278 from GunfighterJ/2.9
Adds vanilla syntax for /clearinventory
2013-01-27 08:40:39 -08:00
KHobbits
1ae58d05b4 Fix vanish status when switching worlds.
This fixes the potion effect being cleared on world change.
2013-01-27 16:39:50 +00:00
KHobbits
4f35a72174 Add command syntax comment, for clarification.
Merge branch '2.9' of github.com:essentials/Essentials into 2.9
2013-01-27 15:26:46 +00:00
KHobbits
addd55228b Don't try and charge a user if we don't have the chat data stored. 2013-01-27 15:26:42 +00:00
Iaccidentally
bb29d48268 Make heal remove fire from players. 2013-01-26 17:16:48 -05:00
Iaccidentally
d9ee9b036c Update heal to account for the fact that 20 is not always the max health 2013-01-26 17:12:17 -05:00
GunfighterJ
95e630de92 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-24 21:16:13 -06:00
KHobbits
2836c0862d Revert "Prevent replacement of { and } characters in chat.format"
This reverts commit 8fde5102b9.
2013-01-25 03:12:13 +00:00
KHobbits
286091cd32 Try command fallback 2013-01-25 03:06:53 +00:00
KHobbits
20786654a4 Merge pull request #284 from phrstbrn/chat-braces-fix
Prevent replacement of { and } characters in chat.format
2013-01-24 08:53:32 -08:00
Zak Ford
8fde5102b9 Prevent replacement of { and } characters in chat.format 2013-01-24 11:43:10 -05:00
GunfighterJ
133fdac343 Update /ci to support vanilla syntax 2013-01-23 16:47:21 -06:00
Chris Ward
2361b9e724 Add debug option to XMPP 2013-01-23 19:41:36 +11:00
Chris Ward
972d831d0d Remove references to earth2me in plugin.ymls 2013-01-23 02:56:18 +11:00
Chris Ward
bfa34130a0 Merge pull request #280 from necrodoom/patch-28
update documation reference in config.yml
2013-01-22 00:13:07 -08:00
Necrodoom
befe1fb39e Update Essentials/src/config.yml 2013-01-22 09:54:48 +02:00
KHobbits
378eaaaf1f Small patch to allow multiple firework effects to be defined in kits. 2013-01-21 23:38:03 +00:00
KHobbits
51a55318d0 Revert /gc change.
Simplify firework syntax, and add help
Merge branch 'patch-26' of git://github.com/necrodoom/Essentials into 2.9
2013-01-21 20:07:02 +00:00
KHobbits
4663c89dd6 Merge pull request #276 from necrodoom/patch-26
Update Essentials/src/plugin.yml
2013-01-21 06:41:32 -08:00
Necrodoom
2a1c3fb8e0 Update Essentials/src/plugin.yml 2013-01-21 16:40:45 +02:00
Necrodoom
0ac1a90b93 Update Essentials/src/messages_en.properties 2013-01-21 16:37:12 +02:00
Necrodoom
ab6b3bff90 fix message 2013-01-21 16:35:40 +02:00
Necrodoom
2d00fd0c1e try make error message more informative 2013-01-21 16:32:49 +02:00
Necrodoom
e5f4cb9a4d Update Essentials/src/plugin.yml 2013-01-21 16:29:26 +02:00
KHobbits
91701e8c2f Allow negative exp to be given 2013-01-21 14:15:53 +00:00
KHobbits
9cef107bc3 Fix a couple of param issues. 2013-01-21 13:40:45 +00:00
KHobbits
76fd829e8c Merge pull request #275 from DMarby/patch-1
Update Essentials/src/messages_se.properties
2013-01-20 15:31:34 -08:00
David Marby
6ea422015c Update Essentials/src/messages_se.properties 2013-01-21 00:26:38 +01:00
KHobbits
443a317184 Show afk warning when pm'ing afk players.
Fix vanished leak on player matching.
2013-01-20 22:05:44 +00:00
KHobbits
50dca9abf5 Add optional 2nd arg to broadcast format. 2013-01-20 20:58:05 +00:00
KHobbits
f1e3d48248 Fix book meta error message. 2013-01-20 20:41:15 +00:00
KHobbits
63ce4a99b9 Trim long /gc output, add /gc all 2013-01-20 20:35:41 +00:00
KHobbits
1ccda52e9f Fix minor /book bug (Null author) 2013-01-20 20:06:27 +00:00
KHobbits
1679790157 Fix eco take derp. 2013-01-20 19:43:59 +00:00
KHobbits
6170540a24 Fix colour syntax message on coloured leather. 2013-01-20 01:44:03 +00:00
KHobbits
987b2ff4d5 Minor cleanup on /eco command. 2013-01-20 01:24:09 +00:00
KHobbits
23a15cb11a Merge pull request #274 from GunfighterJ/2.9
Cleanup /eco, fix reset broadcast
2013-01-19 17:12:07 -08:00
KHobbits
41547e3243 Cleanup /exp command, and fix vanilla syntax issues.
Needs double checking with commandblocks with vanilla syntax.
2013-01-20 01:10:41 +00:00
GunfighterJ
a586edfd0b Cleanup /eco, fix reset broadcast 2013-01-19 17:58:12 -06:00
KHobbits
762bb65677 Add example firework kit, and cleanup debug messages. 2013-01-19 23:43:40 +00:00
KHobbits
73c92bf742 Move firework meta handling into MetaItemStack
Allow firework meta to be applied to item spawning and kit commands.
2013-01-19 23:35:59 +00:00
ElgarL
2b8435342d Negate 'groupmanager.noofflineperms' by default in the owner group. 2013-01-19 22:22:42 +00:00
KHobbits
9566499a2f Merge pull request #272 from GunfighterJ/2.9
/eco overhaul, adds /eco set
2013-01-19 10:54:11 -08:00
GunfighterJ
343c3a1bdd /eco overhaul, adds /eco set 2013-01-19 12:50:35 -06:00
KHobbits
9aeb49f6c3 Reduce chance of self repeating powertool actions. 2013-01-19 15:19:39 +00:00
Chris Ward
7dae04759f Merge pull request #271 from necrodoom/patch-25
update /book description
2013-01-19 06:21:47 -08:00
Necrodoom
e2f6e5a7fd update /book description 2013-01-19 16:16:35 +02:00
ElgarL
d26fa6c5b8 Negate 'groupmanager.noofflineperms' by default in the owner group. 2013-01-19 12:40:40 +00:00
Chris Ward
82f9505a2e Touch of cleanup to Gunfighter's addition to exp 2013-01-19 18:22:22 +11:00
GunfighterJ
f8ce80c18a Adds vanilla syntax to /exp command 2013-01-18 18:20:05 -06:00
Alexander Schepp
313fd30ce9 Fix bug with empty motd 2013-01-18 23:36:59 +01:00
Iaccidentally
da216b05d9 Merge pull request #266 from GunfighterJ/2.9
Duplicate alias removed
2013-01-17 17:30:04 -08:00
GunfighterJ
d8132548f6 Duplicate alias removed 2013-01-17 19:27:21 -06:00
snowleo
6fdeddd96b Merge remote-tracking branch 'origin/groupmanager' into 2.9 2013-01-18 01:01:23 +01:00
Iaccidentally
8082508db9 Merge pull request #265 from GunfighterJ/2.9
Adds essentials.mute.notify
2013-01-17 15:53:37 -08:00
GunfighterJ
78e6da9504 Adds essentials.mute.notify 2013-01-17 17:42:32 -06:00
Iaccidentally
0014d5cfcb Merge pull request #263 from GunfighterJ/2.9
Added /firework command
2013-01-17 14:59:01 -08:00
Iaccidentally
6aeba173b9 Update libs 2013-01-17 14:36:03 -05:00
Iaccidentally
a2813358af Update Bukkit to 1.4.7-R0.1 2013-01-17 14:25:19 -05:00
GunfighterJ
8e663b53ce Now it adds the right firework command 2013-01-16 20:40:29 -06:00
GunfighterJ
214d9414da Adds the actual /firework command 2013-01-16 20:39:09 -06:00
GunfighterJ
6d7881f876 Added /firework command 2013-01-16 20:36:33 -06:00
Iaccidentally
19ccdf2193 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-16 21:23:17 -05:00
KHobbits
35036ecc18 Fix null args on /book 2013-01-16 16:56:27 +00:00
KHobbits
b3cc4dbe09 Remove logger. 2013-01-16 16:30:30 +00:00
KHobbits
04bd9e8baf Remove broken firework meta. 2013-01-15 00:37:08 +00:00
KHobbits
fdc262a205 Start work on firework effect - syntax in flux 2013-01-14 23:11:19 +00:00
Iaccidentally
32ea86bfd3 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-14 17:25:32 -05:00
KHobbits
4807fb39e5 Couple of extra /helpop aliases. 2013-01-14 21:40:25 +00:00
KHobbits
4ffe61a505 Add colour support to item meta. 2013-01-14 21:34:35 +00:00
KHobbits
d74952927a Only show ban reason in the in-game display, not full banFormat. 2013-01-14 11:59:31 +00:00
KHobbits
f8cf3be87f Better handle initial book.txt creation. 2013-01-14 08:21:03 +00:00
KHobbits
ada266a0f9 Switch book meta, to use 'book.txt', and 'book:<section>'.
Should make things clearer and easier to understand.
2013-01-14 08:14:42 +00:00
KHobbits
115c4fa1d0 Merge remote-tracking branch 'remotes/origin/groupmanager' into 2.9 2013-01-14 07:37:11 +00:00
KHobbits
0c19b2feed All the better to kick you with
(Pipe format for linebreak)
2013-01-14 07:36:45 +00:00
ElgarL
04c833f648 Fix recursive loop when used on offline servers. 2013-01-14 06:47:50 +00:00
ElgarL
4533d09fc9 Update GlobalGroups (removing old permissions) as Towny handles it's own
perms now.
2013-01-14 05:48:48 +00:00
KHobbits
7337b86a16 Cleanup /book command. 2013-01-13 23:11:15 +00:00
Iaccidentally
3db015b1c1 Merge pull request #260 from GunfighterJ/patch-3
Fixes /top command not carrying pitch and yaw
2013-01-13 15:09:05 -08:00
GunfighterJ
659d602b57 Fixes /top command not carrying pitch and yaw 2013-01-13 17:02:46 -06:00
KHobbits
f82d7e806f Merge pull request #259 from GunfighterJ/patch-2
Added more book commands for editing author and title
2013-01-13 14:57:35 -08:00
GunfighterJ
a8088fb8c8 Merge branch 'patch-2' of https://github.com/GunfighterJ/Essentials into patch-2
Conflicts:
	Essentials/src/com/earth2me/essentials/commands/Commandbook.java
2013-01-13 16:31:29 -06:00
GunfighterJ
84c06fb746 Added more book arguments for editing author and title amend 2013-01-13 16:19:37 -06:00
KHobbits
ffe2a283d2 Cleanup of book meta. 2013-01-13 22:18:08 +00:00
GunfighterJ
7e3fd48956 Added more book commands for editing author and title 2013-01-13 15:54:11 -06:00
KHobbits
bd22aec38a Adding support for books made from /einfo 2013-01-13 21:08:24 +00:00
ElgarL
675c4b7897 typo in changelog. 2013-01-13 16:40:53 +00:00
ElgarL
ad7009c77e Do not grant any permissions (nort update Bukkit) if the server is in
offline mode and the player has the permission node
'groupmanager.noofflineperms'.
2013-01-13 16:39:53 +00:00
KHobbits
3f783bb43b Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2013-01-13 16:30:43 +00:00
KHobbits
9fe7712bd6 Clean up TextPager 2013-01-13 16:30:22 +00:00
ElgarL
24f56892ad Fix the logger so errors are reported again. 2013-01-13 16:20:38 +00:00
ElgarL
b860e943f6 Synchronize pushing to Bukkit perms to prevent any
ConcurrentModificationException.
2013-01-13 16:20:09 +00:00
Chris Ward
5dc2665377 Merge pull request #258 from necrodoom/patch-22
update ID 397:3
2013-01-13 05:03:05 -08:00
Necrodoom
dd9b7e0d3c update ID 397:3 2013-01-13 15:01:10 +02:00
KHobbits
18a15ca63c Add provisional support for basic item Meta
Adds /book command to allow reediting of signed books.
2013-01-13 04:44:28 +00:00
KHobbits
ef1492a2a2 Clean up userdata saving, to prevent CMI
Also update config section code to use newer bukkit methods
2013-01-12 19:30:06 +00:00
KHobbits
298ab846c1 Don't extend ItemStack 2013-01-12 17:05:05 +00:00
KHobbits
7fdb2ad7d3 Pull item meta from itemdb class 2013-01-12 14:12:12 +00:00
Iaccidentally
3afe8d18f4 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-11 12:56:18 -05:00
Iaccidentally
0b581580c7 Merge pull request #251 from necrodoom/patch-19
/me shakes fist at Khobbits
2013-01-11 09:17:44 -08:00
Necrodoom
01e78cd666 /me shakes fist at Khobbits
fixes e6aeefb12d whitespace
2013-01-11 19:10:32 +02:00
Chris Ward
29d28456aa Merge remote-tracking branch 'origin/groupmanager' into 2.9 2013-01-11 21:59:39 +11:00
Chris Ward
f3812786d0 Fixes Item Frames being linked to Paintings when breaking 2013-01-11 21:54:52 +11:00
ElgarL
999d922fb9 Store a plugin and server reference. 2013-01-11 00:53:48 +00:00
KHobbits
2d4a07b95b New permission: essentials.sethome.bed
Players with this permission will force a bed home updating if daytime beds are enabled.
2013-01-10 22:36:38 +00:00
Chris Ward
5c99eee0c0 Implement abstract methods 2013-01-10 22:57:08 +11:00
Chris Ward
1fc502a4ff Update bukkit/craftbukkit libs. Force latest beta version 2013-01-10 22:51:48 +11:00
KHobbits
e73983649f Ban cleanup 2013-01-09 21:31:56 +00:00
KHobbits
465cdae989 Util commenting 2013-01-09 21:18:46 +00:00
KHobbits
341cb89bb7 Multiline kick messages and tempban countdown. 2013-01-09 21:04:58 +00:00
Chris Ward
79004c7098 Merge branch 'groupmanager' into 2.9 2013-01-10 04:57:10 +11:00
Joseph
2988db08ca Formatting 2013-01-10 03:25:58 +11:00
GunfighterJ
b04fa82be2 Add more items to Fireball command. Add delay option to /spawner 2013-01-10 03:25:57 +11:00
Chris Ward
5d210d81dc Merge pull request #247 from necrodoom/patch-18
rewrite ID 43:6, 44:6, 113, 114
2013-01-09 06:50:31 -08:00
Necrodoom
c14b32123f rewrite ID 43:6, 44:6, 113, 114 2013-01-09 16:46:37 +02:00
ElgarL
f256930269 Synchronize the raising of GroupManager events to Bukkit.getServer()
(should prevent deadlocks).
2013-01-09 14:38:00 +00:00
ElgarL
cde95d832e Merge pull request #241 from necrodoom/patch-15
fix typo
2013-01-09 02:50:30 -08:00
ElgarL
b9af4fb35c Remove attachments BEFORE we clear them. 2013-01-09 04:27:10 +00:00
ElgarL
5056210a38 code tidy. 2013-01-09 04:13:40 +00:00
ElgarL
eacb847305 Remove attachments before clearing 2013-01-09 04:04:59 +00:00
ElgarL
27ff43c0ac Clear our attachment map upon a manload so we correctly reconfigure a
players new permissions.
2013-01-09 03:55:26 +00:00
KHobbits
368c33a843 Expand plugin.yml fireball aliases. 2013-01-09 01:00:13 +00:00
KHobbits
c210e8730b Fire a few extra entities from /fireball 2013-01-09 00:58:29 +00:00
KHobbits
6c48e02c14 Add a couple of extra entities to spawnmob 2013-01-09 00:41:24 +00:00
KHobbits
c54d68a660 Cleanup 2013-01-08 23:59:31 +00:00
KHobbits
33d3123104 Pull and clean up book enchant pullreq.
Removed 1 enchant per book limit, anvils seem to handle multiple enchants fine, even if the result can only be one enchant.
2013-01-08 23:51:46 +00:00
Chasing Code
df0b1cedd8 Add missing import for EnchantmentStorageMeta 2013-01-08 11:46:08 -08:00
Chasing Code
2b57381fb8 Store enchanments in Enchanted Books
Change enchant command to store the enchantment instead of applying it when used on an Enchanted Book.  If an enchantment is already present, replace it (only one allowed on Enchanted Books).
2013-01-08 11:37:46 -08:00
oggehej
67b9a82e51 Update Swedish translation with new messages. 2013-01-08 19:45:51 +11:00
Chris Ward
c4e10da646 Store regex, use util method instead of another regex. Store variable 2013-01-08 02:26:09 +11:00
Chris Ward
fbb1c1278c Fix multiple enchantments in kits 2013-01-08 02:25:35 +11:00
Chris Ward
9b49c5e0f4 Merge pull request #242 from necrodoom/patch-17
update ID 127
2013-01-07 07:00:41 -08:00
Necrodoom
186d4e2fd1 update ID 127 2013-01-07 16:52:51 +02:00
Chris Ward
437b01e371 Unnecessary RegEx is unnecessary. 2013-01-08 00:08:11 +11:00
KHobbits
3bf36fecf9 Enchantment and item spawning cleanup
Should make it a little easier to add itemmeta.
2013-01-06 18:28:24 +00:00
KHobbits
c57332be63 Tell user that /mail sendall succeeded when used in console. 2013-01-06 16:27:20 +00:00
Necrodoom
292fb0cea1 fix typo 2013-01-05 19:05:02 +02:00
Necrodoom
3c4388f8be update IDs 368, 381, 399, 402 2013-01-05 19:27:56 +11:00
KHobbits
f930ff48a2 Throw an error if user doesn't have permission to use kit sign. 2013-01-05 07:39:32 +00:00
KHobbits
ef7b940e96 More user feedback on enchant sign. 2013-01-05 07:24:02 +00:00
KHobbits
6497db837d Allow unsafe enchants to be placed by [enchant] signs if enabled in the config file. 2013-01-05 07:05:25 +00:00
KHobbits
87cb6190eb Couple of extra enchant aliases 2013-01-05 06:59:37 +00:00
KHobbits
74c4c604da Merge branch 'release' into 2.9 2013-01-04 21:40:02 +00:00
KHobbits
0937a35470 Fix sign break bug 2013-01-04 13:05:57 +00:00
md_5
121f09caf0 Might be worth catching other occurances of the event too. 2013-01-04 13:53:01 +11:00
md_5
ef8bd3422a ArrayList, I choose you! (Fixes CraftBook erroring when the killall command is used and custom drops are enabled in that plugin) 2013-01-04 13:49:45 +11:00
Alexander Schepp
2232d859fd Fix nl translation 2013-01-03 11:50:19 +01:00
Iaccidentally
0258abee29 Update AntiBuild to use HangingBreakByEntityEvent instead of deprecated PaintingBreakByEntityEvent 2013-01-02 18:25:40 -05:00
Iaccidentally
9b8991788b Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2013-01-02 18:24:34 -05:00
KHobbits
9a91c99391 Merge pull request #236 from gravypod/patch-1
Store ingredient map and recipe shape
2013-01-01 15:20:26 -08:00
KHobbits
c6dd921f0c New permission: essentials.fly.safelogin - Players with this command will automatically switch to fly mode if they login whilst floating in the air. 2013-01-01 22:00:53 +00:00
KHobbits
63e622374d New perm: essentials.vanish.effect - People with this effect will get the potion effect applied while vanished. 2013-01-01 21:12:26 +00:00
KHobbits
ca25c71010 Cleanup cleanup. 2013-01-01 19:48:08 +00:00
KHobbits
b5e559ff66 More cleanup 2013-01-01 19:34:32 +00:00
KHobbits
555bb76428 Cleanup 2013-01-01 18:39:23 +00:00
ElgarL
f210f8e20b Merge pull request #235 from necrodoom/patch-10
fix isOpOverride checks
2012-12-31 07:59:27 -08:00
gravypod
e572e7c94c Store ingredient map and recipe shape 2012-12-31 10:44:28 -05:00
Chris Ward
5c9d3c6b1a Fix recipe NPE/failed display in game 2013-01-01 02:26:04 +11:00
Necrodoom
ccfc23d629 fix isOpOverride checks 2012-12-31 15:35:58 +02:00
KHobbits
b5dd0fc671 Don't unregister all listeners. 2012-12-31 12:15:51 +00:00
KHobbits
8e3ee8576e Unregister unused events. 2012-12-31 05:44:20 +00:00
KHobbits
4cec7fe5c1 Use bukkit api for chat user list 2012-12-31 05:43:05 +00:00
KHobbits
6c3b2076ff Allow unbanning players who do not have valid userdata 2012-12-31 01:08:39 +00:00
KHobbits
cbc1aeacbe Implement event toggle. 2012-12-30 04:32:43 +00:00
KHobbits
a1b2773bf5 Reorganize entity listener 2012-12-30 03:32:32 +00:00
Alexander Schepp
9ecb501e00 Use the right formatter in XMPP 2012-12-30 00:23:04 +01:00
KHobbits
3dcdad2233 Hide a few more duplicate enchantments from /enchant 2012-12-29 09:00:42 +00:00
KHobbits
3725a5e6d4 Set default tpa timeout to 2 minutes. 2012-12-29 08:40:03 +00:00
KHobbits
ed88f8aa06 Allow unsafe enchantments in /item /give /kit and /enchant
Needs enabled in config file manually.
2012-12-29 08:36:24 +00:00
KHobbits
d551e8c6d2 Make /enchant only show valid enchantments for the item. 2012-12-29 07:58:28 +00:00
KHobbits
69ad186839 Add aliases for new thorns enchantment. 2012-12-29 07:47:07 +00:00
KHobbits
fc89867e4a Ignore self damage in teleport entity protection. 2012-12-29 07:35:26 +00:00
KHobbits
bbb478c51f Lets clean up the recipe window on player quit, just in case. 2012-12-29 06:55:48 +00:00
KHobbits
03445e5b9b Fix home functionality bugs:
/home not using bed when enabled
/home not giving teleport warning
2012-12-29 06:43:26 +00:00
KHobbits
0755fbf089 Update bukkit to 1.4.6-R0.1
bukkit: 1652 cb: 2561
2012-12-29 06:37:52 +00:00
KHobbits
3a789bdcfe Fix string match error on none existing user (/ban). 2012-12-29 02:00:48 +00:00
Chris Ward
93db8bc7c1 Add SimplyPerms to classpath 2012-12-29 11:26:44 +11:00
Xefir
62832ad43a Added SimplyPerms Handler 2012-12-29 10:41:15 +11:00
Alexander Schepp
52b104aca5 Merge pull request #229 from necrodoom/patch-9
fix tempban permission check
2012-12-28 09:37:40 -08:00
Necrodoom
1f98fe710f derp - fix tempban permission check 2012-12-28 19:05:54 +02:00
ElgarL
a73986a358 Fix missing + from Necrodoom's pull request. 2012-12-28 13:46:22 +00:00
ElgarL
257165584e Merge pull request #228 from necrodoom/patch-8
Update EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManage...
2012-12-28 05:43:54 -08:00
Iaccidentally
8e92150cb7 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2012-12-26 09:48:38 -05:00
Chris Ward
4bb275e1b7 Revert 6b18259af6 - Adding permission node to speak, with config option to enable the node 2012-12-27 01:41:32 +11:00
Chris Ward
e5fc579071 Add tpdeny message to /tpahere 2012-12-27 01:10:57 +11:00
Iaccidentally
26306f6fa3 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2012-12-25 18:12:42 -05:00
Necrodoom
0bfb079cbb Update EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java 2012-12-25 18:11:10 +02:00
Chris Ward
6b18259af6 Adding permission node to speak, with config option to enable the node 2012-12-24 01:55:53 +11:00
Chris Ward
99c750d18b Move max-tempban-time in config 2012-12-24 01:04:02 +11:00
Chris Ward
bb64fa468a Fixing IUser 2012-12-23 21:29:26 +11:00
Chris Ward
66db3c6cfb Adding isAfk and setAfk to IUser API 2012-12-23 21:25:29 +11:00
KHobbits
c97763c3c8 Make seen status's only show when true. 2012-12-22 03:36:56 +00:00
Chris Ward
ad3e8a3aba Merge pull request #215 from necrodoom/patch-5
update items.csv to minecraft 1.4.6
2012-12-21 04:33:14 -08:00
KHobbits
617959a11b Log target plugin in debug mode for altcmd 2012-12-21 06:38:51 +00:00
KHobbits
a480091617 Final all the things - Recipe 2012-12-21 03:48:54 +00:00
KHobbits
13a847e0ab Fix recipe layout for small shapes 2012-12-21 03:35:48 +00:00
KHobbits
a8a8b52977 Swap method order on recipe 2012-12-21 03:21:35 +00:00
KHobbits
226a75472c Adjust section matching. 2012-12-20 23:37:37 +00:00
KHobbits
a1c88a140e Merge pull request #227 from Elvaron/2.9
FallBack for missing config property
2012-12-20 15:36:01 -08:00
Elvaron
2c3218b056 FallBack for missing config property 2012-12-21 00:16:18 +01:00
KHobbits
27db9e8c3b Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-12-20 22:58:00 +00:00
KHobbits
cf0e36c973 Add support for whitelisting commands in /help by permission: essentials.help.<plugin>.<command> 2012-12-20 22:57:38 +00:00
KHobbits
1218a0b217 Reduce permissions checking when generating /help 2012-12-20 22:54:36 +00:00
KHobbits
adb75b69c2 Allow certain commands while in jail, but only if the user normally has access to that command. 2012-12-20 22:53:52 +00:00
KHobbits
010df964a1 Merge pull request #226 from Elvaron/2.9
Made socialspy commands list configurable
2012-12-20 14:16:45 -08:00
Elvaron
0e2e8e16af Made socialspy commands list configurable 2012-12-20 23:07:22 +01:00
KHobbits
6f28540d59 Merge branch 'release' of github.com:essentials/Essentials into 2.9 2012-12-20 20:37:42 +00:00
KHobbits
ce78125028 Add a little bit of extra information to /seen, this will show when user is online. 2012-12-20 20:37:04 +00:00
KHobbits
10b972bd07 Warn other party when teleport fails after tpaccept. 2012-12-20 20:24:07 +00:00
KHobbits
371a6437ae Redundant tpaccept cost check. 2012-12-20 20:23:51 +00:00
KHobbits
78666ade2b Fix max tempban length option. 2012-12-20 20:11:45 +00:00
KHobbits
8f00aa5542 Warn other party when teleport fails after tpaccept. 2012-12-20 20:01:43 +00:00
KHobbits
b2d68fe213 Redundant tpaccept cost check. 2012-12-20 19:50:59 +00:00
KHobbits
a6c13974c4 Merge branch 'release' of github.com:essentials/Essentials into 2.9 2012-12-20 17:03:48 +00:00
KHobbits
fb0cd8fbf0 Remove command cost warnings from plugin matching. 2012-12-20 15:51:49 +00:00
Chris Ward
01d1ae442e Fix currency display in MOTD - display currency character, trim decimal places 2012-12-20 15:45:32 +00:00
snowleo
dc13f46ff1 Don't use broken CB methods ... 2012-12-20 15:45:22 +00:00
snowleo
f125ac3b4a Don't use broken CB methods ... 2012-12-20 16:07:40 +01:00
Chris Ward
be29a373ab Useless import 2012-12-20 23:10:38 +11:00
Chris Ward
b28db7e435 Fix currency display in MOTD - display currency character, trim decimal places 2012-12-20 23:07:49 +11:00
md_5
3ac6cc11e3 Fix nagging for overriden commands. 2012-12-20 09:56:30 +01:00
snowleo
9097bef728 Merge branch 'refs/heads/groupmanager' into 2.9 2012-12-20 09:55:26 +01:00
snowleo
68e401821f Fix gm builds
Change craftbukkit.jar -> bukkit,jar
2012-12-20 09:36:35 +01:00
md_5
7f9a52c3f7 Lets leave numeric homes as is for now, looping through all files on server startup is not the place to do this (reverse-merged from commit 79a44b919c) 2012-12-20 17:24:14 +11:00
md_5
79671d08e4 Fix nagging for overriden commands. 2012-12-20 17:11:05 +11:00
Chris Ward
d01d6bcd1b Fix NPE in update (sorry again :P) 2012-12-20 15:45:09 +11:00
Chris Ward
79a44b919c Update home names to prepend "home" to numeric home names 2012-12-20 13:11:05 +11:00
snowleo
477e1a4f58 Force people to use latest CB version 2012-12-20 00:46:03 +01:00
snowleo
c028c385b6 Fix Spawns / Jail loading 2012-12-20 00:46:03 +01:00
snowleo
f9bcc3100c Update Inventory Workaround to the latest version
Still bugged in CB: maxAmount of items
2012-12-20 00:46:03 +01:00
snowleo
3ea3d18922 Force people to use latest CB version 2012-12-19 23:28:18 +01:00
snowleo
3faedec602 Fix Spawns / Jail loading 2012-12-19 23:26:29 +01:00
snowleo
2a88a314ce Update Inventory Workaround to the latest version
Still bugged in CB: maxAmount of items
2012-12-19 22:07:03 +01:00
ElgarL
38293560d7 Update Bukkit to version #2543 (1.4.5-R1.0) To ensure we are all
compatible with current recommended build.
2012-12-19 15:10:37 +00:00
Chris Ward
f57b3595ed Fix recipe command 2012-12-20 01:35:55 +11:00
md_5
e2e6bb3876 Simply using the SnakeYaml default (which in turn defaults to Class.forName) appears to be enough to get the classes for our custom configuration. This avoid Bukkit depreciation. 2012-12-19 12:57:05 +00:00
KHobbits
4e399778b4 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-12-19 12:54:00 +00:00
KHobbits
9ba5f43315 Updating Bukkit to 1.4.5 RB
Bukkit: 1643 CB: 2543
2012-12-19 12:52:05 +00:00
Chris Ward
0bde364125 Merge pull request #223 from chrisgward/patch-1
Add /recipe command
2012-12-19 00:28:27 -08:00
md_5
87f5ec491e Simply using the SnakeYaml default (which in turn defaults to Class.forName) appears to be enough to get the classes for our custom configuration. This avoid Bukkit depreciation. 2012-12-19 19:10:02 +11:00
Chris Ward
1f8a0a811f Add /recipe command 2012-12-19 14:57:12 +11:00
KHobbits
74d5590d3b Remove CB from EssCore libs. 2012-12-18 22:58:55 +00:00
KHobbits
258fbdb0e8 Merge pull request #216 from chrisgward/patch-1
Add tempban limit (with override node)
2012-12-18 02:24:45 -08:00
KHobbits
bd4a48c441 Fix command costs warnings. 2012-12-17 18:32:42 +00:00
KHobbits
00bd6a3e02 Support new skeleton and zombie types.
Also fix baby sheep colours.
2012-12-16 21:39:31 +00:00
KHobbits
28ad7b96d2 Log a few extra metrics. 2012-12-16 21:02:02 +00:00
KHobbits
97204c0e8c Merge pull request #217 from necrodoom/patch-7
add "w" alias
2012-12-16 11:07:10 -08:00
Necrodoom
46645cb39f Update Essentials/src/plugin.yml 2012-12-16 18:05:07 +02:00
Necrodoom
dfd6fc78f0 add "w" alias 2012-12-16 18:03:04 +02:00
Chris Ward
ecf5d47e97 Add tempban limit (with override node) and console override to exempt node. 2012-12-17 02:12:38 +11:00
Alexander Schepp
77df82eaff derp
That's why switch statements are bad.
2012-12-16 13:59:25 +01:00
Alexander Schepp
020f2c3ea5 Fix order of messages 2012-12-16 13:48:02 +01:00
KHobbits
5a855eede5 Update bukkit
Bukkit 1608 CraftBukkit 2488
2012-12-16 12:28:49 +00:00
KHobbits
8b4273cbd1 Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-12-16 12:12:23 +00:00
Necrodoom
30bc597851 update items.csv to minecraft 1.4.6 2012-12-16 12:52:16 +02:00
Alexander Schepp
13efadbb65 Merge pull request #214 from necrodoom/patch-4
change add-prefix-suffix description
2012-12-15 06:17:22 -08:00
snowleo
6bc3d7f0f4 Fix the gap 2012-12-15 14:22:52 +01:00
snowleo
e706614a3b Align /tp syntax with Minecraft /tp command 2012-12-15 14:12:34 +01:00
Necrodoom
cf68031110 change add-prefix-suffic description
hopefully will keep newbies from changing it for no reason
2012-12-15 12:58:57 +02:00
Iaccidentally
5741cea3f5 Merge pull request #210 from Echo4190/patch-1
Update Essentials/src/config.yml
2012-12-11 04:06:10 -08:00
Echo419
7b879331db Update Essentials/src/config.yml
trillions => trillion
english => English
2012-12-11 12:03:21 +00:00
KHobbits
0a27a631e3 Merge pull request #209 from necrodoom/patch-2
update config.yml to reference wiki more
2012-12-10 09:46:31 -08:00
KHobbits
d8c6587532 Add missing import. 2012-12-10 17:45:32 +00:00
KHobbits
d600f160fe Update metrics to r6 2012-12-10 17:43:06 +00:00
KHobbits
d23c324035 Metrics Diff 2012-12-10 17:40:15 +00:00
Necrodoom
52bfeff5b4 update config.yml to reference wiki more
also changed locale setting to be less confusing
2012-12-10 09:39:22 +02:00
KHobbits
3dcb2a828e Delay sending respawn event until we actually try to respawn user. 2012-12-09 17:32:02 +00:00
KHobbits
0b95a691a6 Revert "Bukkit should have fixed this issue, so we can now get a better first join player experience by teleporting them at once with no delay."
This reverts commit f7daa20be8.

This breaks compatibility with multiverse, and Essentials core.
2012-12-09 17:14:57 +00:00
KHobbits
eba2bad113 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-12-09 17:10:31 +00:00
KHobbits
4f21490ec8 Move null bed check to teleport code 2012-12-09 17:10:12 +00:00
md_5
f7daa20be8 Bukkit should have fixed this issue, so we can now get a better first join player experience by teleporting them at once with no delay. 2012-12-09 16:03:00 +11:00
KHobbits
a9ace1163f Shorten local chat format. 2012-12-08 18:51:18 +00:00
KHobbits
ba380e61ee Some nice friendly messages to help debugging command costs. 2012-12-08 15:51:33 +00:00
KHobbits
bbc306970f Throw error when using /more on full stack 2012-12-07 00:46:13 +00:00
KHobbits
7b997634ef Remove unused variable 2012-12-06 23:27:43 +00:00
KHobbits
1efbc3856c Make BPerms sign group checking behave similarly to same as GM and PEX 2012-12-06 23:26:48 +00:00
KHobbits
f769f96f74 Merge pull request #208 from kukelekuuk00/2.9
Added a total profit message for /sell all|blocks
2012-12-05 09:14:07 -08:00
kukelekuuk00
3f69473072 Added a total profit message for /sell all|blocks 2012-12-05 15:40:17 +01:00
KHobbits
d7bcf6508d Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-12-03 09:09:17 +00:00
KHobbits
61c4d8cb5e Update afk status on block interact 2012-12-03 09:08:56 +00:00
Iaccidentally
f7361eed98 Merge pull request #205 from evonuts/patch-1
Spelling/Grammar fixes.
2012-12-01 02:43:20 -08:00
evonuts
deaa72b05d Spelling/Grammar fixes. 2012-12-01 21:51:24 +13:00
Iaccidentally
92bdd51cd4 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2012-11-27 14:54:18 -05:00
snowleo
0ed29c029d Add log color removal.
(This could already be done with the bukkit setting "log-strip-color")
2012-11-27 19:54:32 +01:00
KHobbits
61903355cd Fix kit timers, kit times more than 25 years will be treated as single use. 2012-11-27 18:27:23 +00:00
KHobbits
889f60e58e Userdata cleanup 2012-11-27 17:47:08 +00:00
KHobbits
c4f292f4ef Merge branch 'release' of github.com:essentials/Essentials into 2.9 2012-11-27 15:24:34 +00:00
Iaccidentally
36687e2659 Merge pull request #204 from necrodoom/patch-23
fix typo at config.yml
2012-11-25 09:30:13 -08:00
Necrodoom
948647926d fix typo at config.yml 2012-11-25 15:07:25 +02:00
Iaccidentally
4a4f443fee Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2012-11-24 14:55:54 -05:00
KHobbits
18d52821b7 Merge pull request #201 from necrodoom/patch-22
fix spacing at disabled-commands
2012-11-20 11:16:00 -08:00
Necrodoom
ad7d751856 fix spacing at disabled-commands 2012-11-20 19:38:21 +02:00
ElgarL
1151f1a29c Fix recursive error detection when partial mirroring the main world 2012-11-20 14:55:06 +00:00
snowleo
0b1625f4c1 Better fix for last commit 2012-11-19 22:03:25 +01:00
snowleo
1363406b84 Fix for the plugin conflict with any plugin that contains a log4j library 2012-11-19 20:28:12 +01:00
KHobbits
4b875ed4d9 Merge branch 'release' of github.com:essentials/Essentials into 2.9 2012-11-19 14:28:28 +00:00
KHobbits
42872650d2 Add tptoggle others Essentials style. 2012-11-16 01:37:47 +00:00
Iaccidentally
fd87933aa9 Merge remote-tracking branch 'remotes/origin/release' into 2.9 2012-11-13 22:57:14 -05:00
ElgarL
269cf85457 Update bukkit.jar to #1593 in lib so we can reference the new
interfaces.
2012-11-13 10:17:15 +00:00
Iaccidentally
5728f964a5 Merge pull request #195 from evonuts/2.9
Update fly command to allow for /fly on|*ena*|1 and inversely, /fly off|...
2012-11-11 14:21:18 -08:00
ElgarL
a7aa8be37a Prevent GM commands from being used on CommandBlocks. 2012-11-11 20:56:07 +00:00
ElgarL
237c896fff Add support for Rcon. 2012-11-11 20:39:03 +00:00
Iaccidentally
fbb3d7344f update tptoggle to allow toggling other players :: new permission: essentials.tptoggle.others 2012-11-11 14:34:56 -05:00
KHobbits
8b660d32ac Cleanup spawnmob classes
Spawnmob sign nolonger calls Command
Spawnmob other, now spawns at targets feet, rather than where the target is looking
Console can now spawnmob other
2012-11-11 18:55:02 +00:00
Iaccidentally
98bccf6cec Merge pull request #197 from necrodoom/patch-21
Update Essentials/src/com/earth2me/essentials/Mob.java
2012-11-11 09:10:33 -08:00
KHobbits
936606ce7c Mob comment. 2012-11-11 17:04:16 +00:00
Necrodoom
a63748ca3a Update Essentials/src/com/earth2me/essentials/Mob.java 2012-11-11 18:58:05 +02:00
Iaccidentally
a1ce340ce0 Make playerFishEvent cancel AFK :: fixes #3192 2012-11-11 11:43:10 -05:00
KHobbits
a8df79661a Merge branch '2.9' of github.com:essentials/Essentials into release 2012-11-11 14:55:00 +00:00
KHobbits
f52e0ae7a8 Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-11-11 14:54:19 +00:00
KHobbits
648a5ef8dd Merge branch '2.9' of github.com:essentials/Essentials into release 2012-11-11 14:53:42 +00:00
Iaccidentally
0d610f761b Merge pull request #196 from necrodoom/patch-20
update ID 101, by andrewkm request
2012-11-10 09:53:16 -08:00
Necrodoom
e7afe4109e update ID 101, by andrewkm request 2012-11-10 19:12:25 +02:00
evonuts
b11a1a7cf2 Fix fly specific settings for other players (eg. /fly evonuts on) 2012-11-10 22:17:39 +13:00
evonuts
6a8a2dd28b Update fly command to allow for /fly on|*ena*|1 and inversely, /fly off|*dis*|0. 2012-11-10 13:40:48 +13:00
ElgarL
a370a8e01c Merge pull request #194 from necrodoom/patch-19
correct spaces at plugin.yml
2012-11-09 05:51:52 -08:00
ElgarL
5e38a2180c Merge pull request #193 from necrodoom/patch-18
GroupManager typo fix
2012-11-09 05:51:15 -08:00
ElgarL
f3bc94a547 Merge pull request #190 from necrodoom/patch-16
fix typos and update ingame error message
2012-11-09 05:50:39 -08:00
Necrodoom
ba0db53c44 correct spaces at plugin.yml 2012-11-08 16:35:57 +02:00
Necrodoom
ef98a6b54c GroupManager typo fix 2012-11-08 16:31:49 +02:00
KHobbits
8c9b755671 Extra perm check in /home 2012-11-08 11:53:26 +00:00
md_5
6c1da1d552 Set a players sleeping ignored status synchronously, just in case! Thanks for the hint mbaxter & Wolvereness. Closes ticket 3179. 2012-11-08 18:57:44 +11:00
Iaccidentally
0df0be5762 Merge pull request #192 from evonuts/2.9
Allow for console based gamemode shortcuts. Fixes ticket #3173
2012-11-07 18:39:39 -08:00
evonuts
83120f707f Allow for console based gamemode shortcuts. Fixes ticket #3173 2012-11-08 15:19:07 +13:00
Iaccidentally
9d98edb4ee fix build 2012-11-04 19:04:10 -05:00
Iaccidentally
a50b0ac71d CB 2455 :: Bukkit 1593 2012-11-04 17:52:35 -05:00
KHobbits
d674e65c11 Allow the 'userIsNotAway' and 'userIsAway' translation messages to be empty. 2012-11-04 22:41:35 +00:00
Alexander Schepp
4967279b8c Allow the noNewMail translation to be empty 2012-11-04 22:34:47 +01:00
KHobbits
4722e687fa Code comments. 2012-11-04 21:31:23 +00:00
Iaccidentally
332a59f3fc allow money to be put in kits using the currency symbol before the amount 2012-11-04 16:25:09 -05:00
KHobbits
587f532991 Use durability instead of itemdata for antibuild checks.
Fixes potion blocking using antibuild.
2012-11-04 18:02:36 +00:00
KHobbits
10244d5f90 Fix godmode pvp protection not blocking thrown pots and arrows. 2012-11-04 17:31:57 +00:00
KHobbits
6f1a70dc8b Fix missing mob target block 2012-11-04 16:45:02 +00:00
KHobbits
7369155166 Fix a few more errors in plugin.yml 2012-11-04 13:29:39 +00:00
KHobbits
28d4609c8c Fix plugin.yml typo. 2012-11-04 13:16:05 +00:00
KHobbits
d2966b64eb Code comments 2012-11-04 02:24:54 +00:00
KHobbits
c8f8680ce9 Limit tnt disable on /nuke to 10s 2012-11-04 02:18:51 +00:00
md_5
9fcb412774 Update Spanish translations thanks to nikooo14. 2012-11-03 11:47:39 +11:00
Necrodoom
296af1069e Update EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java 2012-11-02 18:21:26 +02:00
Alexander Schepp
b22e97b3cf remove all L 2012-10-31 21:30:57 +01:00
Iaccidentally
dcf90cbf5a Make /exp accept L before or after the amount, add extra checks 2012-10-31 16:25:13 -04:00
Alexander Schepp
4dc2e2e3fd Handle int overflow in SetExpFix 2012-10-31 21:06:30 +01:00
Alexander Schepp
4d4779ecdc Use the class, not the interface
This code will be changed later, once Elgarl updates the gm branch to 1.4
2012-10-31 20:06:32 +01:00
Alexander Schepp
1c25d317dd Quickfix to prevent GM commands from being called by BlockCommandSender. 2012-10-31 19:44:13 +01:00
Iaccidentally
651a62890a fix minimum required bukkit version. 2012-10-29 14:26:51 -03:00
Iaccidentally
39b38f0619 CB 2420 :: Bukkit 1570 :: Update FakeServer and OfflinePlayer 2012-10-29 13:17:56 -04:00
KHobbits
4a194e8758 Merge pull request #185 from evonuts/patch-5
Update Essentials/src/config.yml
2012-10-29 02:21:24 -07:00
evonuts
5a35da53a0 Update Essentials/src/config.yml
'flase' typo in wither-spawnexplosion
2012-10-29 22:06:23 +13:00
ementalo
8d64c7c81b Fix mail 2012-10-28 20:09:25 +00:00
ementalo
bea3583192 Fix mail 2012-10-28 20:00:15 +00:00
Iaccidentally
618d115233 typo fix 2012-10-28 15:03:45 -03:00
Iaccidentally
5e476f4d61 Update Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
2.9 too
2012-10-28 15:01:54 -03:00
Iaccidentally
5bc1b8df70 nothing to see here, move along (typo fix) 2012-10-28 13:09:19 -04:00
Iaccidentally
72e0ab2cb2 NOW with complete wither protection! 2012-10-28 13:05:08 -04:00
Iaccidentally
e0d189a5e0 oops! :: fix wither spawn explosion blocking 2012-10-28 12:58:01 -04:00
Iaccidentally
91c193b773 Fully support wither blocking in protect 2012-10-28 12:53:12 -04:00
Iaccidentally
4a18130354 CB #2415 2012-10-28 12:23:47 -04:00
Iaccidentally
7c6268fe20 Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9 2012-10-28 11:10:17 -04:00
Iaccidentally
6f213c23e2 update tppos to not accept coords over 30000000 2012-10-28 11:09:49 -04:00
Iaccidentally
cc606fe1aa Merge pull request #184 from necrodoom/patch-15
add bat egg and witch egg
2012-10-28 07:40:52 -07:00
Necrodoom
ee8638841d add bat egg and witch egg
enderdragon and wither have no useable eggs, so not added
2012-10-28 16:37:23 +02:00
Iaccidentally
9864a75c32 Protect updates :: ability to prevent wither damage :: block spawning of new mobs 2012-10-28 09:39:54 -04:00
Iaccidentally
520427239f CB #2406 Bukkit #1568 2012-10-28 09:11:50 -04:00
md-5
614a229ea7 Merge pull request #183 from evonuts/patch-4
Update Essentials/src/config.yml
2012-10-28 03:22:55 -07:00
evonuts
2a4d40020e Update Essentials/src/config.yml 2012-10-28 22:37:00 +13:00
md_5
d6efae202a Why the f*** do we depend on Bukkit too? 2012-10-28 20:09:26 +11:00
md-5
7b9c711486 Merge pull request #182 from evonuts/patch-3
Update Essentials/src/config.yml
2012-10-28 02:02:24 -07:00
md_5
e2bd22d984 No idea why this still refuses to compile locally. Stupid ant. 2012-10-28 20:01:27 +11:00
evonuts
2310b41b21 Update Essentials/src/config.yml 2012-10-28 21:55:20 +13:00
md-5
2ae9c577db Merge pull request #180 from Glyca/2.9
Added, fixed and improved French translations
2012-10-28 01:38:51 -07:00
md-5
7c9375ce2e Merge pull request #176 from necrodoom/patch-14
update files to minecraft 1.4
2012-10-28 01:37:22 -07:00
Glyca
9addc2ccd5 Added, fixed and improved French translations 2012-10-27 21:47:55 +02:00
Necrodoom
e180f6e6b3 update ID 137 2012-10-27 10:41:50 +03:00
KHobbits
f0e29552bc Merge branch '2.9' of github.com:essentials/Essentials into release 2012-10-26 21:41:49 +01:00
KHobbits
48d04216a7 Reduce calls to bukkit getPlayer(); 2012-10-26 21:34:36 +01:00
ementalo
ff6221f1a8 2.9 Release 2012-10-26 09:48:45 +01:00
KHobbits
0bc33554f3 Fix tp delay message 2012-10-23 00:00:55 +01:00
KHobbits
7c480e88d6 Update EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java 2012-10-22 14:55:52 +02:00
KHobbits
c357d19c56 Update listener comment 2012-10-22 12:27:01 +02:00
Alexander Schepp
86124b2705 Fix NPE in UserData on login
if no address is available
2012-10-21 23:17:08 +03:00
KHobbits
99cefb2d74 Fix perm check in /kill 2012-10-20 19:24:33 +01:00
KHobbits
600f99eb6b If the player is still alive, make sure he dies. (/kill) 2012-10-20 19:18:04 +01:00
KHobbits
8ba7a24fd2 Block explicit /home bed, unless user has "essentials.home.bed" permission.
This does not effect the '/home' command when used with no arguments.
In this case, a player will still be sent to the bed home, if they have no Ess home set.
2012-10-20 16:15:43 +01:00
KHobbits
ef608c7595 Remove extra home check. 2012-10-20 16:09:54 +01:00
Necrodoom
2ea453110a update mob.java to 1.4 2012-10-20 12:24:18 +03:00
Necrodoom
a86efb5ebe update items.csv to 1.4
items.csv version 2.2_01
2012-10-20 12:11:27 +03:00
ementalo
e61fa58d2b Fix test 2012-10-17 13:14:59 +01:00
ementalo
ec5edf7bd2 CB #2396 B #1566 2012-10-17 13:09:03 +01:00
snowleo
8dbcebda53 Don't call plugin manager in Settings. 2012-10-15 20:30:52 +02:00
KHobbits
28d2a9ed2e Merge pull request #174 from necrodoom/patch-13
fix sandstone slab aliases
2012-10-14 09:44:26 -07:00
Necrodoom
d47e9145f3 fix sandstone slab aliases 2012-10-14 19:40:57 +03:00
KHobbits
ae7c64619c Allow kicking of hidden players 2012-10-14 13:04:00 +01:00
KHobbits
bdef1780ac Warn when banning a player who has never connected to the server. 2012-10-14 13:03:54 +01:00
Iaccidentally
ced192e8fd Update Essentials/src/items.csv
quick items.csv fix
2012-10-09 05:19:27 -03:00
KHobbits
0a9e9ca41d Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-10-07 22:40:18 +01:00
KHobbits
4982cc950e Add alt warp perm for others 2012-10-07 22:40:04 +01:00
snowleo
140a9100b7 Update AntiBuild for NB7.2 2012-10-07 23:00:09 +02:00
snowleo
0097f961b4 Prevent massive amount of mails being send.
Added new config: mails-per-minute, default 1000
2012-10-07 22:46:15 +02:00
KHobbits
98d657ec4b New permission: essentials.vanish.pvp
If you don't have this permission you cannot PVP while vanished.
2012-10-07 18:10:50 +01:00
KHobbits
63149d0b50 Change default action colour to be different to /say 2012-10-06 22:26:51 +01:00
KHobbits
7a410919a0 Code comments 2012-10-06 03:49:36 +01:00
KHobbits
aa7a39d0b0 Comment for future sanity. 2012-10-05 02:06:23 +01:00
KHobbits
9b88107897 Fix gamemode other perm check 2012-10-02 21:06:28 +01:00
KHobbits
147a2fc227 Better handle invalid warp names 2012-10-02 00:19:42 +01:00
KHobbits
732dc3bf34 Cleanup sethome 2012-10-01 20:32:10 +01:00
Alexander Schepp
227cde75a7 Merge pull request #171 from chrisgward/patch-5
Adding console override to sudo chat
2012-10-01 10:31:48 -07:00
Chris Ward
e670d0af45 Adding console override to sudo chat, changing say to c: 2012-10-02 03:30:13 +10:00
ElgarL
cd0fde05b7 Merge remote-tracking branch 'remotes/origin/2.9' into groupmanager 2012-10-01 17:51:56 +01:00
ElgarL
8cf2ce7b73 Merge branch '2.9' of https://ElgarL@github.com/essentials/Essentials.git into 2.9 2012-10-01 17:50:08 +01:00
ElgarL
1ecf592893 Move Event to LOW so permissions get updated before this event is
triggered.

With LOWEST it would only randomly work with most perm systems,
depending on the loading order.
2012-10-01 17:49:42 +01:00
Alexander Schepp
0dd0dba338 Merge pull request #165 from chrisgward/patch-2
Adding say command to sudo to fake chat
2012-10-01 09:34:49 -07:00
Alexander Schepp
678ae78767 Merge pull request #166 from chrisgward/patch-3
Blocking numeric home names, changing invalid home message
2012-10-01 09:34:09 -07:00
Chris Ward
d8b6742543 Blocking numeric home names, changing invalid home message 2012-10-02 02:32:52 +10:00
Chris Ward
2671f39951 Adding -c switch to sudo to fake chat 2012-10-02 02:31:15 +10:00
Alexander Schepp
d7ddf3c828 Merge pull request #169 from chrisgward/patch-5
Adding console only overrides to exempts
2012-10-01 09:15:18 -07:00
Alexander Schepp
2b7cba936d Merge pull request #170 from chrisgward/2.9
Fixing storage of compiled regex
2012-10-01 09:12:35 -07:00
Chris Ward
2757c707bb Fixing storage of compiled regex 2012-10-02 02:11:05 +10:00
Chris Ward
f50c5276e4 Adding console overrides to exempts 2012-10-02 01:57:29 +10:00
Iaccidentally
a7e692fe37 Merge pull request #164 from chrisgward/patch-1
Fixing bad file names in Windows (Fixes #2924)
2012-10-01 07:16:22 -07:00
Chris Ward
02d273f15e Fixing bad file names in Windows (Fixes #2924) 2012-10-01 21:20:17 +10:00
ElgarL
778f5649c8 allWorldsDataList now returns fully mirrored worlds whihc are not
identical mirrors (fixes the /manselect list).
2012-10-01 12:05:49 +01:00
KHobbits
d7829bef28 Merge pull request #163 from chrisgward/patch-1
Fixes #2933
2012-10-01 03:27:37 -07:00
Chris Ward
d436d10b00 Typo (Ticket 2933) 2012-10-01 20:12:13 +10:00
KHobbits
2d9254eb28 Merge pull request #158 from necrodoom/patch-10
update potion aliases- add all unused potions
2012-09-30 13:55:20 -07:00
KHobbits
23393aea5f Merge pull request #162 from necrodoom/patch-12
small fixes to items.csv
2012-09-30 13:55:09 -07:00
KHobbits
e1562e38bf Restore removed tp method, it is used in other plugins. 2012-09-30 18:15:46 +01:00
KHobbits
4dcce2544e Update Bukkit/CB to 1.3.2 R1
Bukkit: 1546 CB: 2377
2012-09-30 17:33:49 +01:00
Necrodoom
29fa2f0f19 small fixes to items.csv 2012-09-30 19:22:14 +03:00
KHobbits
b850ae93e9 Merge branch 'release' of github.com:essentials/Essentials into 2.9 2012-09-30 17:21:09 +01:00
Necrodoom
21cb8efb90 update kit sign permission check 2012-09-30 17:16:03 +01:00
Necrodoom
cd7be1bb86 update warp sign permission check 2012-09-30 17:15:57 +01:00
KHobbits
69cd17a1b1 Should fix tpaccept charge bug - needs testing 2012-09-30 17:15:40 +01:00
KHobbits
872bc4df4c New permission: essentials.teleport.timer.move - allow players to move during tp delay 2012-09-29 23:48:59 +01:00
KHobbits
3083ba2627 Little bit DRYer 2012-09-29 23:41:12 +01:00
KHobbits
35259892b8 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-09-29 23:35:09 +01:00
KHobbits
fbc0f13b2b Properly handle tphere requests so the right user is in control/charged. 2012-09-29 23:34:46 +01:00
KHobbits
aa7f49cb85 Tidy Teleport file 2012-09-29 23:33:32 +01:00
KHobbits
720676542e Merge pull request #161 from necrodoom/patch-11
update signs permission check
2012-09-29 13:52:07 -07:00
Necrodoom
1d7eb77f27 update kit sign permission check 2012-09-29 15:57:31 +03:00
Necrodoom
895f6269fc update warp sign permission check 2012-09-29 15:55:47 +03:00
KHobbits
4bf0d3ab24 Should fix tpaccept charge bug - needs testing 2012-09-29 03:59:31 +01:00
KHobbits
afccda6350 Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-09-28 23:01:32 +01:00
KHobbits
c0a176825c Add potion effect clearing on /heal - Chris Ward 2012-09-28 20:56:03 +01:00
KHobbits
db6512b702 Cleanup of god mode effects, suggested by gravypod. 2012-09-28 20:45:56 +01:00
KHobbits
46d3f0827a God mode cancel potion effects - Chris ward
Revert heal changes.
2012-09-28 20:35:13 +01:00
Necrodoom
838d7dd8f9 update potion aliases- add all unused potions
items.csv version 2.1_13
2012-09-28 17:02:43 +03:00
Paul A.
b9e5c8827f Fix updating version on items.csv 2012-09-27 16:39:23 +02:00
Paul A.
b8e000c7f9 Merge pull request #156 from evonuts/patch-1
Minor spelling/grammatical fixes
2012-09-27 05:47:31 -07:00
evonuts
5e7af93c77 Minor spelling/grammatical fixes 2012-09-28 00:42:25 +12:00
Paul A.
077ad8cd0f Merge pull request #154 from necrodoom/patch-9
typo fix in config.yml as found by @Evonuts
2012-09-27 05:22:09 -07:00
Necrodoom
0bf954e467 typo fix in config.yml 2012-09-27 15:19:14 +03:00
KHobbits
8a55afc4e1 Remove debug comments. 2012-09-25 22:37:58 +01:00
KHobbits
2bc9f2e386 Handle negated wildcard perms in generic superperms 2012-09-25 22:21:15 +01:00
ElgarL
920e1a3b1f Update users.yml to follow new ordering. 2012-09-25 20:41:16 +01:00
ElgarL
353253b9c5 No need for a new array. 2012-09-25 20:39:24 +01:00
ElgarL
1438230b70 Add alphabetically sorted user lists. 2012-09-25 13:23:19 +01:00
KHobbits
240aebde98 Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-09-25 13:16:41 +01:00
ElgarL
d4e2ed782e Change order of data in Users.yml to [name, Group, SubGroup,
Permissions, Info nodes].
2012-09-25 13:09:26 +01:00
ElgarL
f025cd9d2f Commenting 2012-09-25 11:27:36 +01:00
ElgarL
1ff7082892 Fix javadocs 2012-09-25 11:25:19 +01:00
ElgarL
15fa10dd29 Minor typo fix - Necrodoom 2012-09-25 11:15:28 +01:00
KHobbits
00b4bdadd4 Revert "Clean up imports"
This reverts commit d2546ebd36.
2012-09-24 23:04:33 +01:00
KHobbits
3055dd93a5 Improve fake sign check. 2012-09-24 23:01:58 +01:00
Paul A.
94dc29cc4d Merge pull request #151 from gravypod/patch-2
Clean up imports
2012-09-24 14:34:36 -07:00
KHobbits
22d1db5463 Envelope new drop/pickup/craft perms under 'essentials.build'. 2012-09-24 12:48:07 +01:00
KHobbits
f2b4bb00b6 Minor cleanup 2012-09-24 03:16:15 +01:00
gravypod
d2546ebd36 Clean up imports 2012-09-23 22:06:39 -03:00
KHobbits
f1930e76d6 Fix and give better sign errors. 2012-09-24 00:19:39 +01:00
KHobbits
d722e6a9f0 Less sign checking if certain signs aren't enabled. 2012-09-23 23:51:57 +01:00
KHobbits
8e6d4b1595 config typo. 2012-09-23 23:18:17 +01:00
KHobbits
72065c81f3 Minor colour change 2012-09-23 23:08:35 +01:00
KHobbits
2864d0186c Move wildcard perm check to superperms handler, rather than being PEX specific. 2012-09-23 23:01:14 +01:00
KHobbits
9c9b2be011 Lower reporting level of metrics errors. 2012-09-23 18:08:43 +01:00
KHobbits
2f40264c46 Support new lines in newbie welcome message. 2012-09-22 21:15:04 +01:00
KHobbits
5cc24827fc Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9
Resolved Conflicts:
	EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
2012-09-22 20:44:45 +01:00
KHobbits
da01bdc2b0 Cleanup delhome to match normal home cases properly. 2012-09-22 20:43:27 +01:00
ElgarL
dfb81dd50f Update warning in GlobalGroups - Necrodoom. 2012-09-22 19:51:38 +01:00
ElgarL
567d52459b - Fix Synchronization on adding subgroups (thanks snowleo).
- Remove info node support from GlobalGroups. It should not have them
as GlobalGroups are only permission collections.
2012-09-22 19:18:51 +01:00
KHobbits
80a96e2a73 Reset colour code at start of default broadcast msg. 2012-09-22 15:00:00 +01:00
KHobbits
c2f8467ca9 General demo txt formatting 2012-09-22 14:44:56 +01:00
KHobbits
155ca46fef Clean chat colours. 2012-09-22 14:40:56 +01:00
KHobbits
0952150235 Clean up the info.txt 2012-09-22 14:36:07 +01:00
KHobbits
30faa39070 Merge pull request #148 from necrodoom/patch-7
fix info.txt colors and tags
I'll do a little manual cleanup.
2012-09-22 06:21:51 -07:00
KHobbits
3e367912ec Possibly solve info writing issues in globalgroups
Editing this on the ess branch, cause i'm sure there is a better fix.
2012-09-22 04:35:55 +02:00
Necrodoom
f8cff25bda fix info.txt colors and tags 2012-09-21 18:09:30 +03:00
md_5
3e80bf479e Check for explicit * permission when using PEX. 2012-09-21 19:53:20 +10:00
KHobbits
84afc80873 Update config.yml to show multiple enchantments for kits. 2012-09-21 02:10:39 +01:00
KHobbits
27a943217e Make sure we check for wildcards in PEX 2012-09-20 20:36:07 +01:00
KHobbits
16834d85c5 Switch pex permissions checks to use superperms rather than direct api call. 2012-09-20 20:21:45 +01:00
KHobbits
44d8c85450 ignoreCancelled events. 2012-09-19 21:07:50 +01:00
KHobbits
2a8e44dda8 New Permission:
essentials.build.pickup.<id>[:<datavalue>] - Allows collecting of an item
essentials.build.drop.<id>[:<datavalue>] - Allows dropping of an item
2012-09-19 20:57:06 +01:00
KHobbits
00e3957190 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-09-19 19:48:14 +01:00
KHobbits
a79b76e8d2 New Permission:
essentials.build.craft.<id>[:<datavalue>] - Allows crafting of an item
2012-09-19 19:47:47 +01:00
md_5
0a092ff5b3 Self indulgent commit. Door should be an alias for wood door. 2012-09-17 21:55:52 +10:00
KHobbits
e6aeefb12d Hide Protection sign option. 2012-09-17 11:29:16 +01:00
KHobbits
924b6bd2ba Fix a few minor text formatting issues. 2012-09-16 20:45:33 +01:00
KHobbits
f701090c89 Config file permissions cleanup
Removed deprecated 'restricted-commands' section.
Deprecated 'superperms' toggle.
Remove op override on essentials permissions.
Give op's all permissions by default via superperms.
2012-09-16 20:27:35 +01:00
KHobbits
b9195a561f Merge pull request #146 from necrodoom/patch-6
update dualbit, fix strength, add swift aliases
2012-09-16 08:48:16 -07:00
Necrodoom
d94e4095da update dualbit, fix strength, add swift aliases
items.csv version 2.1_12
2012-09-16 18:46:46 +03:00
md_5
fd61cd1750 Merge remote-tracking branch 'origin/groupmanager' into 2.9 2012-09-16 23:02:56 +10:00
Iaccidentally
e7ae8bcc47 Update Essentials/src/plugin.yml
updating SKYNET
2012-09-15 21:07:42 -03:00
KHobbits
edc4d62004 Missing tl key. 2012-09-15 22:06:42 +01:00
KHobbits
cdff690bb5 Add server uptime to /gc 2012-09-15 22:04:18 +01:00
KHobbits
aa14cc39d9 Add missing TL key
Fixes #1363
2012-09-15 21:16:31 +01:00
KHobbits
cdf2c8beed Allow bans on players who have never connected. 2012-09-15 20:57:44 +01:00
KHobbits
3e06c06827 Reduce the enchantment list some more. 2012-09-15 20:29:29 +01:00
KHobbits
a2886d76d2 Fix Essentials /sethome to more strictly obey home limits. 2012-09-15 19:55:12 +01:00
KHobbits
cc0a65bace /ess reset <player> - Clears stored data about a user. 2012-09-14 02:30:24 +01:00
KHobbits
d988546ef3 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-09-14 01:11:04 +01:00
KHobbits
b7f2add7b4 Fixed jail extend message - xGhOsTkiLLeRx 2012-09-14 01:10:22 +01:00
KHobbits
b07f65c58b Update Essentials/nbproject/project.properties
Accidentally added unneeded line...
2012-09-14 02:01:02 +02:00
KHobbits
18e315a048 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-09-14 00:59:25 +01:00
KHobbits
d3967297bb Don't create empty user files 2012-09-14 00:58:57 +01:00
KHobbits
ea3631ddc2 Merge pull request #141 from DerFlash/2.9
Fix problems with async chat event not sending messages to xmpp chat spy
2012-09-13 06:21:11 -07:00
DerFlash
992e473b72 Fix problems with async chat event not sending messages to xmpp chat spy 2012-09-13 14:57:02 +02:00
KHobbits
0296f4fcf1 remove users from bperm example, different yml file now. 2012-09-13 01:50:55 +01:00
KHobbits
2fc16250a3 Update bpermissions example 2012-09-13 01:46:23 +01:00
ElgarL
75f7b06a23 Remove unused imports. 2012-09-11 11:12:19 +01:00
KHobbits
a7e834e5f9 Couple extra /info aliases. 2012-09-11 05:05:55 +01:00
KHobbits
59086932bd Less strict matching on /realname 2012-09-11 01:07:31 +01:00
KHobbits
5611acf12c Make /realname throw an error if no matches were found 2012-09-11 00:53:32 +01:00
snowleo
60142d872f Missing final 2012-09-10 20:53:25 +02:00
snowleo
1cf0ebbd7f Thread safety for GM 2012-09-10 20:49:07 +02:00
snowleo
736a6d273a Revert bad synchronization
This reverts commit 96ab1b4533.
2012-09-10 19:06:17 +02:00
ElgarL
71179e3dfd Synchronize the world data holder. 2012-09-10 17:46:01 +01:00
KHobbits
24cdc37987 Patch flight disable, to not effect creative mode.
Full world change config still needs coding.
2012-09-10 01:13:30 +01:00
KHobbits
b606f153f4 Fixing map/ironore bug. 2012-09-10 01:10:32 +01:00
ElgarL
96ab1b4533 Change to Hashtables to reduce the chance of a
ConcurrentModificationException pulling group/user data in an Async
thread.
2012-09-10 00:15:42 +01:00
KHobbits
8718d59286 Little bit extra sanity checking. 2012-09-09 20:13:03 +01:00
KHobbits
5d372b8149 Move auto afk permission to 'essentials.afk.auto' 2012-09-09 19:09:35 +01:00
KHobbits
1d62de7e5e Fixing locale typo. 2012-09-09 18:35:20 +01:00
KHobbits
3691417848 Fix Missing TL key 2012-09-09 17:10:26 +01:00
KHobbits
029162bba7 Change default op colour 2012-09-09 16:55:43 +01:00
KHobbits
161a61e0c6 More message cleanup 2012-09-09 16:52:45 +01:00
KHobbits
587addb73f Manual merge necrodoom enchant changes. 2012-09-09 16:29:38 +01:00
KHobbits
d71bd7fb71 Two sets of enchantment aliases. 2012-09-09 16:27:22 +01:00
KHobbits
699ec273dd More message cleanup 2012-09-09 16:15:12 +01:00
KHobbits
c1eed8ebcd Missing TL keys 2012-09-09 15:50:22 +01:00
KHobbits
b8d0cf4cc4 Few more message tweaks. 2012-09-09 15:27:25 +01:00
KHobbits
ff0dd00d79 If chat event doesn't resolve to valid player, cancel and exit. 2012-09-09 06:36:14 +01:00
KHobbits
e18d12f109 Message cleanup. 2012-09-09 05:41:06 +01:00
KHobbits
0a09b355b2 Update some of the example permissions files for the perm changes. 2012-09-08 23:00:57 +01:00
KHobbits
f9659dae68 Move the per world permissions:
essentials.world.worldname is moved to essentials.worlds.worldname
2012-09-08 22:50:20 +01:00
KHobbits
78a580bc40 Log to console the effects of /sudo 2012-09-08 21:10:26 +01:00
KHobbits
8c4d6ad4df Remove dead setting.
Fixes #2465
2012-09-08 20:41:38 +01:00
KHobbits
9c9d4e1da5 Move the per kit and warp permissions:
essentials.kit.kitname is moved to essentials.kits.kitname
essentials.warp.warpname is moved to essentials.warps.warpname
2012-09-08 20:32:48 +01:00
KHobbits
ce50e1448b Look out for nulls. 2012-09-08 18:41:21 +01:00
KHobbits
8e885a3a6e Make /itemdb command list the 15 shortest item.csv names for said item.
This will be useful when making eco signs.
2012-09-08 18:33:06 +01:00
KHobbits
ecd96a81dd Fix /itemdb showing 'uses left' on none held items. 2012-09-08 16:33:00 +01:00
KHobbits
427108574e Fix compile error. 2012-09-08 16:03:54 +01:00
KHobbits
62381a7f52 Async EssentialsSpawn join event, like the others. 2012-09-08 14:55:37 +01:00
KHobbits
b1b09ea542 New Permission: essentials.god.pvp
Unless you have this permission you will be unable to attack other players while in god mode.
2012-09-08 14:51:03 +01:00
KHobbits
e502a7e6fd Give user chance to get display name set before displaying geoip. 2012-09-08 14:40:19 +01:00
KHobbits
acf4d0bcf5 Potential fix for teleporting issue. 2012-09-08 14:30:11 +01:00
KHobbits
6c3b13a7a4 Switch default antibuild status to false. Antibuild toggling shouldn't be an issue with it as a stand alone plugin. 2012-09-08 14:11:12 +01:00
snowleo
cababcbfcf Fix ConcurrentModification bugs
This will probably slow down any access to config
2012-09-07 18:33:28 +02:00
Iaccidentally
a032d0f19f Update Essentials/src/com/earth2me/essentials/commands/Commandburn.java
typo fix
2012-09-04 00:16:23 -03:00
KHobbits
f808e6fa8e Catch null eco symbol. 2012-09-02 20:17:28 +01:00
KHobbits
842d9f73a4 More error on 'Permissions system error' in debug mode. 2012-09-02 18:30:59 +01:00
KHobbits
c2893788e7 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-09-02 18:11:54 +01:00
KHobbits
0b8a6c45c6 Update /kit delay to use updated yaml code. 2012-09-02 18:11:29 +01:00
KHobbits
2049e630fb Merge pull request #136 from necrodoom/patch-3
update enchants with 3-1 letter aliases
2012-09-02 07:51:29 -07:00
KHobbits
6fd82480a3 Add support for /gamemode toggle | /gamemode t and /gmt to toggle between the 3 gamemodes. 2012-09-02 06:54:58 +01:00
KHobbits
e919897f1b Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-09-02 01:57:10 +01:00
Iaccidentally
0fb5fc6bcc fix burn matching all players 2012-09-01 16:40:49 -04:00
Necrodoom
a7d61b1b8d update enchants with 3-1 letter aliases 2012-09-01 10:33:20 +03:00
KHobbits
be9a58457a Another Config tweak. 2012-08-31 22:31:56 +01:00
KHobbits
b1cfc8a8ed Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-08-31 22:28:21 +01:00
KHobbits
6b9b6ba420 Config file tweaks 2012-08-31 22:26:26 +01:00
ElgarL
79c70b1f65 Include the GM version when logging errors. 2012-08-31 21:56:46 +01:00
ElgarL
cfe634e8f7 Give a better error when a subgroup is null. 2012-08-31 21:47:35 +01:00
KHobbits
8c8c6fe73a Fix powertool command logging. 2012-08-31 18:52:40 +01:00
KHobbits
a4353bc8f2 Don't need built in command logger anymore. 2012-08-31 18:44:14 +01:00
KHobbits
4015351c85 Sanity Check. 2012-08-31 17:57:57 +01:00
KHobbits
e89f1d8a03 Add missing repair cost check on /repair hand 2012-08-31 17:54:10 +01:00
KHobbits
ff461be45d Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-08-31 17:48:25 +01:00
KHobbits
93f5a05f17 Reduce the number of permissions checks in command cost lookups
Add support for item number repair costs (repair-123: 120)
Ess charge api supports nested charges.
Slight kit optimization.
2012-08-31 17:48:07 +01:00
KHobbits
3eba7fb90f Merge pull request #134 from necrodoom/patch-16
clear whitespace in globalgroups.yml
2012-08-31 06:48:07 -07:00
Necrodoom
25d51cd79e clear whitespace in globalgroups.yml 2012-08-31 16:40:25 +03:00
KHobbits
a39824abb6 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-08-31 14:09:44 +01:00
KHobbits
2ac4c8e665 Fix metrics when kits are improperly configured. 2012-08-31 14:09:20 +01:00
Paul A.
a84afbaa6e Update Essentials/src/config.yml
More grammar from Evonuts
2012-08-31 12:30:40 +02:00
Paul A.
41f7b4ec2d Update Essentials/src/config.yml
Grammar update thanks to Evonuts
2012-08-31 11:37:10 +02:00
KHobbits
ce90e9710e Fix painting break in antibuild. 2012-08-31 06:06:33 +01:00
KHobbits
930eb7ae86 Fix IllegalStateException in sign click patch
Cleanup
2012-08-31 00:47:53 +01:00
KHobbits
cf79a8fdca Fix min bukkit version warning. 2012-08-30 23:28:16 +01:00
KHobbits
1773a6060d Reset fly/speed on world change
This will be optional in a future version - Discuss http://goo.gl/Vuh4N
2012-08-30 23:13:50 +01:00
KHobbits
5755d647a3 Update chat formatting to use &r instead of &f 2012-08-30 20:43:33 +01:00
KHobbits
5032142a49 Clear up overriding comments on config file.
Closes #2725
2012-08-30 19:19:03 +01:00
KHobbits
15e996f485 Merge pull request #133 from necrodoom/patch-15
clarify some things on config
2012-08-30 10:08:38 -07:00
Necrodoom
b37c08fd31 minor fix 2012-08-30 19:00:53 +03:00
Necrodoom
eaca7f9c09 clarify some things on config 2012-08-30 18:58:43 +03:00
KHobbits
00072501c9 Merge pull request #131 from necrodoom/patch-14
update pork aliases
2012-08-29 08:22:04 -07:00
Necrodoom
b50bb03814 update pork aliases
items.csv version 2.1_11
2012-08-29 16:51:38 +03:00
KHobbits
f55316281c Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-08-28 03:12:16 +01:00
KHobbits
413a7beaa4 Fix CB. 2012-08-28 03:08:06 +01:00
KHobbits
88140f0610 Merge branch '2.9' into release 2012-08-28 03:05:13 +01:00
KHobbits
4996171b6e Update CB :: Bukkit 1536 || Craftbukkit 2352 (1.3.2-R0.1) 2012-08-28 03:01:49 +01:00
KHobbits
d201286fc5 Merge branch '2.9' of github.com:essentials/Essentials into release 2012-08-28 02:55:02 +01:00
KHobbits
12b527be99 If both freeze-afk-players and cancel-afk-on-move is turned on, cancel AFK on player jump. 2012-08-28 02:50:59 +01:00
KHobbits
e666c27d96 Disable AFK when player damages entity. 2012-08-28 02:24:01 +01:00
KHobbits
56cfc47ef6 Manually merge Nickshelton80's alias change. 2012-08-28 02:08:58 +01:00
KHobbits
c4e4235f30 Handle jail teleport locations slightly better. 2012-08-28 02:06:11 +01:00
KHobbits
e045f9d983 Optimize AntiBuild a little
Support item name deny messages in antibuild.
2012-08-28 01:38:16 +01:00
KHobbits
ba8d060927 Fix minor typo in plugin.yml
Remove 'essentials.interact' permission from antibuild - Not needed
2012-08-27 23:59:29 +01:00
KHobbits
5f73bf12d7 Remove max walk option to config, until its fixed in the client. 2012-08-27 03:09:56 +01:00
KHobbits
616f92c214 Missing [player] param syntax on /afk 2012-08-26 20:26:06 +01:00
KHobbits
298f3dc3b2 Comment out/remove the /speed walk code, until the client properly supports this function. 2012-08-26 19:53:58 +01:00
KHobbits
65741403e0 New command /speed [walk|fly] <speed> [player]
New permissions:
essentials.speed = access to the command
essentials.speed.others = ability to change the speed of another player
essentials.speed.bypass = override max speed limits in config.yml
New config options:
max-fly-speed
max-walk-speed
2012-08-26 19:35:39 +01:00
KHobbits
2b6d41ac5f More work on /fly command - Still incomplete
Updated and fixed messages files for missing keys.
2012-08-26 17:16:22 +01:00
KHobbits
a4936355b5 Updated Spanish Translation 2012-08-26 00:36:35 +01:00
KHobbits
02d6eade28 Foundation for speed command - not yet implemented. 2012-08-25 19:23:41 +01:00
KHobbits
089fa8c19b Add AntiBuild to Metrics. 2012-08-25 16:57:36 +01:00
KHobbits
7c687831bc Don't check for loan permission is there is no cost. 2012-08-22 09:12:38 +01:00
KHobbits
d43cb95d72 New perm: essentials.kit.exemptdelay
Allows you to exempt from kit delays.
2012-08-22 00:27:33 +01:00
ElgarL
d588c3f271 iacc's anal 2012-08-21 21:28:26 +01:00
KHobbits
eaa93d545d Remove debug messages. 2012-08-21 20:45:27 +01:00
KHobbits
e324a21b60 New command: /enderchest [player] (alias /endersee and /echest)
This command lets you look inside your or another players enderchest
New Permissions:
essentials.enderchest - Access to the command
essentials.enderchest.others - Lets you look at other enderchests
essentials.enderchest.modify - Lets you modify other enderchests
2012-08-21 20:44:09 +01:00
KHobbits
b9cfd44588 Update CB
Bukkit 1533 || Craftbukkit 2345 (1.3.1-R2.1)
2012-08-21 19:56:14 +01:00
KHobbits
44e9c6ebfc Merge branch '2.9' into release 2012-08-21 19:34:26 +01:00
KHobbits
a836576211 Reorder perm check in antibuild 2012-08-20 08:41:22 +01:00
KHobbits
1ad8c95e3e Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-08-19 23:42:05 +01:00
KHobbits
2dff343c10 Merge branch 'antibuild' into 2.9 2012-08-19 23:41:28 +01:00
KHobbits
fa2a041102 Reduce permissions checks in antibuild.
Add a little debug logging for those with it enabled.
2012-08-19 21:20:55 +01:00
KHobbits
86f8f9c83f Merge pull request #124 from necrodoom/patch-11
patch ID 322 and update ID 260
2012-08-19 12:52:32 -07:00
KHobbits
e359e8ab6e Correct antibuild perm check
(still need to abort interact/use checks on block place)
2012-08-19 16:08:36 +01:00
KHobbits
2f8f3aaa8d Attempt to add support for metadata permissions. 2012-08-19 15:25:40 +01:00
KHobbits
f5bf5ed251 Split Ess protect into EssProtect and EssAntiBuild
New permissions:
essentials.build - same as build: true
essentials.build.interact.<id> - whitelist single interact block
essentials.build.place.<id> - whitelist single place block
essentials.build.break.<id> - whitelist single break block
essentials.build.use.<id> - whitelist single use item
2012-08-19 14:54:58 +01:00
ElgarL
979da6e713 No more null errors from corrupt config.yml's. 2012-08-19 14:49:16 +01:00
necrodoom
6c86fe6117 patch ID 322 and update ID 260
items.csv version 2.1_10
2012-08-19 09:50:19 +03:00
KHobbits
9018fc8324 Add some command cost debugging messages to /ess debug 2012-08-19 03:38:09 +01:00
KHobbits
2f57961ce4 Slightly more realistic worth prices. 2012-08-19 02:49:32 +01:00
KHobbits
4478d438d6 Tidy the worth file formatting. 2012-08-19 02:25:30 +01:00
KHobbits
9261b259a9 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-08-18 16:10:36 +01:00
Iaccidentally
3f3d8c58bc Merge pull request #123 from necrodoom/patch-9
fix ID 2259, pointed out by tanite
2012-08-18 07:59:16 -07:00
KHobbits
e42f7e4ffa Removing EssentialsUpdate from 2.9 branch.
Development may be continued in 3.x branch.
2012-08-18 15:51:55 +01:00
KHobbits
8a9353fd09 Remove 3.x api migration code.
3.x development was moved to different code branch.
Removing deprecated warnings, since it would be silly to deprecate ALL classes.
2012-08-18 15:48:29 +01:00
KHobbits
7d5e0352d2 Fix /warp command matching in console. 2012-08-18 15:25:14 +01:00
necrodoom
05eef76134 fix ID 2259, pointed out by tanite
items.csv version 2.1_09
2012-08-18 10:22:12 +03:00
Iaccidentally
e6ef67f7bf Merge pull request #122 from necrodoom/patch-8
update IDs: 5,6,17,18 - erase unused and add new
2012-08-15 01:20:40 -07:00
necrodoom
bbd93f333d update IDs: 5,6,17,18 - erase unused and add new
items.csv version 2.1_08
2012-08-15 10:39:34 +03:00
ElgarL
84f7859ca9 Fix an error with Logging set to 'OFF' triggering a cast exception. 2012-08-14 13:26:02 +01:00
Iaccidentally
1c0dffa67c Merge pull request #121 from necrodoom/patch-6
few extra fixes to several ID item name aliases
2012-08-13 01:17:22 -07:00
necrodoom
5f3fb9b595 few extra fixes to several IDs
items.csv version 2.1_07
2012-08-13 10:03:39 +03:00
Iaccidentally
4ce1e2d9bf add spruce/pine tree to items.csv 2012-08-13 01:45:10 -04:00
KHobbits
e40f364c1e Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-08-13 02:33:09 +01:00
KHobbits
6bd2d2c4b9 Try and prevent 'corrupt' messages files from breaking essentials. 2012-08-13 02:32:45 +01:00
snowleo
47f06e5c1b Fix encoding of swedish locale 2012-08-13 01:36:39 +02:00
KHobbits
4c4df13c2f Update Essentials/src/items.csv 2012-08-13 01:19:10 +02:00
KHobbits
6ca037ae3e Update Essentials/src/items.csv 2012-08-13 01:15:53 +02:00
KHobbits
47c708fd33 Merge pull request #115 from necrodoom/patch-3
grammar check on plugin.yml
2012-08-11 18:08:50 -07:00
KHobbits
c40b23d80e Add command name matching to /gamemode
This allows aliases such as /gmc and /creative [player] to be used without stating gamemode as a parameter.
2012-08-12 01:13:52 +01:00
KHobbits
f17a790d78 Improve player matching in /gamemode
Add extra aliases to /gamemode
2012-08-12 01:12:10 +01:00
Iaccidentally
bdf67db6ed fix name length check in /kill 2012-08-10 07:17:05 -04:00
Iaccidentally
3e203d193c fix msg and pay to accept 2 character names 2012-08-10 06:54:42 -04:00
KHobbits
a92eb4dee6 Throw warning when using /kill without valid player. 2012-08-10 02:40:05 +01:00
KHobbits
ed411ee217 Add console log message when player is /kicked 2012-08-10 02:35:05 +01:00
KHobbits
368d3a4046 Add console log message when player is /banned 2012-08-10 02:27:10 +01:00
KHobbits
8aab57e86b Fix yaml issue with /kit 2012-08-10 02:26:23 +01:00
KHobbits
e198b61eae Fix Chat Formatting so chat type is shown first. 2012-08-09 13:11:51 +01:00
Iaccidentally
9824cd75b6 Merge pull request #117 from necrodoom/patch-5
items.csv update with ticket #2559 suggestions
2012-08-09 02:07:13 -07:00
necrodoom
562274706b items.csv update with ticket #2559 suggestions
items.csv 2.1_06
2012-08-09 10:24:07 +03:00
KHobbits
03a93bfeff Merge branch 'release' of github.com:essentials/Essentials into release 2012-08-08 23:13:56 +01:00
KHobbits
86749c433c Merge branch '2.9' into release 2012-08-08 23:13:33 +01:00
KHobbits
17adafecf9 Fix /top so that glass counts as a real block. 2012-08-08 23:00:09 +01:00
KHobbits
dd12e5db66 Fix tp permissions check to check player typing command not teleportee.
If you don't want players inviting players to other worlds, do not give them essentials.world.<currentworld>
2012-08-08 22:50:54 +01:00
snowleo
94947ecc21 Merge branch 'refs/heads/2.9' into release 2012-08-08 14:22:13 +02:00
snowleo
8e50158af8 Correct material for beds 2012-08-08 14:21:25 +02:00
snowleo
610fae63d2 Merge branch 'refs/heads/2.9' into release 2012-08-08 14:14:42 +02:00
snowleo
ee072e844b Fix right click on signs 2012-08-08 14:11:40 +02:00
snowleo
0319415f1b Test the places around the location first, then go up 2012-08-08 13:13:39 +02:00
necrodoom
8fdd32a210 sets, not setting 2012-08-08 11:32:21 +03:00
snowleo
32240cd00d Fix teleports on beds 2012-08-08 10:16:06 +02:00
KHobbits
94f9aedf4b Merge branch 'release' of github.com:essentials/Essentials into release 2012-08-08 02:11:04 +01:00
KHobbits
fca3ad4df9 Merge branch '2.9' into release 2012-08-08 02:10:25 +01:00
KHobbits
ba6cc5a9ee Fix minor Exp discrepancy
Add 'l<level>' syntax to /exp command
EG: /exp set l20
2012-08-08 02:07:47 +01:00
KHobbits
101ae201d6 Fix /day /night /sun and /storm aliases to actually set to the current status if used without parameters.
fixes #2365
2012-08-08 00:52:43 +01:00
KHobbits
5c1eea0953 Don't show two error messages on [kit] signs.
Fixes #2508
2012-08-08 00:14:07 +01:00
snowleo
733fcc9d87 Merge branch 'refs/heads/2.9' into release 2012-08-07 21:11:34 +02:00
snowleo
738b895cba Merge branch 'refs/heads/groupmanager' into 2.9 2012-08-07 20:13:27 +02:00
ElgarL
72aeec58ed Better error report on malformed GlobalGroups. 2012-08-07 17:58:57 +01:00
snowleo
4d8116cc39 Merge branch 'refs/heads/2.9' into release 2012-08-07 17:45:40 +02:00
snowleo
54133cd75e Prevent errors in listeners affecting EssentialsChat 2012-08-07 16:03:39 +02:00
Alexander Schepp
322fe386f6 Merge pull request #114 from necrodoom/patch-2
another extra space
2012-08-07 05:44:23 -07:00
necrodoom
d2b30bad99 another extra space 2012-08-07 15:27:25 +03:00
md_5
264eb318b8 Clean up spaces in config. Please don't break this in the future, this is the second fix guys. 2012-08-07 20:39:55 +10:00
Iaccidentally
cebe291a6f Merge pull request #112 from necrodoom/patch-1
update permissions to include new nodes
2012-08-07 01:34:34 -07:00
necrodoom
30d5468be0 update with new workbench node 2012-08-07 11:07:52 +03:00
necrodoom
fbfd62b73e update permissions to include new nodes 2012-08-07 11:04:01 +03:00
KHobbits
0b9725bf77 Merge branch '2.9' of github.com:essentials/Essentials into release 2012-08-07 08:55:35 +01:00
KHobbits
3c268312a2 Fix CB. 2012-08-07 08:52:57 +01:00
KHobbits
4c2d220176 Merge branch '2.9' into release 2012-08-07 08:50:06 +01:00
KHobbits
a855eaf8d0 Updating CB:
CB: 2317 Bukkit 1521
2012-08-07 08:49:09 +01:00
KHobbits
e5c70713b8 Merge branch '2.9' of github.com:essentials/Essentials into release 2012-08-07 08:45:16 +01:00
snowleo
92267fa7f8 Merge branch 'refs/heads/groupmanager' into 2.9 2012-08-06 18:25:55 +02:00
ElgarL
3c5f9e1616 Fix GlobalGroups not loading permission nodes. 2012-08-06 17:15:56 +01:00
snowleo
c2db96edc8 Just don't use nio, this might be slower. 2012-08-06 15:57:54 +02:00
Iaccidentally
4ca09cea2d update gc for all worlds (thanks to Yofel) 2012-08-06 06:54:55 -04:00
KHobbits
9b39a227c9 Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9 2012-08-06 09:17:19 +01:00
ElgarL
a7a06963ac Ignore stupid plugins which add empty permission nodes. 2012-08-06 07:05:20 +01:00
KHobbits
38655811b7 Don't bomb if userMap isn't initialized. 2012-08-06 02:44:01 +01:00
KHobbits
2f562f79aa New Sign: Info
Syntax: [info] / [chapter] / [page number] / [cost]
2012-08-06 00:58:35 +01:00
KHobbits
ee608d944a New Sign: Repair
Syntax: [repair] / <hand|all> / [cost]
2012-08-06 00:33:29 +01:00
KHobbits
9e975568be New command: /workbench (aliases /wb and /wbench)
Permission: essentials.workbench
2012-08-06 00:26:42 +01:00
KHobbits
3dbabfa11d Default value for [gamemode] sign
New syntax: [gamemode] / <mode>  / [price]
2012-08-06 00:23:47 +01:00
snowleo
7a96fd1dce I should read javadoc properly. 2012-08-06 00:55:25 +02:00
snowleo
5174b6fe93 Move FileChannel inside the loop 2012-08-05 20:16:53 +02:00
snowleo
c6617324af Throw exception after 5 attempts 2012-08-05 19:50:37 +02:00
snowleo
c7b90f61f7 Try to fix interrupt problem. 2012-08-05 19:41:28 +02:00
Alexander Schepp
7beab59c1a Fix /gamemode 2 playername 2012-08-04 14:17:41 +03:00
Iaccidentally
55c9cacaa3 i'm in ur config, fixxn ur grammer 2012-08-04 06:56:10 -04:00
Iaccidentally
58fc3f4338 I am a grammar nazi. 2012-08-04 07:40:54 -03:00
snowleo
5379b3955f More thread safety 2012-08-04 11:10:57 +02:00
snowleo
bf93bb2026 Thread safety for XMPP 2012-08-04 10:48:56 +02:00
ementalo
af73c11638 CB #2289 Bukkit #1512
Change PlayerChatEvent to AsyncPlayerChatEvent
2012-08-04 09:25:54 +01:00
snowleo
1a07815f4b Make chat handling more thread safe (and also faster) 2012-08-03 22:57:29 +02:00
snowleo
52702894af Synchronized chatStore 2012-08-03 21:45:32 +02:00
ElgarL
73fb2d3735 Fix mirroring now we are not using any Bukkit methods. 2012-08-03 11:15:14 +01:00
ElgarL
7b482b612e Stop using the YamlConfiguration in bukkit for our config handling. We
can now support periods in world names.
2012-08-03 10:36:26 +01:00
snowleo
bd6614328b Ignore case on /gm command 2012-08-03 10:41:23 +02:00
snowleo
45cd9597c9 Code cleanup 2012-08-03 10:39:45 +02:00
snowleo
b40d663c7e Ignore case on gamemode signs and code cleanup 2012-08-03 10:36:50 +02:00
snowleo
6513842d28 Less loops please 2012-08-03 10:33:45 +02:00
snowleo
c8a07ecdb5 Another fix for /exp 2012-08-03 10:29:22 +02:00
snowleo
80f001fdb7 New exp calculations. 2012-08-03 10:21:03 +02:00
snowleo
ab82f550cf Fix broken output of /itemdb 2012-08-03 10:02:47 +02:00
ElgarL
6064b9760b Fix a cases sensitivity bug in world loading. 2012-08-03 08:54:06 +01:00
snowleo
7802192faa Netbeans 7.2 changes 2012-08-03 09:45:44 +02:00
Iaccidentally
cd437f95f1 Merge branch '2.9' of https://github.com/essentials/Essentials 2012-08-02 20:30:09 -04:00
Iaccidentally
da735b496f update 2.9 item.csv for 1.3 (changes by necrodoom) 2012-08-02 20:29:09 -04:00
ementalo
fc288718b7 Switching the syntax of gamemode /gm mode player and adding mode aliases
Fixing translation keys
Fix plugin.yml gamemode syntax
2012-08-02 17:43:58 +01:00
ementalo
766f9b4dbd CB #2267 Bukkit #1505
Updates to gamemode command, mode is now mandatory [creative|survival|adventure]
Updates to gamemode sign, now requires another line with gamemode
2012-08-02 13:52:11 +01:00
Paul A.
a1ac58d17c Check the player we are bringing has permission to enter the world vs the initiating user the final frontier 2012-08-01 16:04:13 +02:00
Paul A.
2fbdf7e4d6 re: re: Check the player we are bringing has permission to enter the world vs the initiating user 2012-08-01 15:56:58 +02:00
Paul A.
d5ed474be7 Check the player we are bringing has permission to enter the world vs the initiating user part 4 2012-08-01 15:55:04 +02:00
Paul A.
1d92cb0e0a Check the player we are bringing has permission to enter the world vs the initiating user 2012-08-01 15:53:30 +02:00
Paul A.
ab7a19b6e6 Check the player we are bringing has permission to enter the world vs the initiating user 2012-08-01 15:52:55 +02:00
Paul A.
7b94adfac8 Check the player we are bringing has permission to enter the world vs the initiating user 2012-08-01 15:50:28 +02:00
Alexander Schepp
33d7776a8e Fix "x times" on signs. 2012-07-31 13:13:18 +03:00
Iaccidentally
d299309c67 Merge branch '2.9' of https://github.com/essentials/Essentials 2012-07-29 14:23:36 -04:00
Iaccidentally
fcf39ed85b KeepXp fixed. 2012-07-29 14:20:09 -04:00
KHobbits
0badd09ad3 Merge branch '2.9' of github.com:essentials/Essentials into 2.9 2012-07-29 17:16:10 +01:00
KHobbits
cfc8faa43a Recommit Keep Exp on death permission
Permission: essentials.keepxp
Code by Iaccidentially.
2012-07-29 17:15:44 +01:00
Alexander Schepp
b0586abc67 Prevent that Essentials breaks other plugins signs 2012-07-28 00:26:04 +03:00
KHobbits
41235b6ee1 Revert optimization, doesn't find glass blocks. 2012-07-17 21:05:13 +01:00
KHobbits
141a2bb190 Add small optimization tweak to new safe block function. 2012-07-17 01:28:20 +01:00
KHobbits
fb71ebdfdf Remove debugging messages. 2012-07-17 00:47:23 +01:00
KHobbits
66ae1d5b94 Try to do a little better when searching for safe teleport locations. 2012-07-17 00:46:07 +01:00
KHobbits
ada077fead Merge pull request #101 from chrisgward/patch-1
Adding enchantment aliases for fire protection
2012-07-15 10:13:33 -07:00
Chris Ward
45367b17a5 Adding enchantment aliases for fire protection 2012-07-15 19:47:53 +10:00
ElgarL
76717350d6 Fix a typo because Necrodoom is anal. 2012-07-13 16:22:52 +01:00
ElgarL
b71a6ac5e1 Change to our own Yaml parsing for globalgroups instead of using the
YAMLConfiguration class in bukkit.
2012-07-13 13:38:53 +01:00
snowleo
58544c9eea Fix version in messages_se.properties 2012-07-11 13:22:44 +02:00
snowleo
f15cb410ce Added swedish translation (from 3.0 branch) 2012-07-11 13:18:54 +02:00
KHobbits
b0cec9782d Add missing triggers from /mute block list 2012-07-11 02:46:45 +02:00
ElgarL
1eac05799f If a permission is found return the correct node for mangcheckp (not
null).
2012-07-10 14:35:08 +01:00
ElgarL
8fac5f6beb Merge branch 'groupmanager' of
https://ElgarL@github.com/essentials/Essentials.git into groupmanager

Conflicts:
	EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
2012-07-10 14:27:50 +01:00
ElgarL
a46497255e Stop force removing attachments and let Bukkit handle it's own mess. 2012-07-10 14:10:13 +01:00
Alexander Schepp
89670bdfd1 Ignore players, that don't have an IP 2012-07-10 15:57:49 +03:00
Alexander Schepp
71e552c0d1 Another NPE fix for bots 2012-07-10 15:56:12 +03:00
md-5
efec7c8f95 Merge pull request #96 from mbax/groupmanager
Fix critical flaw in permissions removal with regards to fake players and Tekkit.
2012-07-10 02:25:56 -07:00
Matt Baxter
ed668fcac4 Fix critical flaw in permissions removal.
Potential for removing the removal entirely but this can be figured out later.
2012-07-10 06:24:17 -03:00
ElgarL
72015d42fc Throw a better error than 'null' when someone removes all groups from a
yml.
2012-07-06 08:33:57 +01:00
ElgarL
24ec84730e Ignore any sub folders in the Worlds folder which start with a period
(fix for storing data in svn respoitories).
2012-07-04 11:32:17 +01:00
Iaccidentally
dab13931ca Update 2.9 2012-07-03 04:50:29 -03:00
KHobbits
b1c7004d7e Update 2.9 2012-07-01 16:40:48 +02:00
md_5
69ff8b28d8 Fix issue with cross world local chat. 2012-06-26 18:13:53 +10:00
ementalo
0395b5d222 Revert "add essentials.keepxp to allow a player to keep their level after death."
This reverts commit 3b25235755.
2012-06-25 21:40:22 +01:00
Iaccidentally
3b25235755 add essentials.keepxp to allow a player to keep their level after death. 2012-06-24 23:27:30 -04:00
ElgarL
51d61e7a91 Fix loading users with only numerals in their names to be seen as
strings.
2012-06-24 13:10:22 +01:00
KHobbits
4d0ce90787 Merge branch 'master' of github.com:essentials/Essentials into release 2012-06-23 13:47:32 +01:00
KHobbits
4d17b73291 Revert "fix /back resetting on logout"
This is desired behavior, and required for other features.
This reverts commit 329f93a4f6.
2012-06-23 13:33:36 +01:00
md-5
f7a34c49fb Merge pull request #89 from necrodoom/patch-7
major slab alias expansion for items.csv
2012-06-23 02:07:34 -07:00
necrodoom
d0a8dc4812 major slab alias expansion for items.csv 2012-06-23 12:02:28 +03:00
Alexander Schepp
0466a60093 Too much space :D 2012-06-22 20:12:56 +03:00
Alexander Schepp
2c6a81a916 Prevent NPEs in KeywordReplacer 2012-06-22 19:16:40 +03:00
ElgarL
656f25dc97 Only output a Data update message if something has changed. 2012-06-22 15:44:04 +01:00
Iaccidentally
329f93a4f6 fix /back resetting on logout 2012-06-22 03:44:19 -04:00
md-5
b70f950479 Merge pull request #88 from SyntaxBlitz/master
Fix /vanish with no arguments doing nothing
2012-06-21 04:31:18 -07:00
Timothy Aveni
38a2e2bcfd Fix /vanish with no arguments doing nothing 2012-06-21 06:17:26 -04:00
md-5
d9b91e0c34 Merge pull request #87 from necrodoom/patch-5
updated items.csv, 43:4, 43:5, 44:4, 44:5
2012-06-21 03:03:39 -07:00
necrodoom
4ae5579068 while enraged at mibbit and esper failing to work, updated items.csv 2012-06-21 12:18:14 +03:00
md_5
622d710aa9 Merge branch 'master' into release 2012-06-21 18:27:54 +10:00
md_5
f1a7be09c2 Merge remote-tracking branch 'origin/groupmanager' 2012-06-21 18:27:21 +10:00
md_5
0742ca23c1 Update Czech translation. 2012-06-21 18:18:57 +10:00
Iaccidentally
8823ce070e change some default values 2012-06-21 05:05:22 -03:00
Iaccidentally
d77f6cbbf1 fixxy fixxy 2012-06-19 18:13:47 -04:00
Iaccidentally
909c8b3cb5 Add Finnish translation 2012-06-19 18:02:05 -04:00
Iaccidentally
5b7d29fa55 Merge branch 'master' of https://github.com/essentials/Essentials 2012-06-19 17:56:43 -04:00
KHobbits
8dfb3c03c7 *borrows snowleo's strainer* 2012-06-19 20:57:40 +01:00
Iaccidentally
6e8031f477 Merge branch 'master' of https://github.com/essentials/Essentials 2012-06-19 12:48:55 -04:00
Paul A.
81c545f45b Merge pull request #86 from necrodoom/patch-4
adding beef and steak to items.csv - thanks @necrodoom
2012-06-19 07:13:37 -07:00
KHobbits
65025d47c5 Little safety check for bad plugins. 2012-06-19 09:03:37 +01:00
KHobbits
4f23e8aaeb Patch to allow plugins to use ignore lookup, without updating their own code. 2012-06-19 08:59:26 +01:00
KHobbits
aea2c00a95 Add optional 2n'd param to temp ban reason TL key. 2012-06-19 08:46:33 +01:00
necrodoom
eafe0380e1 hotfix before 2.9.2 release 2012-06-19 10:04:13 +03:00
ementalo
3975ceb2a0 Fixing vanish on off arguments 2012-06-18 15:35:21 +01:00
ementalo
0a3ecbcd0e Use the assigned variable when looking at durability in itemdb 2012-06-18 10:28:37 +01:00
KHobbits
9679a90d88 Add sign throttle config option.
Allows you to limit how often an Essentials sign can be spammed per player.
2012-06-17 19:28:59 +01:00
Iaccidentally
c4a704b1a2 The French are weird : they use colons like this. 2012-06-17 11:50:52 -04:00
Iaccidentally
776900bd7b fix spacing issue in messages.properties 2012-06-17 11:41:00 -04:00
ElgarL
5683ea35fc Better update for the User object player reference. 2012-06-16 19:12:54 +01:00
ElgarL
78d4987d5d Clear the player reference on logout so it's refreshed upon a reconnect. 2012-06-16 19:04:40 +01:00
KHobbits
9f852b3a41 Using /exp, show can't find player message, if no matching player is found. 2012-06-16 18:22:31 +01:00
KHobbits
edca2cbdff Added missing syntax to plugin.yml 2012-06-16 17:56:12 +01:00
KHobbits
c578302d7c Fix playerlistname update when prefix/suffix option is disabled.
Fixes #2216
2012-06-16 17:42:42 +01:00
KHobbits
dfce4b31f3 Adjust kit delay description.
Fixes #1580
2012-06-16 17:37:42 +01:00
KHobbits
669edfc048 Prevent joinbots from triggering join code, unless they are actually connected to the server and online. 2012-06-16 17:31:33 +01:00
KHobbits
0a9c88a990 Added TL key for ban syntax,
Default message: "Banned: <reason>"
Default reason: The Ban Hammer has spoken!
Optional 2nd param to banReason, {1}, will contain user who made the ban.
Example use: "banReason=Banned for {0} by {1}"
2012-06-16 17:10:47 +01:00
KHobbits
4e5e5a9684 Fix teleport cooldowns - thanks @basicsensei
Fixes #2260
2012-06-16 16:46:40 +01:00
KHobbits
97eada7dd6 Players should not be able to ignore Console
Also implement chat exempt permission in other commands.
2012-06-16 16:22:51 +01:00
KHobbits
a764f8c929 Fix chat showing [spy] prefix when social spy was not required to see the message.
Fixes #2263
2012-06-16 16:05:48 +01:00
KHobbits
5da886593b Replace op ignore exempt with ignore exempt chat permission:
essentials.chat.ignoreexempt
This permission won't prevent a player from ignoring the player, but the player will see the chat messages anyway.
2012-06-16 16:01:27 +01:00
KHobbits
4c5a88929c Fix /exp so it can be used in the console 2012-06-16 14:26:29 +01:00
KHobbits
af7e427545 Avoid silent command failures on /hat (ie typing /hat fish will no longer silently return as if broken) 2012-06-16 14:02:13 +01:00
KHobbits
4638c5ab55 Added missing TL key 'hatRemoved' 2012-06-16 13:56:36 +01:00
KHobbits
0c2e63baad Make /vanish follow the same rules as /fly, /god and /gamemode 2012-06-16 13:53:46 +01:00
Iaccidentally
ee61ce35c8 Merge pull request #85 from kukelekuuk00/master
Updated dutch translation and fixed many grammar and spelling mistakes.
2012-06-15 15:06:38 -07:00
kukelekuuk00
6ec5b4a5da Updated dutch translation and fixed many grammar and spelling mistakes. 2012-06-16 00:02:19 +02:00
Iaccidentally
d63ad6fc0c Merge pull request #82 from kukelekuuk00/master
Allow your hat to be removed with /hat remove
2012-06-15 13:44:51 -07:00
kukelekuuk00
641a4b9dff Allow your hat to be removed with /hat remove 2012-06-15 22:36:26 +02:00
Paul A.
31001d6b1a Merge pull request #81 from kukelekuuk00/master
/vanish [on|off] - thanks kukelekuuk00
2012-06-15 03:05:13 -07:00
kukelekuuk00
d1a1559dca args[0] instead of args[1]
derp
2012-06-15 11:41:06 +02:00
kukelekuuk00
0d56b700bf /vanish [on|off] 2012-06-15 11:02:04 +02:00
Iaccidentally
cafdb919e4 Merge branch 'master' of https://github.com/essentials/Essentials 2012-06-12 22:33:12 -04:00
Iaccidentally
808f448399 add /e<command> aliases to essentials spawn 2012-06-12 22:28:10 -04:00
KHobbits
10d902e730 Revert "Invert teleport timer."
This reverts commit 0436962ee7.
2012-06-13 03:06:42 +01:00
KHobbits
0436962ee7 Invert teleport timer. 2012-06-13 02:51:47 +01:00
KHobbits
2bebb0bd61 3 char min length on /pay and /msg 2012-06-13 00:49:36 +01:00
Iaccidentally
1e04e3f80d This is broken for some reason. Removing until fixed. 2012-06-12 01:41:39 -04:00
Iaccidentally
c32e10caac oops. forgot this. 2012-06-12 01:13:12 -04:00
Iaccidentally
120440d45b add admin chat 2012-06-12 00:59:53 -04:00
Iaccidentally
61b85901a3 Merge pull request #79 from Iaccidentally/master
update messages_pt.properties
2012-06-11 19:40:42 -07:00
Iaccidentally
f0b3acf491 fix Portuguese translation with new messages 2012-06-11 22:34:40 -04:00
Alexander Schepp
f2d624a795 Merge pull request #78 from Iaccidentally/master
fix some tl keys
2012-06-11 19:17:44 -07:00
Iaccidentally
9e1d7aca92 fix some tl keys 2012-06-11 22:05:30 -04:00
KHobbits
3b43f7bf03 Messing around with whois syntax
(TL's probably need some love)
2012-06-12 01:43:20 +01:00
KHobbits
2f18c6edf1 Fix spacing issue in /list 2012-06-12 00:27:21 +01:00
KHobbits
79f8699174 Fixing messed enchantment. 2012-06-12 00:18:53 +01:00
KHobbits
602681dcc2 Merge pull request #76 from necrodoom/patch-2
pull request for expanding enchant database
2012-06-11 16:17:53 -07:00
KHobbits
3e63047c38 Merge pull request #77 from necrodoom/patch-3
woodenslab fix, pointed out by branicyeti
2012-06-11 16:17:21 -07:00
KHobbits
4f2f166824 Adding mute status to /whois 2012-06-12 00:16:09 +01:00
necrodoom
fc782f286d woodenslab fix, pointed out by branicyeti 2012-06-11 16:39:18 +03:00
necrodoom
425c548611 pull request for expanding enchant database 2012-06-11 15:08:12 +03:00
KHobbits
593f1dd67f Update Bukkit to 1.2.5-R4
Bukkit: #1473 CB: #2222
2012-06-11 00:40:45 +01:00
md_5
8cff4348a6 Fix the vanish command for good. 2012-06-11 09:18:06 +10:00
KHobbits
40271f2ddf I spied some more big Booleans. 2012-06-11 00:14:19 +01:00
KHobbits
aa1205f42d i should prefer boolean to Boolean. 2012-06-11 00:08:31 +01:00
KHobbits
2e15de483d Make /whois throw an error if no matching players are found. 2012-06-11 00:07:22 +01:00
md_5
77b0415c1b Pass the actual player object to Bukkit. 2012-06-11 08:45:24 +10:00
KHobbits
43b3a9df23 /vanish command sets players invisible to essentials commands. 2012-06-10 23:36:10 +01:00
KHobbits
8b47b80b0b Broadcast command allows colour formatting. 2012-06-10 23:35:50 +01:00
KHobbits
13da8c3adc Fix /lightning <player> <damage> to actually deal the proper set damage (5 or 25% by default). 2012-06-10 23:00:49 +01:00
KHobbits
a10190df51 Fix /essentials command to not show command debugging if there were no conflicts. 2012-06-10 22:46:56 +01:00
KHobbits
ecfa745484 Try to be a little more sensible with stored cooldowns. 2012-06-10 21:55:48 +01:00
KHobbits
20d439578b Fix /mute to follow same convention as /tjail
Fixed #2056
2012-06-10 19:56:24 +01:00
KHobbits
dd7f1bcf25 Missing event aborts in sign code. 2012-06-10 19:40:09 +01:00
KHobbits
3b855255cf Fix bug with /remove and minecarts 2012-06-10 19:36:31 +01:00
KHobbits
23283426e0 Allow syntax: /god <player> <on/off> 2012-06-10 19:20:43 +01:00
KHobbits
c958bc78dd Allow syntax: /fly <player> <on/off> 2012-06-10 19:11:45 +01:00
KHobbits
24ec242ecf Fixing up some TL mistakes 2012-06-10 18:38:55 +01:00
KHobbits
9068c13e39 Play a bit less greedy with events 2012-06-10 18:33:07 +01:00
KHobbits
024aff0af5 Remove dura command and merge into itemdb. 2012-06-10 18:31:28 +01:00
KHobbits
57c1d75779 Fix kits to only show to people who can use them. 2012-06-10 18:27:55 +01:00
KHobbits
8c434783a2 Merge pull request #72 from kukelekuuk00/master
Durability command
2012-06-10 10:22:42 -07:00
KHobbits
85ae839211 Merge pull request #75 from necrodoom/patch-1
updating items.csv with newest pastebin, fixes duplicates and wrong alia...
2012-06-10 10:21:40 -07:00
necrodoom
b218d33a24 file indented for unknown reason 2012-06-10 18:06:26 +03:00
necrodoom
6e0f4674d5 updating items.csv with newest pastebin, fixes duplicates and wrong aliases. 2012-06-10 15:29:34 +03:00
kukelekuuk00
62812e1e3a DERP #2 2012-06-10 14:19:03 +02:00
kukelekuuk00
63680b4911 DERP 2012-06-09 23:06:09 +02:00
snowleo
071254ed8d Fix xmpp format stripping 2012-06-08 00:34:25 +03:00
KHobbits
93980629d3 Merge branch 'master' of github.com:essentials/Essentials 2012-06-03 16:35:12 +01:00
KHobbits
f299771044 Fix broken preventmodify permissions check in invsee (*scowls at ementalo*)
Also added check to prevent duping items
2012-06-03 16:34:27 +01:00
md-5
8c013b7680 Merge pull request #74 from Rutr/master
Edit the polish translation, thanks Rutr.
2012-06-02 14:36:00 -07:00
Rutr
78fe659677 translation some new messages and edit some existing 2012-06-02 17:46:26 +03:00
kukelekuuk00
98de950ae2 some more aliases for /durability 2012-06-02 00:36:27 +02:00
kukelekuuk00
96eb9c5db7 added /dura a durability check 2012-05-30 13:42:38 +02:00
md_5
45c1e347b0 Don't allow armor to be used as a hat. 2012-05-27 17:36:04 +10:00
md_5
0559b935e9 Add new command /hat and update translate keys as well as fix colour codes. 2012-05-27 17:24:49 +10:00
md_5
409f337973 Client side note blocks don't play it seems (reverse-merged from commit 0b60d4efe2) 2012-05-26 14:47:30 +10:00
KHobbits
7f5f6b6ac9 Tidy up PVP attack delay. 2012-05-22 21:02:28 +01:00
KHobbits
dc36a50d85 Merge branch 'master' of github.com:essentials/Essentials 2012-05-22 17:54:39 +01:00
KHobbits
74f0babc7d Separate toggle for world teleports using homes. 2012-05-22 17:54:19 +01:00
ementalo
5eeaeaee5d Adding new config setting login-attack-delay. Set this in seconds for a delay before players can attack each other after logging on.
Use permission "essentials.pvpdelay.exempt" to bypass this restriction
2012-05-22 01:29:47 +01:00
KHobbits
fa58503c9f Code tidy. 2012-05-22 00:41:03 +01:00
KHobbits
9fca3728c3 Merge branch 'master' of github.com:essentials/Essentials 2012-05-22 00:39:44 +01:00
KHobbits
56fccb9645 Patch null error in /home after recent update. 2012-05-22 00:39:23 +01:00
md_5
cab40d7893 Keep track of vanished players and tweak lag meter. 2012-05-21 15:13:24 +10:00
KHobbits
faa3a5e027 Make /home and /back obey the world perm system.
This will prevent players from moving between words using virtually all essentials commands.
ATM /warp is excepted, because we already have per warp permissions.
Ess3 may see warp permissions altered to: essentials.warp.<world>.<warpname>
2012-05-20 23:58:03 +01:00
KHobbits
1c0838aa5d Fixing unit tests. 2012-05-19 22:19:24 +01:00
KHobbits
32fa834f3f Forgot to update plugin syntax.
Added missing perm checks.
2012-05-19 22:02:42 +01:00
KHobbits
051af644a7 Exp command cleanup 2012-05-19 21:52:54 +01:00
KHobbits
9b9a6a3148 Merge pull request #70 from kukelekuuk00/master
/exp [set|give|player] [player] [amount]
2012-05-19 12:42:33 -07:00
KHobbits
711426fe69 Update CraftBukkit: 1.2.5-R2.0 - 2190
Update Bukkit: 1.2.5-R2.0 - 1459
2012-05-19 20:35:36 +01:00
KHobbits
18c9c812d7 Merge branch 'master' of github.com:essentials/Essentials 2012-05-19 17:45:09 +01:00
KHobbits
bc798977b5 Strip invalid chars from kit names
This may possibly block some kits from working that previous worked, if the kit name contained unusual letters
2012-05-19 17:44:47 +01:00
kukelekuuk00
853d7cb668 Fixes made, added /exp fix [playername] this fixes negative exp. 2012-05-17 14:39:40 +02:00
md_5
3eac027ddb There is no need to start a second task to measure lag, it can in fact be measured with enough precision from the exisitng one. 2012-05-17 20:33:40 +10:00
md_5
1247401a5f Add a LagMeter (ticks per second) to the /gc command. This command can now be accessed with /lag as well. Also added a simple /vanish command, with the extra node essentials.vanish.see
If you require a more advanced vanish solution checkout VanishNoPacket from mbaxter.
2012-05-17 20:25:02 +10:00
kukelekuuk00
9846362836 small description change 2012-05-14 11:43:57 +02:00
kukelekuuk00
16fc88b50c new command /exp [set|give|player] [player] [amount]
perms are essentials.exp,  essentials.exp.others,  essentials.exp.set,  essentials.exp.set.others,  essentials.exp.give and  essentials.exp.give.others
2012-05-14 11:36:44 +02:00
KHobbits
fee3d7c0d3 Try to trim long displaynicks instead of blankly refusing to show them.
Will try trimming prefixes and dropping suffixes before trimming nicknames.
2012-05-13 18:58:50 +01:00
kukelekuuk00
5020f6b990 Added an /exp command that shows the amount of exp you have and how much you need for the next level.
Permissions are essentials.exp and essentials.exp.needed
2012-05-13 13:44:41 +02:00
KHobbits
a48f6c8c30 Force 3 letters before matching players for /god /gamemode and /fly 2012-05-07 00:30:09 +01:00
KHobbits
8d6b864b5b Revert "Update home count..." This reverts commit 9b731cc39c.
On second thought, this would just lead to inconsistency....
2012-05-07 00:16:45 +01:00
KHobbits
deca5e5e73 Home confirmation when using a bed. 2012-05-07 00:08:01 +01:00
KHobbits
9b731cc39c Update home count to include the bed home if set, this does not prevent people from setting a bed home if they are at max. 2012-05-07 00:05:02 +01:00
KHobbits
78cd64c388 Revert "Revert "New config option 'cancel-afk-on-move' - Set to false you don't use afk." -- This should fix afk mode."
This reverts commit 95e6db6797.

Another attempt at adding 'cancel-afk-on-move' toggle.
2012-05-06 23:38:04 +01:00
KHobbits
d9e15729fd Revert "/me crashes ementalo's face for making the client crash."
This reverts commit 6d1e2dd10e.

And fix the original bug.
2012-05-06 23:30:55 +01:00
KHobbits
0fbe2da9cb Add whisper to social spy trigger list. 2012-05-06 16:11:16 +01:00
KHobbits
d3397279f6 Revert "We can't damage and kill, so we will just kill to make everyone happy, and the event pointless."
This reverts commit 705efc6002.

Also fix kill to do the same.
2012-05-06 16:09:47 +01:00
md_5
705efc6002 We can't damage and kill, so we will just kill to make everyone happy, and the event pointless. 2012-05-05 20:01:18 +10:00
snowleo
3a60191a9d Merge branch 'refs/heads/groupmanager' 2012-04-26 10:42:48 +02:00
snowleo
95e6db6797 Revert "New config option 'cancel-afk-on-move' - Set to false you don't use afk." -- This should fix afk mode.
This reverts commit d927d04765.

Conflicts:

	Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
2012-04-26 10:41:24 +02:00
ementalo
e37b1946f5 Latest items.csv by necrodoom 2012-04-25 11:27:18 +01:00
md_5
6d1e2dd10e /me crashes ementalo's face for making the client crash. 2012-04-25 17:02:15 +10:00
snowleo
0668c4214e Fix items.csv 2012-04-24 21:48:28 +03:00
snowleo
1b4c803ce3 Merge pull request #66 from Iaccidentally/patch-8
Necrodoom's update to items.csv
2012-04-24 11:42:50 -07:00
Iaccidentally
8d00da9e98 Necrodoom's update to items.csv 2012-04-24 14:57:56 -03:00
ementalo
1524a06ac6 Updated czech language, thanks tommymortago 2012-04-24 12:29:24 +01:00
md_5
9ca820d45e Small cleanup of things 2012-04-24 20:31:19 +10:00
ementalo
27102d1c38 Adding the kickedAll TL key the the rest of the files 2012-04-24 10:24:08 +01:00
md_5
18b5405c76 Add message to sender when all players kicked, addresses issue #1968 2012-04-24 17:47:27 +10:00
md_5
de541f6654 Use a quick (and working comparer) 2012-04-24 17:44:49 +10:00
ementalo
9d398b1d2e New permission essentials.invsee.preventmodify. People with this permission cannot have their inventories modified by invsee 2012-04-23 23:51:10 +01:00
snowleo
caeb3279cb Merge pull request #64 from mdojcar/patch-1
0.2 version of Czech translate: optimized by mdojcar
2012-04-23 14:42:55 -07:00
ElgarL
06247732da Allow 'manucheckp' to notify when superperms reports false but it is
really negated.
2012-04-22 12:12:50 +01:00
ElgarL
fc7689354f Fix forgetting sub groups on a manload. 2012-04-21 16:58:22 +01:00
mdojcar
a50b74bb36 0.2 version: optimized by mdojcar (modojcar@seznam.cz) - mirne fixy a trochu jsem preklad vylepsil 2012-04-21 09:35:59 +03:00
ElgarL
a21b5fac76 updated classpath (eclipse) for teh whole project 2012-04-21 02:33:13 +01:00
ElgarL
3d9022d8fa remove unneeded dependency of craftbukkit 2012-04-21 02:32:37 +01:00
ElgarL
4e10470acd Remove unneeded dependency of craftbukkit (Eclipse building) 2012-04-21 02:32:02 +01:00
KHobbits
3cc1a462f5 Remove stack trace cleaning, didn't actually remove unwanted elements. 2012-04-20 22:31:25 +01:00
ElgarL
cd7bf5eff2 Prevent null perms getting past the GlobalGroups loader. 2012-04-18 22:22:35 +01:00
KHobbits
8da3b490d9 Slightly widen block break protection on protected signs (still does not block chain breaks). 2012-04-18 01:30:14 +01:00
KHobbits
00c87c0e60 Merge remote branch 'remotes/origin/groupmanager' 2012-04-18 00:39:14 +01:00
KHobbits
507ecc47b6 Switch the order of the alt give syntax to follow vanilla order. 2012-04-18 00:37:44 +01:00
ElgarL
6ac8abdac8 Fix a couple of perms in GlobalGroups 2012-04-17 18:57:11 +01:00
KHobbits
4a29dd4c9c Don't get the Essentials user object when we don't need it. 2012-04-17 01:14:07 +01:00
KHobbits
6d06636bc2 Wrong default value for AFK disable pickup. 2012-04-17 00:53:57 +01:00
ElgarL
da857895fc Re-initialize the WorldsHolder on a reload, as un-registering and
re-registering a new holder means all plugins have to check for the new
service on every quiery.
2012-04-16 23:54:33 +01:00
KHobbits
425a2184c6 Merge branch 'master' of github.com:essentials/Essentials 2012-04-16 21:43:19 +01:00
KHobbits
6919b52f61 Null check, for quick exit. 2012-04-16 21:42:53 +01:00
md_5
8eb7428ad1 Do we have to remind @khobbits not to code while drunk. Again. 2012-04-16 19:43:53 +10:00
KHobbits
327a57de3c Fixing a few TL issues. 2012-04-16 10:33:51 +01:00
KHobbits
01ba8dbc3f Don't fire entity powertool commands, with our user object. 2012-04-16 10:19:19 +01:00
KHobbits
a97b3abca3 Minor perf tweak. 2012-04-15 23:13:34 +01:00
KHobbits
d927d04765 New config option 'cancel-afk-on-move' - Set to false you don't use afk. 2012-04-15 22:50:55 +01:00
KHobbits
6dc2e96509 Few missing default permissions. 2012-04-15 22:02:08 +01:00
KHobbits
26a0cd0761 Merge remote branch 'remotes/origin/groupmanager' 2012-04-15 19:41:06 +01:00
KHobbits
75b7f7ac22 Fix metrics errors to be... descriptive. 2012-04-15 15:12:42 +01:00
KHobbits
d08ea5a650 Revert "Add option to disable jails entirely."
This reverts commit 34f5c19f99.
2012-04-14 23:18:20 +01:00
KHobbits
1bd1665faa Throw syntax error on /item, if syntax is wrong. 2012-04-14 17:53:33 +01:00
KHobbits
b3847270fa Merge branch 'master' of github.com:essentials/Essentials 2012-04-14 15:58:12 +01:00
KHobbits
055603b09e Fix null locations in /seen 2012-04-14 15:57:47 +01:00
md_5
34f5c19f99 Add option to disable jails entirely. 2012-04-14 15:21:42 +10:00
md_5
602bd5b0d4 Change some ordering and clean pmd warnings 2012-04-14 15:07:10 +10:00
KHobbits
45de85dae2 Optimize sign interacts. 2012-04-14 04:54:01 +01:00
KHobbits
8b9ff2c58a Try to speed up teleport events. 2012-04-14 04:13:37 +01:00
ElgarL
1599a36642 Correct formatting in command list. 2012-04-13 23:56:50 +01:00
ElgarL
1e30f23ca6 Finally remove all deprecated methods. 2012-04-13 15:16:08 +01:00
ElgarL
2f74510cce Code tidy 2012-04-13 15:00:55 +01:00
ElgarL
08bff3ea5f Stop using our own deprecated methods as we tell others to do. 2012-04-13 14:57:23 +01:00
ementalo
90d2451ce2 Merge branch 'master' of https://github.com/essentials/Essentials 2012-04-13 14:52:25 +01:00
ementalo
5b5df254d5 Don't kill tamed ocelots with killall Test #1921 2012-04-13 14:49:15 +01:00
ElgarL
a028abe036 Update all code formatting to use tabs for indentation. 2012-04-13 14:40:26 +01:00
ElgarL
677534c0b7 Fixed the 'last' nested throw/catch and rework all user and group
reading to be certain to trap all errors.
2012-04-13 13:58:05 +01:00
snowleo
2d319fe5aa Fix double charge in /jump 2012-04-12 23:57:19 +03:00
ementalo
bbd2c53dd8 Merge branch 'master' of github.com:essentials/Essentials 2012-04-12 21:26:34 +01:00
ementalo
d1eb7e5614 Display name of new world on world change 2012-04-12 21:26:19 +01:00
snowleo
d9ee666770 Merge branch 'refs/heads/groupmanager' 2012-04-12 04:27:04 +02:00
ElgarL
9f744beb13 Unregister the worldsHolder as a service on a reload/shutdown instead of
the whole plugin.
2012-04-12 03:21:38 +01:00
ElgarL
62a297ec6d Fix silly nested throw/catch statements. Errors are now correctly
generated when reading yml's.
2012-04-12 01:21:22 +01:00
snowleo
3f9e19d279 Merge branch 'refs/heads/groupmanager'
Conflicts:
	EssentialsGroupManager/src/globalgroups.yml
2012-04-11 21:57:58 +02:00
snowleo
c9e64d9e46 Prevent that a config file is loaded/saved by more than one thread. 2012-04-11 22:51:34 +03:00
ElgarL
25759064ff Expand GlobalGroups.yml and groups.yml to cover the VanishNoPacket
plugin. Demonstrating how to negate and add nodes when using the '*'
permission with inheritance.
2012-04-11 19:10:28 +01:00
ElgarL
cd24ffbada Fix 'manuadd' to use the default or selected world (via 'manselect'), if
the world is not specified in the command.
2012-04-10 20:48:34 +01:00
ElgarL
cdae0898c7 Stop the error on shutdown if GM failed to load at startup.
GroupManager will now generate it's own log (in the GM folder) to
keep things tidy, but also to account of those players unable to
find/access their server.log.
Startup errors will now lock out ALL commands other than '/manload'
2012-04-10 20:40:04 +01:00
ElgarL
f02691863b Properly fix concurrent modification when removing all attachments. 2012-04-10 17:02:50 +01:00
snowleo
4c8d0ea2d9 Should fix some exp math issues 2012-04-09 17:52:46 +03:00
ElgarL
ec4f5cc34d Added missing confirmation message on '/manload'. 2012-04-07 21:30:49 +01:00
ElgarL
e8a42e3947 Better handling of errors in user and group yml's. 2012-04-07 19:24:46 +01:00
ElgarL
e8dd963545 Fix a concurrent modification error when removing all attachments. 2012-04-07 17:21:48 +01:00
ElgarL
1c0a5c49a5 Expand 'manwhois' to also list a users subgroups. 2012-04-07 11:47:07 +01:00
KHobbits
bb83dcc828 Allow vanilla syntax of /give 2012-04-07 04:39:12 +01:00
KHobbits
0eefb7f5a1 Remove 'set' and 'add' from /time command args, to allow use of original syntax. 2012-04-07 04:22:17 +01:00
KHobbits
fe95cfe03b New ingame command syntax: /kit <kit> <playername>
New Permission: essentials.kit.others - allows giving kits to other people.
New console commands: /kit & /kit <kit> <playername>
2012-04-07 03:34:01 +01:00
KHobbits
7a6368a980 Console should be able to kick everyone. 2012-04-07 03:07:07 +01:00
KHobbits
9e86681722 Move player loading and updates to new thread, to reduce on join lag. 2012-04-06 19:19:08 +01:00
ElgarL
25bd91eb80 Remove all permission attachments when performing a manload or restart. 2012-04-06 12:53:36 +01:00
KHobbits
6504c88bf7 Chat spy, should show otherworld chat. 2012-04-06 02:36:27 +01:00
KHobbits
6a75d6fe86 Merge branch 'master' of github.com:essentials/Essentials 2012-04-05 23:37:33 +01:00
KHobbits
bc876611d0 Fix /time not working with the '##pm' syntax. 2012-04-05 23:36:57 +01:00
md_5
798ea77736 Add version tag 2012-04-06 07:39:25 +10:00
md_5
21ef83c0ff Add polish translation, thanks losdamianos 2012-04-06 07:33:10 +10:00
ElgarL
bd7af593e7 Don't throw errors when attempting to remove permission attachments
(bukkit will have already removed it).
2012-04-05 21:06:48 +01:00
snowleo
f73a5d0e8d Merge remote-tracking branch 'origin/groupmanager' 2012-04-05 17:05:43 +02:00
ElgarL
f7bc04bc34 Fix an error I caused trying to modify an unmodifiable list when parsing
'*' permissions.
2012-04-05 15:02:08 +01:00
KHobbits
aa43703094 Fixing up NPE bug in jails (implemented in Dev2.9.163) 2012-04-05 13:28:23 +01:00
ElgarL
381886245b Update to 2.0
Fix GM reporting of permission inheritance to retain the correct order.
Lower inheritance groups can no longer negate a higher groups
permissions.
2012-04-05 12:54:26 +01:00
KHobbits
08642ada20 Added wiki names for enchantments. 2012-04-05 05:46:36 +01:00
KHobbits
10cb4c03b7 Jail update, jailed people can't attack other players. 2012-04-05 03:22:49 +01:00
KHobbits
e7d1cb8bb6 Updating plugin.yml to add sendall syntax. 2012-04-04 23:02:13 +01:00
KHobbits
5a7d733cbf Added extra params to setHome TL key {0} world {1} x {2} y {3} z 2012-04-04 18:19:39 +01:00
ementalo
e23f491500 1.2.5 Update Craftbukkit #2149 Bukkit ??? 2012-04-04 15:33:11 +01:00
KHobbits
98b716dfbf Fix unit tests. 2012-04-04 03:21:14 +01:00
KHobbits
2ddd31a37d Report invalid enchantments in kits.
Improve error logging
2012-04-04 03:09:27 +01:00
KHobbits
2b99ed9a2a Catch all values greater than 10 years to avoid exploits. 2012-04-04 02:07:01 +01:00
KHobbits
eeea16a99a Cap mute/ban/jail to 10 years (any more is silly).
Cap time descriptions to 3 significant notions.
2012-04-04 01:55:06 +01:00
KHobbits
e52996609a Update seen to show better data for vanished users:
New Perm: essentials.seen.extra - Shows some extra information for staff
2012-04-04 01:20:57 +01:00
KHobbits
932de33349 Little bit of powertools code cleanup. 2012-04-04 00:40:58 +01:00
KHobbits
195604997b Enable powertools if they are disabled when setting a new tool. 2012-04-04 00:39:59 +01:00
KHobbits
a3a3f81e11 Better hide vanished players. 2012-04-03 16:12:49 +01:00
KHobbits
d0f3fb4417 Command cost api update: Can now set fallback costs.
Repair command addition: ontop of 'repair' and 'repair-<itemname>' you can now charge for 'repair-all' to charge more for /repair all or 'repair-item' to charge per item repaired.
2012-04-03 15:35:13 +01:00
ElgarL
183602ac28 Prevent Null entries in group inheritance from throwing errors. 2012-04-03 14:30:27 +01:00
KHobbits
37370f722c Switch sign listeners back to compare block id, rather than materials. 2012-04-02 22:58:07 +01:00
ElgarL
e2e51c9c95 Added a new permission node 'groupmanager.op'. This will cause players
with this node to be treated as op's when using GroupManager commands
(they will still require each commands
permission node to use them).
2012-04-02 21:12:19 +01:00
KHobbits
bf1e073ef4 Allow tppos to be used in console. 2012-04-02 02:47:44 +01:00
KHobbits
767703bfc9 Optional second param to /gm to force gamemode on other players. 2012-04-02 02:31:31 +01:00
KHobbits
0e0a96b6d8 Listener Cleanup 2012-04-02 02:22:30 +01:00
ElgarL
3f73272524 Force remove player attachments on disconnect, and tidyup during player
join in case of any errors. Fixes a bug of losing permissions.
2012-04-01 03:44:37 +01:00
KHobbits
d72f831519 Make sure can build checks in permbukkit/privileges work for admins/owners. 2012-04-01 02:44:11 +01:00
KHobbits
c6f25c0df6 Minor cleanup to player events. 2012-03-30 21:44:14 +01:00
KHobbits
17058c220c Add newish signs to default enabled commands config. 2012-03-30 21:04:15 +01:00
KHobbits
0e99b35ab2 Formatting. 2012-03-30 13:29:58 +01:00
KHobbits
e795c6ed0b Don't push vault version to metrics. 2012-03-30 13:27:57 +01:00
KHobbits
f3345247ed Reset ban reason to null on /ban <player>, if no reason is set. 2012-03-30 11:40:44 +01:00
KHobbits
1101a3243d Fix tpo syntax error. 2012-03-29 22:32:16 +01:00
KHobbits
c7638efc7e Iaccidentally's changes to pt TL. 2012-03-29 21:17:50 +01:00
KHobbits
d90053c8c4 Update TL header. 2012-03-29 18:49:56 +01:00
KHobbits
6235983ddd New translation messages 2012-03-29 18:37:22 +01:00
KHobbits
7a249abc67 Update default permissions. 2012-03-29 18:14:24 +01:00
KHobbits
c2c613b652 Missing air materials. 2012-03-29 16:41:13 +01:00
ElgarL
590357004d Merge branch 'groupmanager' of https://elgarl@github.com/essentials/Essentials.git into groupmanager 2012-03-29 14:09:07 +01:00
ElgarL
9dbeb1407c Catch errors caused by bad indentation in yml's. 2012-03-29 14:02:53 +01:00
ElgarL
1ef8ab70d1 Stop attempting to push empty permissions when players edit the yml's
incorrectly.
2012-03-29 13:41:59 +01:00
KHobbits
c09ada201c Interact event cleanup 2012-03-29 03:06:52 +01:00
KHobbits
d7139cb16c Update to CB #2126 B #1425
Min CB version changed to 2122
2012-03-29 02:00:51 +01:00
KHobbits
10f82a6723 Fix using /setworth <price> 2012-03-29 00:13:56 +01:00
KHobbits
2aed3af3c4 Merge branch 'groupmanager' of github.com:essentials/Essentials 2012-03-28 17:37:03 +01:00
KHobbits
c45d38ca69 Implement all abstract methods. 2012-03-28 15:12:25 +01:00
KHobbits
576642a573 Merge branch 'master' of github.com:essentials/Essentials 2012-03-28 15:03:45 +01:00
KHobbits
9d545dcbf1 Don't register jail listeners, if no jails are set. 2012-03-28 15:03:18 +01:00
snowleo
71d8744840 Fix for the fix 2012-03-28 11:21:31 +02:00
snowleo
32c689e0f5 Fix isAffordableFor in Trade class
This fixes buy signs giving out items, when the player has essentials.eco.loan permission, but min-money in config is set to 0.
2012-03-28 10:36:10 +02:00
KHobbits
5b62661404 Pull example perm files out of the ess jar. 2012-03-28 00:59:51 +01:00
KHobbits
a7df8a1a0a Try to reduce lag caused by join spam. 2012-03-27 21:08:06 +01:00
snowleo
b14e7c197f Adds pvp protection after teleport 2012-03-27 21:15:11 +02:00
KHobbits
97eed50ccc Adding world permission checks to:
tpaall tpall tpahere tphere tpohere
User is required to have the permission for the world he is in, before he can teleport users outside this world, to it.
2012-03-27 15:28:40 +01:00
ElgarL
b8453ac792 Update GlobalGroups.yml for new/changed Towny permission nodes. 2012-03-27 10:14:53 +01:00
ElgarL
fe7f479e63 Auto rename all case sensitive world folders to lower case (if
possible).
2012-03-26 20:06:59 +01:00
ElgarL
50ea442bf0 Treat all world names as lower case for file handling (please check in
your worlds folder. You should have no folders with upper case letters
from now).
2012-03-26 19:18:19 +01:00
KHobbits
5d45495371 Fix kit enchants for people without oversized stack permission.
Add permissions lookup to debug mode.
2012-03-26 13:28:32 +01:00
KHobbits
e30d900289 Clarify how backup works.
Add option for auto save-all.
2012-03-26 00:49:53 +01:00
KHobbits
2cc96e995b Update tp to check if target player has tptoggle disabled.
Update tpo to allow player to player tp.
2012-03-25 23:32:04 +01:00
KHobbits
47cf1289d7 Don't show 'backup started' on /backup if it hasn't been configured. 2012-03-25 19:10:39 +01:00
KHobbits
d2506cd928 Reorder login/join event calls. 2012-03-25 17:27:06 +01:00
KHobbits
1dbb11ea55 Don't override other plugins which allow joining over capacity. 2012-03-25 16:46:36 +01:00
KHobbits
b60363b6bd Reduce amount of move event calls being processed. 2012-03-25 16:30:22 +01:00
KHobbits
00033c11bc Update [balance] sign to use currency formatting. 2012-03-25 14:26:08 +01:00
KHobbits
c588b78adb Merge branch 'master' of github.com:essentials/Essentials 2012-03-25 14:20:53 +01:00
KHobbits
7bd7992b24 Fix chat format regex. 2012-03-25 14:20:26 +01:00
snowleo
6f86b7400a CopyPaste-Fail 2012-03-25 11:47:26 +02:00
snowleo
e13a2c371d Wrong url 2012-03-25 11:45:50 +02:00
snowleo
0cbded9fca This is no longer stored in file, so it's not part of UserData anymore. 2012-03-25 11:44:33 +02:00
snowleo
3e6e71ca41 Optimize metrics 2012-03-25 11:39:19 +02:00
snowleo
1b2e3b1951 AntiCheat has different version numbers, so don't check. 2012-03-25 11:09:13 +02:00
KHobbits
e53a480c22 Should probably cancel this at lowest. 2012-03-25 02:55:19 +01:00
KHobbits
7280c1c468 Merge branch 'master' of github.com:essentials/Essentials 2012-03-25 02:34:19 +01:00
KHobbits
b7221516dc Invsee now shows a live player inventory in a window, rather than cloning players inventory.
New Permission: essentials.invsee.modify - Player with this permission will be able to add/remove items from the other players inventory.
2012-03-25 02:33:52 +01:00
KHobbits
71aaf81bba Update Essentials/src/config.yml 2012-03-24 23:28:56 +00:00
KHobbits
160c3f428c Mysql is bad. 2012-03-24 23:25:43 +00:00
KHobbits
3c3e8d167f Better English. 2012-03-24 21:12:15 +00:00
KHobbits
7ca2b65c4f New permission check: essentials.list.hidden is now required to /getpos hidden players. 2012-03-24 21:08:45 +00:00
KHobbits
a8cbb5c8f5 Extra itemcsv. 2012-03-23 23:13:04 +00:00
KHobbits
72028086c0 'Enabled' looks better than 'true'. 2012-03-23 22:38:01 +00:00
KHobbits
dddf529ff5 Make sure items don't stack wrong in [free] signs. 2012-03-23 20:15:03 +00:00
KHobbits
b3de0aabae Fix for showing plugins when user has no permission. 2012-03-23 18:26:19 +00:00
KHobbits
77c6a3b730 Wrong colour code symbol. 2012-03-23 17:50:15 +00:00
KHobbits
bb54dbb688 Merge remote branch 'remotes/origin/groupmanager' 2012-03-23 17:44:00 +00:00
KHobbits
0a74da88d6 Help command refresh. 2012-03-23 17:16:09 +00:00
KHobbits
d0b94938e0 Merge branch 'master' of github.com:essentials/Essentials 2012-03-23 13:53:08 +00:00
snowleo
a0cba8e63d Spaaaaaace! So much space! Gotta see it all! 2012-03-23 14:30:00 +01:00
KHobbits
a4d7b5dcf8 Merge branch 'master' of github.com:essentials/Essentials 2012-03-23 13:26:12 +00:00
KHobbits
c503adabc5 Fix url matching. 2012-03-23 13:26:03 +00:00
snowleo
8a22258945 Fix utf-8 decoding problems. 2012-03-23 14:22:10 +01:00
snowleo
29a190f93a http://youtu.be/8DdeLUA0Fms 2012-03-23 12:11:01 +01:00
KHobbits
5c0b522026 Merge branch 'master' of github.com:essentials/Essentials 2012-03-23 10:18:16 +00:00
KHobbits
c46f14665c Adding missing entities to Protect Spawn Blacklist 2012-03-23 10:16:38 +00:00
snowleo
20c973dab2 Fix UTF8 handling in Configuration class 2012-03-23 11:13:44 +01:00
KHobbits
49cb482ca5 Update Essentials/src/config.yml 2012-03-23 10:03:15 +00:00
KHobbits
033c2e22cd Remove white user prefix, if prefix is blank. Messes with EssentialsChat colouring. 2012-03-23 07:56:44 +00:00
KHobbits
2f434291cb Fixing chat color formatting. 2012-03-23 00:19:27 +00:00
KHobbits
42d01471d3 Disabling player list updates by default (can mess with tab completion)
Hopefully this will be reverted if/when patch is found.
2012-03-23 00:15:22 +00:00
KHobbits
c5eb1bb105 Improve kit matching, and add enchantments.
Enchanted kit example in config.yml
2012-03-22 23:47:35 +00:00
KHobbits
3c9057f68e Fix jar building. 2012-03-22 23:10:59 +00:00
KHobbits
96f0dd5824 Update CB to 2105 2012-03-22 23:07:23 +00:00
KHobbits
71358629f4 New command: /fly
New perm: essentials.fly.others
2012-03-22 22:59:52 +00:00
KHobbits
284fef00e7 Split formatting perms for signs as well. 2012-03-22 22:26:04 +00:00
KHobbits
d20519ef8b New Permission: essentials.chat.url
Without this perm, URLs will be modified not to be links.
2012-03-22 22:19:58 +00:00
KHobbits
0dc1270aed Split colour permissions into 3: color/magic/format 2012-03-22 22:07:13 +00:00
KHobbits
cd0d37f73c Update to 1.2.4 (R0.1)
New Minimum CB version: 2100
2012-03-22 20:55:56 +00:00
KHobbits
56fce34539 Extra items in 1.2.4 2012-03-22 20:48:27 +00:00
KHobbits
165a76d492 Add villager professions to /spawnmob 2012-03-22 20:03:52 +00:00
ElgarL
9570e5cfd9 Correct Grammar 2012-03-22 17:54:59 +00:00
ElgarL
c6bb10489e Merge pull request #62 from bonney12/groupmanager
Update language and commenting
2012-03-22 10:53:25 -07:00
KHobbits
3d7d4a47d9 Bukkit R0.3 api updates. 2012-03-22 17:26:05 +00:00
KHobbits
968c849b13 Update missing 1.2.3 items in items.csv 2012-03-22 17:25:42 +00:00
KHobbits
1746569e1a Extra Trees 2012-03-22 17:25:13 +00:00
KHobbits
209c91d3de Fixed again. 2012-03-22 12:02:19 +00:00
KHobbits
7d7c1d34cf Fix typo. 2012-03-22 11:57:30 +00:00
KHobbits
c3ad486f65 Merge branch 'master' of github.com:essentials/Essentials 2012-03-21 23:55:19 +00:00
KHobbits
7bcec32134 Cleaning up displaynames 2012-03-21 23:54:57 +00:00
KHobbits
b19b08dc6e Merge pull request #63 from Iaccidentally/patch-6
update default player-commands to support new and missed commands
2012-03-21 09:25:05 -07:00
Iaccidentally
264e175d6c update default player-commands to support new and missed commands 2012-03-21 13:23:36 -03:00
Michael Bonney
bcd4fd9bff Removed Portuguese text, and added English replacements. Made more sense of the sentences, and also changed an incorrect message to it's proper form. 2012-03-21 16:13:34 +00:00
KHobbits
3e88fb44f4 Split if tree for readability. 2012-03-20 15:03:53 +00:00
KHobbits
518b013a63 Teleport check cleanup 2012-03-20 13:26:49 +00:00
KHobbits
e752538568 Fix per world teleport permission checking. 2012-03-20 11:53:05 +00:00
KHobbits
970364886c Add 'color' sign type to config file.
Enforce colour permission on signs when essentials signs are enabled.
2012-03-19 08:21:39 +00:00
KHobbits
07f859e38b Missing kit time check from [kit] signs. 2012-03-18 17:15:46 +00:00
KHobbits
c806059958 Only show nickname update message in debug mode. 2012-03-18 03:29:49 +00:00
KHobbits
14bce8fd82 Shorten help messages. 2012-03-18 03:01:44 +00:00
KHobbits
17be04cd99 Error and info cleanup. 2012-03-17 20:23:46 +00:00
KHobbits
b93847f077 Merge remote branch 'remotes/origin/groupmanager' 2012-03-17 18:20:33 +00:00
ElgarL
6476158462 Don't remove an attachment on a player leaving as Bukkit never forgets
it. This fixes non mirrored permissions being messed up if a player
relogs.
2012-03-17 15:56:40 +00:00
snowleo
6dd73ff9d0 Merge branch 'refs/heads/groupmanager' 2012-03-17 13:38:51 +01:00
ElgarL
b72083fb18 Removed some debug spam. 2012-03-17 12:37:23 +00:00
snowleo
ca11d4d98b Fix bukkit download url 2012-03-17 11:15:28 +01:00
snowleo
12cb4fd5f8 Fix bukkit download url 2012-03-17 11:12:32 +01:00
KHobbits
4df4eba2a5 Merge remote branch 'remotes/origin/groupmanager' 2012-03-17 08:01:19 +00:00
KHobbits
762105d692 New permission: essentials.tp.others - Allows players to /tp <p1> <p2> replaces old reused permission.
New permission usage: if world-teleport-permissions is true in the config, TP commands will now check for essentials.world.<worldname> when a tp would switch worlds.
2012-03-17 06:10:02 +00:00
KHobbits
e4ce814c2f Comments to SetExpFix. 2012-03-17 03:38:32 +00:00
KHobbits
87cd693020 Adding Exp to /whois, shows total exp and ingame level.
Due to the way minecraft calculates levels (flawed formula), its possible to not match calculated level.
2012-03-17 01:43:49 +00:00
KHobbits
baadd4b1cb Adding reference to &k in MOTD. 2012-03-16 23:03:22 +00:00
KHobbits
adf3755abb Handle permission check failures better. 2012-03-15 23:15:19 +00:00
KHobbits
5c280e7cb7 Add missing methods. 2012-03-15 22:23:26 +00:00
KHobbits
4a149855ab Updating Bukkit/CraftBukkit to match minimum ver. 2012-03-15 22:15:17 +00:00
md_5
cf000b04e4 Fill the entire sign with free goodness 2012-03-15 20:55:56 +11:00
md_5
79cd8d6065 Update minimum CraftBukkit version 2012-03-15 20:51:51 +11:00
md_5
5b930cdc3b Restore [free] and [disposal] signs back to their intended behaviour 2012-03-15 20:48:55 +11:00
snowleo
c09329e5be :P 2012-03-15 09:15:28 +01:00
KHobbits
c513014732 Graph a little bit extra information. 2012-03-15 08:08:25 +00:00
KHobbits
bada36be68 Fix fake explosions. 2012-03-15 06:42:58 +00:00
KHobbits
e5e81eda72 Make /nuke drop tnt from a more reasonable height. 2012-03-15 05:09:34 +00:00
KHobbits
45cf2ae960 Make /spawner errors more descriptive. 2012-03-15 04:41:56 +00:00
KHobbits
d0d0117411 Add metric opt out toggle ingame. 2012-03-15 03:49:17 +00:00
KHobbits
5d79863cfc Fixing setwarp command. 2012-03-15 02:12:43 +00:00
KHobbits
b85756f8b1 Adding some simple feature metrics. 2012-03-15 02:12:27 +00:00
KHobbits
8776f4c1c0 Metrics errors aren't important. 2012-03-15 01:32:08 +00:00
KHobbits
5e8fd3993d Basic module graph. 2012-03-15 01:17:12 +00:00
KHobbits
d3033716ca Add Griefcraft metrics to Essentials
Warns on first start, and first staff join, and 5 minute warning before logging starts.
2012-03-15 00:49:22 +00:00
ementalo
6cf2bb5cd9 Adding permissions for overwriting exisitng warps
essentials.warp.overwrite.[warpname] will allow overwrting of exsiting warps
essentials.warp.overwrite.* for all warps
Adding WarpNotFoundException class
2012-03-14 21:16:22 +00:00
KHobbits
267495a406 Fixing warp command costs. 2012-03-13 16:15:01 +00:00
ElgarL
a8937f7bf0 Fix a globalgroup inheritance in groups.yml 2012-03-12 22:18:25 +00:00
KHobbits
dfd63a81ac Missed a TL key. 2012-03-12 16:50:32 +00:00
KHobbits
dfbc1956c9 Fixing a few TL Keys 2012-03-12 15:35:20 +00:00
KHobbits
c0490c0890 New TL Key, allow formatting/colouring of help output. 2012-03-12 15:21:37 +00:00
KHobbits
2da802d4b7 New permission: essentials.seen.banreason
With this permission players can see why a user was banned, in /seen.
2012-03-12 15:00:44 +00:00
KHobbits
adffbab678 Adding jail time to /whois. 2012-03-12 01:15:10 +00:00
KHobbits
e11525ab64 Update offline user check.
Add ban reason to /seen
2012-03-12 01:00:57 +00:00
KHobbits
8dcd591beb Update setworth to allow /setworth <price> ingame
Allow /setworth to be used from console.
2012-03-11 23:59:59 +00:00
KHobbits
a40c936bcf New Permission: essentials.lightning.others
With this permission you can use /lightning <player>, without only strike based on direction.
2012-03-11 20:58:54 +00:00
KHobbits
5c2622b390 Add Enderman check to EntityChangeEvent (Should fix sheep eating grass). 2012-03-11 01:46:01 +00:00
KHobbits
c7046b696a Use ignoreCancelled on event registration. 2012-03-10 21:42:46 +00:00
KHobbits
9ac5ce8a75 Update info.txt to hint at /einfo. 2012-03-07 12:14:32 +00:00
KHobbits
5c55e18d33 Fixing typo in config.yml 2012-03-06 23:17:10 +00:00
ElgarL
19d233454e change []<> for optional command components 2012-03-06 16:23:57 +00:00
ElgarL
1f761ee1cb Expanded '/manuadd'to accept an optional variable for the world (eg
'/manuadd <player> <group> <world>').
2012-03-06 11:02:48 +00:00
KHobbits
1db5d61945 Merge branch 'release'
Conflicts:
	lib/bukkit.jar
	lib/craftbukkit.jar
2012-03-05 16:25:35 +00:00
md_5
0b60d4efe2 I dont think free noteblocks are a good idea 2012-03-05 18:40:18 +11:00
md_5
d31e434e4d Allow spamming of this, by reducing explosion damage to 0, same effect, no mess 2012-03-05 18:28:04 +11:00
KHobbits
fabc1c3dd9 Missed one. 2012-03-05 00:39:37 +00:00
KHobbits
68fbc40605 Fixing spawnmob count. 2012-03-05 00:22:31 +00:00
KHobbits
8b7c5cf2ed Add listgroups as TL key 2012-03-05 00:19:40 +00:00
KHobbits
1811631b93 Apply colors to group tags. 2012-03-05 00:08:37 +00:00
KHobbits
7cec1564b9 Build custom mob list /spawnmob 2012-03-04 21:54:51 +00:00
KHobbits
a75eefcdd4 CME 2012-03-04 21:43:24 +00:00
KHobbits
6a9027da6d Adding starter/newbie kit to EssentialsSpawn
Optimization to EssentialsSpawn join event.
2012-03-04 20:09:25 +00:00
KHobbits
e55aa3cea7 Extra command alias. 2012-03-04 16:17:16 +00:00
KHobbits
1ce2c60bf4 Updating Craftbukkit #2034 Bukkit #1378 2012-03-04 16:01:49 +00:00
ElgarL
7ba49afa0b Better reporting when a users.yml is failing to load. 2012-03-04 10:39:39 +00:00
KHobbits
6da705c86f Allow more currency customization.
Added currency key to messages.
2012-03-04 10:11:58 +00:00
KHobbits
c3fa56322b Adding option to modify all users balances (including offline) /eco reset ** <amount> 2012-03-04 09:20:03 +00:00
KHobbits
53cfab229b Half-revert double backflip. 10 points.
(op prefix changes that md-5 broke, thinking I broke op prefixes)
2012-03-04 08:18:25 +00:00
KHobbits
b62217f301 Merge branch 'master' of github.com:essentials/Essentials 2012-03-04 08:13:29 +00:00
md_5
d9a8453995 Fix op colours, which KHobbits broke! 2012-03-04 15:43:00 +11:00
snowleo
e6181928e8 Cleanup of /spawnmob 2012-03-03 17:01:53 +01:00
ElgarL
c33499797e Minor change to globalgroups 2012-03-03 14:03:52 +00:00
KHobbits
860f6a41ac Merge branch 'master' of github.com:essentials/Essentials 2012-03-03 13:49:26 +00:00
KHobbits
8aa7b1f301 Update CB #2032 B #1377
Min CB #2015
2012-03-03 13:48:58 +00:00
ElgarL
6efd3eaa27 Fix a silly logic error when testing bukkit perms 2012-03-03 13:47:59 +00:00
ElgarL
d2d8d191da Minor optimization when checking bukkit permissions. 2012-03-03 13:00:17 +00:00
md-5
cea5c81d44 Merge pull request #56 from Iaccidentally/patch-4
Allow spawning baby villagers and ocelots
2012-03-03 00:34:00 -08:00
md-5
504f28df1a Merge pull request #55 from chrisward/master
Just a really small cleanup
2012-03-03 00:31:48 -08:00
Chris Ward
74a57553f6 Cleanup
Signed-off-by: Chris Ward <chris@chrisgward.com>
2012-03-03 19:21:27 +11:00
Iaccidentally
35576ab64a add little babbys 2012-03-03 03:04:54 -05:00
KHobbits
33605517ff Capital case for formatting. 2012-03-03 07:09:41 +00:00
Chris Ward
6da6e4d2e8 Cleanup
Signed-off-by: Chris Ward <chris@chrisgward.com>
2012-03-03 18:07:43 +11:00
KHobbits
c0fa03ede2 Force all kits to lowercase. 2012-03-03 07:03:54 +00:00
KHobbits
301b609e93 *make it look like i'm doing something* 2012-03-03 05:27:02 +00:00
KHobbits
b6bbe237ea I think switches are better. 2012-03-03 05:09:03 +00:00
KHobbits
de7ab13c03 Only update displayname on world change, not every teleport. 2012-03-02 19:05:30 +00:00
KHobbits
7a0f4da860 Extra command aliases 2012-03-02 17:05:55 +00:00
KHobbits
1bbbfe1c96 Make the antioch message optional. 2012-03-02 17:03:34 +00:00
KHobbits
25ebe68389 Entity event cleanup 2012-03-02 16:54:12 +00:00
KHobbits
7737d19c5a Shouldn't really be canceling events at priority monitor, oops. 2012-03-02 16:33:20 +00:00
KHobbits
622ca4bf8a Don't think we need animation event anymore. 2012-03-02 16:29:06 +00:00
KHobbits
b090afbeb3 Merge pull request #54 from Iaccidentally/patch-3
update messages.properties for the new bukkit download link (ci.bukkit,o...
2012-03-01 20:15:16 -08:00
Iaccidentally
dce149511e update messages.properties for the new bukkit download link (ci.bukkit,org no longer works) 2012-03-01 23:10:32 -05:00
snowleo
21a248e94d Will be removed until the next release XD 2012-03-02 01:30:52 +01:00
snowleo
f1aed4b521 Better cats 2012-03-02 00:40:50 +01:00
snowleo
7564ebf79e Fix world heights 2012-03-02 00:18:31 +01:00
snowleo
b9aecbe1d4 Min version CB# 2004 2012-03-02 00:12:22 +01:00
snowleo
49eb451a76 New eggs 2012-03-02 00:09:50 +01:00
snowleo
64d866a77d New Entities and Items for 1.2 2012-03-02 00:06:57 +01:00
snowleo
f75779aa7a CB#2004 B#1368 2012-03-01 23:57:34 +01:00
411 changed files with 28531 additions and 17864 deletions

View File

@@ -3,6 +3,5 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/bukkit-0.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/Permissions3.jar"/>
</classpath>

85
.gitignore vendored
View File

@@ -1,42 +1,47 @@
.DS_Store
/BuildAll/nbproject/private/
/EssentialsProtect/nbproject/private/
/EssentialsChat/nbproject/private/
/EssentialsGroupBridge/nbproject/private/
/EssentialsGeoIP/nbproject/private/
/EssentialsSpawn/nbproject/private/
/EssentialsXMPP/nbproject/private/
/EssentialsGroupManager/nbproject/private/
/BuildAll/build/
/EssentialsGroupBridge/dist/
/EssentialsGroupBridge/build/
/EssentialsGeoIP/dist/
/EssentialsGeoIP/build/
/EssentialsGroupManager/build/
/EssentialsGroupManager/dist/
/BuildAll/dist/
/EssentialsChat/build/
/EssentialsChat/dist/
/EssentialsSpawn/build/
/EssentialsSpawn/dist/
/EssentialsXMPP/dist/
/EssentialsXMPP/build/
/EssentialsProtect/dist/
/EssentialsProtect/build/
/EssentialsPermissionsCommands/nbproject/private/
/EssentialsPermissionsCommands/build/
/EssentialsPermissionsCommands/dist/
/Essentials/nbproject/private/
/Essentials/dist/
/Essentials/build/
/YamlAnnotations/
/EssentialsUpdate/nbproject/private/
/EssentialsRelease/
/EssentialsUpdate/dist/
/EssentialsUpdate/build/
/WebPush/apikey.php
/WebPush/nbproject/private
/.idea
.DS_Store
/BuildAll/nbproject/private/
/EssentialsProtect/nbproject/private/
/EssentialsChat/nbproject/private/
/EssentialsGroupBridge/nbproject/private/
/EssentialsGeoIP/nbproject/private/
/EssentialsSpawn/nbproject/private/
/EssentialsXMPP/nbproject/private/
/EssentialsGroupManager/nbproject/private/
/BuildAll/build/
/EssentialsGroupBridge/dist/
/EssentialsGroupBridge/build/
/EssentialsGeoIP/dist/
/EssentialsGeoIP/build/
/EssentialsGroupManager/build/
/EssentialsGroupManager/dist/
/BuildAll/dist/
/EssentialsChat/build/
/EssentialsChat/dist/
/EssentialsSpawn/build/
/EssentialsSpawn/dist/
/EssentialsXMPP/dist/
/EssentialsXMPP/build/
/EssentialsProtect/dist/
/EssentialsProtect/build/
/EssentialsPermissionsCommands/nbproject/private/
/EssentialsPermissionsCommands/build/
/EssentialsPermissionsCommands/dist/
/Essentials/nbproject/private/
/Essentials/dist/
/Essentials/build/
/YamlAnnotations/
/EssentialsUpdate/nbproject/private/
/EssentialsRelease/
/EssentialsUpdate/dist/
/EssentialsUpdate/build/
/WebPush/apikey.php
/WebPush/nbproject/private
/.idea
*.iml
/EssentialsGroupManager/bin
/EssentialsGroupManager/.externalToolBuilders
/EssentialsGroupManager/.externalToolBuilders
/EssentialsAntiBuild/nbproject/private/
/EssentialsAntiBuild/dist/
/EssentialsAntiBuild/build/
/jars
/out

View File

@@ -12,9 +12,9 @@ is divided into following sections:
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- test compilation
- test execution
- test debugging
- applet
- cleanup
@@ -181,6 +181,7 @@ is divided into following sections:
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="run.jvmargs.ide" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
@@ -225,6 +226,27 @@ is divided into following sections:
<property name="jar.index.metainf" value="${jar.index}"/>
<property name="copylibs.rebase" value="true"/>
<available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
<condition property="junit.available">
<or>
<available classname="org.junit.Test" classpath="${run.test.classpath}"/>
<available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
</or>
</condition>
<condition property="testng.available">
<available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
</condition>
<condition property="junit+testng.available">
<and>
<istrue value="${junit.available}"/>
<istrue value="${testng.available}"/>
</and>
</condition>
<condition else="testng" property="testng.mode" value="mixed">
<istrue value="${junit+testng.available}"/>
</condition>
<condition else="" property="testng.debug.mode" value="-mixed">
<istrue value="${junit+testng.available}"/>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
@@ -357,11 +379,52 @@ is divided into following sections:
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<target if="${junit.available}" name="-init-macrodef-junit-init">
<condition else="false" property="nb.junit.batch" value="true">
<and>
<istrue value="${junit.available}"/>
<not>
<isset property="test.method"/>
</not>
</and>
</condition>
<condition else="false" property="nb.junit.single" value="true">
<and>
<istrue value="${junit.available}"/>
<isset property="test.method"/>
</and>
</condition>
</target>
<target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
@@ -370,32 +433,270 @@ is divided into following sections:
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-ea"/>
<jvmarg line="${run.jvmargs}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
<target name="-profile-pre-init">
<target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
<target if="${testng.available}" name="-init-macrodef-testng">
<macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
<isset property="test.method"/>
</condition>
<union id="test.set">
<fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="BuildAll" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<customize/>
</testng>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-test-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<echo>No tests executed.</echo>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</j2seproject3:junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</j2seproject3:testng>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
<macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<sequential>
<j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
</customize>
</j2seproject3:test-impl>
</sequential>
</macrodef>
</target>
<target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
<macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</j2seproject3:junit-debug>
</sequential>
</macrodef>
</target>
<target if="${testng.available}" name="-init-macrodef-testng-debug">
<macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<element name="customize2" optional="true"/>
<sequential>
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
<isset property="test.method"/>
</condition>
<condition else="-suitename BuildAll -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
<matches pattern=".*\.xml" string="@{testClass}"/>
</condition>
<delete dir="${build.test.results.dir}" quiet="true"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
<customize>
<customize2/>
<jvmarg value="-ea"/>
<arg line="${testng.debug.mode}"/>
<arg line="-d ${build.test.results.dir}"/>
<arg line="-listener org.testng.reporters.VerboseReporter"/>
<arg line="${testng.cmd.args}"/>
</customize>
</j2seproject3:debug>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
<macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<element implicit="true" name="customize2" optional="true"/>
<sequential>
<j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
<customize2/>
</j2seproject3:testng-debug>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<sequential>
<j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
</customize>
</j2seproject3:test-debug-impl>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<sequential>
<j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
<customize2>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</customize2>
</j2seproject3:testng-debug-impl>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
<!--
pre NB7.2 profiling section; consider it deprecated
-->
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-profile-post-init">
<target if="profiler.info.jvmargs.agent" name="-profile-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-profile-init-macrodef-profile">
<target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
<macrodef name="resolve">
<attribute name="name"/>
<attribute name="value"/>
@@ -427,10 +728,13 @@ is divided into following sections:
</sequential>
</macrodef>
</target>
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
<fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
<fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
</target>
<!--
end of pre NB7.2 profiling section
-->
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
@@ -488,6 +792,7 @@ is divided into following sections:
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -504,6 +809,7 @@ is divided into following sections:
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${run.classpath}" name="classpath"/>
<attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
@@ -511,6 +817,7 @@ is divided into following sections:
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -537,6 +844,9 @@ is divided into following sections:
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<filtermapper>
<replacestring from=" " to="%20"/>
</filtermapper>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
@@ -582,7 +892,7 @@ is divided into following sections:
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
<target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
<target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
<!--
===================
COMPILATION SECTION
@@ -638,6 +948,13 @@ is divided into following sections:
<param name="call.target" value="jar"/>
<param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
</antcall>
<antcall target="-maybe-call-dep">
<param name="call.built.properties" value="${built-jar.properties}"/>
<param location="${project.EssentialsAntiBuild}" name="call.subproject"/>
<param location="${project.EssentialsAntiBuild}/build.xml" name="call.script"/>
<param name="call.target" value="jar"/>
<param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
</antcall>
<antcall target="-maybe-call-dep">
<param name="call.built.properties" value="${built-jar.properties}"/>
<param location="${project.EssentialsProtect}" name="call.subproject"/>
@@ -854,7 +1171,11 @@ is divided into following sections:
PROFILING SECTION
=================
-->
<target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
<!--
pre NB7.2 profiler integration
-->
<target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.classpath}"/>
@@ -862,8 +1183,9 @@ is divided into following sections:
</nbprofiledirect>
<profile/>
</target>
<target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
<target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
<fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.classpath}"/>
@@ -871,12 +1193,8 @@ is divided into following sections:
</nbprofiledirect>
<profile classname="${profile.class}"/>
</target>
<!--
=========================
APPLET PROFILING SECTION
=========================
-->
<target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
<target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.classpath}"/>
@@ -888,12 +1206,8 @@ is divided into following sections:
</customize>
</profile>
</target>
<!--
=========================
TESTS PROFILING SECTION
=========================
-->
<target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
<target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.test.classpath}"/>
@@ -915,6 +1229,42 @@ is divided into following sections:
<formatter type="xml"/>
</junit>
</target>
<!--
end of pre NB72 profiling section
-->
<target if="netbeans.home" name="-profile-check">
<condition property="profiler.configured">
<or>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
</or>
</condition>
</target>
<target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
<startprofiler/>
<antcall target="run"/>
</target>
<target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<startprofiler/>
<antcall target="run-single"/>
</target>
<target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
<target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<startprofiler/>
<antcall target="test-single"/>
</target>
<target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<startprofiler/>
<antcal target="run-test-with-main"/>
</target>
<target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<startprofiler/>
<antcall target="run-applet"/>
</target>
<!--
===============
JAVADOC SECTION
@@ -958,7 +1308,7 @@ is divided into following sections:
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
TEST COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
@@ -1001,14 +1351,14 @@ is divided into following sections:
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
TEST EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
<j2seproject3:test testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
@@ -1021,39 +1371,40 @@ is divided into following sections:
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
<j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
<fail unless="test.class">Must select some files in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
<!--
=======================
JUNIT DEBUGGING SECTION
TEST DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
@@ -1140,6 +1491,13 @@ is divided into following sections:
<param name="call.target" value="clean"/>
<param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
</antcall>
<antcall target="-maybe-call-dep">
<param name="call.built.properties" value="${built-clean.properties}"/>
<param location="${project.EssentialsAntiBuild}" name="call.subproject"/>
<param location="${project.EssentialsAntiBuild}/build.xml" name="call.script"/>
<param name="call.target" value="clean"/>
<param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
</antcall>
<antcall target="-maybe-call-dep">
<param name="call.built.properties" value="${built-clean.properties}"/>
<param location="${project.EssentialsProtect}" name="call.subproject"/>
@@ -1174,9 +1532,12 @@ is divided into following sections:
<target name="-check-call-dep">
<property file="${call.built.properties}" prefix="already.built."/>
<condition property="should.call.dep">
<not>
<isset property="already.built.${call.subproject}"/>
</not>
<and>
<not>
<isset property="already.built.${call.subproject}"/>
</not>
<available file="${call.script}"/>
</and>
</condition>
</target>
<target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">

View File

@@ -1,8 +1,8 @@
build.xml.data.CRC32=51b33957
build.xml.data.CRC32=b4df970c
build.xml.script.CRC32=7a797370
build.xml.stylesheet.CRC32=28e38971@1.44.1.45
build.xml.stylesheet.CRC32=28e38971@1.50.3.46
# 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=c5170bed
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
nbproject/build-impl.xml.data.CRC32=b4df970c
nbproject/build-impl.xml.script.CRC32=8905537e
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46

View File

@@ -66,6 +66,7 @@ jar.compress=true
javac.classpath=\
${reference.Essentials.jar}:\
${reference.EssentialsChat.jar}:\
${reference.EssentialsAntiBuild.jar}:\
${reference.EssentialsProtect.jar}:\
${reference.EssentialsSpawn.jar}:\
${reference.EssentialsGeoIP.jar}:\
@@ -103,6 +104,7 @@ project.EssentialsChat=../EssentialsChat
project.EssentialsGeoIP=../EssentialsGeoIP
project.EssentialsGroupBridge=../EssentialsGroupBridge
project.EssentialsGroupManager=../EssentialsGroupManager
project.EssentialsAntiBuild=../EssentialsAntiBuild
project.EssentialsProtect=../EssentialsProtect
project.EssentialsSpawn=../EssentialsSpawn
project.EssentialsXMPP=../EssentialsXMPP
@@ -111,6 +113,7 @@ reference.EssentialsChat.jar=${project.EssentialsChat}/dist/EssentialsChat.jar
reference.EssentialsGeoIP.jar=${project.EssentialsGeoIP}/dist/EssentialsGeoIP.jar
reference.EssentialsGroupBridge.jar=${project.EssentialsGroupBridge}/dist/EssentialsGroupBridge.jar
reference.EssentialsGroupManager.jar=${project.EssentialsGroupManager}/dist/EssentialsGroupManager.jar
reference.EssentialsAntiBuild.jar=${project.EssentialsAntiBuild}/dist/EssentialsAntiBuild.jar
reference.EssentialsProtect.jar=${project.EssentialsProtect}/dist/EssentialsProtect.jar
reference.EssentialsSpawn.jar=${project.EssentialsSpawn}/dist/EssentialsSpawn.jar
reference.EssentialsXMPP.jar=${project.EssentialsXMPP}/dist/EssentialsXMPP.jar

View File

@@ -55,6 +55,14 @@
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
<reference>
<foreign-project>EssentialsAntiBuild</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
<reference>
<foreign-project>EssentialsProtect</foreign-project>
<artifact-type>jar</artifact-type>

View File

@@ -12,9 +12,9 @@ is divided into following sections:
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- test compilation
- test execution
- test debugging
- applet
- cleanup
@@ -181,6 +181,7 @@ is divided into following sections:
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="run.jvmargs.ide" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
@@ -225,6 +226,27 @@ is divided into following sections:
<property name="jar.index.metainf" value="${jar.index}"/>
<property name="copylibs.rebase" value="true"/>
<available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
<condition property="junit.available">
<or>
<available classname="org.junit.Test" classpath="${run.test.classpath}"/>
<available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
</or>
</condition>
<condition property="testng.available">
<available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
</condition>
<condition property="junit+testng.available">
<and>
<istrue value="${junit.available}"/>
<istrue value="${testng.available}"/>
</and>
</condition>
<condition else="testng" property="testng.mode" value="mixed">
<istrue value="${junit+testng.available}"/>
</condition>
<condition else="" property="testng.debug.mode" value="-mixed">
<istrue value="${junit+testng.available}"/>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
@@ -357,11 +379,52 @@ is divided into following sections:
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<target if="${junit.available}" name="-init-macrodef-junit-init">
<condition else="false" property="nb.junit.batch" value="true">
<and>
<istrue value="${junit.available}"/>
<not>
<isset property="test.method"/>
</not>
</and>
</condition>
<condition else="false" property="nb.junit.single" value="true">
<and>
<istrue value="${junit.available}"/>
<isset property="test.method"/>
</and>
</condition>
</target>
<target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
@@ -370,32 +433,270 @@ is divided into following sections:
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-ea"/>
<jvmarg line="${run.jvmargs}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
<target name="-profile-pre-init">
<target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
<target if="${testng.available}" name="-init-macrodef-testng">
<macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
<isset property="test.method"/>
</condition>
<union id="test.set">
<fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="Essentials" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<customize/>
</testng>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-test-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<echo>No tests executed.</echo>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</j2seproject3:junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</j2seproject3:testng>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
<macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<sequential>
<j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
</customize>
</j2seproject3:test-impl>
</sequential>
</macrodef>
</target>
<target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
<macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</j2seproject3:junit-debug>
</sequential>
</macrodef>
</target>
<target if="${testng.available}" name="-init-macrodef-testng-debug">
<macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<element name="customize2" optional="true"/>
<sequential>
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
<isset property="test.method"/>
</condition>
<condition else="-suitename Essentials -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
<matches pattern=".*\.xml" string="@{testClass}"/>
</condition>
<delete dir="${build.test.results.dir}" quiet="true"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
<customize>
<customize2/>
<jvmarg value="-ea"/>
<arg line="${testng.debug.mode}"/>
<arg line="-d ${build.test.results.dir}"/>
<arg line="-listener org.testng.reporters.VerboseReporter"/>
<arg line="${testng.cmd.args}"/>
</customize>
</j2seproject3:debug>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
<macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<element implicit="true" name="customize2" optional="true"/>
<sequential>
<j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
<customize2/>
</j2seproject3:testng-debug>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<sequential>
<j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
</customize>
</j2seproject3:test-debug-impl>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<sequential>
<j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
<customize2>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</customize2>
</j2seproject3:testng-debug-impl>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
<!--
pre NB7.2 profiling section; consider it deprecated
-->
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-profile-post-init">
<target if="profiler.info.jvmargs.agent" name="-profile-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-profile-init-macrodef-profile">
<target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
<macrodef name="resolve">
<attribute name="name"/>
<attribute name="value"/>
@@ -427,10 +728,13 @@ is divided into following sections:
</sequential>
</macrodef>
</target>
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
<fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
<fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
</target>
<!--
end of pre NB7.2 profiling section
-->
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
@@ -488,6 +792,7 @@ is divided into following sections:
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -504,6 +809,7 @@ is divided into following sections:
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${run.classpath}" name="classpath"/>
<attribute default="jvm" name="jvm"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
@@ -511,6 +817,7 @@ is divided into following sections:
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
<jvmarg line="${run.jvmargs}"/>
<jvmarg line="${run.jvmargs.ide}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -537,6 +844,9 @@ is divided into following sections:
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<filtermapper>
<replacestring from=" " to="%20"/>
</filtermapper>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
@@ -582,7 +892,7 @@ is divided into following sections:
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
<target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
<target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
<!--
===================
COMPILATION SECTION
@@ -805,7 +1115,11 @@ is divided into following sections:
PROFILING SECTION
=================
-->
<target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
<!--
pre NB7.2 profiler integration
-->
<target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.classpath}"/>
@@ -813,8 +1127,9 @@ is divided into following sections:
</nbprofiledirect>
<profile/>
</target>
<target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
<target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
<fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.classpath}"/>
@@ -822,12 +1137,8 @@ is divided into following sections:
</nbprofiledirect>
<profile classname="${profile.class}"/>
</target>
<!--
=========================
APPLET PROFILING SECTION
=========================
-->
<target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
<target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.classpath}"/>
@@ -839,12 +1150,8 @@ is divided into following sections:
</customize>
</profile>
</target>
<!--
=========================
TESTS PROFILING SECTION
=========================
-->
<target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
<target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.test.classpath}"/>
@@ -866,6 +1173,42 @@ is divided into following sections:
<formatter type="xml"/>
</junit>
</target>
<!--
end of pre NB72 profiling section
-->
<target if="netbeans.home" name="-profile-check">
<condition property="profiler.configured">
<or>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
</or>
</condition>
</target>
<target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
<startprofiler/>
<antcall target="run"/>
</target>
<target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<startprofiler/>
<antcall target="run-single"/>
</target>
<target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
<target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<startprofiler/>
<antcall target="test-single"/>
</target>
<target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<startprofiler/>
<antcal target="run-test-with-main"/>
</target>
<target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<startprofiler/>
<antcall target="run-applet"/>
</target>
<!--
===============
JAVADOC SECTION
@@ -909,7 +1252,7 @@ is divided into following sections:
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
TEST COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
@@ -952,14 +1295,14 @@ is divided into following sections:
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
TEST EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
<j2seproject3:test testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
@@ -972,39 +1315,40 @@ is divided into following sections:
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
<j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
<fail unless="test.class">Must select some files in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
<!--
=======================
JUNIT DEBUGGING SECTION
TEST DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
@@ -1076,9 +1420,12 @@ is divided into following sections:
<target name="-check-call-dep">
<property file="${call.built.properties}" prefix="already.built."/>
<condition property="should.call.dep">
<not>
<isset property="already.built.${call.subproject}"/>
</not>
<and>
<not>
<isset property="already.built.${call.subproject}"/>
</not>
<available file="${call.script}"/>
</and>
</condition>
</target>
<target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">

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=a9f8842a
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46
nbproject/build-impl.xml.script.CRC32=7c507372
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.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

View File

@@ -1,5 +1,5 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.enabled.in.editor=true
annotation.processing.processors.list=lombok.core.AnnotationProcessor
annotation.processing.run.all.processors=false
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
@@ -68,7 +68,6 @@ 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
@@ -79,6 +78,7 @@ 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
file.reference.SimplyPerms.jar=../lib/SimplyPerms.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
@@ -96,12 +96,12 @@ javac.classpath=\
${file.reference.lombok.jar}:\
${reference.EssentialsGroupManager.jar}:\
${file.reference.bukkit.jar}:\
${file.reference.craftbukkit.jar}:\
${file.reference.Vault.jar}:\
${file.reference.Privileges.jar}:\
${file.reference.bpermissions2.jar}
${file.reference.bpermissions2.jar}:\
${file.reference.SimplyPerms.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.compilerargs=-Xlint:unchecked
javac.deprecation=false
javac.processorpath=\
${javac.classpath}

18
Essentials/src/book.txt Normal file
View File

@@ -0,0 +1,18 @@
This is the book file.
This file format works similar to the info.txt, motd.txt and rules.txt
Place content in here that you would like to be used by books ingame.
You can use this content by using the book:<section> meta option in kits or item spawning.
#Colors
Minecraft colors:
&0 &&0 &1 &&1 &2 &&2 &3 &&3
&4 &&4 &5 &&5 &6 &&6 &7 &&7
&8 &&8 &9 &&9 &a &&a &b &&b
&c &&c &d &&d &e &&e &f &&f
&0
&&k &kMagic&r &&l &lBold
&&m &mStrike&r &&n &nUline
&&o &oItalic&r &&r &rReset

View File

@@ -121,13 +121,14 @@ public class AlternativeCommandsHandler
return commands.get(0);
}
public void executed(final String label, final String otherLabel)
public void executed(final String label, final PluginCommand pc)
{
final String altString = pc.getPlugin().getName() + ":" + pc.getLabel();
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Essentials: Alternative command " + label + " found, using " + otherLabel);
LOGGER.log(Level.INFO, "Essentials: Alternative command " + label + " found, using " + altString);
}
disabledList.put(label, otherLabel);
disabledList.put(label, altString);
}
public Map<String, String> disabledCommands()

View File

@@ -61,12 +61,18 @@ public class Backup implements Runnable
{
return;
}
if ("save-all".equalsIgnoreCase(command)) {
final CommandSender cs = server.getConsoleSender();
server.dispatchCommand(cs, "save-all");
active = false;
return;
}
LOGGER.log(Level.INFO, _("backupStarted"));
final CommandSender cs = server.getConsoleSender();
server.dispatchCommand(cs, "save-all");
server.dispatchCommand(cs, "save-off");
ess.scheduleAsyncDelayedTask(
ess.runTaskAsynchronously(
new Runnable()
{
@Override

View File

@@ -6,12 +6,11 @@ import java.util.*;
/**
* This utility class is used for converting between the ingame
* time in ticks to ingame time as a friendly string.
* Note that the time is INGAME.
*
* This utility class is used for converting between the ingame time in ticks to ingame time as a friendly string. Note
* that the time is INGAME.
*
* http://www.minecraftwiki.net/wiki/Day/night_cycle
*
*
* @author Olof Larsson
*/
public final class DescParseTickFormat
@@ -156,30 +155,31 @@ public final class DescParseTickFormat
int hours = 0;
int minutes = 0;
desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", "");
desc = desc.toLowerCase(Locale.ENGLISH);
String parsetime = desc.replaceAll("[^0-9]", "");
if (desc.length() > 4)
if (parsetime.length() > 4)
{
throw new NumberFormatException();
}
if (desc.length() == 4)
if (parsetime.length() == 4)
{
hours += Integer.parseInt(desc.substring(0, 2));
minutes += Integer.parseInt(desc.substring(2, 4));
hours += Integer.parseInt(parsetime.substring(0, 2));
minutes += Integer.parseInt(parsetime.substring(2, 4));
}
else if (desc.length() == 3)
else if (parsetime.length() == 3)
{
hours += Integer.parseInt(desc.substring(0, 1));
minutes += Integer.parseInt(desc.substring(1, 3));
hours += Integer.parseInt(parsetime.substring(0, 1));
minutes += Integer.parseInt(parsetime.substring(1, 3));
}
else if (desc.length() == 2)
else if (parsetime.length() == 2)
{
hours += Integer.parseInt(desc.substring(0, 2));
hours += Integer.parseInt(parsetime.substring(0, 2));
}
else if (desc.length() == 1)
else if (parsetime.length() == 1)
{
hours += Integer.parseInt(desc.substring(0, 1));
hours += Integer.parseInt(parsetime.substring(0, 1));
}
else
{
@@ -269,11 +269,11 @@ public final class DescParseTickFormat
// How many ingame days have passed since the server start?
final long days = ticks / ticksPerDay;
ticks = ticks - days * ticksPerDay;
ticks -= days * ticksPerDay;
// How many hours on the last day?
final long hours = ticks / ticksPerHour;
ticks = ticks - hours * ticksPerHour;
ticks -= hours * ticksPerHour;
// How many minutes on the last day?
final long minutes = (long)Math.floor(ticks / ticksPerMinute);

View File

@@ -5,66 +5,144 @@ import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Pattern;
import org.bukkit.enchantments.Enchantment;
public class Enchantments
{
private static final transient Pattern NUMPATTERN = Pattern.compile("\\d+");
private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>();
private static final Map<String, Enchantment> ALIASENCHANTMENTS = new HashMap<String, Enchantment>();
static
{
ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL);
ENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL);
ALIASENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL);
ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL);
ENCHANTMENTS.put("arthropodsdamage", Enchantment.DAMAGE_ARTHROPODS);
ALIASENCHANTMENTS.put("sharp", Enchantment.DAMAGE_ALL);
ALIASENCHANTMENTS.put("dal", Enchantment.DAMAGE_ALL);
ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS);
ENCHANTMENTS.put("baneofarthropods", Enchantment.DAMAGE_ARTHROPODS);
ALIASENCHANTMENTS.put("baneofarthropod", Enchantment.DAMAGE_ARTHROPODS);
ALIASENCHANTMENTS.put("arthropod", Enchantment.DAMAGE_ARTHROPODS);
ALIASENCHANTMENTS.put("dar", Enchantment.DAMAGE_ARTHROPODS);
ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD);
ENCHANTMENTS.put("smite", Enchantment.DAMAGE_UNDEAD);
ALIASENCHANTMENTS.put("du", Enchantment.DAMAGE_UNDEAD);
ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED);
ENCHANTMENTS.put("efficiency", Enchantment.DIG_SPEED);
ALIASENCHANTMENTS.put("minespeed", Enchantment.DIG_SPEED);
ALIASENCHANTMENTS.put("cutspeed", Enchantment.DIG_SPEED);
ALIASENCHANTMENTS.put("ds", Enchantment.DIG_SPEED);
ALIASENCHANTMENTS.put("eff", Enchantment.DIG_SPEED);
ENCHANTMENTS.put("durability", Enchantment.DURABILITY);
ENCHANTMENTS.put("dura", Enchantment.DURABILITY);
ALIASENCHANTMENTS.put("dura", Enchantment.DURABILITY);
ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY);
ALIASENCHANTMENTS.put("d", Enchantment.DURABILITY);
ENCHANTMENTS.put("thorns", Enchantment.THORNS);
ENCHANTMENTS.put("highcrit", Enchantment.THORNS);
ALIASENCHANTMENTS.put("thorn", Enchantment.THORNS);
ALIASENCHANTMENTS.put("highercrit", Enchantment.THORNS);
ALIASENCHANTMENTS.put("t", Enchantment.THORNS);
ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT);
ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT);
ALIASENCHANTMENTS.put("meleefire", Enchantment.FIRE_ASPECT);
ALIASENCHANTMENTS.put("meleeflame", Enchantment.FIRE_ASPECT);
ALIASENCHANTMENTS.put("fa", Enchantment.FIRE_ASPECT);
ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK);
ENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS);
ALIASENCHANTMENTS.put("kback", Enchantment.KNOCKBACK);
ALIASENCHANTMENTS.put("kb", Enchantment.KNOCKBACK);
ALIASENCHANTMENTS.put("k", Enchantment.KNOCKBACK);
ALIASENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS);
ENCHANTMENTS.put("fortune", Enchantment.LOOT_BONUS_BLOCKS);
ENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS);
ALIASENCHANTMENTS.put("fort", Enchantment.LOOT_BONUS_BLOCKS);
ALIASENCHANTMENTS.put("lbb", Enchantment.LOOT_BONUS_BLOCKS);
ALIASENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS);
ENCHANTMENTS.put("mobloot", Enchantment.LOOT_BONUS_MOBS);
ENCHANTMENTS.put("looting", Enchantment.LOOT_BONUS_MOBS);
ENCHANTMENTS.put("oxygen", Enchantment.OXYGEN);
ALIASENCHANTMENTS.put("lbm", Enchantment.LOOT_BONUS_MOBS);
ALIASENCHANTMENTS.put("oxygen", Enchantment.OXYGEN);
ENCHANTMENTS.put("respiration", Enchantment.OXYGEN);
ALIASENCHANTMENTS.put("breathing", Enchantment.OXYGEN);
ENCHANTMENTS.put("breath", Enchantment.OXYGEN);
ALIASENCHANTMENTS.put("o", Enchantment.OXYGEN);
ENCHANTMENTS.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL);
ENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL);
ENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS);
ENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS);
ENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS);
ENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL);
ALIASENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL);
ENCHANTMENTS.put("protect", Enchantment.PROTECTION_ENVIRONMENTAL);
ALIASENCHANTMENTS.put("p", Enchantment.PROTECTION_ENVIRONMENTAL);
ALIASENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS);
ALIASENCHANTMENTS.put("explosionprotection", Enchantment.PROTECTION_EXPLOSIONS);
ALIASENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS);
ALIASENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS);
ENCHANTMENTS.put("blastprotect", Enchantment.PROTECTION_EXPLOSIONS);
ALIASENCHANTMENTS.put("pe", Enchantment.PROTECTION_EXPLOSIONS);
ALIASENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL);
ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL);
ENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL);
ENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE);
ENCHANTMENTS.put("featherfall", Enchantment.PROTECTION_FALL);
ALIASENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL);
ALIASENCHANTMENTS.put("pfa", Enchantment.PROTECTION_FALL);
ALIASENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE);
ALIASENCHANTMENTS.put("flameprotection", Enchantment.PROTECTION_FIRE);
ENCHANTMENTS.put("fireprotect", Enchantment.PROTECTION_FIRE);
ALIASENCHANTMENTS.put("flameprotect", Enchantment.PROTECTION_FIRE);
ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE);
ALIASENCHANTMENTS.put("flameprot", Enchantment.PROTECTION_FIRE);
ALIASENCHANTMENTS.put("pf", Enchantment.PROTECTION_FIRE);
ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE);
ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE);
ALIASENCHANTMENTS.put("pp", Enchantment.PROTECTION_PROJECTILE);
ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH);
ALIASENCHANTMENTS.put("softtouch", Enchantment.SILK_TOUCH);
ALIASENCHANTMENTS.put("st", Enchantment.SILK_TOUCH);
ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER);
ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER);
ENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE);
ALIASENCHANTMENTS.put("watermine", Enchantment.WATER_WORKER);
ALIASENCHANTMENTS.put("ww", Enchantment.WATER_WORKER);
ALIASENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE);
ENCHANTMENTS.put("flame", Enchantment.ARROW_FIRE);
ENCHANTMENTS.put("flamearrow", Enchantment.ARROW_FIRE);
ALIASENCHANTMENTS.put("af", Enchantment.ARROW_FIRE);
ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE);
ENCHANTMENTS.put("power", Enchantment.ARROW_DAMAGE);
ALIASENCHANTMENTS.put("arrowpower", Enchantment.ARROW_DAMAGE);
ALIASENCHANTMENTS.put("ad", Enchantment.ARROW_DAMAGE);
ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("punch", Enchantment.ARROW_KNOCKBACK);
ALIASENCHANTMENTS.put("arrowpunch", Enchantment.ARROW_KNOCKBACK);
ALIASENCHANTMENTS.put("ak", Enchantment.ARROW_KNOCKBACK);
ALIASENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE);
ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE);
ENCHANTMENTS.put("infinity", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("infinite", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE);
}
public static Enchantment getByName(String name) {
Enchantment enchantment;
if (NUMPATTERN.matcher(name).matches()) {
if (Util.isInt(name)) {
enchantment = Enchantment.getById(Integer.parseInt(name));
} else {
enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH));
@@ -73,6 +151,10 @@ public class Enchantments
{
enchantment = ENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH));
}
if (enchantment == null)
{
enchantment = ALIASENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH));
}
return enchantment;
}

View File

@@ -20,10 +20,12 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.Economy;
import com.earth2me.essentials.api.IJails;
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.metrics.Metrics;
import com.earth2me.essentials.metrics.MetricsListener;
import com.earth2me.essentials.metrics.MetricsStarter;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import com.earth2me.essentials.signs.SignBlockListener;
@@ -32,25 +34,25 @@ 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.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.Bukkit;
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.command.SimpleCommandMap;
import org.bukkit.command.defaults.VanillaCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.world.WorldLoadEvent;
@@ -61,12 +63,13 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
public static final int BUKKIT_VERSION = 1988;
public static final int BUKKIT_VERSION = 2624;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
@@ -82,6 +85,10 @@ public class Essentials extends JavaPlugin implements IEssentials
private transient UserMap userMap;
private transient ExecuteTimer execTimer;
private transient I18n i18n;
private transient Metrics metrics;
private transient EssentialsTimer timer;
private transient List<String> vanishedPlayers = new ArrayList<String>();
private transient SimpleCommandMap scm;
@Override
public ISettings getSettings()
@@ -120,23 +127,27 @@ public class Essentials extends JavaPlugin implements IEssentials
i18n = new I18n(this);
i18n.onEnable();
execTimer.mark("I18n1");
scm = new SimpleCommandMap(this.getServer());
final PluginManager pm = getServer().getPluginManager();
for (Plugin plugin : pm.getPlugins())
{
if (plugin.getDescription().getName().startsWith("Essentials")
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion())
&& !plugin.getDescription().getName().equals("EssentialsAntiCheat"))
{
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
}
}
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());
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(1));
if (versionNumber < BUKKIT_VERSION && versionNumber > 100)
{
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
this.setEnabled(false);
return;
}
@@ -171,6 +182,8 @@ public class Essentials extends JavaPlugin implements IEssentials
itemDb = new ItemDb(this);
confList.add(itemDb);
execTimer.mark("Init(Worth/ItemDB)");
jails = new Jails(this);
confList.add(jails);
reload();
}
catch (YAMLException exception)
@@ -202,6 +215,40 @@ public class Essentials extends JavaPlugin implements IEssentials
backup = new Backup(this);
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 100, 100);
Economy.setEss(this);
execTimer.mark("RegHandler");
final MetricsStarter metricsStarter = new MetricsStarter(this);
if (metricsStarter.getStart() != null && metricsStarter.getStart() == true)
{
getScheduler().runTaskLaterAsynchronously(this, metricsStarter, 1);
}
else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false)
{
final MetricsListener metricsListener = new MetricsListener(this, metricsStarter);
pm.registerEvents(metricsListener, this);
}
final String timeroutput = execTimer.end();
if (getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
}
}
private void registerListeners(PluginManager pm)
{
HandlerList.unregisterAll(this);
if (getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Registering Listeners");
}
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
pm.registerEvents(serverListener, this);
confList.add(serverListener);
@@ -223,30 +270,27 @@ public class Essentials extends JavaPlugin implements IEssentials
final EssentialsEntityListener entityListener = new EssentialsEntityListener(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.registerEvents(tntListener, this);
final EssentialsTimer timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
Economy.setEss(this);
execTimer.mark("RegListeners");
final String timeroutput = execTimer.end();
if (getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
}
jails.resetListener();
}
@Override
public void onDisable()
{
for (Player p : getServer().getOnlinePlayers())
{
User user = getUser(p);
if (user.isVanished())
{
user.toggleVanished();
p.sendMessage(_("unvanishedReload"));
}
}
i18n.onDisable();
Economy.setEss(null);
Trade.closeLog();
@@ -264,6 +308,9 @@ public class Essentials extends JavaPlugin implements IEssentials
}
i18n.updateLocale(settings.getLocale());
final PluginManager pm = getServer().getPluginManager();
registerListeners(pm);
}
@Override
@@ -281,27 +328,14 @@ public class Essentials extends JavaPlugin implements IEssentials
final PluginCommand pc = alternativeCommandsHandler.getAlternative(commandLabel);
if (pc != null)
{
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
alternativeCommandsHandler.executed(commandLabel, pc);
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();
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
return true;
}
@@ -314,7 +348,6 @@ public class Essentials extends JavaPlugin implements IEssentials
if (sender instanceof Player)
{
user = getUser(sender);
LOGGER.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)));
}
// New mail notification
@@ -330,6 +363,16 @@ public class Essentials extends JavaPlugin implements IEssentials
// Check for disabled commands
if (getSettings().isCommandDisabled(commandLabel))
{
if (scm != null)
{
for (VanillaCommand cmd : scm.getFallbackCommands())
{
if (cmd.matches(commandLabel))
{
cmd.execute(sender, commandLabel, args);
}
}
}
return true;
}
@@ -355,6 +398,19 @@ public class Essentials extends JavaPlugin implements IEssentials
return true;
}
if (user != null && user.isJailed() && !user.isAuthorized(cmd, "essentials.jail.allow."))
{
if (user.getJailTimeout() > 0)
{
user.sendMessage(_("playerJailedFor", user.getName(), Util.formatDateDiff(user.getJailTimeout())));
}
else
{
user.sendMessage(_("jailMessage"));
}
return true;
}
// Run the command
try
{
@@ -435,6 +491,16 @@ public class Essentials extends JavaPlugin implements IEssentials
return backup;
}
public Metrics getMetrics()
{
return metrics;
}
public void setMetrics(Metrics metrics)
{
this.metrics = metrics;
}
@Override
public User getUser(final Object base)
{
@@ -444,16 +510,22 @@ public class Essentials extends JavaPlugin implements IEssentials
}
if (base instanceof String)
{
final User user = userMap.getUser((String)base);
if (user != null && user.getBase() instanceof OfflinePlayer)
{
((OfflinePlayer)user.getBase()).setName((String)base);
}
return user;
return getOfflineUser((String)base);
}
return null;
}
@Override
public User getOfflineUser(final String name)
{
final User user = userMap.getUser(name);
if (user != null && user.getBase() instanceof OfflinePlayer)
{
((OfflinePlayer)user.getBase()).setName(name);
}
return user;
}
private <T extends Player> User getUser(final T base)
{
if (base == null)
@@ -465,6 +537,13 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return (User)base;
}
if (userMap == null)
{
LOGGER.log(Level.WARNING, "Essentials userMap not initialized");
return null;
}
User user = userMap.getUser(base.getName());
if (user == null)
@@ -478,17 +557,6 @@ public class Essentials extends JavaPlugin implements IEssentials
return user;
}
@Override
public User getOfflineUser(final String name)
{
final User user = userMap.getUser(name);
if (user != null && user.getBase() instanceof OfflinePlayer)
{
((OfflinePlayer)user.getBase()).setName(name);
}
return user;
}
@Override
public World getWorld(final String name)
{
@@ -531,7 +599,7 @@ public class Essentials extends JavaPlugin implements IEssentials
for (Player player : players)
{
final User user = getUser(player);
if (!user.isIgnoredPlayer(sender.getName()))
if (!user.isIgnoredPlayer(sender))
{
player.sendMessage(message);
}
@@ -541,9 +609,14 @@ public class Essentials extends JavaPlugin implements IEssentials
}
@Override
public int scheduleAsyncDelayedTask(final Runnable run)
public BukkitTask runTaskAsynchronously(final Runnable run)
{
return this.getScheduler().scheduleAsyncDelayedTask(this, run);
return this.getScheduler().runTaskAsynchronously(this, run);
}
@Override
public BukkitTask runTaskLaterAsynchronously(final Runnable run, final long delay)
{
return this.getScheduler().runTaskLaterAsynchronously(this, run, delay);
}
@Override
@@ -599,15 +672,28 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return i18n;
}
private static class EssentialsWorldListener implements Listener, Runnable {
@Override
public EssentialsTimer getTimer()
{
return timer;
}
@Override
public List<String> getVanishedPlayers()
{
return vanishedPlayers;
}
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)
@@ -616,7 +702,8 @@ public class Essentials extends JavaPlugin implements IEssentials
ess.getWarps().reloadConfig();
for (IConf iConf : ((Essentials)ess).confList)
{
if (iConf instanceof IEssentialsModule) {
if (iConf instanceof IEssentialsModule)
{
iConf.reloadConfig();
}
}
@@ -629,7 +716,8 @@ public class Essentials extends JavaPlugin implements IEssentials
ess.getWarps().reloadConfig();
for (IConf iConf : ((Essentials)ess).confList)
{
if (iConf instanceof IEssentialsModule) {
if (iConf instanceof IEssentialsModule)
{
iConf.reloadConfig();
}
}

View File

@@ -17,23 +17,18 @@ public class EssentialsBlockListener implements Listener
this.ess = ess;
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled())
{
return;
}
final User user = ess.getUser(event.getPlayer());
// Do not rely on getItemInHand();
// http://leaky.bukkit.org/issues/663
// http://leaky.bukkit.org/issues/663
final ItemStack is = Util.convertBlockToItem(event.getBlockPlaced());
if (is == null)
{
return;
}
final boolean unlimitedForUser = user.hasUnlimited(is);
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
final User user = ess.getUser(event.getPlayer());
if (user.hasUnlimited(is) && user.getGameMode() == GameMode.SURVIVAL)
{
ess.scheduleSyncDelayedTask(
new Runnable()

View File

@@ -1,21 +1,24 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.google.common.io.Files;
import java.io.*;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.OfflinePlayer;
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.Vector;
public class EssentialsConf extends YamlConfiguration
@@ -24,14 +27,16 @@ public class EssentialsConf extends YamlConfiguration
private transient File configFile;
private transient String templateName = null;
private transient Class<?> resourceClass = EssentialsConf.class;
private static final Charset UTF8 = Charset.forName("UTF-8");
public EssentialsConf(final File configFile)
{
super();
this.configFile = configFile;
}
private final byte[] bytebuffer = new byte[1024];
public void load()
public synchronized void load()
{
configFile = configFile.getAbsoluteFile();
if (!configFile.getParentFile().exists())
@@ -86,33 +91,58 @@ public class EssentialsConf extends YamlConfiguration
}
else
{
try
{
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
if (!configFile.createNewFile())
{
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
}
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
}
return;
}
}
try
{
super.load(configFile);
}
catch (FileNotFoundException ex)
{
LOGGER.log(Level.SEVERE, null, ex);
final FileInputStream inputStream = new FileInputStream(configFile);
try
{
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
int length;
while ((length = inputStream.read(bytebuffer)) != -1)
{
buffer.put(bytebuffer, 0, length);
}
buffer.rewind();
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
CharsetDecoder decoder = UTF8.newDecoder();
CoderResult result = decoder.decode(buffer, data, true);
if (result.isError())
{
buffer.rewind();
data.clear();
LOGGER.log(Level.INFO, "File " + configFile.getAbsolutePath().toString() + " is not utf-8 encoded, trying " + Charset.defaultCharset().displayName());
decoder = Charset.defaultCharset().newDecoder();
result = decoder.decode(buffer, data, true);
if (result.isError())
{
throw new InvalidConfigurationException("Invalid Characters in file " + configFile.getAbsolutePath().toString());
}
else
{
decoder.flush(data);
}
}
else
{
decoder.flush(data);
}
final int end = data.position();
data.rewind();
super.loadFromString(data.subSequence(0, end).toString());
}
finally
{
inputStream.close();
}
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, null, ex);
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
catch (InvalidConfigurationException ex)
{
@@ -191,6 +221,69 @@ public class EssentialsConf extends YamlConfiguration
this.resourceClass = resClass;
}
public void save()
{
try
{
save(configFile);
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
}
public void saveWithError() throws IOException
{
save(configFile);
}
@Override
public synchronized void save(final File file) throws IOException
{
if (file == null)
{
throw new IllegalArgumentException("File cannot be null");
}
Files.createParentDirs(file);
final String data = saveToString();
if (data.length() == 0)
{
return;
}
if (!configFile.exists())
{
try
{
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
if (!configFile.createNewFile())
{
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
}
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
}
}
final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), UTF8);
try
{
writer.write(data);
}
finally
{
writer.close();
}
}
public boolean hasProperty(final String path)
{
return isSet(path);
@@ -275,53 +368,297 @@ public class EssentialsConf extends YamlConfiguration
set(path, map);
}
public long getLong(final String path, final long def)
public void setProperty(String path, List object)
{
try
{
final Number num = (Number)get(path);
return num == null ? def : num.longValue();
}
catch (ClassCastException ex)
{
return def;
}
set(path, new ArrayList(object));
}
public void setProperty(String path, Map object)
{
set(path, new LinkedHashMap(object));
}
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);
}
@Override
public double getDouble(final String path, final double def)
public synchronized Object get(String path)
{
try
{
Number num = (Number)get(path);
return num == null ? def : num.doubleValue();
}
catch (ClassCastException ex)
{
return def;
}
return super.get(path);
}
public void save() {
try
{
save(configFile);
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, null, ex);
}
@Override
public synchronized Object get(String path, Object def)
{
return super.get(path, def);
}
public Object getProperty(String path) {
return get(path);
@Override
public synchronized boolean getBoolean(String path)
{
return super.getBoolean(path);
}
public void setProperty(String path, Object object) {
set(path, object);
@Override
public synchronized boolean getBoolean(String path, boolean def)
{
return super.getBoolean(path, def);
}
public void removeProperty(String path) {
set(path, null);
@Override
public synchronized List<Boolean> getBooleanList(String path)
{
return super.getBooleanList(path);
}
@Override
public synchronized List<Byte> getByteList(String path)
{
return super.getByteList(path);
}
@Override
public synchronized List<Character> getCharacterList(String path)
{
return super.getCharacterList(path);
}
@Override
public synchronized ConfigurationSection getConfigurationSection(String path)
{
return super.getConfigurationSection(path);
}
@Override
public synchronized double getDouble(String path)
{
return super.getDouble(path);
}
@Override
public synchronized double getDouble(final String path, final double def)
{
return super.getDouble(path, def);
}
@Override
public synchronized List<Double> getDoubleList(String path)
{
return super.getDoubleList(path);
}
@Override
public synchronized List<Float> getFloatList(String path)
{
return super.getFloatList(path);
}
@Override
public synchronized int getInt(String path)
{
return super.getInt(path);
}
@Override
public synchronized int getInt(String path, int def)
{
return super.getInt(path, def);
}
@Override
public synchronized List<Integer> getIntegerList(String path)
{
return super.getIntegerList(path);
}
@Override
public synchronized ItemStack getItemStack(String path, ItemStack def)
{
return super.getItemStack(path, def);
}
@Override
public synchronized Set<String> getKeys(boolean deep)
{
return super.getKeys(deep);
}
@Override
public synchronized List<?> getList(String path)
{
return super.getList(path);
}
@Override
public synchronized List<?> getList(String path, List<?> def)
{
return super.getList(path, def);
}
@Override
public synchronized long getLong(String path)
{
return super.getLong(path);
}
@Override
public synchronized long getLong(final String path, final long def)
{
return super.getLong(path, def);
}
@Override
public synchronized List<Long> getLongList(String path)
{
return super.getLongList(path);
}
public synchronized Map<String, Object> getMap()
{
return map;
}
@Override
public synchronized List<Map<?, ?>> getMapList(String path)
{
return super.getMapList(path);
}
@Override
public synchronized OfflinePlayer getOfflinePlayer(String path)
{
return super.getOfflinePlayer(path);
}
@Override
public synchronized OfflinePlayer getOfflinePlayer(String path, OfflinePlayer def)
{
return super.getOfflinePlayer(path, def);
}
@Override
public synchronized List<Short> getShortList(String path)
{
return super.getShortList(path);
}
@Override
public synchronized String getString(String path)
{
return super.getString(path);
}
@Override
public synchronized String getString(String path, String def)
{
return super.getString(path, def);
}
@Override
public synchronized List<String> getStringList(String path)
{
return super.getStringList(path);
}
@Override
public synchronized Map<String, Object> getValues(boolean deep)
{
return super.getValues(deep);
}
@Override
public synchronized Vector getVector(String path)
{
return super.getVector(path);
}
@Override
public synchronized Vector getVector(String path, Vector def)
{
return super.getVector(path, def);
}
@Override
public synchronized boolean isBoolean(String path)
{
return super.isBoolean(path);
}
@Override
public synchronized boolean isConfigurationSection(String path)
{
return super.isConfigurationSection(path);
}
@Override
public synchronized boolean isDouble(String path)
{
return super.isDouble(path);
}
@Override
public synchronized boolean isInt(String path)
{
return super.isInt(path);
}
@Override
public synchronized boolean isItemStack(String path)
{
return super.isItemStack(path);
}
@Override
public synchronized boolean isList(String path)
{
return super.isList(path);
}
@Override
public synchronized boolean isLong(String path)
{
return super.isLong(path);
}
@Override
public synchronized boolean isOfflinePlayer(String path)
{
return super.isOfflinePlayer(path);
}
@Override
public synchronized boolean isSet(String path)
{
return super.isSet(path);
}
@Override
public synchronized boolean isString(String path)
{
return super.isString(path);
}
@Override
public synchronized boolean isVector(String path)
{
return super.isVector(path);
}
@Override
public synchronized void set(String path, Object value)
{
super.set(path, value);
}
}

View File

@@ -2,20 +2,21 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.List;
import java.util.logging.Level;
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.entity.*;
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.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.inventory.ItemStack;
public class EssentialsEntityListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final IEssentials ess;
public EssentialsEntityListener(IEssentials ess)
@@ -23,46 +24,100 @@ public class EssentialsEntityListener implements Listener
this.ess = ess;
}
@EventHandler(priority = EventPriority.LOWEST)
// This method does something undocumented reguarding certain bucket types #EasterEgg
@EventHandler(priority = EventPriority.LOW)
public void onEntityDamage(final EntityDamageByEntityEvent event)
{
final Entity eAttack = event.getDamager();
final Entity eDefend = event.getEntity();
if (eDefend instanceof Player && eAttack instanceof Player)
if (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())
if (eDefend instanceof Player)
{
for (String command : commandList)
onPlayerVsPlayerDamage(event, (Player)eDefend, attacker);
}
else if (eDefend instanceof Ageable)
{
final ItemStack hand = attacker.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET)
{
if (command != null && !command.isEmpty())
{
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
event.setCancelled(true);
return;
}
((Ageable)eDefend).setBaby();
hand.setType(Material.BUCKET);
attacker.setItemInHand(hand);
attacker.updateInventory();
event.setCancelled(true);
}
}
attacker.updateActivity(true);
}
else if (eDefend instanceof Animals && eAttack instanceof Player)
else if (eAttack instanceof Projectile && eDefend instanceof Player)
{
final User player = ess.getUser(eAttack);
final ItemStack hand = player.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET)
Entity shooter = ((Projectile)event.getDamager()).getShooter();
if (shooter instanceof Player)
{
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
player.updateInventory();
event.setCancelled(true);
final User attacker = ess.getUser(shooter);
onPlayerVsPlayerDamage(event, (Player)eDefend, attacker);
attacker.updateActivity(true);
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
private void onPlayerVsPlayerDamage(final EntityDamageByEntityEvent event, final Player defender, final User attacker)
{
if (ess.getSettings().getLoginAttackDelay() > 0 && !attacker.isAuthorized("essentials.pvpdelay.exempt")
&& (System.currentTimeMillis() < (attacker.getLastLogin() + ess.getSettings().getLoginAttackDelay())))
{
event.setCancelled(true);
}
if (!defender.equals(attacker.getBase()) && (attacker.hasInvulnerabilityAfterTeleport() || ess.getUser(defender).hasInvulnerabilityAfterTeleport()))
{
event.setCancelled(true);
}
if (attacker.isGodModeEnabled() && !attacker.isAuthorized("essentials.god.pvp"))
{
event.setCancelled(true);
}
if (attacker.isHidden() && !attacker.isAuthorized("essentials.vanish.pvp"))
{
event.setCancelled(true);
}
onPlayerVsPlayerPowertool(event, defender, attacker);
}
private void onPlayerVsPlayerPowertool(final EntityDamageByEntityEvent event, final Player defender, final User attacker)
{
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())
{
for (final String tempCommand : commandList)
{
final String command = tempCommand.replaceAll("\\{player\\}", defender.getName());
if (command != null && !command.isEmpty() && !command.equals(tempCommand))
{
ess.scheduleSyncDelayedTask(
new Runnable()
{
@Override
public void run()
{
attacker.getServer().dispatchCommand(attacker.getBase(), command);
LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", attacker.getName(), command));
}
});
event.setCancelled(true);
return;
}
}
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityDamage(final EntityDamageEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -74,7 +129,7 @@ public class EssentialsEntityListener implements Listener
}
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityCombust(final EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -98,16 +153,30 @@ public class EssentialsEntityListener implements Listener
}
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.LOW)
public void onPlayerDeathExpEvent(final PlayerDeathEvent event)
{
final User user = ess.getUser(event.getEntity());
if (user.isAuthorized("essentials.keepxp"))
{
event.setKeepLevel(true);
event.setDroppedExp(0);
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onFoodLevelChange(final FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
final Player player = (Player)event.getEntity();
player.setFoodLevel(20);
player.setSaturation(10);
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
@@ -116,4 +185,16 @@ public class EssentialsEntityListener implements Listener
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPotionSplashEvent(final PotionSplashEvent event)
{
for (LivingEntity entity : event.getAffectedEntities())
{
if (entity instanceof Player && ess.getUser(entity).isGodModeEnabled())
{
event.setIntensity(entity, 0d);
}
}
}
}

View File

@@ -6,36 +6,41 @@ import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.HumanEntity;
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.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
public class EssentialsPlayerListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient Server server;
private final transient IEssentials ess;
private static final int AIR = Material.AIR.getId();
private static final int BED = Material.BED_BLOCK.getId();
public EssentialsPlayerListener(final IEssentials parent)
{
this.ess = parent;
this.server = parent.getServer();
}
@EventHandler(priority = EventPriority.NORMAL)
@@ -43,14 +48,11 @@ public class EssentialsPlayerListener implements Listener
{
final User user = ess.getUser(event.getPlayer());
updateCompass(user);
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
user.setDisplayNick();
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
public void onPlayerChat(final AsyncPlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
if (user.isMuted())
@@ -63,31 +65,47 @@ public class EssentialsPlayerListener implements Listener
while (it.hasNext())
{
final User u = ess.getUser(it.next());
if (u.isIgnoredPlayer(user.getName()))
if (u.isIgnoredPlayer(user))
{
it.remove();
}
}
user.updateActivity(true);
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
user.setDisplayNick();
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent event)
{
if (event.isCancelled())
if (!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers())
{
event.getHandlers().unregister(this);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Unregistering move listener");
}
return;
}
if (event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()
&& event.getFrom().getBlockY() == event.getTo().getBlockY())
{
return;
}
final User user = ess.getUser(event.getPlayer());
final User user = ess.getUser(event.getPlayer());
if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers())
{
final Location from = event.getFrom();
final Location to = event.getTo().clone();
final Location origTo = event.getTo();
final Location to = origTo.clone();
if (ess.getSettings().cancelAfkOnMove() && origTo.getY() >= from.getBlockY() + 1)
{
user.updateActivity(true);
return;
}
to.setX(from.getX());
to.setY(from.getY());
to.setZ(from.getZ());
@@ -101,7 +119,6 @@ public class EssentialsPlayerListener implements Listener
}
return;
}
final Location afk = user.getAfkPosition();
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9)
{
@@ -115,12 +132,16 @@ public class EssentialsPlayerListener implements Listener
final User user = ess.getUser(event.getPlayer());
if (ess.getSettings().removeGodOnDisconnect() && user.isGodModeEnabled())
{
user.toggleGodModeEnabled();
user.setGodModeEnabled(false);
}
if (user.getSavedInventory() != null)
if (user.isVanished())
{
user.getInventory().setContents(user.getSavedInventory());
user.setSavedInventory(null);
user.toggleVanished();
}
user.setLogoutLocation();
if (user.isRecipeSee())
{
user.getPlayer().getOpenInventory().getTopInventory().clear();
}
user.updateActivity(false);
user.dispose();
@@ -129,53 +150,125 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
ess.runTaskAsynchronously(new Runnable()
{
@Override
public void run()
{
delayedJoin(event.getPlayer());
}
});
}
public void delayedJoin(final Player player)
{
if (!player.isOnline())
{
return;
}
ess.getBackup().onPlayerJoin();
final User user = ess.getUser(event.getPlayer());
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
user.setLastLoginAddress(user.getAddress().getAddress().getHostAddress());
final User user = ess.getUser(player);
user.setLastLogin(System.currentTimeMillis());
user.updateActivity(false);
if (user.isAuthorized("essentials.sleepingignored"))
{
user.setSleepingIgnored(true);
}
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
ess.scheduleSyncDelayedTask(new Runnable()
{
try
@Override
public void run()
{
final IText input = new TextInput(user, "motd", true, ess);
final IText output = new KeywordReplacer(input, user, ess);
final TextPager pager = new TextPager(output, true);
pager.showPage("1", null, "motd", user);
}
catch (IOException ex)
{
if (ess.getSettings().isDebug())
user.setDisplayNick();
updateCompass(user);
if (!ess.getVanishedPlayers().isEmpty() && !user.isAuthorized("essentials.vanish.see"))
{
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
for (String p : ess.getVanishedPlayers())
{
Player toVanish = ess.getServer().getPlayerExact(p);
if (toVanish != null && toVanish.isOnline())
{
user.hidePlayer(toVanish);
}
}
}
else
if (user.isAuthorized("essentials.sleepingignored"))
{
LOGGER.log(Level.WARNING, ex.getMessage());
user.setSleepingIgnored(true);
}
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
{
try
{
final IText input = new TextInput(user, "motd", true, ess);
final IText output = new KeywordReplacer(input, user, ess);
final TextPager pager = new TextPager(output, true);
pager.showPage("1", null, "motd", user);
}
catch (IOException ex)
{
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
}
else
{
LOGGER.log(Level.WARNING, ex.getMessage());
}
}
}
if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
{
final List<String> mail = user.getMails();
if (mail.isEmpty())
{
final String msg = _("noNewMail");
if (!msg.isEmpty())
{
user.sendMessage(msg);
}
}
else
{
user.sendMessage(_("youHaveNewMail", mail.size()));
}
}
if (user.isAuthorized("essentials.fly.safelogin"))
{
final World world = user.getLocation().getWorld();
final int x = user.getLocation().getBlockX();
int y = user.getLocation().getBlockY();
final int z = user.getLocation().getBlockZ();
while (Util.isBlockUnsafe(world, x, y, z) && y > -1)
{
y--;
}
if (user.getLocation().getBlockY() - y > 1 || y < 0)
{
user.setAllowFlight(true);
user.setFlying(true);
user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
}
}
}
}
});
}
if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
// Makes the compass item ingame always point to the first essentials home. #EasterEgg
private void updateCompass(final User user)
{
Location loc = user.getHome(user.getLocation());
if (loc == null)
{
final List<String> mail = user.getMails();
if (mail.isEmpty())
{
user.sendMessage(_("noNewMail"));
}
else
{
user.sendMessage(_("youHaveNewMail", mail.size()));
}
loc = user.getBedSpawnLocation();
}
if (loc != null)
{
final Location updateLoc = loc;
user.setCompassTarget(updateLoc);
}
}
@@ -192,8 +285,11 @@ public class EssentialsPlayerListener implements Listener
return;
}
User user = ess.getUser(event.getPlayer());
user.setNPC(false);
final User user = ess.getUser(event.getPlayer());
if (user.isNPC())
{
user.setNPC(false);
}
final long currentTime = System.currentTimeMillis();
final boolean banExpired = user.checkBanTimeout(currentTime);
@@ -202,53 +298,49 @@ public class EssentialsPlayerListener implements Listener
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"));
String banReason = user.getBanReason();
if (banReason == null || banReason.isEmpty() || banReason.equalsIgnoreCase("ban"))
{
banReason = _("defaultBanReason");
}
if (user.getBanTimeout() > 0)
{
//TODO: TL This
banReason += "\n\n" + "Expires in " + Util.formatDateDiff(user.getBanTimeout());
}
event.disallow(Result.KICK_BANNED, banReason);
return;
}
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver"))
if (event.getResult() == Result.KICK_FULL && !user.isAuthorized("essentials.joinfullserver"))
{
event.disallow(Result.KICK_FULL, _("serverFull"));
return;
}
event.allow();
user.setLastLogin(System.currentTimeMillis());
updateCompass(user);
}
private void updateCompass(final User user)
{
Location loc = user.getHome(user.getLocation());
if (loc == null)
{
loc = user.getBedSpawnLocation();
}
if (loc != null)
{
user.setCompassTarget(loc);
}
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if (event.isCancelled())
{
return;
}
//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 boolean backListener = ess.getSettings().registerBackInListener();
final boolean teleportInvulnerability = ess.getSettings().isTeleportInvulnerability();
if (backListener || teleportInvulnerability)
{
final User user = ess.getUser(event.getPlayer());
user.setLastLocation();
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
if (backListener && (event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND))
{
user.setLastLocation();
}
if (teleportInvulnerability)
{
user.enableInvulnerabilityAfterTeleport();
}
}
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -260,7 +352,7 @@ public class EssentialsPlayerListener implements Listener
}
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -278,74 +370,95 @@ public class EssentialsPlayerListener implements Listener
}
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
{
if (event.isCancelled())
{
return;
}
final User user = ess.getUser(event.getPlayer());
final Player player = event.getPlayer();
final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
final List<String> commands = Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email");
if (commands.contains(cmd))
if (ess.getSettings().getSocialSpyCommands().contains(cmd))
{
for (Player player : ess.getServer().getOnlinePlayers())
for (Player onlinePlayer : ess.getServer().getOnlinePlayers())
{
final User spyer = ess.getUser(player);
if (spyer.isSocialSpyEnabled() && !user.equals(spyer))
final User spyer = ess.getUser(onlinePlayer);
if (spyer.isSocialSpyEnabled() && !player.equals(onlinePlayer))
{
player.sendMessage(user.getDisplayName() + " : " + event.getMessage());
onlinePlayer.sendMessage(player.getDisplayName() + " : " + event.getMessage());
}
}
}
if (!cmd.equalsIgnoreCase("afk"))
else if (!cmd.equalsIgnoreCase("afk"))
{
final User user = ess.getUser(player);
user.updateActivity(true);
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChangedWorldHack(final PlayerChangedWorldEvent event)
{
final User user = ess.getUser(event.getPlayer());
if (user.getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly"))
{
user.setAllowFlight(false);
}
user.setFlySpeed(0.1f);
user.setWalkSpeed(0.2f);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
{
final User user = ess.getUser(event.getPlayer());
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
final String newWorld = event.getPlayer().getLocation().getWorld().getName();
user.setDisplayNick();
updateCompass(user);
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
if (ess.getSettings().getNoGodWorlds().contains(newWorld) && user.isGodModeEnabledRaw())
{
if (user.isGodModeEnabledRaw())
{
user.sendMessage(_("noGodWorldWarning"));
}
user.sendMessage(_("noGodWorldWarning"));
}
if (!user.getWorld().getName().equals(newWorld))
{
user.sendMessage(_("currentWorld", newWorld));
}
if (user.isVanished())
{
user.setVanished(user.isAuthorized("essentials.vanish"));
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(final PlayerInteractEvent event)
{
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
switch (event.getAction())
{
case RIGHT_CLICK_BLOCK:
if (event.isCancelled())
if (!event.isCancelled() && event.getClickedBlock().getTypeId() == BED && ess.getSettings().getUpdateBedAtDaytime())
{
return;
}
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
User player = ess.getUser(event.getPlayer());
if (player.isAuthorized("essentials.sethome.bed"))
{
player.setBedSpawnLocation(event.getClickedBlock().getLocation());
player.sendMessage(_("homeSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
}
}
break;
case LEFT_CLICK_AIR:
case LEFT_CLICK_BLOCK:
if (user.hasPowerTools() && user.arePowerToolsEnabled())
if (event.getPlayer().isFlying())
{
if (usePowertools(user))
final User user = ess.getUser(event.getPlayer());
if (user.isFlyClickJump())
{
useFlyClickJump(user);
return;
}
}
case LEFT_CLICK_BLOCK:
if (event.getItem() != null && event.getItem().getTypeId() != AIR)
{
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
if (user.hasPowerTools() && user.arePowerToolsEnabled() && usePowertools(user, event.getItem().getTypeId()))
{
event.setCancelled(true);
}
@@ -356,14 +469,41 @@ public class EssentialsPlayerListener implements Listener
}
}
private boolean usePowertools(final User user)
// This method allows the /jump lock feature to work, allows teleporting while flying #EasterEgg
private void useFlyClickJump(final User user)
{
final ItemStack is = user.getItemInHand();
int id;
if (is == null || (id = is.getTypeId()) == 0)
try
{
return false;
final Location otarget = Util.getTarget(user);
ess.scheduleSyncDelayedTask(
new Runnable()
{
@Override
public void run()
{
Location loc = user.getLocation();
loc.setX(otarget.getX());
loc.setZ(otarget.getZ());
while (Util.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()))
{
loc.setY(loc.getY() + 1d);
}
user.getBase().teleport(loc, TeleportCause.PLUGIN);
}
});
}
catch (Exception ex)
{
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
}
}
}
private boolean usePowertools(final User user, final int id)
{
final List<String> commandList = user.getPowertool(id);
if (commandList == null || commandList.isEmpty())
{
@@ -373,9 +513,8 @@ public class EssentialsPlayerListener implements Listener
// We need to loop through each command and execute
for (final String command : commandList)
{
if (command.matches(".*\\{player\\}.*"))
if (command.contains("{player}"))
{
//user.sendMessage("Click a player to use this command");
continue;
}
else if (command.startsWith("c:"))
@@ -393,6 +532,7 @@ public class EssentialsPlayerListener implements Listener
public void run()
{
user.getServer().dispatchCommand(user.getBase(), command);
LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", user.getName(), command));
}
});
}
@@ -400,17 +540,106 @@ public class EssentialsPlayerListener implements Listener
return used;
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPickupItem(final PlayerPickupItemEvent event)
{
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
if (ess.getSettings().getDisableItemPickupWhileAfk())
{
return;
}
final User user = ess.getUser(event.getPlayer());
if (user.isAfk())
{
event.setCancelled(true);
if (ess.getUser(event.getPlayer()).isAfk())
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onInventoryClickEvent(final InventoryClickEvent event)
{
final Inventory top = event.getView().getTopInventory();
final InventoryType type = top.getType();
if (type == InventoryType.PLAYER)
{
final User user = ess.getUser(event.getWhoClicked());
final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity)
{
final User invOwner = ess.getUser((HumanEntity)invHolder);
if (user.isInvSee() && (!user.isAuthorized("essentials.invsee.modify")
|| invOwner.isAuthorized("essentials.invsee.preventmodify")
|| !invOwner.isOnline()))
{
event.setCancelled(true);
user.updateInventory();
}
}
}
else if (type == InventoryType.ENDER_CHEST)
{
final User user = ess.getUser(event.getWhoClicked());
if (user.isEnderSee() && (!user.isAuthorized("essentials.enderchest.modify")))
{
event.setCancelled(true);
}
}
else if (type == InventoryType.WORKBENCH)
{
User user = ess.getUser(event.getWhoClicked());
if (user.isRecipeSee())
{
event.setCancelled(true);
}
}
else if (type == InventoryType.CHEST && top.getSize() == 9)
{
final User user = ess.getUser(event.getWhoClicked());
final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity && user.isInvSee())
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onInventoryCloseEvent(final InventoryCloseEvent event)
{
final Inventory top = event.getView().getTopInventory();
final InventoryType type = top.getType();
if (type == InventoryType.PLAYER)
{
final User user = ess.getUser(event.getPlayer());
user.setInvSee(false);
}
else if (type == InventoryType.ENDER_CHEST)
{
final User user = ess.getUser(event.getPlayer());
user.setEnderSee(false);
}
else if (type == InventoryType.WORKBENCH)
{
final User user = ess.getUser(event.getPlayer());
if (user.isRecipeSee())
{
user.setRecipeSee(false);
event.getView().getTopInventory().clear();
}
}
else if (type == InventoryType.CHEST && top.getSize() == 9)
{
final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity)
{
final User user = ess.getUser(event.getPlayer());
user.setInvSee(false);
}
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerFishEvent(final PlayerFishEvent event)
{
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
}
}

View File

@@ -20,17 +20,23 @@ public class EssentialsPluginListener implements Listener, IConf
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(final PluginEnableEvent event)
{
if (event.getPlugin().getName().equals("EssentialsChat")) {
ess.getSettings().setEssentialsChatActive(true);
}
ess.getPermissionsHandler().checkPermissions();
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
{
ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getLongName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(final PluginDisableEvent event)
{
if (event.getPlugin().getName().equals("EssentialsChat")) {
ess.getSettings().setEssentialsChatActive(false);
}
ess.getPermissionsHandler().checkPermissions();
ess.getAlternativeCommandsHandler().removePlugin(event.getPlugin());
// Check to see if the plugin thats being disabled is the one we are using

View File

@@ -2,6 +2,7 @@ package com.earth2me.essentials;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.entity.Player;
@@ -11,6 +12,8 @@ public class EssentialsTimer implements Runnable
{
private final transient IEssentials ess;
private final transient Set<User> onlineUsers = new HashSet<User>();
private transient long lastPoll = System.currentTimeMillis();
private final transient LinkedList<Float> history = new LinkedList<Float>();
EssentialsTimer(final IEssentials ess)
{
@@ -21,6 +24,21 @@ public class EssentialsTimer implements Runnable
public void run()
{
final long currentTime = System.currentTimeMillis();
long timeSpent = (currentTime - lastPoll) / 1000;
if (timeSpent == 0)
{
timeSpent = 1;
}
if (history.size() > 10)
{
history.remove();
}
float tps = 100f / timeSpent;
if (tps <= 20)
{
history.add(tps);
}
lastPoll = currentTime;
for (Player player : ess.getServer().getOnlinePlayers())
{
try
@@ -48,6 +66,20 @@ public class EssentialsTimer implements Runnable
}
user.checkMuteTimeout(currentTime);
user.checkJailTimeout(currentTime);
user.resetInvulnerabilityAfterTeleport();
}
}
public float getAverageTPS()
{
float avg = 0;
for (Float f : history)
{
if (f != null)
{
avg += f;
}
}
return avg / history.size();
}
}

View File

@@ -1,9 +1,9 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.craftbukkit.FakeWorld;
import com.earth2me.essentials.settings.Spawns;
import com.earth2me.essentials.storage.YamlStorageWriter;
import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.math.BigInteger;
import java.security.DigestInputStream;
@@ -730,7 +730,7 @@ public class EssentialsUpgrade
doneFile.setProperty("updateSpawnsToNewSpawnsConfig", true);
doneFile.save();
}
private void updateJailsToNewJailsConfig()
{
if (doneFile.getBoolean("updateJailsToNewJailsConfig", false))
@@ -778,6 +778,17 @@ public class EssentialsUpgrade
doneFile.save();
}
private void warnMetrics()
{
if (doneFile.getBoolean("warnMetrics", false))
{
return;
}
ess.getSettings().setMetricsEnabled(false);
doneFile.setProperty("warnMetrics", true);
doneFile.save();
}
public void beforeSettings()
{
if (!ess.getDataFolder().exists())
@@ -800,5 +811,6 @@ public class EssentialsUpgrade
deleteOldItemsCsv();
updateSpawnsToNewSpawnsConfig();
updateJailsToNewJailsConfig();
warnMetrics();
}
}

View File

@@ -70,7 +70,8 @@ public class I18n implements II18n
public static String _(final String string, final Object... objects)
{
if (instance == null) {
if (instance == null)
{
return "";
}
if (objects.length == 0)
@@ -85,11 +86,20 @@ public class I18n implements II18n
public String format(final String string, final Object... objects)
{
final String format = translate(string);
String format = translate(string);
MessageFormat messageFormat = messageFormatCache.get(format);
if (messageFormat == null)
{
messageFormat = new MessageFormat(format);
try
{
messageFormat = new MessageFormat(format);
}
catch (IllegalArgumentException e)
{
ess.getLogger().log(Level.SEVERE, "Invalid Translation key for '" + string + "': " + e.getMessage());
format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
messageFormat = new MessageFormat(format);
}
messageFormatCache.put(format, messageFormat);
}
return messageFormat.format(objects);
@@ -114,6 +124,7 @@ public class I18n implements II18n
{
currentLocale = new Locale(parts[0], parts[1], parts[2]);
}
ResourceBundle.clearCache();
Logger.getLogger("Minecraft").log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
customBundle = ResourceBundle.getBundle(MESSAGES, currentLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess));
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
@@ -132,7 +143,7 @@ public class I18n implements II18n
{
private final transient File dataFolder;
public FileResClassLoader(final ClassLoader classLoader, final IEssentials ess)
FileResClassLoader(final ClassLoader classLoader, final IEssentials ess)
{
super(classLoader);
this.dataFolder = ess.getDataFolder();

View File

@@ -1,9 +1,5 @@
package com.earth2me.essentials;
/**
* @deprecated New interface will be IReload in api package
*/
@Deprecated
public interface IConf {
public void reloadConfig();
}

View File

@@ -1,19 +1,18 @@
package com.earth2me.essentials;
import com.earth2me.essentials.api.IJails;
import com.earth2me.essentials.metrics.Metrics;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import java.util.List;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
/**
* @deprecated This will be moved to the api package soon
*/
@Deprecated
public interface IEssentials extends Plugin
{
void addReloadListener(IConf listener);
@@ -46,7 +45,9 @@ public interface IEssentials extends Plugin
Methods getPaymentMethod();
int scheduleAsyncDelayedTask(Runnable run);
BukkitTask runTaskAsynchronously(Runnable run);
BukkitTask runTaskLaterAsynchronously(Runnable run, long delay);
int scheduleSyncDelayedTask(Runnable run);
@@ -65,4 +66,12 @@ public interface IEssentials extends Plugin
ItemDb getItemDb();
UserMap getUserMap();
Metrics getMetrics();
void setMetrics(Metrics metrics);
EssentialsTimer getTimer();
List<String> getVanishedPlayers();
}

View File

@@ -42,6 +42,8 @@ public interface ISettings extends IConf
double getHealCooldown();
Set<String> getSocialSpyCommands();
Map<String, Object> getKit(String name);
ConfigurationSection getKits();
@@ -92,10 +94,6 @@ public interface ISettings extends IConf
boolean isCommandOverridden(String name);
boolean isCommandRestricted(IEssentialsCommand cmd);
boolean isCommandRestricted(String label);
boolean isDebug();
boolean isEcoDisabled();
@@ -110,8 +108,6 @@ public interface ISettings extends IConf
boolean showNonEssCommandsInHelp();
boolean spawnIfNoHome();
boolean warnOnBuildDisallow();
boolean warnOnSmite();
@@ -128,6 +124,8 @@ public interface ISettings extends IConf
boolean changeDisplayName();
boolean changePlayerListName();
boolean isPlayerCommand(String string);
boolean useBukkitPermissions();
@@ -144,6 +142,10 @@ public interface ISettings extends IConf
boolean getFreezeAfkPlayers();
boolean cancelAfkOnMove();
boolean cancelAfkOnInteract();
boolean areDeathMessagesEnabled();
public void setDebug(boolean debug);
@@ -151,10 +153,14 @@ public interface ISettings extends IConf
Set<String> getNoGodWorlds();
boolean getUpdateBedAtDaytime();
boolean allowUnsafeEnchantments();
boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
boolean isWorldTeleportPermissions();
boolean isWorldHomePermissions();
boolean registerBackInListener();
@@ -163,4 +169,26 @@ public interface ISettings extends IConf
EventPriority getRespawnPriority();
long getTpaAcceptCancellation();
boolean isMetricsEnabled();
void setMetricsEnabled(boolean metricsEnabled);
long getTeleportInvulnerability();
boolean isTeleportInvulnerability();
long getLoginAttackDelay();
int getSignUsePerSecond();
double getMaxFlySpeed();
double getMaxWalkSpeed();
public int getMailsPerMinute();
public void setEssentialsChatActive(boolean b);
long getMaxTempban();
}

View File

@@ -1,16 +1,10 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.net.InetSocketAddress;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.PlayerInventory;
/**
* @deprecated This will be moved to the api package soon
*/
@Deprecated
public interface IUser extends Player
{
long getLastTeleportTimestamp();
@@ -48,4 +42,14 @@ public interface IUser extends Player
Teleport getTeleport();
void setJail(String jail);
boolean isIgnoreExempt();
boolean isAfk();
void setAfk(final boolean set);
void setLogoutLocation();
Location getLogoutLocation();
}

View File

@@ -1,11 +1,9 @@
package com.earth2me.essentials;
import com.earth2me.essentials.api.IItemDb;
import static com.earth2me.essentials.I18n._;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.earth2me.essentials.api.IItemDb;
import java.util.*;
import java.util.regex.Pattern;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@@ -20,8 +18,10 @@ public class ItemDb implements IConf, IItemDb
file = new ManagedFile("items.csv", ess);
}
private final transient Map<String, Integer> items = new HashMap<String, Integer>();
private final transient Map<ItemData, List<String>> names = new HashMap<ItemData, List<String>>();
private final transient Map<String, Short> durabilities = new HashMap<String, Short>();
private final transient ManagedFile file;
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
@Override
public void reloadConfig()
@@ -35,6 +35,7 @@ public class ItemDb implements IConf, IItemDb
durabilities.clear();
items.clear();
names.clear();
for (String line : lines)
{
@@ -51,9 +52,25 @@ public class ItemDb implements IConf, IItemDb
}
final int numeric = Integer.parseInt(parts[1]);
final short data = parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0;
String itemName = parts[0].toLowerCase(Locale.ENGLISH);
durabilities.put(parts[0].toLowerCase(Locale.ENGLISH), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
items.put(parts[0].toLowerCase(Locale.ENGLISH), numeric);
durabilities.put(itemName, data);
items.put(itemName, numeric);
ItemData itemData = new ItemData(numeric, data);
if (names.containsKey(itemData))
{
List<String> nameList = names.get(itemData);
nameList.add(itemName);
Collections.sort(nameList, new LengthCompare());
}
else
{
List<String> nameList = new ArrayList<String>();
nameList.add(itemName);
names.put(itemData, nameList);
}
}
}
@@ -69,19 +86,20 @@ public class ItemDb implements IConf, IItemDb
int itemid = 0;
String itemname = null;
short metaData = 0;
String[] parts = splitPattern.split(id);;
if (id.matches("^\\d+[:+',;.]\\d+$"))
{
itemid = Integer.parseInt(id.split("[:+',;.]")[0]);
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
itemid = Integer.parseInt(parts[0]);
metaData = Short.parseShort(parts[1]);
}
else if (id.matches("^\\d+$"))
else if (Util.isInt(id))
{
itemid = Integer.parseInt(id);
}
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
{
itemname = id.split("[:+',;.]")[0].toLowerCase(Locale.ENGLISH);
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
itemname = parts[0].toLowerCase(Locale.ENGLISH);
metaData = Short.parseShort(parts[1]);
}
else
{
@@ -119,4 +137,85 @@ public class ItemDb implements IConf, IItemDb
retval.setDurability(metaData);
return retval;
}
public String names(ItemStack item)
{
ItemData itemData = new ItemData(item.getTypeId(), item.getDurability());
List<String> nameList = names.get(itemData);
if (nameList == null)
{
itemData = new ItemData(item.getTypeId(), (short)0);
nameList = names.get(itemData);
if (nameList == null)
{
return null;
}
}
if (nameList.size() > 15)
{
nameList = nameList.subList(0, 14);
}
return Util.joinList(", ", nameList);
}
class ItemData
{
final private int itemNo;
final private short itemData;
ItemData(final int itemNo, final short itemData)
{
this.itemNo = itemNo;
this.itemData = itemData;
}
public int getItemNo()
{
return itemNo;
}
public short getItemData()
{
return itemData;
}
@Override
public int hashCode()
{
return (31 * itemNo) ^ itemData;
}
@Override
public boolean equals(Object o)
{
if (o == null)
{
return false;
}
if (!(o instanceof ItemData))
{
return false;
}
ItemData pairo = (ItemData)o;
return this.itemNo == pairo.getItemNo()
&& this.itemData == pairo.getItemData();
}
}
class LengthCompare implements java.util.Comparator<String>
{
public LengthCompare()
{
super();
}
@Override
public int compare(String s1, String s2)
{
return s1.length() - s2.length();
}
}
}

View File

@@ -9,12 +9,16 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
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.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
@@ -26,21 +30,24 @@ import org.bukkit.plugin.PluginManager;
public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.settings.Jails> implements IJails
{
private static final transient Logger LOGGER = Bukkit.getLogger();
private static transient boolean enabled = false;
public Jails(final IEssentials ess)
{
super(ess, com.earth2me.essentials.settings.Jails.class);
reloadConfig();
registerListeners();
}
private void registerListeners()
{
enabled = true;
final PluginManager pluginManager = ess.getServer().getPluginManager();
final JailBlockListener blockListener = new JailBlockListener();
final JailPlayerListener playerListener = new JailPlayerListener();
final JailListener blockListener = new JailListener();
pluginManager.registerEvents(blockListener, ess);
pluginManager.registerEvents(playerListener, ess);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Registering Jail listener");
}
}
@Override
@@ -49,6 +56,32 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
return new File(ess.getDataFolder(), "jail.yml");
}
@Override
public void finishRead()
{
checkRegister();
}
@Override
public void finishWrite()
{
checkRegister();
}
public void resetListener()
{
enabled = false;
checkRegister();
}
private void checkRegister()
{
if (enabled == false && getCount() > 0)
{
registerListeners();
}
}
@Override
public Location getJail(final String jailName) throws Exception
{
@@ -115,7 +148,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
acquireReadLock();
try
{
if (!(user.getBase() instanceof OfflinePlayer))
if (user.isOnline())
{
Location loc = getJail(jail);
user.getTeleport().now(loc, false, TeleportCause.COMMAND);
@@ -146,10 +179,23 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
private class JailBlockListener implements Listener
@Override
public int getCount()
{
@EventHandler(priority = EventPriority.LOW)
try
{
return getList().size();
}
catch (Exception ex)
{
return 0;
}
}
private class JailListener implements Listener
{
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockBreak(final BlockBreakEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -159,7 +205,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockPlace(final BlockPlaceEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -169,7 +215,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockDamage(final BlockDamageEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -178,12 +224,26 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityDamageByEntity(final EntityDamageByEntityEvent event)
{
if (event.getCause() != DamageCause.ENTITY_ATTACK || event.getEntity().getType() != EntityType.PLAYER)
{
return;
}
final Entity damager = event.getDamager();
if (damager.getType() == EntityType.PLAYER)
{
final User user = ess.getUser(damager);
if (user != null && user.isJailed())
{
event.setCancelled(true);
}
}
}
private class JailPlayerListener implements Listener
{
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEvent event)
{
final User user = ess.getUser(event.getPlayer());

View File

@@ -5,7 +5,7 @@ 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 java.util.logging.Level;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@@ -21,7 +21,7 @@ public class Kit
final StringBuilder list = new StringBuilder();
for (String kiteItem : kits.getKeys(false))
{
if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
if (user == null || user.isAuthorized("essentials.kits." + kiteItem.toLowerCase(Locale.ENGLISH)))
{
list.append(" ").append(capitalCase(kiteItem));
}
@@ -30,33 +30,52 @@ public class Kit
}
catch (Exception ex)
{
throw new Exception(_("kitError"));
throw new Exception(_("kitError"), ex);
}
}
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws NoChargeException
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws Exception
{
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
final Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, -(int)delay);
c.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
final long mintime = c.getTimeInMillis();
final Long lastTime = user.getKitTimestamp(kitName);
if (lastTime == null || lastTime < mintime)
if (user.isAuthorized("essentials.kit.exemptdelay"))
{
final Calendar now = new GregorianCalendar();
user.setKitTimestamp(kitName, now.getTimeInMillis());
return;
}
final Calendar time = new GregorianCalendar();
// Take the current time, and remove the delay from it.
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0.0d;
final Calendar earliestTime = new GregorianCalendar();
earliestTime.add(Calendar.SECOND, -(int)delay);
earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
// This value contains the most recent time a kit could have been used that would allow another use.
final long earliestLong = earliestTime.getTimeInMillis();
// When was the last kit used?
final long lastTime = user.getKitTimestamp(kitName);
if (lastTime < earliestLong || lastTime == 0L)
{
user.setKitTimestamp(kitName, time.getTimeInMillis());
}
else if (lastTime > time.getTimeInMillis())
{
// This is to make sure time didn't get messed up on last kit use.
// If this happens, let's give the user the benifit of the doubt.
user.setKitTimestamp(kitName, time.getTimeInMillis());
}
else if (earliestLong < 0L)
{
user.sendMessage(_("kitOnce"));
throw new NoChargeException();
}
else
{
final Calendar future = new GregorianCalendar();
future.setTimeInMillis(lastTime);
future.add(Calendar.SECOND, (int)delay);
future.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
user.sendMessage(_("kitTimed", Util.formatDateDiff(future.getTimeInMillis())));
time.setTimeInMillis(lastTime);
time.add(Calendar.SECOND, (int)delay);
time.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
user.sendMessage(_("kitTimed", Util.formatDateDiff(time.getTimeInMillis())));
throw new NoChargeException();
}
}
@@ -75,7 +94,7 @@ public class Kit
catch (Exception e)
{
user.sendMessage(_("kitError2"));
throw new Exception(_("kitErrorHelp"));
throw new Exception(_("kitErrorHelp"), e);
}
}
@@ -84,20 +103,34 @@ public class Kit
try
{
boolean spew = false;
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
for (String d : items)
{
final String[] parts = d.split("[^0-9]+", 3);
final int id = Material.getMaterial(Integer.parseInt(parts[0])).getId();
final int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
final short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
if (d.startsWith(ess.getSettings().getCurrencySymbol()))
{
Double value = Double.parseDouble(d.substring(ess.getSettings().getCurrencySymbol().length()).trim());
Trade t = new Trade(value, ess);
t.pay(user);
continue;
}
final String[] parts = d.split(" ");
final ItemStack parseStack = ess.getItemDb().get(parts[0], parts.length > 1 ? Integer.parseInt(parts[1]) : 1);
final MetaItemStack metaStack = new MetaItemStack(parseStack);
if (parts.length > 2)
{
metaStack.parseStringMeta(user, allowUnsafe, parts, 2, ess);
}
final Map<Integer, ItemStack> overfilled;
if (user.isAuthorized("essentials.oversizedstacks"))
{
overfilled = InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), new ItemStack(id, amount, data));
overfilled = InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack());
}
else
{
overfilled = InventoryWorkaround.addItem(user.getInventory(), true, new ItemStack(id, amount, data));
overfilled = InventoryWorkaround.addItems(user.getInventory(), metaStack.getItemStack());
}
for (ItemStack itemStack : overfilled.values())
{
@@ -114,7 +147,15 @@ public class Kit
catch (Exception e)
{
user.updateInventory();
throw new Exception(_("kitError2"));
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.WARNING, e.getMessage());
}
else
{
ess.getLogger().log(Level.WARNING, e.getMessage());
}
throw new Exception(_("kitError2"), e);
}
}
}

View File

@@ -0,0 +1,361 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.textreader.*;
import java.util.*;
import java.util.regex.Pattern;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.*;
public class MetaItemStack
{
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
private final ItemStack stack;
private final static Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>();
private final static Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>();
private FireworkEffect.Builder builder = FireworkEffect.builder();
private boolean validFirework = false;
static
{
for (DyeColor color : DyeColor.values())
{
colorMap.put(color.name(), color);
}
for (FireworkEffect.Type type : FireworkEffect.Type.values())
{
fireworkShape.put(type.name(), type);
}
}
public MetaItemStack(final ItemStack stack)
{
this.stack = stack.clone();
}
public ItemStack getItemStack()
{
return stack;
}
public boolean isValidFirework()
{
return validFirework;
}
public FireworkEffect.Builder getFireworkBuilder()
{
return builder;
}
public void parseStringMeta(final CommandSender user, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception
{
for (int i = fromArg; i < string.length; i++)
{
addStringMeta(user, allowUnsafe, string[i], ess);
}
if (validFirework)
{
FireworkEffect effect = builder.build();
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
fmeta.addEffect(effect);
stack.setItemMeta(fmeta);
}
}
//TODO: TL this
private void addStringMeta(final CommandSender user, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception
{
final String[] split = splitPattern.split(string, 2);
if (split.length < 1)
{
return;
}
if (split.length > 1 && split[0].equalsIgnoreCase("name"))
{
final String displayName = Util.replaceFormat(split[1].replace('_', ' '));
final ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(displayName);
stack.setItemMeta(meta);
}
else if (split.length > 1 && (split[0].equalsIgnoreCase("lore") || split[0].equalsIgnoreCase("desc")))
{
final List<String> lore = new ArrayList<String>();
for (String line : split[1].split("\\|"))
{
lore.add(Util.replaceFormat(line.replace('_', ' ')));
}
final ItemMeta meta = stack.getItemMeta();
meta.setLore(lore);
stack.setItemMeta(meta);
}
else if (split.length > 1 && (split[0].equalsIgnoreCase("player") || split[0].equalsIgnoreCase("owner")) && stack.getType() == Material.SKULL_ITEM)
{
if (stack.getDurability() == 3)
{
final String owner = split[1];
final SkullMeta meta = (SkullMeta)stack.getItemMeta();
boolean result = meta.setOwner(owner);
stack.setItemMeta(meta);
}
else
{
throw new Exception("You can only set the owner of player skulls (397:3)");
}
}
else if (split.length > 1 && split[0].equalsIgnoreCase("book") && stack.getType() == Material.WRITTEN_BOOK)
{
final BookMeta meta = (BookMeta)stack.getItemMeta();
final IText input = new BookInput("book", true, ess);
final BookPager pager = new BookPager(input);
List<String> pages = pager.getPages(split[1]);
meta.setPages(pages);
stack.setItemMeta(meta);
}
else if (split.length > 1 && split[0].equalsIgnoreCase("author") && stack.getType() == Material.WRITTEN_BOOK)
{
final String author = split[1];
final BookMeta meta = (BookMeta)stack.getItemMeta();
meta.setAuthor(author);
stack.setItemMeta(meta);
}
else if (split.length > 1 && split[0].equalsIgnoreCase("title") && stack.getType() == Material.WRITTEN_BOOK)
{
final String title = Util.replaceFormat(split[1].replace('_', ' '));
final BookMeta meta = (BookMeta)stack.getItemMeta();
meta.setTitle(title);
stack.setItemMeta(meta);
}
else if (split.length > 1 && split[0].equalsIgnoreCase("power") && stack.getType() == Material.FIREWORK)
{
final int power = Util.isInt(split[1]) ? Integer.parseInt(split[1]) : 0;
final FireworkMeta meta = (FireworkMeta)stack.getItemMeta();
meta.setPower(power > 3 ? 4 : power);
stack.setItemMeta(meta);
}
else if (stack.getType() == Material.FIREWORK) //WARNING - Meta for fireworks will be ignored after this point.
{
addFireworkMeta(user, false, string, ess);
}
else if (split.length > 1 && (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour"))
&& (stack.getType() == Material.LEATHER_BOOTS
|| stack.getType() == Material.LEATHER_CHESTPLATE
|| stack.getType() == Material.LEATHER_HELMET
|| stack.getType() == Material.LEATHER_LEGGINGS))
{
final String[] color = split[1].split("(\\||,)");
if (color.length == 3)
{
final int red = Util.isInt(color[0]) ? Integer.parseInt(color[0]) : 0;
final int green = Util.isInt(color[1]) ? Integer.parseInt(color[1]) : 0;
final int blue = Util.isInt(color[2]) ? Integer.parseInt(color[2]) : 0;
final LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
meta.setColor(Color.fromRGB(red, green, blue));
stack.setItemMeta(meta);
}
else
{
throw new Exception("Leather Color Syntax: color:<red>,<green>,<blue> eg: color:255,0,0");
}
}
else
{
parseEnchantmentStrings(user, allowUnsafe, split);
}
}
public void addFireworkMeta(final CommandSender user, final boolean allowShortName, final String string, final IEssentials ess) throws Exception
{
if (stack.getType() == Material.FIREWORK)
{
final String[] split = splitPattern.split(string, 2);
if (split.length < 2)
{
return;
}
if (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour") || (allowShortName && split[0].equalsIgnoreCase("c")))
{
if (validFirework)
{
FireworkEffect effect = builder.build();
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
fmeta.addEffect(effect);
stack.setItemMeta(fmeta);
builder = FireworkEffect.builder();
}
List<Color> primaryColors = new ArrayList<Color>();
String[] colors = split[1].split(",");
for (String color : colors)
{
if (colorMap.containsKey(color.toUpperCase()))
{
validFirework = true;
primaryColors.add(colorMap.get(color.toUpperCase()).getFireworkColor());
}
else
{
user.sendMessage(_("fireworkSyntax"));
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
}
}
builder.withColor(primaryColors);
}
else if (split[0].equalsIgnoreCase("shape") || split[0].equalsIgnoreCase("type") || (allowShortName && (split[0].equalsIgnoreCase("s") || split[0].equalsIgnoreCase("t"))))
{
FireworkEffect.Type finalEffect = null;
split[1] = (split[1].equalsIgnoreCase("large") ? "BALL_LARGE" : split[1]);
if (fireworkShape.containsKey(split[1].toUpperCase()))
{
finalEffect = fireworkShape.get(split[1].toUpperCase());
}
else
{
user.sendMessage(_("fireworkSyntax"));
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
}
if (finalEffect != null)
{
builder.with(finalEffect);
}
}
else if (split[0].equalsIgnoreCase("fade") || (allowShortName && split[0].equalsIgnoreCase("f")))
{
List<Color> fadeColors = new ArrayList<Color>();
String[] colors = split[1].split(",");
for (String color : colors)
{
if (colorMap.containsKey(color.toUpperCase()))
{
fadeColors.add(colorMap.get(color.toUpperCase()).getFireworkColor());
}
else
{
user.sendMessage(_("fireworkSyntax"));
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
}
}
if (!fadeColors.isEmpty())
{
builder.withFade(fadeColors);
}
}
else if (split[0].equalsIgnoreCase("effect") || (allowShortName && split[0].equalsIgnoreCase("e")))
{
String[] effects = split[1].split(",");
for (String effect : effects)
{
if (effect.equalsIgnoreCase("twinkle"))
{
builder.flicker(true);
}
else if (effect.equalsIgnoreCase("trail"))
{
builder.trail(true);
}
else
{
user.sendMessage(_("fireworkSyntax"));
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
}
}
}
}
}
private void parseEnchantmentStrings(final CommandSender user, final boolean allowUnsafe, final String[] split) throws Exception
{
Enchantment enchantment = getEnchantment(null, split[0]);
int level = -1;
if (split.length > 1)
{
try
{
level = Integer.parseInt(split[1]);
}
catch (NumberFormatException ex)
{
level = -1;
}
}
if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel()))
{
level = enchantment.getMaxLevel();
}
addEnchantment(user, allowUnsafe, enchantment, level);
}
public void addEnchantment(final CommandSender user, final boolean allowUnsafe, final Enchantment enchantment, final int level) throws Exception
{
try
{
if (stack.getType().equals(Material.ENCHANTED_BOOK))
{
EnchantmentStorageMeta meta = (EnchantmentStorageMeta)stack.getItemMeta();
if (level == 0)
{
meta.removeStoredEnchant(enchantment);
}
else
{
meta.addStoredEnchant(enchantment, level, allowUnsafe);
}
stack.setItemMeta(meta);
}
else // all other material types besides ENCHANTED_BOOK
{
if (level == 0)
{
stack.removeEnchantment(enchantment);
}
else
{
if (allowUnsafe)
{
stack.addUnsafeEnchantment(enchantment, level);
}
else
{
stack.addEnchantment(enchantment, level);
}
}
}
}
catch (Exception ex)
{
throw new Exception("Enchantment " + enchantment.getName() + ": " + ex.getMessage(), ex);
}
}
//TODO: Properly TL this
public Enchantment getEnchantment(final User user, final String name) throws Exception
{
final Enchantment enchantment = Enchantments.getByName(name);
if (enchantment == null)
{
throw new Exception(_("enchantmentNotFound") + ": " + name);
}
final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
if (user != null && !user.isAuthorized("essentials.enchant." + enchantmentName))
{
throw new Exception(_("enchantmentPerm", enchantmentName));
}
return enchantment;
}
}

View File

@@ -1,20 +1,19 @@
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;
import java.util.Set;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
// Suffixes can be appended on the end of a mob name to make it plural
// Entities without a suffix, will default to 's'
public enum Mob
{
CHICKEN("Chicken", Enemies.FRIENDLY, EntityType.CHICKEN),
@@ -39,8 +38,16 @@ public enum Mob
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);
SNOWMAN("Snowman", Enemies.FRIENDLY, "", EntityType.SNOWMAN),
OCELOT("Ocelot", Enemies.NEUTRAL, EntityType.OCELOT),
IRONGOLEM("IronGolem", Enemies.NEUTRAL, EntityType.IRON_GOLEM),
WITHER("Wither", Enemies.ENEMY, EntityType.WITHER),
BAT("Bat", Enemies.FRIENDLY, EntityType.BAT),
WITCH("Witch", Enemies.ENEMY, EntityType.WITCH),
BOAT("Boat", Enemies.NEUTRAL, EntityType.BOAT),
MINECART("Minecart", Enemies.NEUTRAL, EntityType.MINECART),
ENDERCRYSTAL("EnderCrystal", Enemies.NEUTRAL, EntityType.ENDER_CRYSTAL),
EXPERIENCEORB("ExperienceOrb", Enemies.NEUTRAL, EntityType.EXPERIENCE_ORB);
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s, EntityType type)
@@ -70,14 +77,20 @@ public enum Mob
hashMap.put(mob.name.toLowerCase(Locale.ENGLISH), mob);
}
}
public static Set<String> getMobList() {
public static Set<String> getMobList()
{
return Collections.unmodifiableSet(hashMap.keySet());
}
public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException
public Entity spawn(final Player player, final Server server, final Location loc) throws MobException
{
final LivingEntity entity = player.getWorld().spawn(loc, (Class<? extends LivingEntity>)this.bukkitType.getEntityClass());
return spawn(player.getWorld(), server, loc);
}
public Entity spawn(final World world, final Server server, final Location loc) throws MobException
{
final Entity entity = world.spawn(loc, (Class<? extends Entity>)this.bukkitType.getEntityClass());
if (entity == null)
{
logger.log(Level.WARNING, _("unableToSpawnMob"));

View File

@@ -7,14 +7,12 @@ import lombok.Delegate;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
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.*;
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;
@@ -25,7 +23,6 @@ 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;
@@ -841,6 +838,12 @@ public class OfflinePlayer implements Player
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setBedSpawnLocation(Location lctn, boolean force)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void playEffect(EntityEffect ee)
{
@@ -1027,4 +1030,142 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isBlocking()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void abandonConversation(Conversation arg0, ConversationAbandonedEvent arg1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isFlying()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setFlying(boolean arg0)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getExpToLevel()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasLineOfSight(Entity entity)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isValid()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setFlySpeed(float value) throws IllegalArgumentException
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setWalkSpeed(float value) throws IllegalArgumentException
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public float getFlySpeed()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public float getWalkSpeed()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Inventory getEnderChest()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void playSound(Location arg0, Sound arg1, float arg2, float arg3)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void giveExpLevels(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean getRemoveWhenFarAway()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setRemoveWhenFarAway(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public EntityEquipment getEquipment()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setCanPickupItems(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean getCanPickupItems()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getLocation(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTexturePack(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setMaxHealth(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void resetMaxHealth()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@@ -12,6 +12,7 @@ import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.event.EventPriority;
@@ -23,6 +24,7 @@ public class Settings implements ISettings
private final transient EssentialsConf config;
private final static Logger logger = Logger.getLogger("Minecraft");
private final transient IEssentials ess;
private boolean metricsEnabled = true;
public Settings(IEssentials ess)
{
@@ -53,19 +55,21 @@ public class Settings implements ISettings
@Override
public int getHomeLimit(final User user)
{
final Set<String> homeList = getMultipleHomes();
if (homeList == null)
int limit = 1;
if (user.isAuthorized("essentials.sethome.multiple"))
{
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
// return getHomeLimit("default");
return config.getInt("multiple-homes", 5);
limit = getHomeLimit("default");
}
int limit = getHomeLimit("default");
for (String set : homeList)
final Set<String> homeList = getMultipleHomes();
if (homeList != null)
{
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
for (String set : homeList)
{
limit = getHomeLimit(set);
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
{
limit = getHomeLimit(set);
}
}
}
return limit;
@@ -76,11 +80,17 @@ public class Settings implements ISettings
{
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
}
private int chatRadius = 0;
private int _getChatRadius()
{
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
}
@Override
public int getChatRadius()
{
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
return chatRadius;
}
@Override
@@ -112,39 +122,29 @@ public class Settings implements ISettings
{
return isCommandDisabled(cmd.getName());
}
private Set<String> disabledCommands = new HashSet<String>();
@Override
public boolean isCommandDisabled(String label)
{
return disabledCommands.contains(label);
}
private Set<String> getDisabledCommands()
{
Set<String> disCommands = new HashSet<String>();
for (String c : config.getStringList("disabled-commands"))
{
if (!c.equalsIgnoreCase(label))
{
continue;
}
return true;
disCommands.add(c.toLowerCase(Locale.ENGLISH));
}
return config.getBoolean("disable-" + label.toLowerCase(Locale.ENGLISH), false);
}
@Override
public boolean isCommandRestricted(IEssentialsCommand cmd)
{
return isCommandRestricted(cmd.getName());
}
@Override
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands"))
for (String c : config.getKeys(false))
{
if (!c.equalsIgnoreCase(label))
if (c.startsWith("disable-"))
{
continue;
disCommands.add(c.substring(8).toLowerCase(Locale.ENGLISH));
}
return true;
}
return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
return disCommands;
}
@Override
@@ -174,6 +174,7 @@ public class Settings implements ISettings
}
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
}
private ConfigurationSection commandCosts;
@Override
public double getCommandCost(IEssentialsCommand cmd)
@@ -181,21 +182,97 @@ public class Settings implements ISettings
return getCommandCost(cmd.getName());
}
@Override
public double getCommandCost(String label)
public ConfigurationSection _getCommandCosts()
{
double cost = config.getDouble("command-costs." + label, 0.0);
if (cost == 0.0)
if (config.isConfigurationSection("command-costs"))
{
cost = config.getDouble("cost-" + label, 0.0);
final ConfigurationSection section = config.getConfigurationSection("command-costs");
final ConfigurationSection newSection = new MemoryConfiguration();
for (String command : section.getKeys(false))
{
PluginCommand cmd = ess.getServer().getPluginCommand(command);
if (command.charAt(0) == '/')
{
ess.getLogger().warning("Invalid command cost. '" + command + "' should not start with '/'.");
}
if (section.isDouble(command))
{
newSection.set(command.toLowerCase(Locale.ENGLISH), section.getDouble(command));
}
else if (section.isInt(command))
{
newSection.set(command.toLowerCase(Locale.ENGLISH), (double)section.getInt(command));
}
else if (section.isString(command))
{
String costString = section.getString(command);
try
{
double cost = Double.parseDouble(costString.trim().replace(getCurrencySymbol(), "").replaceAll("\\W", ""));
newSection.set(command.toLowerCase(Locale.ENGLISH), cost);
}
catch (NumberFormatException ex)
{
ess.getLogger().warning("Invalid command cost for: " + command + " (" + costString + ")");
}
}
else
{
ess.getLogger().warning("Invalid command cost for: " + command);
}
}
return newSection;
}
return cost;
return null;
}
@Override
public double getCommandCost(String name)
{
name = name.replace('.', '_').replace('/', '_');
if (commandCosts != null)
{
return commandCosts.getDouble(name, 0.0);
}
return 0.0;
}
private Set<String> socialSpyCommands = new HashSet<String>();
public Set<String> _getSocialSpyCommands()
{
Set<String> socialspyCommands = new HashSet<String>();
if (config.isConfigurationSection("socialspy-commands"))
{
for (String c : config.getStringList("socialspy-commands"))
{
socialspyCommands.add(c.toLowerCase(Locale.ENGLISH));
}
}
else
{
socialspyCommands.addAll(Arrays.asList("msg", "r", "mail", "m", "whisper", "emsg", "t", "tell", "er", "reply", "ereply", "email", "action", "describe", "eme", "eaction", "edescribe", "etell", "ewhisper", "pm"));
}
return socialspyCommands;
}
public Set<String> getSocialSpyCommands()
{
return socialSpyCommands;
}
private String nicknamePrefix = "~";
private String _getNicknamePrefix()
{
return config.getString("nickname-prefix", "~");
}
@Override
public String getNicknamePrefix()
{
return config.getString("nickname-prefix", "~");
return nicknamePrefix;
}
@Override
@@ -239,7 +316,7 @@ public class Settings implements ISettings
public Map<String, Object> getKit(String name)
{
name = name.replace('.', '_').replace('/', '_');
if (config.isConfigurationSection("kits"))
if (getKits() != null)
{
final ConfigurationSection kits = getKits();
if (kits.isConfigurationSection(name))
@@ -249,19 +326,25 @@ public class Settings implements ISettings
}
return null;
}
private ChatColor operatorColor = null;
@Override
public ChatColor getOperatorColor() throws Exception
public ChatColor getOperatorColor()
{
return operatorColor;
}
private ChatColor _getOperatorColor()
{
String colorName = config.getString("ops-name-color", null);
if (colorName == null)
{
return ChatColor.RED;
return ChatColor.DARK_RED;
}
if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
{
throw new Exception();
return null;
}
try
@@ -302,7 +385,7 @@ public class Settings implements ISettings
@Override
public boolean areSignsDisabled()
{
return enabledSigns.isEmpty();
return !signsEnabled;
}
@Override
@@ -316,7 +399,7 @@ public class Settings implements ISettings
{
return config.getString("backup.command", null);
}
private Map<String, MessageFormat> chatFormats = new HashMap<String, MessageFormat>();
private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
@Override
public MessageFormat getChatFormat(String group)
@@ -326,13 +409,14 @@ public class Settings implements ISettings
{
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 = Util.replaceFormat(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\\]");
format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
format = "§r".concat(format);
mFormat = new MessageFormat(format);
chatFormats.put(group, mFormat);
}
@@ -348,7 +432,7 @@ public class Settings implements ISettings
@Override
public IText getAnnounceNewPlayerFormat()
{
return new SimpleTextInput(Util.replaceColor(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
return new SimpleTextInput(Util.replaceFormat(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
}
@Override
@@ -381,9 +465,32 @@ public class Settings implements ISettings
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
enabledSigns = _getEnabledSigns();
teleportInvulnerability = _isTeleportInvulnerability();
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
registerBackInListener = _registerBackInListener();
cancelAfkOnInteract = _cancelAfkOnInteract();
cancelAfkOnMove = _cancelAfkOnMove() && cancelAfkOnInteract;
getFreezeAfkPlayers = _getFreezeAfkPlayers();
itemSpawnBl = _getItemSpawnBlacklist();
loginAttackDelay = _getLoginAttackDelay();
signUsePerSecond = _getSignUsePerSecond();
kits = _getKits();
chatFormats.clear();
changeDisplayName = _changeDisplayName();
disabledCommands = getDisabledCommands();
nicknamePrefix = _getNicknamePrefix();
operatorColor = _getOperatorColor();
changePlayerListName = _changePlayerListName();
configDebug = _isDebug();
prefixsuffixconfigured = _isPrefixSuffixConfigured();
addprefixsuffix = _addPrefixSuffix();
disablePrefix = _disablePrefix();
disableSuffix = _disableSuffix();
chatRadius = _getChatRadius();
commandCosts = _getCommandCosts();
socialSpyCommands = _getSocialSpyCommands();
warnOnBuildDisallow = _warnOnBuildDisallow();
mailsPerMinute = _getMailsPerMinute();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@@ -421,6 +528,7 @@ public class Settings implements ISettings
return epItemSpwn;
}
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
private boolean signsEnabled = false;
@Override
public List<EssentialsSign> enabledSigns()
@@ -439,6 +547,11 @@ public class Settings implements ISettings
{
continue;
}
if (signName.equals("COLOR") || signName.equals("COLOUR"))
{
signsEnabled = true;
continue;
}
try
{
newSigns.add(Signs.valueOf(signName).getSign());
@@ -446,28 +559,36 @@ public class Settings implements ISettings
catch (Exception ex)
{
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
continue;
}
signsEnabled = true;
}
return newSigns;
}
private boolean warnOnBuildDisallow;
@Override
public boolean spawnIfNoHome()
private boolean _warnOnBuildDisallow()
{
return config.getBoolean("spawn-if-no-home", false);
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
}
@Override
public boolean warnOnBuildDisallow()
{
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
return warnOnBuildDisallow;
}
private boolean debug = false;
private boolean configDebug = false;
private boolean _isDebug()
{
return config.getBoolean("debug", false);
}
@Override
public boolean isDebug()
{
return debug || config.getBoolean("debug", false);
return debug || configDebug;
}
@Override
@@ -488,10 +609,12 @@ public class Settings implements ISettings
return config.getString("locale", "");
}
//This method should always only return one character due to the implementation of the calling methods
//If you need to use a string currency, for example "coins", use the translation key 'currency'.
@Override
public String getCurrencySymbol()
{
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
return config.getString("currency-symbol", "$").concat("$").substring(0, 1).replaceAll("[0-9]", "$");
}
@Override
@@ -594,11 +717,29 @@ public class Settings implements ISettings
{
return config.getBoolean("remove-god-on-disconnect", false);
}
private boolean changeDisplayName = true;
private boolean _changeDisplayName()
{
return config.getBoolean("change-displayname", true);
}
@Override
public boolean changeDisplayName()
{
return config.getBoolean("change-displayname", true);
return changeDisplayName;
}
private boolean changePlayerListName = false;
private boolean _changePlayerListName()
{
return config.getBoolean("change-playerlist", false);
}
@Override
public boolean changePlayerListName()
{
return changePlayerListName;
}
@Override
@@ -606,25 +747,56 @@ public class Settings implements ISettings
{
return config.getBoolean("use-bukkit-permissions", false);
}
private boolean prefixsuffixconfigured = false;
private boolean addprefixsuffix = false;
private boolean essentialsChatActive = false;
private boolean _addPrefixSuffix()
{
return config.getBoolean("add-prefix-suffix", false);
}
private boolean _isPrefixSuffixConfigured()
{
return config.hasProperty("add-prefix-suffix");
}
@Override
public void setEssentialsChatActive(boolean essentialsChatActive)
{
this.essentialsChatActive = essentialsChatActive;
}
@Override
public boolean addPrefixSuffix()
{
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
}
private boolean disablePrefix = false;
@Override
public boolean disablePrefix()
private boolean _disablePrefix()
{
return config.getBoolean("disablePrefix", false);
}
@Override
public boolean disableSuffix()
public boolean disablePrefix()
{
return disablePrefix;
}
private boolean disableSuffix = false;
private boolean _disableSuffix()
{
return config.getBoolean("disableSuffix", false);
}
@Override
public boolean disableSuffix()
{
return disableSuffix;
}
@Override
public long getAutoAfk()
{
@@ -636,12 +808,42 @@ public class Settings implements ISettings
{
return config.getLong("auto-afk-kick", -1);
}
private boolean getFreezeAfkPlayers;
@Override
public boolean getFreezeAfkPlayers()
{
return getFreezeAfkPlayers;
}
private boolean _getFreezeAfkPlayers()
{
return config.getBoolean("freeze-afk-players", false);
}
private boolean cancelAfkOnMove;
@Override
public boolean cancelAfkOnMove()
{
return cancelAfkOnMove;
}
private boolean _cancelAfkOnMove()
{
return config.getBoolean("cancel-afk-on-move", true);
}
private boolean cancelAfkOnInteract;
@Override
public boolean cancelAfkOnInteract()
{
return cancelAfkOnInteract;
}
private boolean _cancelAfkOnInteract()
{
return config.getBoolean("cancel-afk-on-interact", true);
}
@Override
public boolean areDeathMessagesEnabled()
@@ -669,21 +871,45 @@ public class Settings implements ISettings
}
@Override
public boolean getIsWorldTeleportPermissions()
public boolean allowUnsafeEnchantments()
{
return config.getBoolean("unsafe-enchantments", false);
}
@Override
public boolean isWorldTeleportPermissions()
{
return config.getBoolean("world-teleport-permissions", false);
}
@Override
public boolean isWorldHomePermissions()
{
return config.getBoolean("world-home-permissions", false);
}
private boolean registerBackInListener;
@Override
public boolean registerBackInListener()
{
return registerBackInListener;
}
private boolean _registerBackInListener()
{
return config.getBoolean("register-back-in-listener", false);
}
private boolean disableItemPickupWhileAfk;
@Override
public boolean getDisableItemPickupWhileAfk()
{
return config.getBoolean("disable-item-pickup-while-afk", true);
return disableItemPickupWhileAfk;
}
private boolean _getDisableItemPickupWhileAfk()
{
return config.getBoolean("disable-item-pickup-while-afk", false);
}
@Override
@@ -716,6 +942,95 @@ public class Settings implements ISettings
@Override
public long getTpaAcceptCancellation()
{
return config.getLong("tpa-accept-cancellation", 0);
return config.getLong("tpa-accept-cancellation", 120);
}
@Override
public boolean isMetricsEnabled()
{
return metricsEnabled;
}
@Override
public void setMetricsEnabled(boolean metricsEnabled)
{
this.metricsEnabled = metricsEnabled;
}
private boolean teleportInvulnerability;
@Override
public long getTeleportInvulnerability()
{
return config.getLong("teleport-invulnerability", 0) * 1000;
}
private boolean _isTeleportInvulnerability()
{
return (config.getLong("teleport-invulnerability", 0) > 0);
}
@Override
public boolean isTeleportInvulnerability()
{
return teleportInvulnerability;
}
private long loginAttackDelay;
private long _getLoginAttackDelay()
{
return config.getLong("login-attack-delay", 0) * 1000;
}
@Override
public long getLoginAttackDelay()
{
return loginAttackDelay;
}
private int signUsePerSecond;
private int _getSignUsePerSecond()
{
final int perSec = config.getInt("sign-use-per-second", 4);
return perSec > 0 ? perSec : 1;
}
@Override
public int getSignUsePerSecond()
{
return signUsePerSecond;
}
@Override
public double getMaxFlySpeed()
{
double maxSpeed = config.getDouble("max-fly-speed", 1.0);
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
}
//This option does not exist in the config.yml because it wasn't yet implemented in bukkit
//The code was commented out in the /speed command
@Override
public double getMaxWalkSpeed()
{
double maxSpeed = config.getDouble("max-walk-speed", 0.8);
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
}
private int mailsPerMinute;
private int _getMailsPerMinute()
{
return config.getInt("mails-per-minute", 1000);
}
@Override
public int getMailsPerMinute()
{
return mailsPerMinute;
}
@Override
public long getMaxTempban()
{
return config.getLong("max-tempban-time", -1);
}
}

View File

@@ -0,0 +1,295 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob.MobException;
import java.util.HashSet;
import java.util.Locale;
import java.util.Random;
import java.util.Set;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.material.Colorable;
public class SpawnMob
{
public static String mobList(final User user)
{
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"));
}
return Util.joinList(availableList);
}
public static String[] mobData(final String mobString)
{
String[] returnString = new String[4];
final String[] parts = mobString.split(",");
String[] mobParts = parts[0].split(":");
returnString[0] = mobParts[0];
if (mobParts.length == 2)
{
returnString[1] = mobParts[1];
}
if (parts.length > 1)
{
String[] mountParts = parts[1].split(":");
returnString[2] = mountParts[0];
if (mountParts.length == 2)
{
returnString[3] = mountParts[1];
}
}
return returnString;
}
// This method spawns a mob where the user is looking, owned by user
public static void spawnmob(final IEssentials ess, final Server server, final User user, final String[] Data, int mobCount) throws Exception
{
final Block block = Util.getTarget(user).getBlock();
if (block == null)
{
throw new Exception(_("unableToSpawnMob"));
}
spawnmob(ess, server, user, user, block.getLocation(), Data, mobCount);
}
// This method spawns a mob at loc, owned by noone
public static void spawnmob(final IEssentials ess, final Server server, final CommandSender sender, final Location loc, final String[] Data, int mobCount) throws Exception
{
spawnmob(ess, server, sender, null, loc, Data, mobCount);
}
// This method spawns a mob at target, owned by target
public static void spawnmob(final IEssentials ess, final Server server, final CommandSender sender, final User target, final String[] Data, int mobCount) throws Exception
{
spawnmob(ess, server, sender, target, target.getLocation(), Data, mobCount);
}
// This method spawns a mob at loc, owned by target
public static void spawnmob(final IEssentials ess, final Server server, final CommandSender sender, final User target, final Location loc, final String[] Data, int mobCount) throws Exception
{
final Location sloc = Util.getSafeDestination(loc);
final String mobType = Data[0];
final String mobData = Data[1];
final String mountType = Data[2];
final String mountData = Data[3];
Mob mob = Mob.fromName(mobType);
Mob mobMount = null;
checkSpawnable(ess, sender, mob);
if (mountType != null)
{
mobMount = Mob.fromName(mountType);
checkSpawnable(ess, sender, mobMount);
}
int serverLimit = ess.getSettings().getSpawnMobLimit();
if (mobCount > serverLimit)
{
mobCount = serverLimit;
sender.sendMessage(_("mobSpawnLimit"));
}
try
{
for (int i = 0; i < mobCount; i++)
{
spawnMob(ess, server, sender, target, sloc, mob, mobData, mobMount, mountData);
}
sender.sendMessage(mobCount + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
}
catch (MobException e1)
{
throw new Exception(_("unableToSpawnMob"), e1);
}
catch (NumberFormatException e2)
{
throw new Exception(_("numberRequired"), e2);
}
catch (NullPointerException np)
{
throw new Exception(_("soloMob"), np);
}
}
private static void spawnMob(final IEssentials ess, final Server server, final CommandSender sender, final User target, final Location sloc, Mob mob, String mobData, Mob mobMount, String mountData) throws Exception
{
Entity spawnedMob = mob.spawn(sloc.getWorld(), server, sloc);
Entity spawnedMount = null;
if (mobMount != null)
{
spawnedMount = mobMount.spawn(sloc.getWorld(), server, sloc);
spawnedMob.setPassenger(spawnedMount);
}
if (mobData != null)
{
changeMobData(mob.getType(), spawnedMob, mobData, target);
}
if (spawnedMount != null && mountData != null)
{
changeMobData(mobMount.getType(), spawnedMount, mountData, target);
}
}
private static void checkSpawnable(IEssentials ess, CommandSender sender, Mob mob) throws Exception
{
if (mob == null)
{
throw new Exception(_("invalidMob"));
}
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("disabledToSpawnMob"));
}
if (sender instanceof User && !((User)sender).isAuthorized("essentials.spawnmob." + mob.name.toLowerCase()))
{
throw new Exception(_("noPermToSpawnMob"));
}
}
private static void changeMobData(final EntityType type, final Entity spawned, String data, final User target) throws Exception
{
data = data.toLowerCase(Locale.ENGLISH);
if (spawned instanceof Slime)
{
try
{
((Slime)spawned).setSize(Integer.parseInt(data));
}
catch (Exception e)
{
throw new Exception(_("slimeMalformedSize"), e);
}
}
if ((spawned instanceof Ageable) && data.contains("baby"))
{
((Ageable)spawned).setBaby();
data = data.replace("baby", "");
}
if (spawned instanceof Colorable)
{
final String color = data.toUpperCase(Locale.ENGLISH);
try
{
if (color.equals("RANDOM"))
{
final Random rand = new Random();
((Colorable)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
}
else if (color.length() > 1)
{
((Colorable)spawned).setColor(DyeColor.valueOf(color));
}
}
catch (Exception e)
{
throw new Exception(_("sheepMalformedColor"), e);
}
}
if (spawned instanceof Tameable && data.contains("tamed") && target != null)
{
final Tameable tameable = ((Tameable)spawned);
tameable.setTamed(true);
tameable.setOwner(target.getBase());
data = data.replace("tamed", "");
}
if (type == EntityType.WOLF)
{
if (data.contains("angry"))
{
((Wolf)spawned).setAngry(true);
}
}
if (type == EntityType.CREEPER && data.contains("powered"))
{
((Creeper)spawned).setPowered(true);
}
if (type == EntityType.OCELOT)
{
if (data.contains("siamese") || data.contains("white"))
{
((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT);
}
else if (data.contains("red") || data.contains("orange") || data.contains("tabby"))
{
((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT);
}
else if (data.contains("black") || data.contains("tuxedo"))
{
((Ocelot)spawned).setCatType(Ocelot.Type.BLACK_CAT);
}
}
if (type == EntityType.VILLAGER)
{
for (Villager.Profession prof : Villager.Profession.values())
{
if (data.contains(prof.toString().toLowerCase(Locale.ENGLISH)))
{
((Villager)spawned).setProfession(prof);
}
}
}
if (spawned instanceof Zombie)
{
if (data.contains("villager"))
{
((Zombie)spawned).setVillager(true);
}
if (data.contains("baby"))
{
((Zombie)spawned).setBaby(true);
}
}
if (type == EntityType.SKELETON)
{
if (data.contains("wither"))
{
((Skeleton)spawned).setSkeletonType(SkeletonType.WITHER);
}
}
if (type == EntityType.EXPERIENCE_ORB)
{
if (Util.isInt(data))
{
((ExperienceOrb)spawned).setExperience(Integer.parseInt(data));
}
}
}
}

View File

@@ -1,6 +1,5 @@
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;
@@ -25,13 +24,13 @@ public class TNTExplodeListener implements Listener, Runnable
if (!enabled)
{
enabled = true;
timer = ess.scheduleSyncDelayedTask(this, 1000);
timer = ess.scheduleSyncDelayedTask(this, 200);
return;
}
if (timer != -1)
{
ess.getScheduler().cancelTask(timer);
timer = ess.scheduleSyncDelayedTask(this, 1000);
timer = ess.scheduleSyncDelayedTask(this, 200);
}
}
@@ -46,8 +45,12 @@ public class TNTExplodeListener implements Listener, Runnable
{
return;
}
FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
if (event.blockList().size() < 1)
{
return;
}
event.setCancelled(true);
event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
}
@Override

View File

@@ -1,13 +1,12 @@
package com.earth2me.essentials;
import com.earth2me.essentials.api.ITeleport;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import com.earth2me.essentials.api.ITeleport;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -16,38 +15,40 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Teleport implements Runnable, ITeleport
{
private static final double MOVE_CONSTANT = 0.3;
private static class Target
private class Target
{
private final Location location;
private final Entity entity;
public Target(Location location)
private final String name;
Target(Location location)
{
this.location = location;
this.entity = null;
this.name = null;
}
public Target(Entity entity)
Target(Player entity)
{
this.entity = entity;
this.name = entity.getName();
this.location = null;
}
public Location getLocation()
{
if (this.entity != null)
if (this.name != null)
{
return this.entity.getLocation();
return ess.getServer().getPlayerExact(name).getLocation();
}
return location;
}
}
private IUser user;
private IUser teleportUser;
private int teleTimer = -1;
private long started; // time this task was initiated
private long delay; // how long to delay the teleport
private long tpdelay; // how long to delay the teleport
private int health;
// note that I initially stored a clone of the location for reference, but...
// when comparing locations, I got incorrect mismatches (rounding errors, looked like)
@@ -56,55 +57,76 @@ public class Teleport implements Runnable, ITeleport
private long initY;
private long initZ;
private Target teleportTarget;
private boolean respawn;
private Trade chargeFor;
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
private TeleportCause cause;
private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause)
{
initTimer(delay, user, target, chargeFor, cause, false);
}
private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause, boolean respawn)
{
this.started = System.currentTimeMillis();
this.delay = delay;
this.health = user.getHealth();
this.initX = Math.round(user.getLocation().getX() * MOVE_CONSTANT);
this.initY = Math.round(user.getLocation().getY() * MOVE_CONSTANT);
this.initZ = Math.round(user.getLocation().getZ() * MOVE_CONSTANT);
this.tpdelay = delay;
this.health = teleportUser.getHealth();
this.initX = Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT);
this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT);
this.initZ = Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT);
this.teleportUser = teleportUser;
this.teleportTarget = target;
this.chargeFor = chargeFor;
this.cause = cause;
this.respawn = respawn;
}
@Override
public void run()
{
if (user == null || !user.isOnline() || user.getLocation() == null)
{
cancel();
cancel(false);
return;
}
if (Math.round(user.getLocation().getX() * MOVE_CONSTANT) != initX
|| Math.round(user.getLocation().getY() * MOVE_CONSTANT) != initY
|| Math.round(user.getLocation().getZ() * MOVE_CONSTANT) != initZ
|| user.getHealth() < health)
{ // user moved, cancel teleport
if (teleportUser == null || !teleportUser.isOnline() || teleportUser.getLocation() == null)
{
cancel(false);
return;
}
if (!user.isAuthorized("essentials.teleport.timer.move")
&& (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX
|| Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY
|| Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ
|| teleportUser.getHealth() < health))
{
// user moved, cancel teleport
cancel(true);
return;
}
health = user.getHealth(); // in case user healed, then later gets injured
health = teleportUser.getHealth(); // in case user healed, then later gets injured
long now = System.currentTimeMillis();
if (now > started + delay)
if (now > started + tpdelay)
{
try
{
cooldown(false);
user.sendMessage(_("teleportationCommencing"));
teleportUser.sendMessage(_("teleportationCommencing"));
try
{
now(teleportTarget, cause);
if (respawn)
{
teleportUser.getTeleport().respawn(cause);
}
else
{
teleportUser.getTeleport().now(teleportTarget, cause);
}
cancel(false);
if (chargeFor != null)
{
chargeFor.charge(user);
@@ -118,54 +140,59 @@ public class Teleport implements Runnable, ITeleport
catch (Exception ex)
{
user.sendMessage(_("cooldownWithMessage", ex.getMessage()));
if (user != teleportUser)
{
teleportUser.sendMessage(_("cooldownWithMessage", ex.getMessage()));
}
}
}
}
public Teleport(IUser user, IEssentials ess)
{
this.user = user;
this.ess = ess;
}
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
{
final Player player = user.getBase();
final Location bed = player.getBedSpawnLocation();
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null);
ess.getServer().getPluginManager().callEvent(pre);
teleport(new Target(pre.getRespawnLocation()), chargeFor, cause);
}
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
{
Location loc = ess.getWarps().getWarp(warp);
teleport(new Target(loc), chargeFor, cause);
user.sendMessage(_("warpingTo", warp));
}
public void cooldown(boolean check) throws Exception
{
Calendar now = new GregorianCalendar();
final Calendar time = new GregorianCalendar();
if (user.getLastTeleportTimestamp() > 0)
{
double cooldown = ess.getSettings().getTeleportCooldown();
Calendar cooldownTime = new GregorianCalendar();
cooldownTime.setTimeInMillis(user.getLastTeleportTimestamp());
cooldownTime.add(Calendar.SECOND, (int)cooldown);
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !user.isAuthorized("essentials.teleport.cooldown.bypass"))
// Take the current time, and remove the delay from it.
final double cooldown = ess.getSettings().getTeleportCooldown();
final Calendar earliestTime = new GregorianCalendar();
earliestTime.add(Calendar.SECOND, -(int)cooldown);
earliestTime.add(Calendar.MILLISECOND, -(int)((cooldown * 1000.0) % 1000.0));
// This value contains the most recent time a teleport could have been used that would allow another use.
final long earliestLong = earliestTime.getTimeInMillis();
// When was the last teleport used?
final Long lastTime = user.getLastTeleportTimestamp();
if (lastTime > time.getTimeInMillis())
{
throw new Exception(_("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
// This is to make sure time didn't get messed up on last kit use.
// If this happens, let's give the user the benifit of the doubt.
user.setLastTeleportTimestamp(time.getTimeInMillis());
return;
}
else if (lastTime > earliestLong && !user.isAuthorized("essentials.teleport.cooldown.bypass"))
{
time.setTimeInMillis(lastTime);
time.add(Calendar.SECOND, (int)cooldown);
time.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
throw new Exception(_("timeBeforeTeleport", Util.formatDateDiff(time.getTimeInMillis())));
}
}
// if justCheck is set, don't update lastTeleport; we're just checking
if (!check)
{
user.setLastTeleportTimestamp(now.getTimeInMillis());
user.setLastTeleportTimestamp(time.getTimeInMillis());
}
}
//If we need to cancel a pending teleport call this method
public void cancel(boolean notifyUser)
{
if (teleTimer == -1)
@@ -178,6 +205,10 @@ public class Teleport implements Runnable, ITeleport
if (notifyUser)
{
user.sendMessage(_("pendingTeleportCancelled"));
if (teleportUser != user)
{
teleportUser.sendMessage(_("pendingTeleportCancelled"));
}
}
}
finally
@@ -186,30 +217,54 @@ public class Teleport implements Runnable, ITeleport
}
}
public void cancel()
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
{
cancel(false);
if (cooldown)
{
cooldown(false);
}
now(new Target(loc), cause);
}
public void teleport(Location loc, Trade chargeFor) throws Exception
public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception
{
teleport(new Target(loc), chargeFor, TeleportCause.PLUGIN);
if (cooldown)
{
cooldown(false);
}
now(new Target(entity), cause);
}
private void now(Target target, TeleportCause cause) throws Exception
{
cancel(false);
user.setLastLocation();
user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause);
}
//The teleport function is used when you want to normally teleport someone to a location or player.
//This method is nolonger used internally and will be removed.
@Deprecated
public void teleport(Location loc, Trade chargeFor) throws Exception
{
teleport(loc, chargeFor, TeleportCause.PLUGIN);
}
public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
{
teleport(new Target(loc), chargeFor, cause);
}
public void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception
public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception
{
teleport(new Target(entity), chargeFor, cause);
}
private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
{
double delay = ess.getSettings().getTeleportDelay();
if (chargeFor != null)
{
chargeFor.isAffordableFor(user);
@@ -225,66 +280,119 @@ public class Teleport implements Runnable, ITeleport
}
return;
}
cancel(false);
warnUser(user, delay);
initTimer((long)(delay * 1000.0), target, chargeFor, cause);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
cancel();
//The teleportToMe function is a wrapper used to handle teleporting players to them, like /tphere
public void teleportToMe(User otherUser, Trade chargeFor, TeleportCause cause) throws Exception
{
Target target = new Target(user);
double delay = ess.getSettings().getTeleportDelay();
if (chargeFor != null)
{
chargeFor.isAffordableFor(user);
}
cooldown(true);
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
{
cooldown(false);
otherUser.getTeleport().now(target, cause);
if (chargeFor != null)
{
chargeFor.charge(user);
}
return;
}
cancel(false);
warnUser(otherUser, delay);
initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause, false);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
private void warnUser(final IUser user, final double delay)
{
Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
initTimer((long)(delay * 1000.0), target, chargeFor, cause);
}
//The respawn function is a wrapper used to handle tp fallback, on /jail and /home
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
{
double delay = ess.getSettings().getTeleportDelay();
if (chargeFor != null)
{
chargeFor.isAffordableFor(user);
}
cooldown(true);
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
{
cooldown(false);
respawn(cause);
if (chargeFor != null)
{
chargeFor.charge(user);
}
return;
}
cancel(false);
warnUser(user, delay);
initTimer((long)(delay * 1000.0), user, null, chargeFor, cause, true);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
private void now(Target target, TeleportCause cause) throws Exception
public void respawn(TeleportCause cause) throws Exception
{
cancel();
user.setLastLocation();
user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause);
}
public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
{
if (cooldown)
final Player player = user.getBase();
Location bed = player.getBedSpawnLocation();
if (bed != null)
{
cooldown(false);
now(new Target(bed), cause);
}
now(new Target(loc), cause);
}
public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
{
cooldown(false);
chargeFor.charge(user);
now(new Target(loc), cause);
}
public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception
{
if (cooldown)
else
{
cooldown(false);
if (ess.getSettings().isDebug())
{
ess.getLogger().info("Could not find bed spawn, forcing respawn event.");
}
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, player.getWorld().getSpawnLocation(), false);
ess.getServer().getPluginManager().callEvent(pre);
now(new Target(pre.getRespawnLocation()), cause);
}
now(new Target(entity), cause);
}
//The warp function is a wrapper used to teleport a player to a /warp
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
{
Location loc = ess.getWarps().getWarp(warp);
user.sendMessage(_("warpingTo", warp));
teleport(new Target(loc), chargeFor, cause);
}
//The back function is a wrapper used to teleport a player /back to their previous location.
public void back(Trade chargeFor) throws Exception
{
teleport(new Target(user.getLastLocation()), chargeFor, TeleportCause.COMMAND);
}
//This function is used to throw a user back after a jail sentence
public void back() throws Exception
{
now(new Target(user.getLastLocation()), TeleportCause.COMMAND);
}
public void home(IUser user, String home, Trade chargeFor) throws Exception
//This function handles teleporting to /home
public void home(Location loc, Trade chargeFor) throws Exception
{
final Location loc = user.getHome(home);
if (loc == null)
{
throw new NotEnoughArgumentsException();
}
teleport(new Target(loc), chargeFor, TeleportCause.COMMAND);
}
}

View File

@@ -1,8 +1,8 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import com.earth2me.essentials.craftbukkit.SetExpFix;
import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -20,6 +20,7 @@ import org.bukkit.inventory.ItemStack;
public class Trade
{
private final transient String command;
private final transient Trade fallbackTrade;
private final transient Double money;
private final transient ItemStack itemStack;
private final transient Integer exp;
@@ -27,27 +28,33 @@ public class Trade
public Trade(final String command, final IEssentials ess)
{
this(command, null, null, null, ess);
this(command, null, null, null, null, ess);
}
public Trade(final String command, final Trade fallback, final IEssentials ess)
{
this(command, fallback, null, null, null, ess);
}
public Trade(final double money, final IEssentials ess)
{
this(null, money, null, null, ess);
this(null, null, money, null, null, ess);
}
public Trade(final ItemStack items, final IEssentials ess)
{
this(null, null, items, null, ess);
this(null, null, null, items, null, ess);
}
public Trade(final int exp, final IEssentials ess)
{
this(null, null, null, exp, ess);
this(null, null, null, null, exp, ess);
}
private Trade(final String command, final Double money, final ItemStack item, final Integer exp, final IEssentials ess)
private Trade(final String command, final Trade fallback, final Double money, final ItemStack item, final Integer exp, final IEssentials ess)
{
this.command = command;
this.fallbackTrade = fallback;
this.money = money;
this.itemStack = item;
this.exp = exp;
@@ -56,27 +63,29 @@ public class Trade
public void isAffordableFor(final IUser user) throws ChargeException
{
final double mon = user.getMoney();
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.INFO, "checking if " + user.getName() + " can afford charge.");
}
if (getMoney() != null
&& mon < getMoney()
&& getMoney() > 0
&& !user.isAuthorized("essentials.eco.loan"))
&& !user.canAfford(getMoney()))
{
throw new ChargeException(_("notEnoughMoney"));
}
if (getItemStack() != null
&& !InventoryWorkaround.containsItem(user.getInventory(), true, true, itemStack))
&& !user.getInventory().containsAtLeast(itemStack, itemStack.getAmount()))
{
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
}
double money;
if (command != null && !command.isEmpty()
&& !user.isAuthorized("essentials.nocommandcost.all")
&& !user.isAuthorized("essentials.nocommandcost." + command)
&& mon < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command)
&& 0 < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command)
&& !user.isAuthorized("essentials.eco.loan"))
&& 0 < (money = getCommandCost(user))
&& !user.canAfford(money))
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -104,7 +113,7 @@ public class Trade
{
if (dropItems)
{
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItems(user.getInventory(), getItemStack());
final Location loc = user.getLocation();
for (ItemStack itemStack : leftOver.values())
{
@@ -128,7 +137,7 @@ public class Trade
}
else
{
success = InventoryWorkaround.addAllItems(user.getInventory(), true, getItemStack());
success = InventoryWorkaround.addAllItems(user.getInventory(), getItemStack());
}
user.updateInventory();
}
@@ -141,9 +150,14 @@ public class Trade
public void charge(final IUser user) throws ChargeException
{
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.INFO, "charging user " + user.getName());
}
if (getMoney() != null)
{
if (!user.canAfford(getMoney()) && getMoney() > 0)
if (!user.canAfford(getMoney()) && getMoney() > 0.0d)
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -151,19 +165,17 @@ public class Trade
}
if (getItemStack() != null)
{
if (!InventoryWorkaround.containsItem(user.getInventory(), true, true, itemStack))
if (!user.getInventory().containsAtLeast(itemStack, itemStack.getAmount()))
{
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
}
InventoryWorkaround.removeItem(user.getInventory(), true, true, getItemStack());
user.getInventory().removeItem(getItemStack());
user.updateInventory();
}
if (command != null && !command.isEmpty()
&& !user.isAuthorized("essentials.nocommandcost.all")
&& !user.isAuthorized("essentials.nocommandcost." + command))
if (command != null)
{
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
if (!user.canAfford(cost) && cost > 0)
final double cost = getCommandCost(user);
if (!user.canAfford(cost) && cost > 0.0d)
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -194,10 +206,37 @@ public class Trade
{
return exp;
}
public Double getCommandCost(final IUser user)
{
double cost = 0.0d;
if (command != null && !command.isEmpty())
{
cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
if (cost == 0.0d && fallbackTrade != null)
{
cost = fallbackTrade.getCommandCost(user);
}
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.INFO, "calculated command (" + command + ") cost for " + user.getName() + " as " + cost);
}
}
if (cost != 0.0d && (user.isAuthorized("essentials.nocommandcost.all")
|| user.isAuthorized("essentials.nocommandcost." + command)))
{
return 0.0d;
}
return cost;
}
private static FileWriter fw = null;
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
{
//isEcoLogUpdateEnabled() - This refers to log entries with no location, ie API updates #EasterEgg
//isEcoLogEnabled() - This refers to log entries with with location, ie /pay /sell and eco signs.
if ((loc == null && !ess.getSettings().isEcoLogUpdateEnabled())
|| (loc != null && !ess.getSettings().isEcoLogEnabled()))
{

View File

@@ -7,9 +7,13 @@ 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;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@@ -17,12 +21,18 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
private CommandSender replyTo = null;
private transient User teleportRequester;
private transient boolean teleportRequestHere;
private transient boolean vanished;
private transient final Teleport teleport;
private transient long teleportRequestTime;
private transient long lastOnlineActivity;
private transient long lastThrottledAction;
private transient long lastActivity = System.currentTimeMillis();
private boolean hidden = false;
private boolean rightClickJump = false;
private transient Location afkPosition = null;
private boolean invSee = false;
private boolean recipeSee = false;
private boolean enderSee = false;
private static final Logger logger = Logger.getLogger("Minecraft");
User(final Player base, final IEssentials ess)
@@ -56,22 +66,39 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@Override
public boolean isAuthorized(final String node)
{
final boolean result = isAuthorizedCheck(node);
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node + " - " + result);
}
return result;
}
private boolean isAuthorizedCheck(final String node)
{
if (base instanceof OfflinePlayer)
{
return false;
}
if (isOp())
try
{
return true;
return ess.getPermissionsHandler().hasPermission(base, node);
}
if (isJailed())
catch (Exception ex)
{
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage(), ex);
}
else
{
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage());
}
return false;
}
return ess.getPermissionsHandler().hasPermission(base, node);
}
public void healCooldown() throws Exception
@@ -100,7 +127,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void giveMoney(final double value, final CommandSender initiator)
{
if (value == 0)
if (value == 0.0d)
{
return;
}
@@ -114,7 +141,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void payUser(final User reciever, final double value) throws Exception
{
if (value == 0)
if (value == 0.0d)
{
return;
}
@@ -139,7 +166,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void takeMoney(final double value, final CommandSender initiator)
{
if (value == 0)
if (value == 0.0d)
{
return;
}
@@ -151,6 +178,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
@Override
public boolean canAfford(final double cost)
{
return canAfford(cost, true);
@@ -158,6 +186,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public boolean canAfford(final double cost, final boolean permcheck)
{
if (cost <= 0.0d)
{
return true;
}
final double mon = getMoney();
if (!permcheck || isAuthorized("essentials.eco.loan"))
{
@@ -186,7 +218,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@Override
public int compareTo(final User other)
{
return Util.stripColor(this.getDisplayName()).compareToIgnoreCase(Util.stripColor(other.getDisplayName()));
return Util.stripFormat(this.getDisplayName()).compareToIgnoreCase(Util.stripFormat(other.getDisplayName()));
}
@Override
@@ -216,21 +248,17 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
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());
}
@Override
public void setLogoutLocation()
{
setLogoutLocation(getLocation());
}
public void requestTeleport(final User player, final boolean here)
{
@@ -244,92 +272,105 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return teleportRequester;
}
public boolean isTeleportRequestHere()
public boolean isTpRequestHere()
{
return teleportRequestHere;
}
public String getNick(final boolean addprefixsuffix)
public String getNick(final boolean longnick)
{
final StringBuilder nickname = new StringBuilder();
final StringBuilder prefix = new StringBuilder();
String nickname;
String suffix = "";
final String nick = getNickname();
if (ess.getSettings().isCommandDisabled("nick") || nick == null || nick.isEmpty() || nick.equals(getName()))
{
nickname.append(getName());
nickname = getName();
}
else
{
nickname.append(ess.getSettings().getNicknamePrefix()).append(nick);
nickname = ess.getSettings().getNicknamePrefix() + nick;
}
if (addprefixsuffix && isOp())
if (isOp())
{
try
{
final String opPrefix = ess.getSettings().getOperatorColor().toString();
if (opPrefix.length() > 0) {
nickname.insert(0, opPrefix);
nickname.append("§f");
final ChatColor opPrefix = ess.getSettings().getOperatorColor();
if (opPrefix != null && opPrefix.toString().length() > 0)
{
prefix.insert(0, opPrefix.toString());
suffix = "§r";
}
}
catch (Exception e)
{
}
}
if (addprefixsuffix && ess.getSettings().addPrefixSuffix())
if (ess.getSettings().addPrefixSuffix())
{
//These two extra toggles are not documented, because they are mostly redundant #EasterEgg
if (!ess.getSettings().disablePrefix())
{
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
nickname.insert(0, prefix);
final String ptext = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
prefix.insert(0, ptext);
suffix = "§r";
}
if (!ess.getSettings().disableSuffix())
{
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
nickname.append(suffix);
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
{
nickname.append("§f");
}
}
else
{
nickname.append("§f");
final String stext = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
suffix = stext + "§r";
suffix = suffix.replace("§f§f", "§f").replace("§f§r", "§r").replace("§r§r", "§r");
}
}
return nickname.toString();
final String strPrefix = prefix.toString();
String output = strPrefix + nickname + suffix;
if (!longnick && output.length() > 16)
{
output = strPrefix + nickname;
}
if (!longnick && output.length() > 16)
{
output = Util.lastCode(strPrefix) + nickname;
}
if (!longnick && output.length() > 16)
{
output = Util.lastCode(strPrefix) + nickname.substring(0, 14);
}
if (output.charAt(output.length() - 1) == '§')
{
output = output.substring(0, output.length() - 1);
}
return output;
}
public void setDisplayNick()
{
String name = getNick(true);
setDisplayName(name);
if (name.length() > 16)
if (base.isOnline() && ess.getSettings().changeDisplayName())
{
name = getNick(false);
}
if (name.length() > 16)
{
name = name.substring(0, name.charAt(15) == '§' ? 15 : 16);
}
try
{
setPlayerListName(name);
}
catch (IllegalArgumentException e)
{
logger.log(Level.INFO, "Playerlist for " + name + " was not updated. Use a shorter displayname prefix.");
setDisplayName(getNick(true));
if (ess.getSettings().changePlayerListName())
{
String name = getNick(false);
try
{
setPlayerListName(name);
}
catch (IllegalArgumentException e)
{
if (ess.getSettings().isDebug())
{
logger.log(Level.INFO, "Playerlist for " + name + " was not updated. Name clashed with another online player.");
}
}
}
}
}
@Override
public String getDisplayName()
{
if (!(base instanceof OfflinePlayer) && ess.getSettings().changeDisplayName())
{
setDisplayNick();
}
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
}
@@ -434,6 +475,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void setHidden(final boolean hidden)
{
this.hidden = hidden;
if (hidden == true)
{
setLastLogout(getLastOnlineActivity());
}
}
//Returns true if status expired during this check
@@ -451,6 +496,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
catch (Exception ex)
{
try
{
getTeleport().respawn(null, TeleportCause.PLUGIN);
}
catch (Exception ex1)
{
}
}
return true;
}
@@ -484,12 +536,17 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void updateActivity(final boolean broadcast)
{
if (isAfk())
if (isAfk() && ess.getSettings().cancelAfkOnInteract())
{
setAfk(false);
if (broadcast && !isHidden())
{
ess.broadcastMessage(this, _("userIsNotAway", getDisplayName()));
setDisplayNick();
final String msg = _("userIsNotAway", getDisplayName());
if (!msg.isEmpty())
{
ess.broadcastMessage(this, msg);
}
}
}
lastActivity = System.currentTimeMillis();
@@ -516,12 +573,17 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
final long autoafk = ess.getSettings().getAutoAfk();
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk"))
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk.auto"))
{
setAfk(true);
if (!isHidden())
{
ess.broadcastMessage(this, _("userIsAway", getDisplayName()));
setDisplayNick();
final String msg = _("userIsAway", getDisplayName());
if (!msg.isEmpty())
{
ess.broadcastMessage(this, msg);
}
}
}
}
@@ -531,16 +593,6 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return afkPosition;
}
@Override
public boolean toggleGodModeEnabled()
{
if (!isGodModeEnabled())
{
setFoodLevel(20);
}
return super.toggleGodModeEnabled();
}
@Override
public boolean isGodModeEnabled()
{
@@ -553,6 +605,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return super.isGodModeEnabled();
}
@Override
public String getGroup()
{
return ess.getPermissionsHandler().getGroup(base);
@@ -576,4 +629,140 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
return teleportRequestTime;
}
public boolean isInvSee()
{
return invSee;
}
public void setInvSee(final boolean set)
{
invSee = set;
}
public boolean isEnderSee()
{
return enderSee;
}
public void setEnderSee(final boolean set)
{
enderSee = set;
}
private transient long teleportInvulnerabilityTimestamp = 0;
public void enableInvulnerabilityAfterTeleport()
{
final long time = ess.getSettings().getTeleportInvulnerability();
if (time > 0)
{
teleportInvulnerabilityTimestamp = System.currentTimeMillis() + time;
}
}
public void resetInvulnerabilityAfterTeleport()
{
if (teleportInvulnerabilityTimestamp != 0
&& teleportInvulnerabilityTimestamp < System.currentTimeMillis())
{
teleportInvulnerabilityTimestamp = 0;
}
}
public boolean hasInvulnerabilityAfterTeleport()
{
return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis();
}
public boolean isVanished()
{
return vanished;
}
public void setVanished(final boolean set)
{
vanished = set;
if (set)
{
for (Player p : ess.getServer().getOnlinePlayers())
{
if (!ess.getUser(p).isAuthorized("essentials.vanish.see"))
{
p.hidePlayer(getBase());
}
}
setHidden(true);
ess.getVanishedPlayers().add(getName());
if (isAuthorized("essentials.vanish.effect"))
{
this.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
}
}
else
{
for (Player p : ess.getServer().getOnlinePlayers())
{
p.showPlayer(getBase());
}
setHidden(false);
ess.getVanishedPlayers().remove(getName());
if (isAuthorized("essentials.vanish.effect"))
{
this.removePotionEffect(PotionEffectType.INVISIBILITY);
}
}
}
public void toggleVanished()
{
final boolean set = !vanished;
this.setVanished(set);
}
public boolean checkSignThrottle()
{
if (isSignThrottled())
{
return true;
}
updateThrottle();
return false;
}
public boolean isSignThrottled()
{
final long minTime = lastThrottledAction + (1000 / ess.getSettings().getSignUsePerSecond());
return (System.currentTimeMillis() < minTime);
}
public void updateThrottle()
{
lastThrottledAction = System.currentTimeMillis();;
}
public boolean isFlyClickJump()
{
return rightClickJump;
}
public void setRightClickJump(boolean rightClickJump)
{
this.rightClickJump = rightClickJump;
}
@Override
public boolean isIgnoreExempt()
{
return this.isAuthorized("essentials.chat.ignoreexempt");
}
public boolean isRecipeSee()
{
return recipeSee;
}
public void setRecipeSee(boolean recipeSee)
{
this.recipeSee = recipeSee;
}
}

View File

@@ -1,10 +1,10 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.util.*;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -12,14 +12,14 @@ import org.bukkit.inventory.ItemStack;
public abstract class UserData extends PlayerExtension implements IConf
{
protected final transient IEssentials ess;
private final EssentialsConf config;
private static final Logger logger = Logger.getLogger("Minecraft");
private EssentialsConf config;
private final File folder;
protected UserData(Player base, IEssentials ess)
{
super(base);
this.ess = ess;
File folder = new File(ess.getDataFolder(), "userdata");
folder = new File(ess.getDataFolder(), "userdata");
if (!folder.exists())
{
folder.mkdirs();
@@ -28,6 +28,13 @@ public abstract class UserData extends PlayerExtension implements IConf
reloadConfig();
}
public final void reset()
{
config.getFile().delete();
config = new EssentialsConf(new File(folder, Util.sanitizeFileName(base.getName()) + ".yml"));
reloadConfig();
}
@Override
public final void reloadConfig()
{
@@ -41,24 +48,24 @@ public abstract class UserData extends PlayerExtension implements IConf
lastHealTimestamp = _getLastHealTimestamp();
jail = _getJail();
mails = _getMails();
savedInventory = _getSavedInventory();
teleportEnabled = getTeleportEnabled();
ignoredPlayers = getIgnoredPlayers();
teleportEnabled = _getTeleportEnabled();
godmode = _getGodModeEnabled();
muted = getMuted();
muted = _getMuted();
muteTimeout = _getMuteTimeout();
jailed = getJailed();
jailed = _getJailed();
jailTimeout = _getJailTimeout();
lastLogin = _getLastLogin();
lastLogout = _getLastLogout();
lastLoginAddress = _getLastLoginAddress();
afk = getAfk();
afk = _getAfk();
geolocation = _getGeoLocation();
isSocialSpyEnabled = _isSocialSpyEnabled();
isNPC = _isNPC();
arePowerToolsEnabled = _arePowerToolsEnabled();
kitTimestamps = _getKitTimestamps();
nickname = _getNickname();
setIgnoredPlayers(_getIgnoredPlayers());
logoutLocation = _getLogoutLocation();
}
private double money;
@@ -102,26 +109,25 @@ public abstract class UserData extends PlayerExtension implements IConf
return new HashMap<String, Object>();
}
public Location getHome(String name) throws Exception
private String getHomeName(String search)
{
Location loc = config.getLocation("homes." + name, getServer());
if (loc == null)
if (Util.isInt(search))
{
try
{
loc = config.getLocation("homes." + getHomes().get(Integer.parseInt(name) - 1), getServer());
search = getHomes().get(Integer.parseInt(search) - 1);
}
catch (IndexOutOfBoundsException e)
catch (Exception e)
{
return null;
}
catch (NumberFormatException e)
{
return null;
}
}
return loc;
return search;
}
public Location getHome(String name) throws Exception
{
String search = getHomeName(name);
return config.getLocation("homes." + search, getServer());
}
public Location getHome(final Location world)
@@ -149,13 +155,13 @@ public abstract class UserData extends PlayerExtension implements IConf
public List<String> getHomes()
{
return new ArrayList(homes.keySet());
return new ArrayList<String>(homes.keySet());
}
public void setHome(String name, Location loc)
{
//Invalid names will corrupt the yaml
name = Util.sanitizeFileName(name);
name = Util.safeString(name);
homes.put(name, loc);
config.setProperty("homes." + name, loc);
config.save();
@@ -163,21 +169,20 @@ public abstract class UserData extends PlayerExtension implements IConf
public void delHome(String name) throws Exception
{
String search = name;
String search = getHomeName(name);
if (!homes.containsKey(search))
{
search = Util.sanitizeFileName(name);
search = Util.safeString(search);
}
if (homes.containsKey(search))
{
homes.remove(name);
config.removeProperty("homes." + name);
homes.remove(search);
config.removeProperty("homes." + search);
config.save();
}
else
{
//TODO: move this message to messages file
throw new Exception("Home " + name + " doesn't exist");
throw new Exception(_("invalidHome", search));
}
}
@@ -189,14 +194,13 @@ public abstract class UserData extends PlayerExtension implements IConf
}
return false;
}
private String nickname;
public String _getNickname()
{
return config.getString("nickname");
}
public String getNickname()
{
return nickname;
@@ -256,11 +260,13 @@ public abstract class UserData extends PlayerExtension implements IConf
config.save();
}
@SuppressWarnings("unchecked")
public List<String> getPowertool(ItemStack stack)
{
return (List<String>)powertools.get("" + stack.getTypeId());
}
@SuppressWarnings("unchecked")
public List<String> getPowertool(int id)
{
return (List<String>)powertools.get("" + id);
@@ -313,6 +319,37 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("lastlocation", loc);
config.save();
}
private Location logoutLocation;
private Location _getLogoutLocation()
{
try
{
return config.getLocation("logoutlocation", getServer());
}
catch (Exception e)
{
return null;
}
}
public Location getLogoutLocation()
{
return logoutLocation;
}
public void setLogoutLocation(Location loc)
{
if (loc == null || loc.getWorld() == null)
{
return;
}
logoutLocation = loc;
config.setProperty("logoutlocation", loc);
config.save();
}
private long lastTeleportTimestamp;
private long _getLastTeleportTimestamp()
@@ -407,53 +444,9 @@ public abstract class UserData extends PlayerExtension implements IConf
mails.add(mail);
setMails(mails);
}
private ItemStack[] savedInventory;
public ItemStack[] getSavedInventory()
{
return savedInventory;
}
private ItemStack[] _getSavedInventory()
{
int size = config.getInt("inventory.size", 0);
if (size < 1 || (getInventory() != null && size > getInventory().getSize()))
{
return null;
}
ItemStack[] is = new ItemStack[size];
for (int i = 0; i < size; i++)
{
is[i] = config.getItemStack("inventory." + i);
}
return is;
}
public void setSavedInventory(ItemStack[] is)
{
if (is == null || is.length == 0)
{
savedInventory = null;
config.removeProperty("inventory");
}
else
{
savedInventory = is;
config.setProperty("inventory.size", is.length);
for (int i = 0; i < is.length; i++)
{
if (is[i] == null || is[i].getType() == Material.AIR)
{
continue;
}
config.setProperty("inventory." + i, is[i]);
}
}
config.save();
}
private boolean teleportEnabled;
private boolean getTeleportEnabled()
private boolean _getTeleportEnabled()
{
return config.getBoolean("teleportenabled", true);
}
@@ -485,16 +478,16 @@ public abstract class UserData extends PlayerExtension implements IConf
}
private List<String> ignoredPlayers;
public List<String> getIgnoredPlayers()
public List<String> _getIgnoredPlayers()
{
return config.getStringList("ignore");
return Collections.synchronizedList(config.getStringList("ignore"));
}
public void setIgnoredPlayers(List<String> players)
{
if (players == null || players.isEmpty())
{
ignoredPlayers = new ArrayList<String>();
ignoredPlayers = Collections.synchronizedList(new ArrayList<String>());
config.removeProperty("ignore");
}
else
@@ -505,20 +498,31 @@ public abstract class UserData extends PlayerExtension implements IConf
config.save();
}
public boolean isIgnoredPlayer(String name)
@Deprecated
public boolean isIgnoredPlayer(final String userName)
{
return ignoredPlayers.contains(name.toLowerCase(Locale.ENGLISH));
final IUser user = ess.getUser(userName);
if (user == null || !user.isOnline())
{
return false;
}
return isIgnoredPlayer(user);
}
public void setIgnoredPlayer(String name, boolean set)
public boolean isIgnoredPlayer(IUser user)
{
return (ignoredPlayers.contains(user.getName().toLowerCase(Locale.ENGLISH)) && !user.isIgnoreExempt());
}
public void setIgnoredPlayer(IUser user, boolean set)
{
if (set)
{
ignoredPlayers.add(name.toLowerCase(Locale.ENGLISH));
ignoredPlayers.add(user.getName().toLowerCase(Locale.ENGLISH));
}
else
{
ignoredPlayers.remove(name.toLowerCase(Locale.ENGLISH));
ignoredPlayers.remove(user.getName().toLowerCase(Locale.ENGLISH));
}
setIgnoredPlayers(ignoredPlayers);
}
@@ -540,19 +544,17 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("godmode", set);
config.save();
}
public boolean toggleGodModeEnabled()
{
boolean ret = !isGodModeEnabled();
setGodModeEnabled(ret);
return ret;
}
private boolean muted;
private boolean getMuted()
public boolean _getMuted()
{
return config.getBoolean("muted", false);
}
public boolean getMuted()
{
return muted;
}
public boolean isMuted()
{
@@ -565,13 +567,6 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("muted", set);
config.save();
}
public boolean toggleMuted()
{
boolean ret = !isMuted();
setMuted(ret);
return ret;
}
private long muteTimeout;
private long _getMuteTimeout()
@@ -592,7 +587,7 @@ public abstract class UserData extends PlayerExtension implements IConf
}
private boolean jailed;
private boolean getJailed()
private boolean _getJailed()
{
return config.getBoolean("jailed", false);
}
@@ -641,7 +636,7 @@ public abstract class UserData extends PlayerExtension implements IConf
public void setBanReason(String reason)
{
config.setProperty("ban.reason", reason);
config.setProperty("ban.reason", Util.sanitizeString(reason));
config.save();
}
@@ -667,10 +662,19 @@ public abstract class UserData extends PlayerExtension implements IConf
return lastLogin;
}
public void setLastLogin(long time)
private void _setLastLogin(long time)
{
lastLogin = time;
config.setProperty("timestamps.login", time);
}
public void setLastLogin(long time)
{
_setLastLogin(time);
if (base.getAddress() != null && base.getAddress().getAddress() != null)
{
_setLastLoginAddress(base.getAddress().getAddress().getHostAddress());
}
config.save();
}
private long lastLogout;
@@ -703,15 +707,14 @@ public abstract class UserData extends PlayerExtension implements IConf
return lastLoginAddress;
}
public void setLastLoginAddress(String address)
private void _setLastLoginAddress(String address)
{
lastLoginAddress = address;
config.setProperty("ipAddress", address);
config.save();
}
private boolean afk;
private boolean getAfk()
private boolean _getAfk()
{
return config.getBoolean("afk", false);
}
@@ -822,22 +825,39 @@ public abstract class UserData extends PlayerExtension implements IConf
{
return config.getBoolean("powertoolsenabled", true);
}
private Map<String, Object> kitTimestamps;
private Map<String, Object> _getKitTimestamps()
private Map<String, Long> kitTimestamps;
private Map<String, Long> _getKitTimestamps()
{
if (config.isConfigurationSection("timestamps.kits"))
{
return config.getConfigurationSection("timestamps.kits").getValues(false);
final ConfigurationSection section = config.getConfigurationSection("timestamps.kits");
final Map<String, Long> timestamps = new HashMap<String, Long>();
for (String command : section.getKeys(false))
{
if (section.isLong(command))
{
timestamps.put(command.toLowerCase(Locale.ENGLISH), section.getLong(command));
}
else if (section.isInt(command))
{
timestamps.put(command.toLowerCase(Locale.ENGLISH), (long)section.getInt(command));
}
}
return timestamps;
}
return new HashMap<String, Object>();
return new HashMap<String, Long>();
}
public Long getKitTimestamp(final String name)
public long getKitTimestamp(String name)
{
final Number num = (Number)kitTimestamps.get(name.toLowerCase(Locale.ENGLISH));
return num == null ? null : num.longValue();
name = name.replace('.', '_').replace('/', '_');
if (kitTimestamps != null && kitTimestamps.containsKey(name))
{
return kitTimestamps.get(name);
}
return 0l;
}
public void setKitTimestamp(final String name, final long time)

View File

@@ -27,7 +27,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
private void loadAllUsersAsync(final IEssentials ess)
{
ess.scheduleAsyncDelayedTask(new Runnable()
ess.runTaskAsynchronously(new Runnable()
{
@Override
public void run()

View File

@@ -24,12 +24,19 @@ public class Util
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]");
//Used to clean file names before saving to disk
public static String sanitizeFileName(final String name)
{
final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
return newName;
return safeString(name);
}
//Used to clean strings/names before saving as filenames/permissions
public static String safeString(final String string)
{
return INVALIDFILECHARS.matcher(string.toLowerCase(Locale.ENGLISH)).replaceAll("_");
}
//Less restrictive string sanitizing, when not used as perm or filename
public static String sanitizeString(final String string)
{
return INVALIDCHARS.matcher(string).replaceAll("");
@@ -80,11 +87,17 @@ public class Util
_("second"),
_("seconds")
};
int accuracy = 0;
for (int i = 0; i < types.length; i++)
{
if (accuracy > 2)
{
break;
}
int diff = dateDiff(types[i], fromDate, toDate, future);
if (diff > 0)
{
accuracy++;
sb.append(" ").append(diff).append(" ").append(names[i * 2 + (diff > 1 ? 1 : 0)]);
}
}
@@ -92,7 +105,7 @@ public class Util
{
return "now";
}
return sb.toString();
return sb.toString().trim();
}
private static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
@@ -209,6 +222,13 @@ public class Util
{
c.add(Calendar.SECOND, seconds * (future ? 1 : -1));
}
Calendar max = new GregorianCalendar();
max.add(Calendar.YEAR, 10);
if (c.after(max))
{
return max.getTimeInMillis();
}
return c.getTimeInMillis();
}
// The player can stand inside these materials
@@ -242,6 +262,7 @@ public class Util
AIR_MATERIALS.add(Material.REDSTONE_TORCH_OFF.getId());
AIR_MATERIALS.add(Material.REDSTONE_TORCH_ON.getId());
AIR_MATERIALS.add(Material.STONE_BUTTON.getId());
AIR_MATERIALS.add(Material.SNOW.getId());
AIR_MATERIALS.add(Material.SUGAR_CANE_BLOCK.getId());
AIR_MATERIALS.add(Material.DIODE_BLOCK_OFF.getId());
AIR_MATERIALS.add(Material.DIODE_BLOCK_ON.getId());
@@ -249,8 +270,10 @@ public class Util
AIR_MATERIALS.add(Material.PUMPKIN_STEM.getId());
AIR_MATERIALS.add(Material.MELON_STEM.getId());
AIR_MATERIALS.add(Material.VINE.getId());
AIR_MATERIALS.add(Material.NETHER_WARTS.getId());
AIR_MATERIALS.add(Material.FENCE_GATE.getId());
AIR_MATERIALS.add(Material.WATER_LILY.getId());
AIR_MATERIALS.add(Material.NETHER_FENCE.getId());
AIR_MATERIALS.add(Material.NETHER_WARTS.getId());
for (Integer integer : AIR_MATERIALS)
{
@@ -269,6 +292,46 @@ public class Util
}
return block.getLocation();
}
public final static int RADIUS = 3;
public final static Vector3D[] VOLUME;
public static class Vector3D
{
public Vector3D(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public int x;
public int y;
public int z;
}
static
{
List<Vector3D> pos = new ArrayList<Vector3D>();
for (int x = -RADIUS; x <= RADIUS; x++)
{
for (int y = -RADIUS; y <= RADIUS; y++)
{
for (int z = -RADIUS; z <= RADIUS; z++)
{
pos.add(new Vector3D(x, y, z));
}
}
}
Collections.sort(pos, new Comparator<Vector3D>()
{
@Override
public int compare(Vector3D a, Vector3D b)
{
return (a.x * a.x + a.y * a.y + a.z * a.z) - (b.x * b.x + b.y * b.y + b.z * b.z);
}
});
VOLUME = pos.toArray(new Vector3D[0]);
}
public static Location getSafeDestination(final Location loc) throws Exception
{
@@ -280,33 +343,54 @@ public class Util
int x = loc.getBlockX();
int y = (int)Math.round(loc.getY());
int z = loc.getBlockZ();
final int origX = x;
final int origY = y;
final int origZ = z;
while (isBlockAboveAir(world, x, y, z))
{
y -= 1;
if (y < 0)
{
y = origY;
break;
}
}
int i = 0;
while (isBlockUnsafe(world, x, y, z))
{
i++;
if (i >= VOLUME.length)
{
x = origX;
y = origY + RADIUS;
z = origZ;
break;
}
x = origX + VOLUME[i].x;
y = origY + VOLUME[i].y;
z = origZ + VOLUME[i].z;
}
while (isBlockUnsafe(world, x, y, z))
{
y += 1;
if (y >= world.getMaxHeight())
{
x += 1;
break;
}
}
while (isBlockUnsafe(world, x, y, z))
{
y += 1;
if (y >= 127)
{
x += 1;
break;
}
}
while (isBlockUnsafe(world, x, y, z))
{
y -= 1;
if (y <= 1)
{
y = 127;
x += 1;
if (x - 32 > loc.getBlockX())
y = world.getHighestBlockYAt(x, z);
if (x - 48 > loc.getBlockX())
{
throw new Exception(_("holeInFloor"));
}
@@ -321,6 +405,15 @@ public class Util
}
public static boolean isBlockUnsafe(final World world, final int x, final int y, final int z)
{
if (isBlockDamaging(world, x, y, z))
{
return true;
}
return isBlockAboveAir(world, x, y, z);
}
public static boolean isBlockDamaging(final World world, final int x, final int y, final int z)
{
final Block below = world.getBlockAt(x, y - 1, z);
if (below.getType() == Material.LAVA || below.getType() == Material.STATIONARY_LAVA)
@@ -333,12 +426,17 @@ public class Util
return true;
}
if (below.getType() == Material.BED_BLOCK)
{
return true;
}
if ((!AIR_MATERIALS.contains(world.getBlockAt(x, y, z).getType().getId()))
|| (!AIR_MATERIALS.contains(world.getBlockAt(x, y + 1, z).getType().getId())))
{
return true;
}
return isBlockAboveAir(world, x, y, z);
return false;
}
public static ItemStack convertBlockToItem(final Block block)
@@ -495,26 +593,127 @@ public class Util
}
return buf.toString();
}
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)
public static String lastCode(final String input)
{
int pos = input.lastIndexOf("§");
if (pos == -1 || (pos + 1) == input.length())
{
return "";
}
return input.substring(pos, pos + 2);
}
private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]?");
private static transient final Pattern LOGCOLOR_PATTERN = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]");
private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]");
private static transient final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00A7+[Kk]");
private static transient final Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00A7+[L-ORl-or]");
private static transient final Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])");
private static transient final Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)");
private static transient final Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])");
//This method is used to simply strip the native minecraft colour codes
public static String stripFormat(final String input)
{
if (input == null)
{
return null;
}
return VANILLA_COLOR_PATTERN.matcher(input).replaceAll("");
return VANILLA_PATTERN.matcher(input).replaceAll("");
}
public static String replaceColor(final String input)
public static String stripLogColorFormat(final String input)
{
if (input == null)
{
return null;
}
return LOGCOLOR_PATTERN.matcher(input).replaceAll("");
}
return EASY_COLOR_PATTERN.matcher(input).replaceAll("\u00a7$1");
//This method is used to simply replace the ess colour codes with minecraft ones, ie &c
public static String replaceFormat(final String input)
{
if (input == null)
{
return null;
}
return REPLACE_PATTERN.matcher(input).replaceAll("\u00a7$1");
}
//This is the general permission sensitive message format function, does not touch urls.
public static String formatString(final IUser user, final String permBase, final String input)
{
if (input == null)
{
return null;
}
String message;
if (user.isAuthorized(permBase + ".color"))
{
message = Util.replaceColor(input, REPLACE_COLOR_PATTERN);
}
else
{
message = Util.stripColor(input, VANILLA_COLOR_PATTERN);
}
if (user.isAuthorized(permBase + ".magic"))
{
message = Util.replaceColor(message, REPLACE_MAGIC_PATTERN);
}
else
{
message = Util.stripColor(message, VANILLA_MAGIC_PATTERN);
}
if (user.isAuthorized(permBase + ".format"))
{
message = Util.replaceColor(message, REPLACE_FORMAT_PATTERN);
}
else
{
message = Util.stripColor(message, VANILLA_FORMAT_PATTERN);
}
return message;
}
//This is the general permission sensitive message format function, checks for urls.
public static String formatMessage(final IUser user, final String permBase, final String input)
{
if (input == null)
{
return null;
}
String message = formatString(user, permBase, input);
if (!user.isAuthorized(permBase + ".url"))
{
message = Util.blockURL(message);
}
return message;
}
private static String blockURL(final String input)
{
if (input == null)
{
return null;
}
String text = URL_PATTERN.matcher(input).replaceAll("$1 $2");
while (URL_PATTERN.matcher(text).find())
{
text = URL_PATTERN.matcher(text).replaceAll("$1 $2");
}
return text;
}
private static String stripColor(final String input, final Pattern pattern)
{
return pattern.matcher(input).replaceAll("");
}
private static String replaceColor(final String input, final Pattern pattern)
{
return pattern.matcher(input).replaceAll("\u00a7$1");
}
}

View File

@@ -1,7 +1,9 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.WarpNotFoundException;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -48,7 +50,7 @@ public class Warps implements IConf
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp));
if (conf == null)
{
throw new Exception(_("warpNotExist"));
throw new WarpNotFoundException();
}
return conf.getLocation(null, server);
}
@@ -69,7 +71,14 @@ public class Warps implements IConf
}
conf.setProperty(null, loc);
conf.setProperty("name", name);
conf.save();
try
{
conf.saveWithError();
}
catch (IOException ex)
{
throw new IOException(_("invalidWarpName"));
}
}
public void delWarp(String name) throws Exception

View File

@@ -8,7 +8,6 @@ import com.earth2me.essentials.Util;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
/**
@@ -72,17 +71,7 @@ public final class Economy
{
throw new RuntimeException(noCallBeforeLoad);
}
User user;
Player player = ess.getServer().getPlayer(name);
if (player != null)
{
user = ess.getUser(player);
}
else
{
user = ess.getOfflineUser(name);
}
return user;
return ess.getUser(name);
}
/**

View File

@@ -1,10 +0,0 @@
package com.earth2me.essentials.api;
import java.util.Map;
import org.bukkit.command.PluginCommand;
public interface IAlternativeCommandsHandler
{
Map<String, String> disabledCommands();
}

View File

@@ -1,51 +0,0 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.perm.IPermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
public interface IEssentials extends Plugin, IReload
{
void addReloadListener(IReload listener);
IUser getUser(Object base);
int broadcastMessage(IUser sender, String message);
II18n getI18n();
ISettings getSettings();
IJails getJail();
IWarps getWarps();
IWorth getWorth();
IItemDb getItemDb();
IUserMap getUserMap();
IEssentialsEconomy getEconomy();
World getWorld(String name);
Methods getPaymentMethod();
int scheduleAsyncDelayedTask(Runnable run);
int scheduleSyncDelayedTask(Runnable run);
int scheduleSyncDelayedTask(Runnable run, long delay);
int scheduleSyncRepeatingTask(Runnable run, long delay, long period);
IPermissionsHandler getPermissionsHandler();
IAlternativeCommandsHandler getAlternativeCommandsHandler();
void showCommandError(CommandSender sender, String commandLabel, Throwable exception);
}

View File

@@ -1,37 +0,0 @@
package com.earth2me.essentials.api;
public interface IEssentialsEconomy
{
double getMoney(String name) throws UserDoesNotExistException;
void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException;
void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException;
void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException;
void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException;
void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException;
void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException;
boolean hasEnough(String name, double amount) throws UserDoesNotExistException;
boolean hasMore(String name, double amount) throws UserDoesNotExistException;
boolean hasLess(String name, double amount) throws UserDoesNotExistException;
boolean isNegative(String name) throws UserDoesNotExistException;
String format(double amount);
boolean playerExists(String name);
boolean isNPC(String name) throws UserDoesNotExistException;
boolean createNPC(String name);
void removeNPC(String name) throws UserDoesNotExistException;
}

View File

@@ -10,6 +10,8 @@ public interface IJails extends IReload
Collection<String> getList() throws Exception;
int getCount();
void removeJail(String jail) throws Exception;
void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception;

View File

@@ -1,10 +0,0 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.settings.Settings;
import com.earth2me.essentials.storage.IStorageObjectHolder;
public interface ISettings extends IStorageObjectHolder<Settings>
{
}

View File

@@ -1,43 +0,0 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.commands.IEssentialsCommand;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public interface IUser extends Player, IReload
{
long getLastTeleportTimestamp();
boolean isAuthorized(String node);
boolean isAuthorized(IEssentialsCommand cmd);
boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix);
void setLastTeleportTimestamp(long time);
Location getLastLocation();
Player getBase();
double getMoney();
void takeMoney(double value);
void giveMoney(double value);
String getGroup();
void setLastLocation();
Location getHome(String name) throws Exception;
Location getHome(Location loc) throws Exception;
boolean isHidden();
ITeleport getTeleport();
void setJail(String jail);
}

View File

@@ -1,20 +0,0 @@
package com.earth2me.essentials.api;
import java.io.File;
import java.util.Set;
public interface IUserMap
{
boolean userExists(final String name);
IUser getUser(final String name);
void removeUser(final String name);
Set<String> getAllUniqueUsers();
int getUniqueUsers();
File getUserFile(final String name);
}

View File

@@ -1,16 +0,0 @@
package com.earth2me.essentials.api;
import java.util.Collection;
import org.bukkit.Location;
public interface IWarps extends IReload
{
Location getWarp(String warp) throws Exception;
Collection<String> getWarps();
void removeWarp(String name) throws Exception;
void setWarp(String name, Location loc) throws Exception;
}

View File

@@ -1,11 +0,0 @@
package com.earth2me.essentials.api;
import org.bukkit.inventory.ItemStack;
public interface IWorth extends IReload
{
double getPrice(ItemStack itemStack);
void setPrice(ItemStack itemStack, double price);
}

View File

@@ -31,12 +31,14 @@ public class Commandafk extends EssentialsCommand
private void toggleAfk(User user)
{
user.setDisplayNick();
String msg = "";
if (!user.toggleAfk())
{
//user.sendMessage(_("markedAsNotAway"));
if (!user.isHidden())
{
ess.broadcastMessage(user, _("userIsNotAway", user.getDisplayName()));
msg = _("userIsNotAway", user.getDisplayName());
}
user.updateActivity(false);
}
@@ -45,8 +47,12 @@ public class Commandafk extends EssentialsCommand
//user.sendMessage(_("markedAsAway"));
if (!user.isHidden())
{
ess.broadcastMessage(user, _("userIsAway", user.getDisplayName()));
msg = _("userIsAway", user.getDisplayName());
}
}
if (!msg.isEmpty())
{
ess.broadcastMessage(user, msg);
}
}
}

View File

@@ -6,7 +6,7 @@ import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.TNTPrimed;
// This command has a in theme message that only shows if you supply a parameter #EasterEgg
public class Commandantioch extends EssentialsCommand
{
public Commandantioch()

View File

@@ -16,6 +16,11 @@ public class Commandback extends EssentialsCommand
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.worlds." + user.getLastLocation().getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.worlds." + user.getLastLocation().getWorld().getName()));
}
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.sendMessage(_("backUsageMsg"));

View File

@@ -19,7 +19,12 @@ public class Commandbackup extends EssentialsCommand
final Backup backup = ess.getBackup();
if (backup == null)
{
throw new Exception();
throw new Exception(_("backupDisabled"));
}
final String command = ess.getSettings().getBackupCommand();
if (command == null || "".equals(command) || "save-all".equalsIgnoreCase(command))
{
throw new Exception(_("backupDisabled"));
}
backup.run();
sender.sendMessage(_("backupStarted"));

View File

@@ -27,6 +27,7 @@ public class Commandbalance extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
//TODO: Remove 'other' perm
final double bal = (args.length < 1
|| !(user.isAuthorized("essentials.balance.others")
|| user.isAuthorized("essentials.balance.other"))

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.textreader.ArrayListInput;
import com.earth2me.essentials.textreader.TextPager;
@@ -12,7 +12,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
//TODO: Remove op and replace with perm
public class Commandbalancetop extends EssentialsCommand
{
public Commandbalancetop()
@@ -63,7 +63,7 @@ public class Commandbalancetop extends EssentialsCommand
{
lock.readLock().unlock();
}
ess.scheduleAsyncDelayedTask(new Viewer(sender, page, force));
ess.runTaskAsynchronously(new Viewer(sender, page, force));
}
else
{
@@ -71,7 +71,7 @@ public class Commandbalancetop extends EssentialsCommand
{
sender.sendMessage(_("orderBalances", ess.getUserMap().getUniqueUsers()));
}
ess.scheduleAsyncDelayedTask(new Viewer(sender, page, force));
ess.runTaskAsynchronously(new Viewer(sender, page, force));
}
}
@@ -82,7 +82,7 @@ public class Commandbalancetop extends EssentialsCommand
cal.setTimeInMillis(cacheage);
final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
sender.sendMessage(_("balanceTop", format.format(cal.getTime())));
new TextPager(cache).showPage(Integer.toString(page), "", "balancetop", sender);
new TextPager(cache).showPage(Integer.toString(page), null, "balancetop", sender);
}
@@ -144,7 +144,7 @@ public class Commandbalancetop extends EssentialsCommand
{
lock.writeLock().unlock();
}
ess.scheduleAsyncDelayedTask(viewer);
ess.runTaskAsynchronously(viewer);
}
}
@@ -178,7 +178,7 @@ public class Commandbalancetop extends EssentialsCommand
{
lock.readLock().unlock();
}
ess.scheduleAsyncDelayedTask(new Calculator(new Viewer(sender, page, force), force));
ess.runTaskAsynchronously(new Calculator(new Viewer(sender, page, force), force));
}
}
}

View File

@@ -4,6 +4,8 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -19,12 +21,22 @@ public class Commandban extends EssentialsCommand
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
boolean nomatch = false;
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final User user = getPlayer(server, args, 0, true);
if (user.getBase() instanceof OfflinePlayer)
User user;
try
{
user = getPlayer(server, args, 0, true);
}
catch (NoSuchFieldException e)
{
nomatch = true;
user = ess.getUser(new OfflinePlayer(args[0], ess));
}
if (!user.isOnline())
{
if (sender instanceof Player
&& !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
@@ -35,31 +47,39 @@ public class Commandban extends EssentialsCommand
}
else
{
if (user.isAuthorized("essentials.ban.exempt"))
if (user.isAuthorized("essentials.ban.exempt") && sender instanceof Player)
{
sender.sendMessage(_("banExempt"));
return;
}
}
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
String banReason;
if (args.length > 1)
{
banReason = getFinalArg(args, 1);
user.setBanReason(banReason);
banReason = Util.replaceFormat(getFinalArg(args, 1).replace("\\n", "\n").replace("|", "\n"));
}
else
{
banReason = _("defaultBanReason");
}
user.setBanReason(_("banFormat", banReason, senderName));
user.setBanned(true);
user.kickPlayer(banReason);
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
user.setBanTimeout(0);
user.kickPlayer(_("banFormat", banReason, senderName));
server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason));
if (nomatch) {
sender.sendMessage(_("userUnknown", args[0]));
}
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
if (player.isAuthorized("essentials.ban.notify"))
if (onlinePlayer == sender || player.isAuthorized("essentials.ban.notify"))
{
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
}

View File

@@ -27,6 +27,10 @@ public class Commandbigtree extends EssentialsCommand
{
tree = TreeType.BIG_TREE;
}
else if (args.length > 0 && args[0].equalsIgnoreCase("jungle"))
{
tree = TreeType.JUNGLE;
}
else
{
throw new NotEnoughArgumentsException();

View File

@@ -0,0 +1,92 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
public class Commandbook extends EssentialsCommand
{
public Commandbook()
{
super("book");
}
//TODO: Translate this
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
final ItemStack item = user.getItemInHand();
final String player = user.getName();
if (item.getType() == Material.WRITTEN_BOOK)
{
BookMeta bmeta = (BookMeta)item.getItemMeta();
if (args.length > 1 && args[0].equalsIgnoreCase("author"))
{
if (user.isAuthorized("essentals.book.author"))
{
bmeta.setAuthor(args[1]);
item.setItemMeta(bmeta);
user.sendMessage(_("bookAuthorSet", getFinalArg(args, 1)));
}
else
{
throw new Exception(_("denyChangeAuthor"));
}
}
else if (args.length > 1 && args[0].equalsIgnoreCase("title"))
{
if (user.isAuthorized("essentials.book.title") && (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others")))
{
bmeta.setTitle(args[1]);
item.setItemMeta(bmeta);
user.sendMessage(_("bookTitleSet", getFinalArg(args, 1)));
}
else
{
throw new Exception(_("denyChangeTitle"));
}
}
else
{
if (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others"))
{
ItemStack newItem = new ItemStack(Material.BOOK_AND_QUILL, item.getAmount());
newItem.setItemMeta(bmeta);
user.setItemInHand(newItem);
user.sendMessage(_("editBookContents"));
}
else
{
throw new Exception(_("denyBookEdit"));
}
}
}
else if (item.getType() == Material.BOOK_AND_QUILL)
{
BookMeta bmeta = (BookMeta)item.getItemMeta();
if (!user.isAuthorized("essentals.book.author"))
{
bmeta.setAuthor(player);
}
ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount());
newItem.setItemMeta(bmeta);
user.setItemInHand(newItem);
user.sendMessage(_("bookLocked"));
}
else
{
throw new Exception(_("holdBook"));
}
}
private boolean isAuthor(BookMeta bmeta, String player)
{
String author = bmeta.getAuthor();
return author != null && author.equalsIgnoreCase(player);
}
}

View File

@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.Server;
@@ -29,8 +30,10 @@ public class Commandbreak extends EssentialsCommand
}
if (block.getType() == Material.BEDROCK && !user.isAuthorized("essentials.break.bedrock"))
{
throw new Exception("You are not allowed to destroy bedrock."); //TODO: Translation
throw new Exception(_("noBreakBedrock"));
}
//final List<ItemStack> list = (List<ItemStack>)block.getDrops();
//final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase(), list);
final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase());
server.getPluginManager().callEvent(event);
if (event.isCancelled())

View File

@@ -1,6 +1,8 @@
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;
@@ -12,6 +14,17 @@ public class Commandbroadcast extends EssentialsCommand
super("broadcast");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
ess.broadcastMessage(null, _("broadcast", Util.replaceFormat(getFinalArg(args, 0)), user.getDisplayName()));
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
@@ -20,6 +33,6 @@ public class Commandbroadcast extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
ess.broadcastMessage(null, _("broadcast", getFinalArg(args, 0)));
ess.broadcastMessage(null, _("broadcast", Util.replaceFormat(getFinalArg(args, 0)), sender.getName()));
}
}

View File

@@ -20,6 +20,12 @@ public class Commandburn extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
//TODO: TL this
if (args[0].trim().length() < 2)
{
throw new NotEnoughArgumentsException("You need to specify a player to burn.");
}
for (Player p : server.matchPlayer(args[0]))
{

View File

@@ -2,10 +2,12 @@ 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.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class Commandclearinventory extends EssentialsCommand
@@ -21,78 +23,134 @@ public class Commandclearinventory extends EssentialsCommand
{
if (args.length > 0 && user.isAuthorized("essentials.clearinventory.others"))
{
//TODO: Fix fringe user match case.
if (args[0].length() >= 3)
if (args[0].contentEquals("*") && user.isAuthorized("essentials.clearinventory.all"))
{
List<Player> online = server.matchPlayer(args[0]);
if (!online.isEmpty())
{
for (Player p : online)
{
p.getInventory().clear();
user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
return;
}
throw new Exception(_("playerNotFound"));
cleanInventoryAll(server, user, args);
}
else if (args[0].trim().length() < 2)
{
cleanInventorySelf(server, user, args);
}
else
{
Player p = server.getPlayer(args[0]);
if (p != null)
{
p.getInventory().clear();
user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
else
{
throw new Exception(_("playerNotFound"));
}
cleanInventoryOthers(server, user, args);
}
}
else
{
user.getInventory().clear();
user.sendMessage(_("inventoryCleared"));
cleanInventorySelf(server, user, args);
}
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
if (args.length > 0)
{
throw new NotEnoughArgumentsException();
}
if (args[0].length() >= 3)
{
List<Player> online = server.matchPlayer(args[0]);
if (!online.isEmpty())
if (args[0].contentEquals("*"))
{
for (Player p : online)
{
p.getInventory().clear();
sender.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
return;
cleanInventoryAll(server, sender, args);
}
throw new Exception(_("playerNotFound"));
}
else
{
Player u = server.getPlayer(args[0]);
if (u != null)
{
u.getInventory().clear();
sender.sendMessage(_("inventoryClearedOthers", u.getDisplayName()));
}
else
else if (args[0].trim().length() < 2)
{
throw new Exception(_("playerNotFound"));
}
else
{
cleanInventoryOthers(server, sender, args);
}
}
else
{
throw new NotEnoughArgumentsException();
}
}
}
private void cleanInventoryAll(Server server, CommandSender sender, String[] args) throws Exception
{
if (args.length > 1)
{
for (Player onlinePlayer : server.getOnlinePlayers())
{
clearInventory(onlinePlayer, args[1]);
}
sender.sendMessage("Cleared everyone's inventory");
}
else
{
throw new NotEnoughArgumentsException();
}
}
private void cleanInventoryOthers(Server server, CommandSender user, String[] args) throws Exception
{
List<Player> online = server.matchPlayer(args[0]);
if (!online.isEmpty())
{
for (Player p : online)
{
if (args.length > 1)
{
clearInventory(p, args[1]);
}
else
{
p.getInventory().clear();
}
user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
}
}
else
{
throw new Exception(_("playerNotFound"));
}
}
private void cleanInventorySelf(Server server, User user, String[] args) throws Exception
{
if (args.length > 0)
{
clearInventory(user, args[0]);
}
else
{
user.getInventory().clear();
}
user.sendMessage(_("inventoryCleared"));
}
private void clearInventory(Player player, String arg) throws Exception
{
if (arg.equalsIgnoreCase("*"))
{
player.getInventory().clear();
}
else
{
final String[] split = arg.split(":");
final ItemStack item = ess.getItemDb().get(split[0]);
final int type = item.getTypeId();
if (split.length > 1 && Util.isInt(split[1]))
{
player.getInventory().clear(type, Integer.parseInt(split[1]));
}
else if (split.length > 1 && split[1].equalsIgnoreCase("*"))
{
player.getInventory().clear(type, -1);
}
else
{
if (Util.isInt(split[0]))
{
player.getInventory().clear(type, -1);
}
else
{
player.getInventory().clear(type, item.getDurability());
}
}
}
}
}

View File

@@ -50,10 +50,10 @@ public class Commanddelhome extends EssentialsCommand
{
name = expandedArg[0];
}
//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(_("invalidHomeName")); }
user.delHome(name.toLowerCase(Locale.ENGLISH));
sender.sendMessage(_("deleteHome", name));
}

View File

@@ -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;
@@ -18,6 +19,9 @@ public class Commandeco extends EssentialsCommand
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
Double broadcast = null;
Double broadcastAll = null;
final double startingBalance = (double)ess.getSettings().getStartingBalance();
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
@@ -34,6 +38,8 @@ public class Commandeco extends EssentialsCommand
throw new NotEnoughArgumentsException(ex);
}
final double minBalance = ess.getSettings().getMinMoney();
if (args[1].contentEquals("**"))
{
for (String sUser : ess.getUserMap().getAllUniqueUsers())
@@ -49,11 +55,25 @@ public class Commandeco extends EssentialsCommand
if (player.canAfford(amount, false))
{
player.takeMoney(amount);
}
}
else
{
if (player.getMoney() > 0)
{
player.setMoney(0);
}
}
break;
case RESET:
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
player.setMoney(startingBalance);
broadcastAll = startingBalance;
break;
case SET:
boolean underMinimum = (player.getMoney() - amount) < minBalance;
player.setMoney(underMinimum ? minBalance : amount);
broadcastAll = underMinimum ? minBalance : amount;
break;
}
}
@@ -70,15 +90,28 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
if (!player.canAfford(amount, false))
if (player.canAfford(amount))
{
throw new Exception(_("notEnoughMoney"));
player.takeMoney(amount);
}
else
{
if (player.getMoney() > 0)
{
player.setMoney(0);
}
}
player.takeMoney(amount);
break;
case RESET:
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
player.setMoney(startingBalance);
broadcast = startingBalance;
break;
case SET:
boolean underMinimum = (player.getMoney() - amount) < minBalance;
player.setMoney(underMinimum ? minBalance : amount);
broadcast = underMinimum ? minBalance : amount;
break;
}
}
@@ -93,23 +126,38 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
if (!player.canAfford(amount, false))
if (!player.canAfford(amount))
{
throw new Exception(_("notEnoughMoney"));
}
player.takeMoney(amount, sender);
break;
case RESET:
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
player.setMoney(startingBalance);
break;
case SET:
boolean underMinimum = (player.getMoney() - amount) < minBalance;
player.setMoney(underMinimum ? minBalance : amount);
break;
}
}
if (broadcast != null)
{
server.broadcastMessage(_("resetBal", Util.formatAsCurrency(broadcast)));
}
if (broadcastAll != null)
{
server.broadcastMessage(_("resetBalAll", Util.formatAsCurrency(broadcastAll)));
}
}
private enum EcoCommands
{
GIVE, TAKE, RESET
GIVE, TAKE, RESET, SET
}
}

View File

@@ -2,9 +2,13 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.Enchantments;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.MetaItemStack;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.*;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.bukkit.Server;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@@ -32,7 +36,7 @@ public class Commandenchant extends EssentialsCommand
for (Map.Entry<String, Enchantment> entry : Enchantments.entrySet())
{
final String enchantmentName = entry.getValue().getName().toLowerCase(Locale.ENGLISH);
if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName))
if (enchantmentslist.contains(enchantmentName) || (user.isAuthorized("essentials.enchant." + enchantmentName) && entry.getValue().canEnchantItem(stack)))
{
enchantmentslist.add(entry.getKey());
//enchantmentslist.add(enchantmentName);
@@ -40,6 +44,7 @@ public class Commandenchant extends EssentialsCommand
}
throw new NotEnoughArgumentsException(_("enchantments", Util.joinList(enchantmentslist.toArray())));
}
int level = -1;
if (args.length > 1)
{
@@ -52,20 +57,14 @@ public class Commandenchant extends EssentialsCommand
level = -1;
}
}
final Enchantment enchantment = getEnchantment(args[0], user);
if (level < 0 || level > enchantment.getMaxLevel())
{
level = enchantment.getMaxLevel();
}
if (level == 0)
{
stack.removeEnchantment(enchantment);
}
else
{
stack.addEnchantment(enchantment, level);
}
user.getInventory().setItemInHand(stack);
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchant.allowunsafe");
final MetaItemStack metaStack = new MetaItemStack(stack);
final Enchantment enchantment = metaStack.getEnchantment(user, args[0]);
metaStack.addEnchantment(user, allowUnsafe, enchantment, level);
user.getInventory().setItemInHand(metaStack.getItemStack());
user.updateInventory();
final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
if (level == 0)
@@ -77,20 +76,4 @@ public class Commandenchant extends EssentialsCommand
user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' ')));
}
}
public static Enchantment getEnchantment(final String name, final User user) throws Exception
{
final Enchantment enchantment = Enchantments.getByName(name);
if (enchantment == null)
{
throw new Exception(_("enchantmentNotFound"));
}
final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
if (user != null && !user.isAuthorized("essentials.enchant." + enchantmentName))
{
throw new Exception(_("enchantmentPerm", enchantmentName));
}
return enchantment;
}
}

View File

@@ -0,0 +1,30 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import org.bukkit.Server;
public class Commandenderchest extends EssentialsCommand
{
public Commandenderchest()
{
super("enderchest");
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && user.isAuthorized("essentials.enderchest.others"))
{
final User invUser = getPlayer(server, args, 0);
user.openInventory(invUser.getEnderChest());
user.setEnderSee(true);
}
else
{
user.openInventory(user.getEnderChest());
user.setEnderSee(false);
}
}
}

View File

@@ -1,7 +1,9 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.User;
import com.earth2me.essentials.metrics.Metrics;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
@@ -12,7 +14,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
// This command has 4 undocumented behaviours #EasterEgg
public class Commandessentials extends EssentialsCommand
{
public Commandessentials()
@@ -40,16 +42,25 @@ public class Commandessentials extends EssentialsCommand
{
run_moo(server, sender, commandLabel, args);
}
else if (args[0].equalsIgnoreCase("reset"))
{
run_reset(server, sender, commandLabel, args);
}
else if (args[0].equalsIgnoreCase("opt-out"))
{
run_optout(server, sender, commandLabel, args);
}
else {
run_reload(server, sender, commandLabel, args);
}
}
//If you do not supply an argument this command will list 'overridden' commands.
private void run_disabled(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
sender.sendMessage("Essentials " + ess.getDescription().getVersion());
sender.sendMessage("/<command> <reload/debug>");
sender.sendMessage(_("blockList"));
final StringBuilder disabledCommands = new StringBuilder();
for (Map.Entry<String, String> entry : ess.getAlternativeCommandsHandler().disabledCommands().entrySet())
{
@@ -58,7 +69,21 @@ public class Commandessentials extends EssentialsCommand
}
disabledCommands.append(entry.getKey()).append(" => ").append(entry.getValue());
}
sender.sendMessage(disabledCommands.toString());
if (disabledCommands.length() > 0) {
sender.sendMessage(_("blockList"));
sender.sendMessage(disabledCommands.toString());
}
}
private void run_reset(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException("/<command> reset <player>");
}
final User user = getPlayer(server, args, 1, true);
user.reset();
sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName());
}
private void run_debug(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
@@ -117,7 +142,7 @@ public class Commandessentials extends EssentialsCommand
if (loc.getBlock().getTypeId() == 0)
{
noteBlocks.put(player, loc.getBlock());
player.sendBlockChange(loc, Material.NOTE_BLOCK, (byte)0);
loc.getBlock().setType(Material.NOTE_BLOCK);
}
}
taskid = ess.scheduleSyncRepeatingTask(new Runnable()
@@ -171,4 +196,23 @@ public class Commandessentials extends EssentialsCommand
else
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
}
private void run_optout(final Server server, final CommandSender sender, final String command, final String args[])
{
final Metrics metrics = ess.getMetrics();
try
{
sender.sendMessage("Essentials collects simple metrics to highlight which features to concentrate work on in the future.");
if (metrics.isOptOut()) {
metrics.enable();
} else {
metrics.disable();
}
sender.sendMessage("Anonymous Metrics are now: " + (metrics.isOptOut() ? "disabled" : "enabled"));
}
catch (IOException ex)
{
sender.sendMessage("Unable to modify 'plugins/PluginMetrics/config.yml': " + ex.getMessage());
}
}
}

View File

@@ -0,0 +1,192 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.craftbukkit.SetExpFix;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandexp extends EssentialsCommand
{
public Commandexp()
{
super("exp");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length == 0)
{
showExp(user, user);
}
else if (args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
{
if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
{
expMatch(server, user, args[1], args[2], false);
}
else
{
setExp(user, user, args[1], false);
}
}
else if (args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
{
if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
{
expMatch(server, user, args[1], args[2], true);
}
else
{
setExp(user, user, args[1], true);
}
}
else if (args[0].equalsIgnoreCase("show"))
{
if (args.length >= 2 && user.isAuthorized("essentials.exp.others"))
{
String match = args[1].trim();
showMatch(server, user, match);
}
else
{
showExp(user, user);
}
}
else
{
if (args.length >= 1 && Util.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", "")) && user.isAuthorized("essentials.exp.give"))
{
if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others"))
{
expMatch(server, user, args[1], args[0], true);
}
else
{
setExp(user, user, args[0], true);
}
}
else if (args.length >= 1 && user.isAuthorized("essentials.exp.others"))
{
String match = args[0].trim();
showMatch(server, user, match);
}
else
{
showExp(user, user);
}
}
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
else if (args.length > 2 && args[0].equalsIgnoreCase("set"))
{
expMatch(server, sender, args[1], args[2], false);
}
else if (args.length > 2 && args[0].equalsIgnoreCase("give"))
{
expMatch(server, sender, args[1], args[2], true);
}
else
{
String match = args[0].trim();
if (args.length >= 2 && Util.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", "")))
{
match = args[1].trim();
expMatch(server, sender, match, args[0], true);
}
else if (args.length == 1)
{
match = args[0].trim();
}
showMatch(server, sender, match);
}
}
private void showMatch(final Server server, final CommandSender sender, final String match) throws NotEnoughArgumentsException
{
boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(match))
{
foundUser = true;
final User target = ess.getUser(matchPlayer);
showExp(sender, target);
}
if (!foundUser)
{
throw new NotEnoughArgumentsException(_("playerNotFound"));
}
}
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException
{
boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(match))
{
final User target = ess.getUser(matchPlayer);
setExp(sender, target, amount, give);
foundUser = true;
}
if (!foundUser)
{
throw new NotEnoughArgumentsException(_("playerNotFound"));
}
}
private void showExp(final CommandSender sender, final User target)
{
sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), SetExpFix.getExpUntilNextLevel(target)));
}
//TODO: Limit who can give negative exp?
private void setExp(final CommandSender sender, final User target, String strAmount, final boolean give) throws NotEnoughArgumentsException
{
long amount;
strAmount = strAmount.toLowerCase(Locale.ENGLISH);
if (strAmount.contains("l"))
{
strAmount = strAmount.replaceAll("l", "");
int neededLevel = Integer.parseInt(strAmount);
if (give)
{
neededLevel += target.getLevel();
}
amount = (long)SetExpFix.getExpToLevel(neededLevel);
SetExpFix.setTotalExperience(target, 0);
}
else
{
amount = Long.parseLong(strAmount);
if (amount > Integer.MAX_VALUE || amount < Integer.MIN_VALUE)
{
throw new NotEnoughArgumentsException();
}
}
if (give)
{
amount += SetExpFix.getTotalExperience(target);
}
if (amount > Integer.MAX_VALUE)
{
amount = (long)Integer.MAX_VALUE;
}
if (amount < 0l)
{
amount = 0l;
}
SetExpFix.setTotalExperience(target, (int)amount);
sender.sendMessage(_("expSet", target.getDisplayName(), amount));
}
}

View File

@@ -2,8 +2,7 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.SmallFireball;
import org.bukkit.entity.*;
import org.bukkit.util.Vector;
@@ -18,12 +17,43 @@ public class Commandfireball extends EssentialsCommand
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
boolean small = false;
if (args.length > 0 && args[0].equalsIgnoreCase("small"))
Class<? extends Entity> type = Fireball.class;
Projectile projectile;
int speed = 2;
if (args.length > 0)
{
small = true;
if (args[0].equalsIgnoreCase("small"))
{
type = SmallFireball.class;
}
else if (args[0].equalsIgnoreCase("arrow"))
{
type = Arrow.class;
}
else if (args[0].equalsIgnoreCase("skull"))
{
type = WitherSkull.class;
}
else if (args[0].equalsIgnoreCase("egg"))
{
type = Egg.class;
}
else if(args[0].equalsIgnoreCase("snowball"))
{
type = Snowball.class;
}
else if(args[0].equalsIgnoreCase("expbottle"))
{
type = ThrownExpBottle.class;
}
else if(args[0].equalsIgnoreCase("large"))
{
type = LargeFireball.class;
}
}
final Vector direction = user.getEyeLocation().getDirection().multiply(2);
Fireball fireball = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
fireball.setShooter(user.getBase());
final Vector direction = user.getEyeLocation().getDirection().multiply(speed);
projectile = (Projectile)user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type);
projectile.setShooter(user.getBase());
projectile.setVelocity(direction);
}
}

View File

@@ -0,0 +1,156 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.MetaItemStack;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector;
//This command has quite a complicated syntax, in theory it has 4 seperate syntaxes which are all variable:
//
//1: /firework clear - This clears all of the effects on a firework stack
//
//2: /firework power <int> - This changes the base power of a firework
//
//3: /firework fire - This 'fires' a copy of the firework held.
//3: /firework fire <int> - This 'fires' a number of copies of the firework held.
//3: /firework fire <other> - This 'fires' a copy of the firework held, in the direction you are looking, #easteregg
//
//4: /firework [meta] - This will add an effect to the firework stack held
//4: /firework color:<color> - The minimum you need to set an effect is 'color'
//4: Full Syntax: color:<color[,color,..]> [fade:<color[,color,..]>] [shape:<shape>] [effect:<effect[,effect]>]
//4: Possible Shapes: star, ball, large, creeper, burst
//4: Possible Effects trail, twinkle
public class Commandfirework extends EssentialsCommand
{
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
private final static Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>();
private final static Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>();
static
{
for (DyeColor color : DyeColor.values())
{
colorMap.put(color.name(), color);
}
for (FireworkEffect.Type type : FireworkEffect.Type.values())
{
fireworkShape.put(type.name(), type);
}
}
public Commandfirework()
{
super("firework");
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
final ItemStack stack = user.getItemInHand();
if (stack.getType() == Material.FIREWORK)
{
if (args.length > 0)
{
if (args[0].equalsIgnoreCase("clear"))
{
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
fmeta.clearEffects();
stack.setItemMeta(fmeta);
user.sendMessage(_("fireworkEffectsCleared"));
}
else if (args.length > 1 && (args[0].equalsIgnoreCase("power") || (args[0].equalsIgnoreCase("p"))))
{
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
try
{
int power = Integer.parseInt(args[1]);
fmeta.setPower(power > 3 ? 4 : power);
}
catch (NumberFormatException e)
{
throw new Exception(_("invalidFireworkFormat", args[1], args[0]));
}
stack.setItemMeta(fmeta);
}
else if ((args[0].equalsIgnoreCase("fire") || (args[0].equalsIgnoreCase("p")))
&& user.isAuthorized("essentials.firework.fire"))
{
int amount = 1;
boolean direction = false;
if (Util.isInt(args[1]))
{
final int serverLimit = ess.getSettings().getSpawnMobLimit();
amount = Integer.parseInt(args[1]);
if (amount > serverLimit)
{
amount = serverLimit;
user.sendMessage(_("mobSpawnLimit"));
}
}
else
{
direction = true;
}
for (int i = 0; i < amount; i++)
{
Firework firework = (Firework)user.getWorld().spawnEntity(user.getLocation(), EntityType.FIREWORK);
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
if (direction)
{
final Vector vector = user.getEyeLocation().getDirection().multiply(0.070);
if (fmeta.getPower() > 1)
{
fmeta.setPower(1);
}
firework.setVelocity(vector);
}
firework.setFireworkMeta(fmeta);
}
}
else
{
final MetaItemStack mStack = new MetaItemStack(stack);
for (String arg : args)
{
final String[] split = splitPattern.split(arg, 2);
mStack.addFireworkMeta(user, true, arg, ess);
}
if (mStack.isValidFirework())
{
FireworkMeta fmeta = (FireworkMeta)mStack.getItemStack().getItemMeta();
FireworkEffect effect = mStack.getFireworkBuilder().build();
fmeta.addEffect(effect);
stack.setItemMeta(fmeta);
}
else
{
user.sendMessage(_("fireworkSyntax"));
throw new Exception(_("fireworkColor"));
}
}
}
else
{
throw new NotEnoughArgumentsException();
}
}
else
{
throw new Exception(_("holdFirework"));
}
}
}

View File

@@ -0,0 +1,96 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandfly extends EssentialsCommand
{
public Commandfly()
{
super("fly");
}
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
flyOtherPlayers(server, sender, args);
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length == 1)
{
if (args[0].equalsIgnoreCase("on") || args[0].startsWith("ena") || args[0].equalsIgnoreCase("1"))
{
user.setAllowFlight(true);
}
else if (args[0].equalsIgnoreCase("off") || args[0].startsWith("dis") || args[0].equalsIgnoreCase("0"))
{
user.setAllowFlight(false);
}
else if (user.isAuthorized("essentials.fly.others"))
{
flyOtherPlayers(server, user, args);
return;
}
}
else if (args.length == 2 && user.isAuthorized("essentials.fly.others"))
{
flyOtherPlayers(server, user, args);
return;
}
else
{
user.setAllowFlight(!user.getAllowFlight());
if (!user.getAllowFlight())
{
user.setFlying(false);
}
}
user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName()));
}
private void flyOtherPlayers(final Server server, final CommandSender sender, final String[] args)
{
for (Player matchPlayer : server.matchPlayer(args[0]))
{
final User player = ess.getUser(matchPlayer);
if (player.isHidden())
{
continue;
}
if (args.length > 1)
{
if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1"))
{
player.setAllowFlight(true);
}
else
{
player.setAllowFlight(false);
}
}
else
{
player.setAllowFlight(!player.getAllowFlight());
}
if (!player.getAllowFlight())
{
player.setFlying(false);
}
sender.sendMessage(_("flyMode", _(player.getAllowFlight() ? "enabled" : "disabled"), player.getDisplayName()));
}
}
}

View File

@@ -19,39 +19,116 @@ public class Commandgamemode extends EssentialsCommand
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
GameMode gameMode;
if (args.length == 0)
{
throw new NotEnoughArgumentsException();
}
else if (args.length == 1)
{
gameMode = matchGameMode(commandLabel);
gamemodeOtherPlayers(server, sender, gameMode, args[0]);
}
else if (args.length == 2)
{
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
gamemodeOtherPlayers(server, sender, gameMode, args[1]);
}
gamemodeOtherPlayers(server, sender, args[0]);
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.gamemode.others"))
GameMode gameMode;
if (args.length == 0)
{
gamemodeOtherPlayers(server, user, args[0]);
gameMode = matchGameMode(commandLabel);
}
else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
{
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
gamemodeOtherPlayers(server, user, gameMode, args[1]);
return;
}
user.setGameMode(user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
else
{
try
{
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
}
catch (NotEnoughArgumentsException e)
{
if (user.isAuthorized("essentials.gamemode.others"))
{
gameMode = matchGameMode(commandLabel);
gamemodeOtherPlayers(server, user, gameMode, args[0]);
return;
}
throw new NotEnoughArgumentsException();
}
}
if (gameMode == null)
{
gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
}
user.setGameMode(gameMode);
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
}
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String name)
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String player) throws NotEnoughArgumentsException
{
for (Player matchPlayer : server.matchPlayer(name))
//TODO: TL this
if (player.trim().length() < 2 || gameMode == null)
{
final User player = ess.getUser(matchPlayer);
if (player.isHidden())
throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
}
boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(player))
{
final User user = ess.getUser(matchPlayer);
if (user.isHidden())
{
continue;
}
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
user.setGameMode(gameMode);
sender.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
foundUser = true;
}
if (!foundUser)
{
throw new NotEnoughArgumentsException(_("playerNotFound"));
}
}
}
private GameMode matchGameMode(String modeString) throws NotEnoughArgumentsException
{
GameMode mode = null;
if (modeString.equalsIgnoreCase("gmc") || modeString.equalsIgnoreCase("egmc")
|| modeString.contains("creat") || modeString.equalsIgnoreCase("1") || modeString.equalsIgnoreCase("c"))
{
mode = GameMode.CREATIVE;
}
else if (modeString.equalsIgnoreCase("gms") || modeString.equalsIgnoreCase("egms")
|| modeString.contains("survi") || modeString.equalsIgnoreCase("0") || modeString.equalsIgnoreCase("s"))
{
mode = GameMode.SURVIVAL;
}
else if (modeString.equalsIgnoreCase("gma") || modeString.equalsIgnoreCase("egma")
|| modeString.contains("advent") || modeString.equalsIgnoreCase("2") || modeString.equalsIgnoreCase("a"))
{
mode = GameMode.ADVENTURE;
}
else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt")
|| modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t"))
{
mode = null;
}
else
{
throw new NotEnoughArgumentsException();
}
return mode;
}
}

View File

@@ -1,6 +1,10 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Util;
import java.lang.management.ManagementFactory;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -16,16 +20,42 @@ public class Commandgc extends EssentialsCommand
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
float tps = ess.getTimer().getAverageTPS();
ChatColor color;
if (tps >= 18)
{
color = ChatColor.GREEN;
}
else if (tps >= 15)
{
color = ChatColor.YELLOW;
}
else
{
color = ChatColor.RED;
}
sender.sendMessage(_("uptime", Util.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())));
sender.sendMessage(_("tps", "" + color + tps));
sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
for (World w : server.getWorlds())
List<World> worlds = server.getWorlds();
for (World w : worlds)
{
sender.sendMessage(
(w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": "
+ w.getLoadedChunks().length + _("gcchunks")
+ w.getEntities().size() + _("gcentities"));
String worldType = "World";
switch (w.getEnvironment())
{
case NETHER:
worldType = "Nether";
break;
case THE_END:
worldType = "The End";
break;
}
sender.sendMessage(_("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size()));
}
}
}

View File

@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -12,21 +13,23 @@ public class Commandgetpos extends EssentialsCommand
{
super("getpos");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
{
final User otherUser = getPlayer(server, args, 0);
outputPosition(user, otherUser.getLocation(), user.getLocation());
}
else
{
outputPosition(user, user.getLocation(), null);
if (!otherUser.isHidden() || user.isAuthorized("essentials.list.hidden"))
{
outputPosition(user, otherUser.getLocation(), user.getLocation());
return;
}
}
outputPosition(user, user.getLocation(), null);
}
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
@@ -37,19 +40,18 @@ public class Commandgetpos extends EssentialsCommand
final User user = getPlayer(server, args, 0);
outputPosition(sender, user.getLocation(), null);
}
//TODO: Translate
private void outputPosition(final CommandSender sender, final Location coords, final Location distance)
{
sender.sendMessage("§7World: " + coords.getWorld().getName());
sender.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)");
sender.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
sender.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)");
sender.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)");
sender.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
sender.sendMessage(_("currentWorld", coords.getWorld().getName()));
sender.sendMessage(_("posX", coords.getBlockX()));
sender.sendMessage(_("posY", coords.getBlockY()));
sender.sendMessage(_("posZ", coords.getBlockZ()));
sender.sendMessage(_("posYaw", (coords.getYaw() + 180 + 360) % 360));
sender.sendMessage(_("posPitch", coords.getPitch()));
if (distance != null && coords.getWorld().equals(distance.getWorld()))
{
sender.sendMessage("§7Distance: " + coords.distance(distance));
sender.sendMessage(_("distance", coords.distance(distance)));
}
}
}

View File

@@ -1,13 +1,14 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.MetaItemStack;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -19,7 +20,6 @@ public class Commandgive extends EssentialsCommand
super("give");
}
//TODO: move these messages to message file
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
@@ -28,7 +28,7 @@ public class Commandgive extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final ItemStack stack = ess.getItemDb().get(args[1]);
ItemStack stack = ess.getItemDb().get(args[1]);
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (sender instanceof Player
@@ -39,61 +39,64 @@ public class Commandgive extends EssentialsCommand
: (!ess.getUser(sender).isAuthorized("essentials.itemspawn.exempt")
&& !ess.getUser(sender).canSpawnItem(stack.getTypeId()))))
{
throw new Exception(ChatColor.RED + "You are not allowed to spawn the item " + itemname);
throw new Exception(_("cantSpawnItem", itemname));
}
final User giveTo = getPlayer(server, args, 0);
if (args.length > 2 && Integer.parseInt(args[2]) > 0)
try
{
stack.setAmount(Integer.parseInt(args[2]));
if (args.length > 3 && Util.isInt(args[2]) && Util.isInt(args[3]))
{
stack.setAmount(Integer.parseInt(args[2]));
stack.setDurability(Short.parseShort(args[3]));
}
else if (args.length > 2 && Integer.parseInt(args[2]) > 0)
{
stack.setAmount(Integer.parseInt(args[2]));
}
else if (ess.getSettings().getDefaultStackSize() > 0)
{
stack.setAmount(ess.getSettings().getDefaultStackSize());
}
else if (ess.getSettings().getOversizedStackSize() > 0 && giveTo.isAuthorized("essentials.oversizedstacks"))
{
stack.setAmount(ess.getSettings().getOversizedStackSize());
}
}
else if (ess.getSettings().getDefaultStackSize() > 0)
catch (NumberFormatException e)
{
stack.setAmount(ess.getSettings().getDefaultStackSize());
}
else if (ess.getSettings().getOversizedStackSize() > 0 && giveTo.isAuthorized("essentials.oversizedstacks"))
{
stack.setAmount(ess.getSettings().getOversizedStackSize());
throw new NotEnoughArgumentsException();
}
if (args.length > 3)
{
for (int i = 3; i < args.length; i++)
MetaItemStack metaStack = new MetaItemStack(stack);
boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
if (allowUnsafe && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.enchant.allowunsafe"))
{
final String[] split = args[i].split("[:+',;.]", 2);
if (split.length < 1)
{
continue;
}
final Enchantment enchantment = Commandenchant.getEnchantment(split[0], sender instanceof Player ? ess.getUser(sender) : null);
int level;
if (split.length > 1)
{
level = Integer.parseInt(split[1]);
}
else
{
level = enchantment.getMaxLevel();
}
stack.addEnchantment(enchantment, level);
allowUnsafe = false;
}
metaStack.parseStringMeta(sender, allowUnsafe, args, Util.isInt(args[3]) ? 4 : 3, ess);
stack = metaStack.getItemStack();
}
if (stack.getType() == Material.AIR)
{
throw new Exception(ChatColor.RED + "You can't give air.");
throw new Exception(_("cantSpawnItem", "Air"));
}
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
sender.sendMessage(_("giveSpawn", stack.getAmount(), itemName, giveTo.getDisplayName()));
if (giveTo.isAuthorized("essentials.oversizedstacks"))
{
InventoryWorkaround.addItem(giveTo.getInventory(), true, ess.getSettings().getOversizedStackSize(), stack);
InventoryWorkaround.addOversizedItems(giveTo.getInventory(), ess.getSettings().getOversizedStackSize(), stack);
}
else
{
InventoryWorkaround.addItem(giveTo.getInventory(), true, stack);
InventoryWorkaround.addItems(giveTo.getInventory(), stack);
}
giveTo.updateInventory();
}

View File

@@ -22,31 +22,59 @@ public class Commandgod extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
godOtherPlayers(server, sender, args[0]);
godOtherPlayers(server, sender, args);
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && !args[0].trim().isEmpty() && user.isAuthorized("essentials.god.others"))
if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.god.others"))
{
godOtherPlayers(server, user, args[0]);
godOtherPlayers(server, user, args);
return;
}
user.sendMessage(_("godMode", (user.toggleGodModeEnabled() ? _("enabled") : _("disabled"))));
godPlayer(user, !user.isGodModeEnabled());
user.sendMessage(_("godMode", (user.isGodModeEnabled() ? _("enabled") : _("disabled"))));
}
private void godOtherPlayers(final Server server, final CommandSender sender, final String name)
private void godPlayer(User player, boolean enabled)
{
for (Player matchPlayer : server.matchPlayer(name))
player.setGodModeEnabled(enabled);
if (enabled)
{
player.setHealth(player.getMaxHealth());
player.setFoodLevel(20);
}
}
private void godOtherPlayers(final Server server, final CommandSender sender, final String[] args)
{
for (Player matchPlayer : server.matchPlayer(args[0]))
{
final User player = ess.getUser(matchPlayer);
if (player.isHidden())
{
continue;
}
final boolean enabled = player.toggleGodModeEnabled();
boolean enabled;
if (args.length > 1)
{
if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1"))
{
enabled = true;
}
else
{
enabled = false;
}
}
else
{
enabled = !player.isGodModeEnabled();
}
godPlayer(player, enabled);
player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled"))));
sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", matchPlayer.getDisplayName())));
}

View File

@@ -0,0 +1,63 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class Commandhat extends EssentialsCommand
{
public Commandhat()
{
super("hat");
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0")))
{
final PlayerInventory inv = user.getInventory();
final ItemStack head = inv.getHelmet();
if (head == null || head.getType() == Material.AIR)
{
user.sendMessage(_("hatEmpty"));
}
else
{
final ItemStack air = new ItemStack(Material.AIR);
inv.setHelmet(air);
InventoryWorkaround.addItems(user.getInventory(), head);
user.sendMessage(_("hatRemoved"));
}
}
else
{
if (user.getItemInHand().getType() != Material.AIR)
{
final ItemStack hand = user.getItemInHand();
if (hand.getType().getMaxDurability() == 0)
{
final PlayerInventory inv = user.getInventory();
final ItemStack head = inv.getHelmet();
inv.removeItem(hand);
inv.setHelmet(hand);
inv.setItemInHand(head);
user.sendMessage(_("hatPlaced"));
}
else
{
user.sendMessage(_("hatArmor"));
}
}
else
{
user.sendMessage(_("hatFail"));
}
}
}
}

View File

@@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
public class Commandheal extends EssentialsCommand
@@ -33,9 +34,7 @@ public class Commandheal extends EssentialsCommand
{
user.healCooldown();
}
user.setHealth(20);
user.setFoodLevel(20);
user.sendMessage(_("heal"));
healPlayer(user);
}
@Override
@@ -63,10 +62,20 @@ public class Commandheal extends EssentialsCommand
{
continue;
}
p.setHealth(20);
p.setFoodLevel(20);
p.sendMessage(_("heal"));
healPlayer(p);
sender.sendMessage(_("healOther", p.getDisplayName()));
}
}
private void healPlayer(final Player player)
{
player.setHealth(player.getMaxHealth());
player.setFoodLevel(20);
player.setFireTicks(0);
player.sendMessage(_("heal"));
for (PotionEffect effect : player.getActivePotionEffects())
{
player.removePotionEffect(effect.getType());
}
}
}

View File

@@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.textreader.*;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -21,6 +22,7 @@ public class Commandhelp extends EssentialsCommand
IText output;
String pageStr = args.length > 0 ? args[0] : null;
String chapterPageStr = args.length > 1 ? args[1] : null;
String command = commandLabel;
final IText input = new TextInput(user, "help", false, ess);
if (input.getLines().isEmpty())
@@ -31,7 +33,12 @@ public class Commandhelp extends EssentialsCommand
}
else
{
output = new HelpInput(user, pageStr, ess);
if (pageStr.length() > 26)
{
pageStr = pageStr.substring(0, 25);
}
output = new HelpInput(user, pageStr.toLowerCase(Locale.ENGLISH), ess);
command = command.concat(" ").concat(pageStr);
pageStr = chapterPageStr;
}
chapterPageStr = null;
@@ -41,7 +48,7 @@ public class Commandhelp extends EssentialsCommand
output = new KeywordReplacer(input, user, ess);
}
final TextPager pager = new TextPager(output);
pager.showPage(pageStr, chapterPageStr, commandLabel, user);
pager.showPage(pageStr, chapterPageStr, command, user);
}
@Override

View File

@@ -22,8 +22,8 @@ public class Commandhelpop extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
final String message = _("helpOp", user.getDisplayName(), Util.stripColor(getFinalArg(args, 0)));
user.setDisplayNick();
final String message = _("helpOp", user.getDisplayName(), Util.stripFormat(getFinalArg(args, 0)));
logger.log(Level.INFO, message);
for (Player onlinePlayer : server.getOnlinePlayers())
{

View File

@@ -23,7 +23,6 @@ public class Commandhome extends EssentialsCommand
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
User player = user;
String homeName = "";
String[] nameParts;
@@ -45,52 +44,57 @@ public class Commandhome extends EssentialsCommand
}
try
{
if ("bed".equalsIgnoreCase(homeName))
if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed"))
{
final Location bed = player.getBedSpawnLocation();
if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK)
if (bed != null)
{
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
throw new NoChargeException();
}
}
user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge);
goHome(user, 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))
{
if (bed != null)
{
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
throw new NoChargeException();
}
user.getTeleport().respawn(charge, TeleportCause.COMMAND);
}
else if (homes.isEmpty())
{
throw new Exception(player == user ? _("noHomeSet") : _("noHomeSetPlayer"));
throw new Exception(_("noHomeSetPlayer"));
}
else if (homes.size() == 1 && player.equals(user))
{
user.getTeleport().home(player, homes.get(0), charge);
goHome(user, player, homes.get(0), charge);
}
else
{
if (bed != null)
if (bed != null && user.isAuthorized("essentials.home.bed"))
{
homes.add("bed");
homes.add(_("bed"));
}
user.sendMessage(_("homes", Util.joinList(homes)));
}
}
throw new NoChargeException();
}
private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception
{
final Location loc = player.getHome(home);
if (loc == null)
{
throw new NotEnoughArgumentsException();
}
if (user.getWorld() != loc.getWorld() && ess.getSettings().isWorldHomePermissions()
&& !user.isAuthorized("essentials.worlds." + loc.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.worlds." + loc.getWorld().getName()));
}
user.getTeleport().home(loc, charge);
}
}

View File

@@ -32,15 +32,14 @@ public class Commandignore extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
final String name = player.getName();
if (user.isIgnoredPlayer(name))
if (user.isIgnoredPlayer(player))
{
user.setIgnoredPlayer(name, false);
user.setIgnoredPlayer(player, false);
user.sendMessage(_("unignorePlayer", player.getName()));
}
else
{
user.setIgnoredPlayer(name, true);
user.setIgnoredPlayer(player, true);
user.sendMessage(_("ignorePlayer", player.getName()));
}
}

View File

@@ -1,10 +1,8 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import java.util.Arrays;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Inventory;
public class Commandinvsee extends EssentialsCommand
@@ -13,45 +11,30 @@ public class Commandinvsee extends EssentialsCommand
{
super("invsee");
}
//This method has a hidden param, which if given will display the equip slots. #easteregg
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1 && user.getSavedInventory() == null)
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
User invUser = user;
if (args.length == 1)
{
invUser = getPlayer(server, args, 0);
}
if (invUser == user && user.getSavedInventory() != null)
{
invUser.getInventory().setContents(user.getSavedInventory());
user.setSavedInventory(null);
user.sendMessage(_("invRestored"));
throw new NoChargeException();
}
if (user.getSavedInventory() == null)
final User invUser = getPlayer(server, args, 0);
Inventory inv;
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip"))
{
user.setSavedInventory(user.getInventory().getContents());
inv = server.createInventory(invUser, 9, "Equipped");
inv.setContents(invUser.getInventory().getArmorContents());
}
ItemStack[] invUserStack = invUser.getInventory().getContents();
final int userStackLength = user.getInventory().getContents().length;
if (invUserStack.length < userStackLength)
else
{
invUserStack = Arrays.copyOf(invUserStack, userStackLength);
inv = invUser.getInventory();
}
if (invUserStack.length > userStackLength)
{
throw new Exception(_("invBigger"));
}
user.getInventory().setContents(invUserStack);
user.sendMessage(_("invSee", invUser.getDisplayName()));
user.sendMessage(_("invSeeHelp"));
throw new NoChargeException();
user.openInventory(inv);
user.setInvSee(true);
}
}

View File

@@ -1,12 +1,12 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.MetaItemStack;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@@ -24,7 +24,7 @@ public class Commanditem extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
final ItemStack stack = ess.getItemDb().get(args[0]);
ItemStack stack = ess.getItemDb().get(args[0]);
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (ess.getSettings().permissionBasedItemSpawn()
@@ -36,42 +36,35 @@ public class Commanditem extends EssentialsCommand
{
throw new Exception(_("cantSpawnItem", itemname));
}
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
try
{
stack.setAmount(Integer.parseInt(args[1]));
}
else if (ess.getSettings().getDefaultStackSize() > 0)
{
stack.setAmount(ess.getSettings().getDefaultStackSize());
}
else if (ess.getSettings().getOversizedStackSize() > 0 && user.isAuthorized("essentials.oversizedstacks"))
{
stack.setAmount(ess.getSettings().getOversizedStackSize());
}
if (args.length > 2)
{
for (int i = 2; i < args.length; i++)
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
{
final String[] split = args[i].split("[:+',;.]", 2);
if (split.length < 1)
{
continue;
}
final Enchantment enchantment = Commandenchant.getEnchantment(split[0], user);
int level;
if (split.length > 1)
{
level = Integer.parseInt(split[1]);
}
else
{
level = enchantment.getMaxLevel();
}
stack.addEnchantment(enchantment, level);
stack.setAmount(Integer.parseInt(args[1]));
}
else if (ess.getSettings().getDefaultStackSize() > 0)
{
stack.setAmount(ess.getSettings().getDefaultStackSize());
}
else if (ess.getSettings().getOversizedStackSize() > 0 && user.isAuthorized("essentials.oversizedstacks"))
{
stack.setAmount(ess.getSettings().getOversizedStackSize());
}
}
catch (NumberFormatException e)
{
throw new NotEnoughArgumentsException();
}
if (args.length > 2)
{
MetaItemStack metaStack = new MetaItemStack(stack);
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchant.allowunsafe");
metaStack.parseStringMeta(user, allowUnsafe, args, 2, ess);
stack = metaStack.getItemStack();
}
if (stack.getType() == Material.AIR)
{
@@ -82,11 +75,11 @@ public class Commanditem extends EssentialsCommand
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
if (user.isAuthorized("essentials.oversizedstacks"))
{
InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), stack);
InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), stack);
}
else
{
InventoryWorkaround.addItem(user.getInventory(), true, stack);
InventoryWorkaround.addItems(user.getInventory(), stack);
}
user.updateInventory();
}

View File

@@ -1,5 +1,7 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -17,10 +19,12 @@ public class Commanditemdb extends EssentialsCommand
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
ItemStack itemStack = null;
boolean itemHeld = false;
if (args.length < 1)
{
if (sender instanceof Player)
{
itemHeld = true;
itemStack = ((Player)sender).getItemInHand();
}
if (itemStack == null)
@@ -32,6 +36,21 @@ public class Commanditemdb extends EssentialsCommand
{
itemStack = ess.getItemDb().get(args[0]);
}
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData()));
sender.sendMessage(_("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability())));
if (itemHeld && itemStack.getType() != Material.AIR)
{
int maxuses = itemStack.getType().getMaxDurability();
int durability = ((maxuses + 1) - itemStack.getDurability());
if (maxuses != 0)
{
sender.sendMessage(_("durability", Integer.toString(durability)));
}
}
final String itemNameList = ess.getItemDb().names(itemStack);
if (itemNameList != null)
{
sender.sendMessage(_("itemNames", ess.getItemDb().names(itemStack)));
}
}
}

View File

@@ -8,7 +8,7 @@ import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
// This method contains an undocumented sub command #EasterEgg
public class Commandjump extends EssentialsCommand
{
public Commandjump()
@@ -19,6 +19,21 @@ public class Commandjump extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && args[0].contains("lock") && user.isAuthorized("essentials.jump.lock"))
{
if (user.isFlyClickJump())
{
user.setRightClickJump(false);
user.sendMessage("Flying wizard mode disabled");
}
else
{
user.setRightClickJump(true);
user.sendMessage("Enabling flying wizard mode");
}
return;
}
Location loc;
final Location cloc = user.getLocation();
@@ -37,5 +52,6 @@ public class Commandjump extends EssentialsCommand
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND);
throw new NoChargeException();
}
}

View File

@@ -3,6 +3,8 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
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.command.CommandSender;
import org.bukkit.entity.Player;
@@ -23,21 +25,34 @@ public class Commandkick extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final User user = getPlayer(server, args, 0);
if (user.isAuthorized("essentials.kick.exempt"))
final User target = getPlayer(server, args, 0, true);
if (sender instanceof Player)
{
throw new Exception(_("kickExempt"));
User user = ess.getUser(sender);
if (target.isHidden() && !user.isAuthorized("essentials.list.hidden"))
{
throw new PlayerNotFoundException();
}
if (target.isAuthorized("essentials.kick.exempt"))
{
throw new Exception(_("kickExempt"));
}
}
final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
user.kickPlayer(kickReason);
String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
kickReason = Util.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n"));
target.kickPlayer(kickReason);
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
server.getLogger().log(Level.INFO, _("playerKicked", senderName, target.getName(), kickReason));
for (Player onlinePlayer : server.getOnlinePlayers())
{
User player = ess.getUser(onlinePlayer);
if (player.isAuthorized("essentials.kick.notify"))
{
onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
onlinePlayer.sendMessage(_("playerKicked", senderName, target.getName(), kickReason));
}
}
}

View File

@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -16,6 +17,9 @@ public class Commandkickall extends EssentialsCommand
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
String kickReason = args.length > 0 ? getFinalArg(args, 0) : _("kickDefault");
kickReason = Util.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n"));
for (Player onlinePlayer : server.getOnlinePlayers())
{
if (sender instanceof Player && onlinePlayer.getName().equalsIgnoreCase(((Player)sender).getName()))
@@ -24,8 +28,9 @@ public class Commandkickall extends EssentialsCommand
}
else
{
onlinePlayer.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : _("kickDefault"));
onlinePlayer.kickPlayer(kickReason);
}
}
sender.sendMessage(_("kickedAll"));
}
}

View File

@@ -22,17 +22,28 @@ public class Commandkill extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
//TODO: TL this
if (args[0].trim().length() < 2)
{
throw new NotEnoughArgumentsException("You need to specify a player to kill.");
}
for (Player matchPlayer : server.matchPlayer(args[0]))
{
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000);
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede);
if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
if (ede.isCancelled() && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.kill.force"))
{
continue;
}
matchPlayer.damage(1000);
matchPlayer.setHealth(0);
matchPlayer.damage(Short.MAX_VALUE);
if (matchPlayer.getHealth() > 0)
{
matchPlayer.setHealth(0);
}
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
}
}

View File

@@ -1,27 +1,16 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Mob;
import static com.earth2me.essentials.I18n._;
import java.util.Collections;
import com.earth2me.essentials.Mob;
import java.util.ArrayList;
import java.util.Locale;
import org.bukkit.Chunk;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Animals;
import org.bukkit.entity.ComplexLivingEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Flying;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.NPC;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.WaterMob;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
public class Commandkillall extends EssentialsCommand
@@ -61,7 +50,7 @@ public class Commandkillall extends EssentialsCommand
}
catch (NumberFormatException e)
{
throw new Exception(_("numberRequired"));
throw new Exception(_("numberRequired"), e);
}
}
}
@@ -121,11 +110,18 @@ public class Commandkillall extends EssentialsCommand
continue;
}
}
if (entity instanceof Ocelot)
{
if (((Ocelot)entity).isTamed())
{
continue;
}
}
if (animals)
{
if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob)
{
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, new ArrayList<ItemStack>(0));
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -135,7 +131,7 @@ public class Commandkillall extends EssentialsCommand
{
if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime)
{
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, new ArrayList<ItemStack>(0));
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -143,14 +139,14 @@ public class Commandkillall extends EssentialsCommand
}
else if (all)
{
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, new ArrayList<ItemStack>(0));
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
}
else if (entityClass != null && entityClass.isAssignableFrom(entity.getClass()))
{
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, new ArrayList<ItemStack>(0));
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;

View File

@@ -1,9 +1,15 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.*;
import static com.earth2me.essentials.I18n._;
import java.util.*;
import com.earth2me.essentials.Kit;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandkit extends EssentialsCommand
@@ -19,38 +25,68 @@ public class Commandkit extends EssentialsCommand
if (args.length < 1)
{
final String kitList = Kit.listKits(ess, user);
if (kitList.length() > 0)
{
user.sendMessage(_("kits", kitList));
}
else
{
user.sendMessage(_("noKits"));
}
user.sendMessage(kitList.length() > 0 ? _("kits", kitList) : _("noKits"));
throw new NoChargeException();
}
else if (args.length > 1 && user.isAuthorized("essentials.kit.others"))
{
final User userTo = getPlayer(server, args, 1, true);
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
giveKit(userTo, user, kitName);
}
else
{
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
giveKit(user, user, kitName);
}
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 2)
{
final String kitList = Kit.listKits(ess, null);
sender.sendMessage(kitList.length() > 0 ? _("kits", kitList) : _("noKits"));
throw new NoChargeException();
}
else
{
final User userTo = getPlayer(server, args, 1, true);
final String kitName = args[0].toLowerCase(Locale.ENGLISH);
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
final List<String> items = Kit.getItems(userTo, kit);
Kit.expandItems(ess, userTo, items);
if (!user.isAuthorized("essentials.kit." + kitName))
{
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
}
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));
sender.sendMessage(_("kitGive", kitName));
}
}
private void giveKit(User userTo, User userFrom, String kitName) throws Exception
{
if (kitName.isEmpty())
{
throw new Exception(_("kitError2"));
}
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
if (!userFrom.isAuthorized("essentials.kits." + kitName))
{
throw new Exception(_("noKitPermission", "essentials.kits." + kitName));
}
final List<String> items = Kit.getItems(userTo, kit);
Kit.checkTime(userFrom, kitName, kit);
final Trade charge = new Trade("kit-" + kitName, ess);
charge.isAffordableFor(userFrom);
Kit.expandItems(ess, userTo, items);
charge.charge(userFrom);
userTo.sendMessage(_("kitGive", kitName));
}
}

View File

@@ -0,0 +1,44 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.User;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.Ocelot;
// This command is not documented on the wiki #EasterEgg
public class Commandkittycannon extends EssentialsCommand
{
private static Random random = new Random();
public Commandkittycannon()
{
super("kittycannon");
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
final Mob cat = Mob.OCELOT;
final Ocelot ocelot = (Ocelot)cat.spawn(user, server, user.getEyeLocation());
if (ocelot == null)
{
return;
}
final int i = random.nextInt(Ocelot.Type.values().length);
ocelot.setCatType(Ocelot.Type.values()[i]);
ocelot.setTamed(true);
ocelot.setVelocity(user.getEyeLocation().getDirection().multiply(2));
ess.scheduleSyncDelayedTask(new Runnable()
{
@Override
public void run()
{
final Location loc = ocelot.getLocation();
ocelot.remove();
loc.getWorld().createExplosion(loc, 0F);
}
}, 20);
}
}

View File

@@ -23,11 +23,11 @@ public class Commandlightning extends EssentialsCommand
if (sender instanceof Player)
{
user = ess.getUser(((Player)sender));
}
if (args.length < 1 & user != null)
{
user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation());
return;
if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others")))
{
user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation());
return;
}
}
if (server.matchPlayer(args[0]).isEmpty())
@@ -35,7 +35,7 @@ public class Commandlightning extends EssentialsCommand
throw new Exception(_("playerNotFound"));
}
int power = 1;
int power = 5;
if (args.length > 1)
{
try
@@ -50,18 +50,12 @@ public class Commandlightning extends EssentialsCommand
for (Player matchPlayer : server.matchPlayer(args[0]))
{
sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName()));
if (power <= 0)
{
matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation());
}
else
{
LightningStrike strike = matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation());
matchPlayer.damage(power - 1, strike);
}
final LightningStrike strike = matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation());
if (!ess.getUser(matchPlayer).isGodModeEnabled())
{
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
matchPlayer.damage(power, strike);
}
if (ess.getSettings().warnOnSmite())
{

View File

@@ -44,8 +44,10 @@ public class Commandlist extends EssentialsCommand
if (showhidden && playerHidden > 0)
{
online = _("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers());
} else {
online = _("listAmount",server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers());
}
else
{
online = _("listAmount", server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers());
}
sender.sendMessage(online);
@@ -73,7 +75,7 @@ public class Commandlist extends EssentialsCommand
for (String group : groups)
{
final StringBuilder groupString = new StringBuilder();
groupString.append(_("listGroupTag",Util.replaceColor(group)));
groupString.append(_("listGroupTag", Util.replaceFormat(group)));
final List<User> users = sort.get(group);
Collections.sort(users);
boolean first = true;
@@ -95,6 +97,7 @@ public class Commandlist extends EssentialsCommand
{
groupString.append(_("listHiddenTag"));
}
user.setDisplayNick();
groupString.append(user.getDisplayName());
groupString.append("§f");
}
@@ -136,6 +139,7 @@ public class Commandlist extends EssentialsCommand
{
onlineUsers.append(_("listHiddenTag"));
}
user.setDisplayNick();
onlineUsers.append(user.getDisplayName());
onlineUsers.append("§f");
}

View File

@@ -4,20 +4,21 @@ 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;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandmail extends EssentialsCommand
{
private static int mailsPerMinute = 0;
private static long timestamp = 0;
public Commandmail()
{
super("mail");
}
//TODO: Tidy this up
//TODO: Tidy this up / TL these errors.
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
@@ -43,24 +44,29 @@ public class Commandmail extends EssentialsCommand
throw new Exception(_("noPerm", "essentials.mail.send"));
}
Player player = server.getPlayer(args[1]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[1]);
}
User u = ess.getUser(args[1]);
if (u == null)
{
throw new Exception(_("playerNeverOnServer", args[1]));
}
if (!u.isIgnoredPlayer(user.getName()))
if (!u.isIgnoredPlayer(user))
{
final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2)));
u.addMail(user.getName() + ": " + mail);
final String mail = user.getName() + ": " + Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2)));
if (mail.length() > 1000)
{
throw new Exception("Mail message too long. Try to keep it below 1000");
}
if (Math.abs(System.currentTimeMillis() - timestamp) > 60000)
{
timestamp = System.currentTimeMillis();
mailsPerMinute = 0;
}
mailsPerMinute++;
if (mailsPerMinute > ess.getSettings().getMailsPerMinute())
{
throw new Exception("Too many mails have been send within the last minute. Maximum: " + ess.getSettings().getMailsPerMinute());
}
u.addMail(mail);
}
user.sendMessage(_("mailSent"));
return;
@@ -71,7 +77,7 @@ public class Commandmail extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.mail.sendall"));
}
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1))));
ess.runTaskAsynchronously(new SendAll(user.getName() + ": " + Util.stripFormat(getFinalArg(args, 1))));
user.sendMessage(_("mailSent"));
return;
}
@@ -97,16 +103,7 @@ public class Commandmail extends EssentialsCommand
}
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
{
Player player = server.getPlayer(args[1]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[1]);
}
User u = ess.getUser(args[1]);
if (u == null)
{
throw new Exception(_("playerNeverOnServer", args[1]));
@@ -117,21 +114,14 @@ public class Commandmail extends EssentialsCommand
}
else if (args.length >= 1 && "sendall".equalsIgnoreCase(args[0]))
{
ess.scheduleAsyncDelayedTask(new SendAll("Server: " + getFinalArg(args, 2)));
ess.runTaskAsynchronously(new SendAll("Server: " + getFinalArg(args, 2)));
sender.sendMessage(_("mailSent"));
return;
}
else if (args.length >= 2)
{
//allow sending from console without "send" argument, since it's the only thing the console can do
Player player = server.getPlayer(args[0]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[0]);
}
User u = ess.getUser(args[0]);
if (u == null)
{
throw new Exception(_("playerNeverOnServer", args[0]));

View File

@@ -27,15 +27,9 @@ public class Commandme extends EssentialsCommand
}
String message = getFinalArg(args, 0);
if (user.isAuthorized("essentials.chat.color"))
{
message = Util.replaceColor(message);
}
else {
message = Util.stripColor(message);
}
message = Util.formatMessage(user, "essentials.chat", message);
user.setDisplayNick();
ess.broadcastMessage(user, _("action", user.getDisplayName(), message));
}
}

Some files were not shown because too many files have changed in this diff Show More