1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-09-07 05:00:47 +02:00

Compare commits

...

515 Commits

Author SHA1 Message Date
snowleo
4051a377c3 Update version number of Bukkit 2011-06-11 12:42:00 +02:00
snowleo
fc13bc5d34 Update for the changes in Bukkit 2011-06-11 12:36:17 +02:00
snowleo
752600e518 CB #860 B#716 2011-06-11 12:27:42 +02:00
snowleo
4754b9fcca Ignore all build files 2011-06-11 12:25:55 +02:00
snowleo
ce0164583c gitignore for .DS_Store files 2011-06-11 12:25:33 +02:00
ementalo
7d826daf95 [trunk] remove softdepend, is busted in bukkit
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1559 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 16:22:14 +00:00
ementalo
c7c55d0687 [trunk] softdepend, hopefully works and sorts concurrent errors
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1558 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 15:49:27 +00:00
ementalo
be89986b4e [trunk] revert
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1557 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 15:29:21 +00:00
ementalo
d313d0dc87 [trunk] quickfix for concurrent issues
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1556 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 15:10:59 +00:00
snowleo
8e151357ce Missed some parts for the last commits
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1555 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 11:26:12 +00:00
snowleo
86e40db6b9 Several bug fixes and cleanup.
Found using PMD and FindBugs.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1554 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 10:52:41 +00:00
snowleo
117d938ac5 Several bug fixes and cleanup.
Found using PMD and FindBugs.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1553 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 10:40:12 +00:00
ementalo
2a614e53a7 [trunk] RB #818, re-enable nether, nether needs testing
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1552 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 09:20:03 +00:00
snowleo
b710743792 Removed iConomyBridges. Promote the use of Register instead.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1551 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-06-01 08:12:51 +00:00
snowleo
f91844892c French translation
updated danish timePattern string

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1550 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-31 20:52:07 +00:00
snowleo
978650618d Fix: 1 day displayed additionally on 31th of month
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1549 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-31 20:36:43 +00:00
snowleo
26e81106b3 CB#817
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1548 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-31 18:08:04 +00:00
snowleo
68e75da160 CB#816
Multiworld-Nether disabled 

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1547 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-31 07:45:19 +00:00
ementalo
a3e4c720a4 [trunk]Danish Translation by papand13
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1546 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-29 14:11:48 +00:00
snowleo
caf7d0a9ad First code for the update and error report stuff. Disabled until finished.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1545 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-28 03:29:11 +00:00
snowleo
23530ec2c3 Updated items.csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1544 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-28 00:13:11 +00:00
snowleo
4986c30a36 CB#815
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1543 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-28 00:10:43 +00:00
snowleo
d52358ddec Added missing spawner command to plugin.yml
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1542 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-28 00:08:23 +00:00
ementalo
aab8c6878b [trunk] fix /spawn issue.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1541 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-27 21:34:30 +00:00
ementalo
0da79dc120 [trunk] Initial fix to allow plugins to override essentials commands, looking into better way
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1540 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-26 20:11:11 +00:00
ementalo
faa830ef2d [trunk] Register 1.7
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1539 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-26 18:57:41 +00:00
snowleo
0b8f6e2694 CB#812
Fix for change in the minecraft class structure.
Do not use this yet!

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1538 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-26 14:50:13 +00:00
snowleo
008a98d241 Updated items.csv for 1.6 by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1537 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-26 14:34:31 +00:00
snowleo
62ebb31940 Fix kickall command
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1535 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-26 00:25:12 +00:00
ementalo
e2ab985ca8 new items.csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1534 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-24 12:40:14 +00:00
snowleo
70c84083c4 Show file name, if there is an exception in the user upgrade code.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1533 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-23 10:59:26 +00:00
snowleo
a7217b5f03 Removed duplicated message.
Command costs are double values now

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1532 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-23 09:55:23 +00:00
snowleo
6b65c5cc83 Don't charge if the cost is 0.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1531 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-23 09:42:33 +00:00
snowleo
1f02f6fac8 Copy&Paste bug in trade signs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1530 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-23 09:23:03 +00:00
snowleo
8ede0f19c5 CB#803
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1529 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 22:15:30 +00:00
snowleo
b642273f60 Fix array out of bounds exception handling on warp and trade signs.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1528 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 22:08:40 +00:00
snowleo
15142c0ead Warp sign: Shorter error, so it won't get cut off.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1527 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 21:51:55 +00:00
snowleo
e2c06506bc Add stuff directly to inventory to prevent theft by standing next to the sign, while someone breaks it.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1526 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 21:43:47 +00:00
snowleo
2ca88187c4 Workaround for bukkit bug again.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1525 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 21:29:04 +00:00
snowleo
64eda9b295 Revoke last commit. It's not broken.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1524 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 21:01:23 +00:00
snowleo
5c10b96609 Bukkit broke the command override.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1523 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 20:54:25 +00:00
snowleo
c744675063 Comment about Register plugin inside Essentials Eco api
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1522 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 20:30:19 +00:00
snowleo
d5a0cc5cb0 More debug messages, if debug: true is set.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1521 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 20:27:09 +00:00
snowleo
1c5d9b1db0 cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1520 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 20:06:17 +00:00
snowleo
7ed87d696a cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1519 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 20:05:47 +00:00
snowleo
009bf996f3 cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1518 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 19:55:20 +00:00
snowleo
aeb46128bc Ignore teleport delay on portals,
fix cooldown not working if delay is disabled,
fix cooldown for teleport.now()

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1517 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 19:41:22 +00:00
snowleo
1f23740832 Don't hurt god players with lightning.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1516 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 19:23:03 +00:00
snowleo
df29d80e5d Catch exceptions while loading warps.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1515 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 19:19:42 +00:00
snowleo
b790a1b404 Typo in english translation
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1514 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 19:15:35 +00:00
snowleo
0c0499bbfd Sign lines with color only support 13 characters. Fixes the trade signs for users with names longer than 13 characters.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1513 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 19:13:59 +00:00
snowleo
5ae48481bd Refactoring: New Charge class
user.canAfford(String), user.canAfford(EssentialsCommand), user.charge(String), user.charge(EssentialsCommand) have been removed.
Teleport class has been changed to use the Charge class.
This also fixes some bugs, like the one with warp signs.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1512 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 18:53:23 +00:00
snowleo
011fc09b4f Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1511 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 18:20:32 +00:00
snowleo
90fe817267 Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1510 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 17:32:24 +00:00
snowleo
4182157167 Fix that dropItem drops Stack that are over MaxStackSize.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1509 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 17:29:59 +00:00
snowleo
e8c8ca7ed0 Changed default message format to
msgFormat = §7[{0}§7 -> {1}§7] §f{2}

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1508 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-22 17:02:53 +00:00
ementalo
3bdf428683 commit the jar
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1507 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-21 19:19:59 +00:00
ementalo
73563e72e8 [trunk] Recommended build #798
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1506 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-21 15:40:06 +00:00
snowleo
b518a04795 Removed plugin command from Essentials. It's useless at the moment.
If you want to reload the config files use /essentials.
If you update jar files, restart the server.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1505 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-19 19:32:55 +00:00
snowleo
a805c5425c Only update config, if there are worth values.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1504 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-16 21:43:43 +00:00
ementalo
139a3a128a [trunk] Register 1.5
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1503 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-16 20:48:19 +00:00
ementalo
80f6c58dad [trunk] debug a error when processing help permissions nodes
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1502 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-16 19:59:23 +00:00
snowleo
4c52cefcb0 More testing
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1501 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-16 09:46:10 +00:00
snowleo
bb804a5710 Fix _setMoney failing on upgrade.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1500 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-16 08:55:20 +00:00
snowleo
62fe52ee13 Various translation bugfixes
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1499 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-16 08:40:28 +00:00
snowleo
a4fc756f1e Fix /home player for offline players
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1498 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 21:33:50 +00:00
snowleo
7a50ed8179 Fix /home player for offline players
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1497 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 21:27:54 +00:00
snowleo
0d39f9225a Reverting to old behavior for nether creation. If you use other multiworld plugins, make sure you setup the nether correctly there too.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1496 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 18:31:36 +00:00
snowleo
fecd5676ce Missing stuff for /ignore
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1495 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 18:28:19 +00:00
snowleo
e9dcbbe459 ß => ss
Minecraft can't display ß

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1494 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 18:08:15 +00:00
snowleo
26f1d1654b German translation finished.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1493 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 18:03:35 +00:00
snowleo
d8824b37ba Small fix so that the player gets a reply, even if he is ignored
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1492 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 16:54:25 +00:00
snowleo
c7208b9b42 Catch class cast exceptions in EssentialsConf
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1491 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 16:26:34 +00:00
snowleo
410f174b23 Add the tag Essentials to the payment messages.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1490 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 15:56:43 +00:00
snowleo
3b94411958 More fixes for the trade signs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1489 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 15:49:53 +00:00
snowleo
fb818a611d Register v1.2
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1488 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 15:23:31 +00:00
snowleo
403963cf96 Fix for muted translation
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1487 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 14:56:06 +00:00
snowleo
e4967815eb Partly translated to german
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1486 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 14:39:36 +00:00
snowleo
3bc23d4374 Removed unused translation usage
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1485 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 14:04:22 +00:00
snowleo
eb49497c07 Fix noPlayerFound => playerNotFound
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1484 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 14:02:22 +00:00
snowleo
9bb70c1495 Fix /r if noone talked to you before.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1483 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 13:39:33 +00:00
snowleo
942e893248 Fix Mail display in case not enough arguments are supplied
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1482 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 13:34:11 +00:00
snowleo
cc37bafb42 Always close files.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1481 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 13:19:04 +00:00
snowleo
0e0cfbb15b More translation stuff.
Check if the version of a translation file is up to date with essentials version.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1480 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 13:18:38 +00:00
snowleo
c51612d998 Added permissions to bypass EssentialsProtect damage protection.
Change for admin!
Since we don't want to murder all admins, I added another permission:
essentials.protect.damage.disable
Since all admins get this by using '*', all those damage permissions are disabled
Don't use - -essentials.protect.damage.* as I stated in the last commit.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1479 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 12:33:17 +00:00
snowleo
cf46d880c5 Missing part for the /ignore command
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1478 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 12:27:23 +00:00
snowleo
e70195b170 More translation stuff.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1477 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 12:23:47 +00:00
snowleo
a0b5e8d0f8 Added permissions to bypass EssentialsProtect damage protection.
As admin you want to disable this with
- -essentials.protect.damage.*

New permissions:
essentials.protect.damage.contact
essentials.protect.damage.lava
essentials.protect.damage.tnt
essentials.protect.damage.creeper
essentials.protect.damage.projectiles
essentials.protect.damage.fall
essentials.protect.damage.suffocation
essentials.protect.damage.fire
essentials.protect.damage.drowning
essentials.protect.damage.lightning

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1476 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 12:10:24 +00:00
snowleo
32989d56b6 Always create nether if it's enabled in config.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1475 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 11:42:15 +00:00
snowleo
0246d21e69 New feature allows a user to ignore other players
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1474 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 11:40:46 +00:00
snowleo
86dce6e092 /home: Allows to go to offline players home.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1473 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 02:39:59 +00:00
snowleo
e50cb7d86a Fix money and amount display of all signs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1472 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 02:07:20 +00:00
snowleo
5eeb020f01 Finally all commands translated.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1471 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-15 01:30:54 +00:00
snowleo
c107f7ed66 More translation stuff
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1470 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 23:32:28 +00:00
snowleo
798cb319f9 More translation stuff
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1469 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 23:30:56 +00:00
snowleo
848a34d736 Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1468 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 23:07:55 +00:00
snowleo
85fd2c712e Fix problem with offline users. Store all usernames in lower case.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1467 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 23:07:29 +00:00
snowleo
f3aa5fe2ce Fix translation error in god
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1466 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 17:29:31 +00:00
snowleo
abb1c159c1 Fix translation error in gc
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1465 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 17:27:49 +00:00
snowleo
85eb7c6ec4 Socialspy: catch /r messages
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1464 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 11:29:21 +00:00
snowleo
47f1b2809b We now ignore the case, when we read the kits from config.yml.
Beware, that permissions always have to be lowercase.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1463 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 11:20:05 +00:00
snowleo
7b9606994a Ignore exceptions on bulk /sell
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1462 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 10:57:55 +00:00
snowleo
e09e75fb3c Fix that isNew and isNPC are not read from user file.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1461 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 10:54:18 +00:00
snowleo
58daa86b79 Using default group for users with unknown group.
Ignore double users.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1460 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 10:42:18 +00:00
snowleo
78ce69528f Update to Register v1.0
Removed softDepend because of a bukkit bug.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1459 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 10:14:58 +00:00
snowleo
2b4724dae2 Remove old files
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1458 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 02:31:52 +00:00
snowleo
7686e04b69 Register v0.6
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1457 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 02:16:47 +00:00
snowleo
fa963505e8 Register v0.6
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1456 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 02:16:05 +00:00
snowleo
4bd6bdcc39 Don't load worlds on startup for Upgrade process, use FakeWorld instead.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1455 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-14 02:02:15 +00:00
snowleo
ea52e817b5 Move Register stuff inside Essentials
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1454 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 23:39:18 +00:00
snowleo
cf86a79f1f Add Register as dependency for all projects.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1453 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 23:14:03 +00:00
snowleo
816fb79a1a Moving all libs to one directory.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1452 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 23:09:21 +00:00
snowleo
16af2a2d61 Remove Essentials from Register to prevent recursion.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1451 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:58:25 +00:00
snowleo
477f8ae4b5 Translation files have to be the same.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1450 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:52:50 +00:00
snowleo
0d97688c94 Basic lib folder
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1449 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:44:13 +00:00
snowleo
056d2b7432 Fix path to lib folder
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1448 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:42:33 +00:00
snowleo
d3360adfb9 Fix path to lib folder
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1447 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:41:02 +00:00
snowleo
f8016204b5 Fix path to Register.jar
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1446 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:22:17 +00:00
snowleo
02f24a2fd8 Remove wrong Register.jar from lib
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1445 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:19:00 +00:00
snowleo
18b8c0cde5 Register included inside Essentials with different packagename to prevent recursion.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1444 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:13:10 +00:00
snowleo
1f3ba98ad6 Register included inside Essentials with different packagename to prevent recursion
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1443 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 22:08:44 +00:00
ementalo
c4099dfb21 [trunk] make user matching a bit less random
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1442 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 21:10:49 +00:00
snowleo
3eb2022c2c Essentials has now a function setRegisterFallback() instead of setiConomyFallback()
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1441 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 20:54:42 +00:00
snowleo
fdf58932eb case-sensitive filesystems :D
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1440 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 20:45:22 +00:00
snowleo
fe8edacf08 Catch the case, if the user does not have a account with Register
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1439 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 20:41:49 +00:00
snowleo
0f72b94724 Added Support for Register.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1438 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 20:36:41 +00:00
snowleo
de4046e81c Added License info. Essentials is GPLv3
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1437 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 19:58:30 +00:00
snowleo
fa0a0b3301 Unit Tests for Economy API
Finally fixed the Currency format

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1436 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 19:18:22 +00:00
snowleo
6c42f42005 Op users now have access to all GroupManager commands.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1435 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 17:36:41 +00:00
snowleo
ea15ea0995 The default group does not have build rights.
Op users always have build rights.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1434 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 17:29:20 +00:00
snowleo
6678366a55 The default values for fire spread in config.yml have been changed to true.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1433 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 17:15:45 +00:00
snowleo
edd5df58cb Fix Tests
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1432 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 17:04:14 +00:00
snowleo
82dd4e88b4 Rewritten Economy API. Please update your plugins.
This Economy API is now supported by Essentials.
Do not use NPC Accounts as bank accounts. Bank accounts are not supported yet.
New config: currency-symbol

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1431 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 16:57:45 +00:00
snowleo
fdb9473baa Make sure, we will never give a null as respawn location.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1430 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 14:31:07 +00:00
snowleo
9af0566229 Prevent userdata creation, when the player is already rejected by another plugin.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1429 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 13:55:44 +00:00
KimKandor
d0bc33aaab Updated command override section concerning worldguard /KK
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1428 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 13:16:47 +00:00
snowleo
bc485b5b78 Fix player kick if home is not set on respawn.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1427 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 09:18:25 +00:00
snowleo
b7924d8b87 Update motd on reload.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1426 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-13 09:15:24 +00:00
snowleo
3e046d71a8 Reverting to old way of displaying currency.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1425 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-11 23:12:52 +00:00
ementalo
92b34ec15f [trunk] translations = T's
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1424 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-11 22:42:48 +00:00
snowleo
f315bbe43c Finally get rid of all dependency problems.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1423 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-11 22:30:34 +00:00
ementalo
299be08d13 [trunk] translations
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1422 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-11 21:53:01 +00:00
snowleo
bcd6e272ad Another typo in translation
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1421 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-11 21:33:14 +00:00
ementalo
e0a7996885 [trunk] temp double fix, we should probably change doubles to decimals in prices
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1420 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-11 15:11:07 +00:00
snowleo
106a44d3a0 IConfExternal is abstract class for other jars, because the interface is not accessible.
Forgot to remove the import.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1419 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 22:02:42 +00:00
snowleo
03b4ba2db4 Creating info.txt, if it does not exist.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1418 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:58:08 +00:00
snowleo
a2ed8ea52a IConfExternal is abstract class for other jars, because the interface is not accessible.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1417 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:53:27 +00:00
ementalo
07e49c3fbb [trunk] translations - halfway there
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1416 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:52:07 +00:00
snowleo
04044282ad Permission essentials.balance.other is now essentials.balance.others
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1415 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:36:50 +00:00
snowleo
48409fd9ea Fix EssentialsProtect not loading correctly, because Essentials is not loaded first.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1414 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:34:01 +00:00
snowleo
0db4afa5f1 Permission essentials.balance.other is now essentials.balance.others
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1413 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:30:31 +00:00
snowleo
bcd4ed0fdb Add support for info_username.txt and info_groupname.txt.
Fix color in chapter names. Use &[0-9a-f] as color codes.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1412 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:26:38 +00:00
snowleo
300f9c33cc Reload Users and Protect on /essentials reload.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1411 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 21:14:38 +00:00
snowleo
87b0ae2695 Don't change color of op if setting is set to none.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1410 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 20:40:32 +00:00
snowleo
b99820246e Fix translation
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1409 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 20:05:52 +00:00
snowleo
e846093fd0 More translation stuff. Translated Spawn, Chat, Protect, GeoIP
Protect is only partly translated (sql stuff is not translated)
EssentialsSpawn is changed to use the onCommand from Essentials jar, since that is more up to date.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1408 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 19:57:59 +00:00
snowleo
8e1f018104 More translation stuff. Essentials namespace is now translated.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1407 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 19:02:59 +00:00
snowleo
4176d3f0da PlayerWrapper: new base functions of cb#766
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1406 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 18:21:09 +00:00
ementalo
1d0127bc68 [trunk] add the rb jar XD
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1405 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 18:18:10 +00:00
ementalo
c67923edc5 [trunk] fix give args
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1404 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 13:50:15 +00:00
ementalo
31a2d1b2d9 [trunk] RB #766
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1403 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-10 12:23:18 +00:00
snowleo
08136ab0ad Update Inventory after /item and /give. Hopefully fixes too many items bug.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1402 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 23:46:05 +00:00
snowleo
6e37682c0c Fixing minor typo that breaks the tests.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1401 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 21:52:47 +00:00
snowleo
5f803ffcaa More translation stuff
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1400 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 21:45:35 +00:00
ementalo
7b066c0468 [trunk] translations
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1399 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 21:37:02 +00:00
ementalo
164f592937 [trunk] translations
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1398 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 21:12:49 +00:00
snowleo
0529db4a80 More translation stuff
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1397 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 21:07:00 +00:00
snowleo
dfa6e88efe sugarcane fix by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1396 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 20:47:57 +00:00
snowleo
4486a99a4e More translation stuff
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1395 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 20:46:25 +00:00
snowleo
442e54ad6b Time diff: Parse numbers as seconds
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1394 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 19:51:53 +00:00
ementalo
1bbe1ee8da [trunk] import cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1393 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 14:21:20 +00:00
snowleo
153bcd9fa0 Log items that are sold using /sell
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1392 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 09:31:36 +00:00
snowleo
cf6ac87a29 Short sapling names by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1391 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 09:19:25 +00:00
snowleo
d7ec819ad8 Minor fix on give and item
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1390 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 09:00:29 +00:00
snowleo
185d574288 cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1389 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 03:11:59 +00:00
snowleo
e18cd69b5d cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1388 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 02:48:30 +00:00
snowleo
a314f16f90 [trunk] Translation of Essentials to other languages. This is just a start, many strings needs to be added.
Console doesn't show umlauts, but in game chat does.
New config property: locale

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1387 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 02:47:19 +00:00
snowleo
0c334bc1e7 [trunk] Translation of Essentials to other languages. This is just a start, many strings needs to be added.
Console doesn't show umlauts, but in game chat does.
New config property: locale

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1386 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 02:42:20 +00:00
snowleo
3195470b1b [trunk] ItemDb.get(): Added support for other seperation characters : + ' , ; .
added support for itemname:data, e.g. wool:7

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1385 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 00:48:21 +00:00
snowleo
e9927519c4 [trunk] Updated /item and /give to support the new ItemDb.get()
Heal sign supports data items too.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1384 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 00:37:05 +00:00
snowleo
ed47df93e9 [trunk] Rewritten ItemDb.get(), removed the getUnsafe function.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1383 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 00:22:45 +00:00
snowleo
e0f103c7d8 [trunk] Add compatibility with backpack plugin.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1382 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-09 00:12:58 +00:00
snowleo
abc22d4e21 [trunk] Fix formatCurrency and roundDouble (it breaks on non-us locales)
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1381 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 23:57:44 +00:00
snowleo
a41a7e60b1 [trunk] Don't show /back message on death if command is disabled
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1380 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 23:38:40 +00:00
snowleo
80e0b84875 [trunk] Fix chargeFor on teleports
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1379 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 23:28:23 +00:00
snowleo
dae0ce78d1 [trunk] New config property: nether.ratio, defaults to 16.
Please update use1to1ratio to ratio: 1.0

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1378 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 22:57:38 +00:00
snowleo
14b53db85a [trunk] warp sign: Only charge the user, if he is authorized to use the sign.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1377 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 22:45:10 +00:00
snowleo
02a9909e8b [trunk] Help: first test for help_username.txt, then help_groupname.txt and then help.txt, to allow help files for seperate groups and users.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1376 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 22:37:38 +00:00
snowleo
fb82943f29 Updated authors.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1375 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 22:25:27 +00:00
snowleo
a5b229e6c1 iConomy 5.0 support
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1374 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 22:23:04 +00:00
xeology
c33d3cbed8 API Changes.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1373 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 19:53:05 +00:00
xeology
8f67268c69 API Changes.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1372 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 19:40:24 +00:00
xeology
a1306a1a4e Bug fixes on API.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1371 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 19:25:44 +00:00
xeology
79a09fe046 Attempted fix on API overwriting values.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1370 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 19:09:04 +00:00
ementalo
840ce9c190 [trunk] cleanup debug messaging
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1369 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 13:03:03 +00:00
xeology
e4c79cf895 Fixed bad Main class. -iConomy Bridge4
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1368 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 03:37:46 +00:00
ementalo
f2a6bb39f0 [trunk] if ops name is empty handling
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1367 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-08 00:06:28 +00:00
ementalo
7e799276c5 [trunk] socialspy fix
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1366 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 23:58:14 +00:00
ementalo
42971cfad6 [trunk] I have gone insane. [trade] sign fixes
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1365 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 23:06:03 +00:00
ementalo
31f5802611 [trunk] metadata support in itemsdb.java, allows worth commands with metadata
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1364 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 13:03:45 +00:00
ementalo
bd5b8eacd0 [trunk] fix /sell inventory / blocks chat spam
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1363 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 12:11:56 +00:00
ementalo
cf1b72a740 [trunk] remove debug code
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1362 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 11:17:14 +00:00
ementalo
050b2cae18 [trunk] more trade sign fixes, upon breaking
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1361 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 11:13:26 +00:00
ementalo
1c68dde4a8 [trunk]missed a rouge $
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1360 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 10:58:51 +00:00
ementalo
0f2b3521b4 [trunk]various trade sign fixes
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1359 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-07 10:58:00 +00:00
ementalo
35d03143e0 [trunk] possible tpa fix, can't test
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1358 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 23:58:06 +00:00
ementalo
eaae9e7c75 [trunk] heal others fixed
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1357 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 23:37:18 +00:00
ementalo
2efb97013f [trunk] cleanup double $
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1356 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 21:08:58 +00:00
ementalo
c160d9c74d [trunk] fix doubles in signs and output display
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1355 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 20:55:12 +00:00
ementalo
9271e8eb3a [trunk] fix none ops colour option
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1354 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 20:19:44 +00:00
ementalo
b971abd151 [trunk] fix formatting of sell
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1353 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 19:50:14 +00:00
xeology
ef194e9a81 Compatability fix with API.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1352 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-06 01:36:26 +00:00
ementalo
bd18f97a10 [trunk] standardising the currency settings
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1351 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-05 22:13:05 +00:00
xeology
176b3da7d9 Removed indentations.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1350 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-05 19:39:44 +00:00
xeology
35bfb004f5 currnceyName > currencyName in config.yml . . . I need to lrn2spell
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1349 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-05 19:22:39 +00:00
ementalo
ec397349e7 [trunk] cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1348 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-05 10:10:31 +00:00
xeology
6a0a724353 Fixed offline player data changes rollingback on relogin. Need to reproccess OfflinePlayer as a user, not declare it as a user. Tested and works perfectly.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1347 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-05 04:32:32 +00:00
ementalo
5051bcb383 [trunk] EssentialsProtect :- fix owner spam on arm swing, will only show on right-click now
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1346 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-05 00:05:22 +00:00
ementalo
0825a1de86 [trunk] /sell inventory, /sell blocks fixes
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1345 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 23:33:32 +00:00
ementalo
cf020d235e [trunk warps should charge only once, and not when an exception happens
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1344 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 23:19:17 +00:00
ementalo
27dffd1533 [trunk] Untested - /sell inventory sells all your inventory minus armour stuff, /sell blocks sells blocks only
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1343 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 16:22:38 +00:00
ementalo
50780f7399 [trunk] adding support to warp other players to warps, this requires the essentials.warp.otherplayers permission
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1342 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 15:53:32 +00:00
ementalo
d9a5b73ea4 [trunk/ Groupmanager] change the groups.yml so the default config will let default build.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1341 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 15:00:42 +00:00
ementalo
8647f4f955 [trunk] formatting monies and signs. signs still need some work to incorporate doubles
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1340 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 14:23:22 +00:00
ementalo
c4bf23211f [trunk] {MAILS} in motd will show how many mails
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1339 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 11:23:45 +00:00
ementalo
d0dc96542b [trunk] new socialspy command. if toggled will show the output of /msg and /mail in the chat for the toggle persons. usage /socialspy to turn on, /socialspy again to turn off
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1338 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 10:39:56 +00:00
ementalo
21601e34d2 [trunk] rules from console
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1337 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 10:06:47 +00:00
ementalo
a61c1591e8 [trunk] lightning <playername> from the console
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1336 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 10:01:31 +00:00
xeology
d31466253f Reverse Compatibility is impossible as of now until a method to dynamically change code (or how it works) in external plugins is found. Removed Redundant and useless packages.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1335 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-04 02:34:44 +00:00
ementalo
e025a1a099 [trunk] warps should once again charge if setup in command costs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1334 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-03 23:39:10 +00:00
ementalo
11740c49bc [trunk/protect] Adding warning for changes coming soon to protect in regards to worldguard
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1332 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-03 21:37:36 +00:00
xeology
ee192afcc0 Cleaned up my format . . .
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1328 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-03 05:22:03 +00:00
xeology
a46bc7448b Working with ico 5.0 plugins. Not sure about banks . . no plugins to test it with . . . yet! Reverse compatability broken, ico decided to switch packages.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1327 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-03 04:29:37 +00:00
xeology
897810fe41 Fixed currency/plural.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1326 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-03 04:05:28 +00:00
ementalo
d269d148e2 [trunk]fix nullpointer on mails after you clear them and try to send mails
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1325 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 23:10:24 +00:00
xeology
b02fea8cbb EXPIRIMENTAL Essentials Iconomy Bridge for iConomy 5.0. This has reverse compatability and is tested but unsure of 5.0 API, needs testing but no 5.0 API plugins yet!
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1324 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 22:54:38 +00:00
ementalo
bbf1bef888 [trunk]fix nullpointer on mails after you clear them
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1323 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 22:51:57 +00:00
ementalo
96a1bdedc8 [trunk] word spacing on mute / tempban
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1322 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 22:30:48 +00:00
snowleo
79c0ef69c4 Cleanup of the iConomyBridge Code
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1321 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 18:22:17 +00:00
snowleo
2af13fd062 [trunk] Delete temp files, if they are not needed.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1320 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 16:59:25 +00:00
snowleo
592c30f5da [trunk] Stop the server instead of reloading, since reloading does not unload worlds.
This for compatibility to other multiworld plugins, since we load all unloaded worlds as normal worlds.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1319 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 16:57:19 +00:00
xeology
2e3841cbdd Fixed last minute screw up.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1318 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 10:09:43 +00:00
xeology
ed96ae495b Fixes dependencies for icoBridge
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1317 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 10:09:07 +00:00
xeology
9d961980e8 FayConomy is now EssentialsiConomyBridge, done and ported, fully functional. Relies on EcoAPI!
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1316 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 09:56:40 +00:00
xeology
e327aee283 Fixed API ALOT, added bypass on iconomy calls for ico-bridge.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1315 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 09:55:22 +00:00
xeology
affb889e42 git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1314 e251c2fe-e539-e718-e476-b85c1f46cddb 2011-05-02 05:28:30 +00:00
xeology
9a46f96c7b EssentialsiConomyBridge.jar replaces the iConomy.jar dependency. Project updated.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1313 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 05:26:36 +00:00
xeology
66f42ea2e0 EssentialsiConomyBridge.jar replaces the iConomy.jar dependency.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1312 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 05:22:42 +00:00
xeology
894a270a0e Integrated EcoAPI at EcoAPI.java
Fixed worth's ugly decimal display, does math with decimals now also!

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1311 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 03:56:51 +00:00
snowleo
87c937ff3c [trunk] Check for null in /sell
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1310 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 02:15:19 +00:00
snowleo
7efdb11d53 [trunk] /item /give, new permissions
- essentials.itemspawn.item-all
  - essentials.itemspawn.item-[itemname]
  - essentials.itemspawn.item-[itemid]
  - essentials.give.item-all
  - essentials.give.item-[itemname]
  - essentials.give.item-[itemid]
these have to be activated  with permission-based-item-spawn: true in config.yml

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1309 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 01:49:38 +00:00
xeology
037473d13b Fixed ugly decimals in messages and in balance.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1308 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 01:23:57 +00:00
snowleo
b986a3d503 [trunk] Eco: removed useless converting string => double => string
Missing brackets added

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1307 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 00:46:15 +00:00
ementalo
7426b641a4 [trunk] formatting
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1306 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 00:37:57 +00:00
xeology
5f74dffeae Made signs double compatible and fixed Sign Colours Permissions bypass exploit in Eco Signs.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1305 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 00:25:39 +00:00
snowleo
9d9adaa0b5 [trunk] Fix converting to new home format.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1304 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-02 00:20:57 +00:00
snowleo
6f16650e7d [trunk] Upgrade:
- move users.yml to users.yml.old
- handle filesystems that ignore case

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1303 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 22:58:54 +00:00
snowleo
c5850ddbd1 [trunk] Another fix for upgrading the home locations
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1302 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 22:35:26 +00:00
snowleo
088508bd37 [trunk] Fix bug on upgrade the home locations
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1301 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:58:38 +00:00
snowleo
224c18348a This is a big refactoring of the user class and more.
Many commands have been cleaned.

File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.

Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax

New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added

Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
-  time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
snowleo
03fd6249fc [trunk] Geoip: New permission essentials.geoip.show, that allow the player to see the location of other players.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1299 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 19:38:25 +00:00
snowleo
200d79bcec [trunk] New items.csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1298 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 19:13:12 +00:00
snowleo
4a50a36b5f [trunk] Fix unknown itemids to crash clients.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1297 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 19:09:38 +00:00
snowleo
7f34f32624 [trunk] /kickall <reason>, the reason is now optional, also fixes that only the first word is send as kick message.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1296 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 18:37:58 +00:00
snowleo
013c1d8147 [trunk] GeoIP: New permission: essentials.geoip.hide
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1295 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 11:57:57 +00:00
snowleo
bc54ba12bf [trunk] Fix the seperate stacks with /unlimited for all data items.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1294 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 11:32:17 +00:00
snowleo
e4e7213c9f Empty project for Fayconomy
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1293 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 11:06:17 +00:00
snowleo
41d73bf90e EssentialsGeoIP is now officially part of Essentials
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1292 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 11:04:34 +00:00
snowleo
ec18c0096d [trunk/GroupManager] Correct error message on failing to load users file.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1291 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-30 18:12:46 +00:00
ementalo
6b7e913bbc RB #740
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1290 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-29 09:35:58 +00:00
ementalo
94774a32ac [trunk] add new config setting warn-on-smite: true setting this to false will not tell people they are smited when using /lightning
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1289 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-29 08:48:29 +00:00
ementalo
2b915e72fa [trunk] fix /home playername. Look out for any case sesitive weirdness
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1288 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-28 22:52:08 +00:00
ementalo
db191e3115 [trunk] test the svn bot
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1287 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-28 00:32:47 +00:00
ementalo
a267cef78a [trunk] remove chat spam from lightning
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1286 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-27 19:28:40 +00:00
ementalo
de2ba1e06a [trunk] Update items.csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1285 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-27 15:44:07 +00:00
ementalo
2ccc2234d4 [trunk] added new config settings to disable weather. you can disable storm / thunder and lightning seperately.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1284 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-27 01:33:45 +00:00
ementalo
71f1a44013 [trunk] sky alias
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1283 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-27 00:42:53 +00:00
ementalo
29869fa264 [trunk] lightning strikes where you look if you do not pass an arg. fixed health taking
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1282 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-27 00:16:23 +00:00
ementalo
edc0904789 [trunk] fix /weather and /thunder args
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1281 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 22:46:34 +00:00
ementalo
63f2eb157a [trunk] cleanup, prevent lightning fire spread
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1280 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 21:36:51 +00:00
ementalo
530fc32515 [trunk] lightning, not as harsh, will take 5 hearts.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1279 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 12:48:24 +00:00
ementalo
aaee159fc9 [trunk] weather / thunder refactor, added /lightning. usage: /lightning [player] it will zap them and kill them. You can also zap yourself.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1278 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 12:39:57 +00:00
ementalo
6a892fcfc1 [trunk] weather / thunder refactor
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1277 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 12:13:39 +00:00
snowleo
80eee83f10 [trunk] New items.csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1276 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 11:04:02 +00:00
snowleo
0867930623 [trunk] /unlimited:
- Reset durability on some data items to prevent second stacks
- Double Step gives Step

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1275 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 10:47:59 +00:00
ementalo
e2ad9b41e8 [trunk] do'h
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1274 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 10:36:53 +00:00
ementalo
6a353a5628 Rcommended #733
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1273 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 09:14:38 +00:00
snowleo
983af7b476 CB 731
Adding new craftbukkit because it fixes one of the bugs I reported.

Mysql and sqlite are included in craftbukkit, we don't need to add the libs to our jars.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1272 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-26 02:05:22 +00:00
zenexer
1c06e813b0 Code cleanup; deprecated /nuble
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1271 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-24 22:13:14 +00:00
ementalo
99150d673a delete
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1270 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-24 20:49:02 +00:00
zenexer
ea284b6b0f Let's get to the bottom of this ban error.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1269 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-24 01:24:37 +00:00
ceulemansl
41279fc159 updatedplugin.yml
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1268 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 01:21:54 +00:00
ceulemansl
987ebf99e4 small CB build fix
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1267 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 00:45:10 +00:00
ceulemansl
e4fcdaf4a9 added thunder,
usage: /thunder <true/false> [duration]

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1266 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 00:43:27 +00:00
Zenexer
3a0b69e7b0 CB 711
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1265 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 00:30:59 +00:00
ceulemansl
998b025310 added wheather,
usage /weather <sun/storm> [time in seconds]

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1264 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 00:26:10 +00:00
ceulemansl
ab3d6779de added wheather,
usage /weather <sun/storm> [time in seconds]

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1263 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 00:24:29 +00:00
Zenexer
4bb368f7d7 CB 711
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1262 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-23 00:20:55 +00:00
snowleo
c60070a148 CB 699
Finally fixes creeper.isPowered()

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1261 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 18:05:07 +00:00
snowleo
103f124083 CB 698
Fixes creeper.isPowered()

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1260 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 17:52:31 +00:00
snowleo
f7ff96c12e New option for /spawnmob
/spawnmob creeper:powered 1

Creates a creeper that is charged by a ligthning.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1259 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 17:03:44 +00:00
snowleo
a86fbddc61 CB 697
Fixes spawning of web and new rails.
New config: Disable Lightning damage for players.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1258 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 16:58:02 +00:00
snowleo
5fbee1f39e Fix item drop on trade signs, if player inventory is full.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1257 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 16:37:37 +00:00
snowleo
e08bba4db3 Typo
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1255 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 15:00:07 +00:00
snowleo
00425eee73 Removed reference to EssentialsHome, we don't have that anymore
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1254 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 14:41:43 +00:00
snowleo
d11b13d986 Fix signs for names > 14 char length.
This can be exploited by creating a user with the same first 14 characters.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1253 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 14:08:01 +00:00
snowleo
f53ab01e3e Fix signs for names > 14 char length.
This can be exploited by creating a user with the same first 14 characters.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1252 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 11:59:22 +00:00
snowleo
755938ca5f Use the correct nether in case there are more worlds loaded.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1251 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 11:48:07 +00:00
snowleo
f4a15da12b New items.csv for 1.5 by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1250 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 10:43:19 +00:00
snowleo
2dc7208b82 Prevent to give air.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1249 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 10:08:44 +00:00
snowleo
8954dff5d0 Missed one function rename of the wolf entity
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1248 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 09:45:59 +00:00
snowleo
f1f3d2fec5 Craftbukkit 689 / MC 1.5
Testing only, do not release until 689 or higher is recommended

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1247 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 09:33:25 +00:00
snowleo
8ea366d8bb Updated build-impl by Netbeans 7.0
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1246 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-21 09:29:31 +00:00
zenexer
e4c8609be1 Added /e aliases for most commands
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1245 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-20 19:00:22 +00:00
ementalo
ad873c6867 [trunk] args length fix
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1244 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-19 10:52:24 +00:00
ementalo
acbdab7b08 [trunk] add optional playername param to home. Players with "essentials.homes.others" permission can teleport to other players homes.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1243 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-19 10:49:17 +00:00
ementalo
a214fcf1c1 Craftbukkit recommended #684
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1242 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-19 10:04:51 +00:00
Zenexer
faf283e9a3 Settings are now in trunk
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1241 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-18 01:01:34 +00:00
ementalo
457f8f23f0 [trunk] cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1239 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-17 14:42:59 +00:00
snowleo
f71bec35e5 [trunk] Throw errors on upgrade rename fail.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1238 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-17 00:08:09 +00:00
snowleo
74c8b634a0 [trunk] Catch the case where the upgrade is called before the config.yml file exists.
We don't need to update then.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1237 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 23:41:11 +00:00
snowleo
468f646e6e [trunk] Less spam on command errors by default
Added new debug setting to config.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1236 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 23:18:00 +00:00
zenexer
da1023975b Formatting
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1235 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 19:13:53 +00:00
zenexer
c98d81bf8c git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1234 e251c2fe-e539-e718-e476-b85c1f46cddb 2011-04-16 19:05:31 +00:00
snowleo
e547b0f006 [trunk] EssentialsConf: getDouble(): do not change the config on get() if the value is not set
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1233 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 17:26:32 +00:00
snowleo
307ecced06 [trunk] EssentialsUpgrade: rename backup to .upgradebackup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1232 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 16:49:56 +00:00
snowleo
dc663472c2 [trunk] Protection signs: Last character from group was cut off.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1231 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 16:24:45 +00:00
snowleo
4824493ced [trunk] Protection signs: Only owner of signs can destroy the signs.
This is also guarded by EssentialsProtect.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1230 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 16:16:04 +00:00
snowleo
4363d975b5 [trunk] Protection signs: Only owner of signs can destroy the signs.
This is also guarded by EssentialsProtect.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1229 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:53:36 +00:00
snowleo
1504979bbb [trunk] /sell hand will sell the item in hand.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1228 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:39:58 +00:00
snowleo
aabf820910 [trunk] /setworth: support double
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1227 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:36:37 +00:00
snowleo
2571d31cb0 [trunk] /sell: fix negative value
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1226 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:33:52 +00:00
snowleo
8ede5aad01 [trunk] Worth: Don't default to 0.0, default to NaN.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1225 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:25:48 +00:00
snowleo
a1b89ee75c [trunk] Better log of command errors
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1224 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:25:06 +00:00
snowleo
981f08405f [trunk] NPE in /sell
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1223 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:21:17 +00:00
snowleo
e58e73f1e5 [trunk] /sell itemname amount
New syntax for sell command, proposed by KimKandor
It won't sell the items in hand anymore.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1222 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:15:46 +00:00
snowleo
59c0534d48 [trunk] /sell itemname amount
New syntax for sell command, proposed by KimKandor
It won't sell the items in hand anymore.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1221 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:12:45 +00:00
snowleo
5ef0fd180b [trunk] /sell itemname amount
New syntax for sell command, proposed by KimKandor
It won't sell the items in hand anymore.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1220 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:11:44 +00:00
snowleo
137bafd0a8 [trunk] /sell itemname amount
New syntax for sell command, proposed by KimKandor
It won't sell the items in hand anymore.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1219 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 15:11:20 +00:00
snowleo
4c245dd25b [trunk] Bukkit-Bug: http://leaky.bukkit.org/issues/668
changed getData().getData() to getDurability()

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1218 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 14:39:31 +00:00
snowleo
201ffa4770 [trunk] Update user data if a command from /powertool is removed
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1217 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 13:41:36 +00:00
snowleo
8ac6f92250 [trunk] Removed useless loadClasses() method from Essentials.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1216 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 13:38:02 +00:00
snowleo
d311fc126f [trunk] New mechanism for upgrading config files. This will be extended in the future.
New worth.yml autogenerated from the previous values.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1215 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 13:36:09 +00:00
snowleo
aaae6264cb [trunk] Group inheritance for warp signs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1214 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 07:05:46 +00:00
snowleo
0b95a2f417 [trunk] Groups for Protection signs.
Group inheritance.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1213 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 07:01:18 +00:00
snowleo
09ab981585 [trunk] Worth/Sell: Support for double values as prices and more important: support for data items.
the yaml structure has changed, there is a fallback to the old structure.

This code is untested.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1212 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 06:45:37 +00:00
snowleo
c849bf7fe9 [trunk] Worth/Sell: Support for double values as prices and more important: support for data items.
the yaml structure has changed, there is a fallback to the old structure.

This code is untested.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1211 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 06:28:56 +00:00
snowleo
cf144b1a64 [trunk] Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1210 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 06:00:27 +00:00
snowleo
528aa3d6cf [trunk] Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1209 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 05:59:59 +00:00
snowleo
31dc8694b6 [trunk] /worth: don't access config directly, don't reload config after save and use getPrice() method.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1208 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 05:57:16 +00:00
snowleo
fc9a9c2b9f [trunk] 1 to 1 ratio in Nether: The code is in two places. Also fixes 1/16=0 error using /world command.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1207 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 05:52:58 +00:00
snowleo
76dda664d7 [trunk] Groups for Protection signs.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1206 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 05:36:32 +00:00
ementalo
a9a178466c [trunk] restore a users saved inventory if they use invsee then logout
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1205 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 00:54:31 +00:00
ementalo
ed71a41578 forgot to return
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1204 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 00:46:53 +00:00
ementalo
2372be6a57 [trunk] moved the worth-id: cost out to their own file "worth.yml" some default values will be created. If you have values in config.yml already then they need to be copied to this new file. Added a setworth command that can change / add worth values.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1203 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-16 00:42:43 +00:00
ementalo
3a18f9bf33 [trunk] change the ability to nick others to permission node "essentials.nick.others"
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1202 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 23:21:40 +00:00
ementalo
c1ef4faaf9 [trunk] new setting use-1to1-ratio if true sets the nether offset when using world to 1:1 else defaults to normal nether ratio
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1201 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 23:06:29 +00:00
ementalo
60bf78040c [trunk] fix setting for prevent-block-on-rails
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1200 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 21:56:40 +00:00
ementalo
8a12038948 [trunk] fixing node setting for warn-on-build-disallow. This needs to be in the protect: section under the disable: best place is to put it under the build: true node
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1199 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 21:18:32 +00:00
ementalo
d3b6534396 [trunk] case insensitive items from items csv when using /item and /give
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1198 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 21:11:41 +00:00
ementalo
77ad27a6ff [trunk] change the way we prevent jailed players teleporting, should fix conflict with nocheat
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1197 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 20:13:16 +00:00
ementalo
4bef593e2f [trunk] emoney
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1196 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 19:47:17 +00:00
ementalo
2756dae1f8 [trunk] remove ServerList section
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1195 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 16:42:53 +00:00
snowleo
6736daa894 Removing private directory again.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1194 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 06:55:39 +00:00
zenexer
a8ef55e057 Added overridden-commands. Commands beginning with /e will also give Essentials precedence.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1193 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-15 01:41:42 +00:00
ementalo
7463d06594 cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1192 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-14 22:53:36 +00:00
snowleo
bffaf98fcd [trunk] Don't forget to update the minBukkitBuildVersion in Essentials class.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1191 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-14 22:16:01 +00:00
snowleo
31ab41fab3 [trunk] Do not rely on getItemInHand();
Bukkit-Bug: http://leaky.bukkit.org/issues/663

Fixes issue with data items and /unlimited

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1190 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-14 22:11:35 +00:00
ementalo
2b1164f021 [trunk] add setting warn-on-build-disallow to protect. setting this will give users with build:false a warning
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1189 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-14 21:14:16 +00:00
ementalo
7e93ef0bd0 RB #677
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1188 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-14 10:36:17 +00:00
ementalo
dd164d2e38 [trunk] adding new setting to send a person to spawn if /home is used with no home set
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1187 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-14 09:36:25 +00:00
ementalo
b3d6c32b71 recommend # 674
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1186 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-13 12:37:56 +00:00
ementalo
268961045f new RB #647,
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1185 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-13 12:21:39 +00:00
snowleo
7d01b1c352 [trunk] God/Heal: New aliases /egod and /eheal
Also fix: /money and /bal for /balance

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1184 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-12 20:29:32 +00:00
snowleo
1142a66b24 No private folders please!
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1183 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-12 20:28:52 +00:00
snowleo
eaa6333ceb [trunk] God/Heal: New aliases /egod and /eheal
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1182 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-12 19:39:38 +00:00
zenexer
b4e7bc3507 Added /ifo and /about as aliases for /info
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1181 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-12 03:14:01 +00:00
zenexer
ef29285239 Added ability to disable nicknames by adding /nick to the disabled commands list
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1180 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-12 02:21:53 +00:00
zenexer
8641290caa Added /realname
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1179 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 17:38:40 +00:00
snowleo
13940ddebe [trunk] Antioch: Removed restriction to op users.
People want use the command, so we don't need this artificial restriction.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1178 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 11:23:10 +00:00
snowleo
0c0a8b2602 [trunk] Protect: new prevent.portal-creation
If enabled, players can't create portals using fire.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1177 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 10:49:45 +00:00
snowleo
8a30845b1d [trunk] getSaveDestination: floor location and center the player on the block
Less chance to get stuck in walls

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1176 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 08:58:16 +00:00
ementalo
3f2a7388b6 [trunk] updated csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1175 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 08:48:40 +00:00
snowleo
545fcccaf7 [trunk] UserData: Catch null location in getHome
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1174 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 00:35:56 +00:00
snowleo
48a39e8779 [trunk] Config: added all possible values to prevent spawning
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1173 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-11 00:10:18 +00:00
snowleo
d731dd4da1 [trunk] UserTest/Home: We can't test home without a running server.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1172 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 23:43:02 +00:00
snowleo
d23e7a2821 [trunk] Home: Catch world not loaded/unknown in server.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1171 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 23:35:07 +00:00
snowleo
471e20473b [trunk] GroupManager: Support utf-8 for saving files.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1170 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 22:55:11 +00:00
ementalo
27a3d0a9a1 [trunk] add alias of ci to cleaninventory
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1169 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 21:21:34 +00:00
snowleo
c753621b40 [trunk] added woodenstair, woodstair, wstair to item.csv
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1168 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 21:00:50 +00:00
snowleo
b2b1c1510a [trunk] change portal exit position for fixed getSavePosition
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1167 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 20:51:39 +00:00
snowleo
c8c019660e [trunk] getSaveDestination: round location and center the player on the block
Less chance to get stuck in walls

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1166 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 20:09:04 +00:00
snowleo
017e208231 [trunk] New permissions:
essentials.nocommandcost.all
essentials.nocommandcost.[commandname]

Don't charge a user for a command.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1165 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 19:44:12 +00:00
snowleo
affa1dd652 [trunk] New /info command, reads text from info.txt.
Chapters are supported. Each line that starts with #name creates a chapter named name. Name does not support spaces and ignores case.

If info.txt contains chapters and no chapter is selected with /info command, then it will either print the file until the first chapter or if the first line is a chapter, it will return a list of all chapters.


git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1164 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 19:29:37 +00:00
snowleo
44de35240d [trunk] Backported some code from 3.0 branch: Correct the protection of signs and rails.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1163 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 18:17:53 +00:00
zenexer
b43fb88772 Updated according to necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1162 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 16:48:25 +00:00
zenexer
b859c55b90 Updated according to necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1161 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-10 16:36:57 +00:00
ementalo
605a09df37 updated items.csv
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1160 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-09 19:36:11 +00:00
snowleo
8dda02da99 [trunk] tpall command
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1159 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-09 00:58:41 +00:00
snowleo
76ba31d1a3 [trunk] New permission essentials.protect.ownerinfo shows the owner of each block, was essentials.protect.admin before.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1158 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 16:35:32 +00:00
snowleo
70e72d7744 [trunk] empty fields in Inventory now return null instead of Material.AIR
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1157 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 11:45:14 +00:00
snowleo
22f9b76d77 [trunk] empty fields in Inventory now return null instead of Material.AIR
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1156 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 11:43:10 +00:00
snowleo
51ec3434f5 [trunk] Typo in groups.yml
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1155 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 11:28:55 +00:00
snowleo
395530bfd4 [trunk] Replace all CraftInventory with Inventory
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1154 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 11:13:33 +00:00
ementalo
9a17f38448 test libs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1150 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 08:22:19 +00:00
ementalo
f124c1f824 New RB #670
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1149 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-08 08:16:28 +00:00
snowleo
452f4ff0e7 [trunk] Monster don't target players.
new config: protect.prevent.entitytarget
new permission: essentials.protect.entitytarget.bypass

forgot to add it to settings

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1148 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 20:44:06 +00:00
snowleo
0b9f037a14 [trunk] Monster don't target players.
new config: protect.prevent.entitytarget
new permission: essentials.protect.entitytarget.bypass

forgot to add it to settings

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1147 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 20:39:27 +00:00
snowleo
12b1b7c85a [trunk] Monster don't target players.
new config: protect.prevent.entitytarget
new permission: essentials.protect.entitytarget.bypass

typo

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1146 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 20:37:48 +00:00
snowleo
79bd8d0b2c [trunk] Monster don't target players.
new config: protect.prevent.entitytarget
new permission: essentials.protect.entitytarget.bypass

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1145 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 20:32:00 +00:00
snowleo
5dcb5e02fb [trunk] Last heal, Last teleport: Don't error if it's the first time.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1144 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 16:57:06 +00:00
snowleo
3908443717 [trunk] New base class for User for storing all data.
More data for future use.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1143 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 02:59:56 +00:00
snowleo
46e6276c63 [trunk] New base class for User for storing all data.
TODO:
	- Get rid of users.yml
	- Cleanup User class

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1142 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-07 02:21:10 +00:00
snowleo
c1ac5b345f [trunk] Don't expect the values from yaml to be a specific number format.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1141 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 10:32:59 +00:00
snowleo
9a85c73c9f [trunk] trying to avoid IllegalAccess errors
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1140 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 01:05:41 +00:00
snowleo
eb39ae777b [trunk] trying to avoid IllegalAccess errors
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1139 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 01:02:31 +00:00
snowleo
2f1e22bfb3 [trunk] Fixes tjail if there is a jail stuck in the config.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1138 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 00:52:27 +00:00
snowleo
fc2c9d71bb [trunk] Fixes failed back after tjail
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1137 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-06 00:50:16 +00:00
snowleo
1b3386336a [trunk] Another IllegalAccess error?
http://pastebin.com/C122fiuQ

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1136 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 23:30:58 +00:00
snowleo
7137e7b829 [trunk] /msg /r Reply to the console. Add /r console command.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1135 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 18:28:18 +00:00
snowleo
4b8ffabfb8 [trunk] /msg /r Reply to the console. Add /r console command.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1134 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 18:14:18 +00:00
snowleo
2442285d7b [trunk] EssentialsChat: chat-radius is now multi world compatible.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1133 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 16:59:46 +00:00
snowleo
3ef2efd1fb [trunk] Teleport Cooldown: uncommented code
What was the regression here?

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1132 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 16:53:26 +00:00
snowleo
333ef69e88 [trunk] Jail: Directly send player to Jail.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1131 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 16:46:06 +00:00
snowleo
1bd8fe41b8 [trunk] Hopefully fixes java.lang.IllegalAccessError in EssentialsBlockListener
Force the hidden classes to load by the same ClassLoader.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1130 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 16:31:38 +00:00
snowleo
57b5af7829 [trunk] /msg /r Reply to the console. Add /r console command.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1129 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 15:57:54 +00:00
snowleo
dbc653edb8 [trunk] /list: Reset color after [AFK]
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1128 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 15:54:59 +00:00
snowleo
21659e4068 [trunk] /plugin commands are broken.
see http://leaky.bukkit.org/issues/641 for details
Disabled all commands except /plugin list
/plugin load, /plugin reload and /plugin enable will call server.reload() function.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1127 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-05 15:53:29 +00:00
snowleo
e3b92d9c2d [trunk] Unlimited: Displayed wrong name
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1126 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 19:48:59 +00:00
snowleo
72ea0a1220 [trunk] Unlimited: Fix for list
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1125 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 17:58:02 +00:00
snowleo
b19fa531cf [trunk] Clear Inventory: Fix "Player not found" message
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1124 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 15:38:25 +00:00
snowleo
5f177b3b1e [trunk] Unlimited: fix unlimited.item-all permission
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1123 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 15:11:42 +00:00
snowleo
076fedf6e4 [trunk] Unlimited: removed the - from names, so that the names correspond with the ones in items.csv.
Now its:

essentials.unlimited.item-waterbucket instead of item-water-bucket

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1122 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 15:02:07 +00:00
snowleo
6f84be54f0 [trunk] Unlimited: allow permissions with ids instead of names:
essentials.unlimited.item-1

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1121 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 14:51:19 +00:00
snowleo
28da8fa91c [trunk] Unlimited: List unlimited items with /unlimited list <player>
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1120 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 14:40:16 +00:00
snowleo
792b1c7af5 [trunk] Unlimited: List unlimited items with /unlimited list <player>
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1119 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 14:27:06 +00:00
snowleo
2606e5d9ff [trunk] Unlimited: Breaking change!
In favor for a much easier system, the config.yml settings have been removed.

New permissions:
essentials.unlimited: activates the /unlimited command
essentials.unlimited.others: allows to give unlimited stacks to others
essentials.unlimited.item-all: Access to all items
essentials.unlimited.item-bucket: Access to all buckets
essentials.unlimited.item-[itemname]: Access to specific item
item names are from https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/Material.java
lower case, with - instead of _

All other essentials.unlimited.* permissions have been removed.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1118 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 14:16:00 +00:00
snowleo
cd64b68222 [trunk] Unlimited: Better config documentation
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1117 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 13:25:02 +00:00
snowleo
66bf05621c [trunk] Unlimited: Display a message when user already has permissions to avoid confusion.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1116 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 13:06:01 +00:00
snowleo
4dbf568cf8 [trunk] Unlimited: Don't run on canceled place.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1115 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 12:46:19 +00:00
snowleo
9c96ad9065 [trunk] Refactoring & cleanup of /spawnmob
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1114 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 02:58:41 +00:00
snowleo
02f221bfa0 [trunk] New /powertool command
Disable spam message for {player} commands

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1113 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 01:55:27 +00:00
snowleo
7d0e9a26b0 [trunk] New /powertool command
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1112 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-04 01:26:45 +00:00
snowleo
3f4df23144 [trunk] /unlimited: Only give out one item, if the inventory does not contain one.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1111 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 20:52:23 +00:00
snowleo
bc243cb7df [trunk] Renamed infinite to unlimited
Please change your permissions and config if you have used this.

New Command: /unlimited [item] <player>
Allows a player to enable unlimited placing for one item. Can be used on other players.
The permission essentials.unlimited.placing still enables it for all items.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1110 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 20:39:39 +00:00
snowleo
51f0955c88 [trunk] Renamed infinite to unlimited
Please change your permissions and config if you have used this.

New Command: /unlimited [item] <player>
Allows a player to enable unlimited placing for one item. Can be used on other players.
The permission essentials.unlimited.placing still enables it for all items.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1109 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 20:31:18 +00:00
snowleo
9df79032ea [trunk] Renamed infinite to unlimited
Please change your permissions and config if you have used this.

New Command: /unlimited [item] <player>
Allows a player to enable unlimited placing for one item. Can be used on other players.
The permission essentials.unlimited.placing still enables it for all items.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1108 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 20:21:20 +00:00
snowleo
25f09c792d [trunk] Default config changed:
protect.alert.on-use: empty now
protect.disable.build: true

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1107 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 18:16:23 +00:00
snowleo
bcc8387496 [trunk] Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1106 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 17:16:02 +00:00
snowleo
05c902371a [trunk] Spawn angry or tamed wolf
/spawnmob wolf:angry
/spawnmob wolf:tamed

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1105 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 17:10:19 +00:00
snowleo
e5be12bc5c [trunk] Fixes slime:size
1 is smallest
Also added wool color for sheeps: Use color name (like white, red, blue) 
Example: /spawnmob sheep:blue

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1104 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 16:32:33 +00:00
snowleo
1438f91392 [trunk] Typo in config
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1103 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 16:01:21 +00:00
snowleo
b1f58d7a92 [trunk] Removed debug message "Kit is timed"
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1102 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 14:53:22 +00:00
snowleo
c437074dc7 [trunk] Removed unused imports
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1101 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 14:31:30 +00:00
snowleo
20d51e3311 [trunk] Infinite placement of blocks, egg throws, buckets
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1100 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 14:25:10 +00:00
snowleo
8539f28146 [trunk] Drop items from Buy Signs if the inventory is full
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1099 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 13:38:25 +00:00
snowleo
0b92c89ad7 [trunk] Warp signs
Since we can charge for warping now, Free is wrong, changed to Everyone.
So if you want everyone to use the sign use either "Everyone" or leave the third line empty.
In the latter case per Warp permission may apply, if enabled and the user needs essentials.signs.warp.use permission.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1098 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 12:15:22 +00:00
snowleo
b11964dac4 [trunk] Warp signs
4th line: charge money or items

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1097 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 12:02:33 +00:00
snowleo
7bd9527e34 [trunk] Warp signs
PerWarpPermissions

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1096 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 01:19:50 +00:00
snowleo
fef58aeb18 [trunk] Warp signs
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1095 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-03 01:12:55 +00:00
ceulemansl
d9f3208d43 [Warp] signes.
Format:
    [Warp]
    warp-name
    Free/group/empty(then need permission to use)

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1094 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-02 23:21:45 +00:00
ceulemansl
7a6a0ec775 [Warp] signes.
Format:
    [Warp]
    warp-name
    Free/group/empty(then need permission to use)

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1093 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-02 23:21:28 +00:00
snowleo
4337b6ecec [trunk] Trim whitespaces from names in item lists in config.yml
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1092 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-02 09:46:13 +00:00
snowleo
3496a85228 [trunk] Prevent explosions near protected objects
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1091 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-02 02:43:58 +00:00
snowleo
348cb29469 [trunk] Readded [balance] and [heal] sign code that was lost
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1090 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-02 00:41:58 +00:00
snowleo
0efed42015 [trunk] teleportTo replaced with teleport; craftbukkit deprecated
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1089 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 23:39:18 +00:00
snowleo
f6ccc7b089 [trunk] Fixed multiworld support for /home
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1088 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 23:35:10 +00:00
snowleo
09006ced4f [trunk] Prevent scam (air, zero items) signs and prevent stacks size lower than 1 with /give and /item
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1087 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 23:06:44 +00:00
snowleo
f1e44b1fda [trunk] Cleanup
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1086 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 22:55:28 +00:00
snowleo
bd234780cf [trunk] Handle suffix with a size of 0 or 1.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1085 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 22:46:27 +00:00
snowleo
3c59ec9c58 [trunk] Item lists in settings are now stored as Integer lists.
Also: Names from items.csv now work in item lists.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1084 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 22:06:00 +00:00
snowleo
1e45b468dc [trunk] CraftBukkit: new recommended build 617
Fixes Sign bug (sign won't change)

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1081 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 20:11:55 +00:00
ementalo
b514353f39 Temp fix for coloured suffixes
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1076 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 10:15:49 +00:00
snowleo
6207c76d3c [trunk] New 1.4 items.csv by necrodoom
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1075 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 04:13:38 +00:00
snowleo
9d1b8ae5fe [trunk] CraftBukkit new recommended build 612
Compatibility with MC 1.4

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1069 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 02:16:07 +00:00
snowleo
7f4226eff9 [trunk] Ignore dist & build
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1063 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 01:36:47 +00:00
snowleo
40f6247aad [trunk] Correcting path for c3p0
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1059 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 01:21:30 +00:00
snowleo
f9f5e427bc [trunk] Remove private directories.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1055 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-04-01 00:18:15 +00:00
ementalo
65312004df NULL item is when we click on stuff like doors.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1053 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-31 22:39:08 +00:00
ementalo
fb80869961 Fix NPE where players trigger creature spawn
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1052 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-31 22:20:53 +00:00
ementalo
6416041d22 wolf spawn
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1051 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-31 21:48:46 +00:00
Zenexer
6e9561764f Fixed priorities
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1046 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-31 12:05:42 +00:00
Zenexer
fcf67d18b7 We shouldn't be canceling Priority.Monitor events; switched to Priority.Lowest.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1045 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-31 11:59:43 +00:00
Zenexer
12b5203039 Temporary fix for teleportation
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1044 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 20:22:07 +00:00
Zenexer
17b3c793d9 Updated for CB 602
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1043 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 17:58:00 +00:00
Zenexer
5125181967 git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1041 e251c2fe-e539-e718-e476-b85c1f46cddb 2011-03-30 16:57:05 +00:00
zenexer
825ad4edfc Updated for bukkit 600+
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1039 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 16:40:44 +00:00
Zenexer
c0ab3e290e git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1038 e251c2fe-e539-e718-e476-b85c1f46cddb 2011-03-30 16:38:56 +00:00
ementalo
2b66459bce remove
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1037 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 14:31:54 +00:00
ementalo
243ff48778 gah
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1036 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 14:28:46 +00:00
ementalo
c2f7853ec9 2.1 v
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1035 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 14:22:14 +00:00
Zenexer
d4973ae644 Fixed merge error
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1034 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 14:08:12 +00:00
Zenexer
441b8ad926 Deprecated Serverlist
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1030 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 13:39:00 +00:00
snowleo
b4421831c7 Commit 993
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1029 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 13:34:15 +00:00
snowleo
357c1b75ff Commit 994 996
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1028 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 13:31:01 +00:00
snowleo
903ccfc798 Commit 1001
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1027 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 13:28:57 +00:00
snowleo
79d2518939 Commit 1002
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1026 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 13:28:15 +00:00
Zenexer
d60bef2138 Deprecated Serverlist
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1025 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 13:16:54 +00:00
snowleo
d4f15e62d2 Revert to 1013
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1022 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 12:58:01 +00:00
snowleo
08041599ff Revert to 1013
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1021 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 12:56:34 +00:00
Zenexer
81c9b91561 Updated merged jars to add c3p0
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1020 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 12:22:10 +00:00
ementalo
00bd3ddde3 latest RB #602
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1018 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 07:49:29 +00:00
Zenexer
cbbe0d8beb Renamed 2.1 -> trunk
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1017 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 04:04:57 +00:00
Zenexer
cb21bc4d7a 2.1 prerelease, part 2 of 3
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk2.1@1015 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-30 04:03:21 +00:00
KimKandor
063f594069 Updated to more normal settings including essentials permission nodes.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1000 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-22 13:42:45 +00:00
KimKandor
8d4e677dc6 Updated to more normal settings including essentials permission nodes.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@999 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-22 13:40:44 +00:00
snowleo
a1dffe534a [2.1] Adding world name to location of whois
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@997 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-21 15:50:35 +00:00
snowleo
e93457a41f [trunk] Fix for ticket #161. Reset the color to white after away.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@995 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-21 15:39:57 +00:00
snowleo
a3405bb714 [trunk] Fix NPE in EssentialsConf on closing the stream.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@989 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-21 12:51:26 +00:00
snowleo
d9117d74b3 [trunk] Corrected log names in items.csv
by necrodoom

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@987 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-20 12:41:46 +00:00
snowleo
0f0632ca7e Testcommit
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@980 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-20 01:36:03 +00:00
snowleo
7f03e6c733 Testcommit to trunk for merge
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@978 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-20 01:32:07 +00:00
snowleo
cca97269e2 Testmerge from 2.1 to trunk
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@976 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-20 00:41:19 +00:00
snowleo
a3ebd254f2 Moving all files to trunk.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@969 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-03-19 22:39:51 +00:00
snowleo
487577f2fa git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@968 e251c2fe-e539-e718-e476-b85c1f46cddb 2011-03-19 22:36:16 +00:00
291 changed files with 56156 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@@ -0,0 +1,25 @@
.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/

74
BuildAll/build.xml Normal file
View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="BuildAll" default="default" basedir=".">
<description>Builds, tests, and runs the project BuildAll.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="BuildAll-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
build.xml.data.CRC32=c4188209
build.xml.script.CRC32=7a797370
build.xml.stylesheet.CRC32=28e38971@1.43.1.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=c4188209
nbproject/build-impl.xml.script.CRC32=73a4865f
nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45

View File

@@ -0,0 +1,93 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=BuildAll
application.vendor=Paul
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/BuildAll.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.compress=false
javac.classpath=\
${reference.Essentials.jar}:\
${reference.EssentialsChat.jar}:\
${reference.EssentialsGroupBridge.jar}:\
${reference.EssentialsGroupManager.jar}:\
${reference.EssentialsProtect.jar}:\
${reference.EssentialsSpawn.jar}:\
${reference.EssentialsGeoIP.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
project.Essentials=../Essentials
project.EssentialsChat=../EssentialsChat
project.EssentialsGeoIP=../EssentialsGeoIP
project.EssentialsGroupBridge=../EssentialsGroupBridge
project.EssentialsGroupManager=../EssentialsGroupManager
project.EssentialsProtect=../EssentialsProtect
project.EssentialsSpawn=../EssentialsSpawn
reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar
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.EssentialsProtect.jar=${project.EssentialsProtect}/dist/EssentialsProtect.jar
reference.EssentialsSpawn.jar=${project.EssentialsSpawn}/dist/EssentialsSpawn.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>BuildAll</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
<definitions>..\lib\nblibraries.properties</definitions>
</libraries>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>Essentials</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>EssentialsChat</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>EssentialsGeoIP</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>EssentialsGroupBridge</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>EssentialsGroupManager</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>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
<reference>
<foreign-project>EssentialsSpawn</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>

7
Essentials/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# NetBeans cruft
/build
/dist
/nbproject/private
# Mac cruft
.DS_Store

84
Essentials/build.xml Normal file
View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Essentials" default="default" basedir=".">
<description>Builds, tests, and runs the project Essentials.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Essentials-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<!--target name="-post-jar">
<jar jarfile="${dist.dir}/Essentials.jar">
<zipfileset src="${dist.jar}" excludes="META-INF/*" />
<zipfileset src="${dist.dir}/lib/Register.jar" excludes="META-INF/*" />
<manifest>
<attribute name="Classpath" value="Essentials.jar"/>
</manifest>
</jar>
</target-->
</project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
build.xml.data.CRC32=7d758acf
build.xml.script.CRC32=3233ee78
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=4b596d89
nbproject/build-impl.xml.script.CRC32=4926001b
nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45
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

@@ -0,0 +1 @@
DoNotUseThreads

View File

@@ -0,0 +1,82 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Essentials
application.vendor=Paul
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Essentials.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.BOSEconomy.jar=../lib/BOSEconomy.jar
file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
file.reference.iCo4.jar=../lib/iCo4.jar
file.reference.iCo5.jar=../lib/iCo5.jar
file.reference.junit-4.5.jar=..\\lib\\junit_4\\junit-4.5.jar
file.reference.Permissions.jar=..\\lib\\Permissions.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.Permissions.jar}:\
${file.reference.craftbukkit-0.0.1-SNAPSHOT.jar}:\
${file.reference.BOSEconomy.jar}:\
${file.reference.iCo4.jar}:\
${file.reference.iCo5.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${file.reference.junit-4.5.jar}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=-Djline.terminal=jline.UnsupportedTerminal
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>Essentials</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
<definitions>../lib/nblibraries.properties</definitions>
</libraries>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1"/>
</configuration>
</project>

View File

@@ -0,0 +1,84 @@
package com.earth2me.essentials;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
public class Backup implements Runnable {
private static final Logger logger = Logger.getLogger("Minecraft");
private final CraftServer server;
private final IEssentials ess;
private boolean running = false;
private int taskId = -1;
private boolean active = false;
public Backup(IEssentials ess) {
this.ess = ess;
server = (CraftServer)ess.getServer();
if (server.getOnlinePlayers().length > 0) {
startTask();
}
}
void onPlayerJoin() {
startTask();
}
private void startTask() {
if (!running) {
long interval = ess.getSettings().getBackupInterval()*1200; // minutes -> ticks
if (interval < 1200) {
return;
}
taskId = ess.scheduleSyncRepeatingTask(this, interval, interval);
running = true;
}
}
public void run() {
if (active) return;
active = true;
final String command = ess.getSettings().getBackupCommand();
if (command == null || "".equals(command)) {
return;
}
logger.log(Level.INFO, Util.i18n("backupStarted"));
final CommandSender cs = server.getServer().console;
server.dispatchCommand(cs, "save-all");
server.dispatchCommand(cs, "save-off");
ess.scheduleAsyncDelayedTask(
new Runnable() {
public void run() {
try {
Process child = Runtime.getRuntime().exec(command);
child.waitFor();
} catch (InterruptedException ex) {
logger.log(Level.SEVERE, null, ex);
} catch (IOException ex) {
logger.log(Level.SEVERE, null, ex);
} finally {
ess.scheduleSyncDelayedTask(
new Runnable() {
public void run() {
server.dispatchCommand(cs, "save-on");
if (server.getOnlinePlayers().length == 0) {
running = false;
if (taskId != -1) {
server.getScheduler().cancelTask(taskId);
}
}
active = false;
logger.log(Level.INFO, Util.i18n("backupFinished"));
}
});
}
}
});
}
}

View File

@@ -0,0 +1,104 @@
package com.earth2me.essentials;
import org.bukkit.inventory.ItemStack;
public class Charge
{
private final String command;
private final Double costs;
private final ItemStack items;
private final IEssentials ess;
public Charge(String command, IEssentials ess)
{
this(command, null, null, ess);
}
public Charge(double money, IEssentials ess)
{
this(null, money, null, ess);
}
public Charge(ItemStack items, IEssentials ess)
{
this(null, null, items, ess);
}
private Charge(String command, Double money, ItemStack item, IEssentials ess)
{
this.command = command;
this.costs = money;
this.items = item;
this.ess = ess;
}
public void isAffordableFor(IUser user) throws Exception
{
double mon = user.getMoney();
if (costs != null)
{
if (mon < costs && !user.isAuthorized("essentials.eco.loan"))
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
}
if (items != null)
{
if (!InventoryWorkaround.containsItem(user.getInventory(), true, items))
{
throw new Exception(Util.format("missingItems", items.getAmount(), items.getType().toString().toLowerCase().replace("_", " ")));
}
}
if (command != null && !command.isEmpty())
{
if (user.isAuthorized("essentials.nocommandcost.all")
|| user.isAuthorized("essentials.nocommandcost." + command))
{
return;
}
double cost = ess.getSettings().getCommandCost(command.startsWith("/") ? command.substring(1) : command);
if (mon < cost && !user.isAuthorized("essentials.eco.loan"))
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
}
}
public void charge(IUser user) throws Exception
{
double mon = user.getMoney();
if (costs != null)
{
if (mon < costs && !user.isAuthorized("essentials.eco.loan"))
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
user.takeMoney(costs);
}
if (items != null)
{
if (!InventoryWorkaround.containsItem(user.getInventory(), true, items))
{
throw new Exception(Util.format("missingItems", items.getAmount(), items.getType().toString().toLowerCase().replace("_", " ")));
}
InventoryWorkaround.removeItem(user.getInventory(), true, items);
user.updateInventory();
}
if (command != null && !command.isEmpty())
{
if (user.isAuthorized("essentials.nocommandcost.all")
|| user.isAuthorized("essentials.nocommandcost." + command))
{
return;
}
double cost = ess.getSettings().getCommandCost(command.startsWith("/") ? command.substring(1) : command);
if (mon < cost && !user.isAuthorized("essentials.eco.loan"))
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
user.takeMoney(cost);
}
}
}

View File

@@ -0,0 +1,34 @@
package com.earth2me.essentials;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
public final class Console implements IReplyTo {
private static Console instance = new Console();
private CommandSender replyTo;
public final static String NAME = "Console";
private Console() {
}
public static CommandSender getCommandSender(Server server) throws Exception {
if (! (server instanceof CraftServer)) {
throw new Exception(Util.i18n("invalidServer"));
}
return ((CraftServer)server).getServer().console;
}
public void setReplyTo(CommandSender user) {
replyTo = user;
}
public CommandSender getReplyTo() {
return replyTo;
}
public static Console getConsoleReplyTo() {
return instance;
}
}

View File

@@ -0,0 +1,747 @@
/*
* Essentials - a bukkit plugin
* Copyright (C) 2011 Essentials Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.earth2me.essentials;
import com.earth2me.essentials.commands.EssentialsCommand;
import java.io.*;
import java.util.*;
import java.util.logging.*;
import org.bukkit.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import com.earth2me.essentials.register.payment.Methods;
import java.math.BigInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.*;
import org.bukkit.plugin.java.*;
public class Essentials extends JavaPlugin implements IEssentials
{
public static final String AUTHORS = "Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans and Xeology";
public static final int minBukkitBuildVersion = 860;
private static final Logger logger = Logger.getLogger("Minecraft");
private Settings settings;
private EssentialsPlayerListener playerListener;
private EssentialsBlockListener blockListener;
private EssentialsEntityListener entityListener;
private JailPlayerListener jailPlayerListener;
private static Essentials instance = null;
private Spawn spawn;
private Jail jail;
private Warps warps;
private Worth worth;
private List<IConf> confList;
public ArrayList bans = new ArrayList();
public ArrayList bannedIps = new ArrayList();
private Backup backup;
private final Map<String, User> users = new HashMap<String, User>();
private EssentialsTimer timer;
private EssentialsUpdateTimer updateTimer;
private boolean registerFallback = true;
private final Methods paymentMethod = new Methods();
private final static boolean enableErrorLogging = false;
private final EssentialsErrorHandler errorHandler = new EssentialsErrorHandler();
public static IEssentials getStatic()
{
return instance;
}
public Settings getSettings()
{
return settings;
}
public void setupForTesting(Server server) throws IOException, InvalidDescriptionException
{
File dataFolder = File.createTempFile("essentialstest", "");
dataFolder.delete();
dataFolder.mkdir();
logger.log(Level.INFO, Util.i18n("usingTempFolderForTesting"));
logger.log(Level.INFO, dataFolder.toString());
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
settings = new Settings(dataFolder);
setStatic();
}
public void setStatic()
{
instance = this;
}
public void onEnable()
{
if (enableErrorLogging)
{
logger.addHandler(errorHandler);
}
setStatic();
EssentialsUpgrade upgrade = new EssentialsUpgrade(this.getDescription().getVersion(), this);
upgrade.beforeSettings();
confList = new ArrayList<IConf>();
settings = new Settings(this.getDataFolder());
confList.add(settings);
upgrade.afterSettings();
Util.updateLocale(settings.getLocale(), this.getDataFolder());
spawn = new Spawn(getServer(), this.getDataFolder());
confList.add(spawn);
warps = new Warps(getServer(), this.getDataFolder());
confList.add(warps);
worth = new Worth(this.getDataFolder());
confList.add(worth);
reload();
backup = new Backup(this);
PluginManager pm = getServer().getPluginManager();
for (Plugin plugin : pm.getPlugins())
{
if (plugin.getDescription().getName().startsWith("Essentials"))
{
if (!plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
{
logger.log(Level.WARNING, Util.format("versionMismatch", plugin.getDescription().getName()));
}
}
}
Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(getServer().getVersion());
if (versionMatch.matches())
{
int versionNumber = Integer.parseInt(versionMatch.group(4));
if (versionNumber < minBukkitBuildVersion)
{
logger.log(Level.WARNING, Util.i18n("notRecommendedBukkit"));
}
}
else
{
logger.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
}
ServerListener serverListener = new EssentialsPluginListener(paymentMethod);
pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this);
pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this);
playerListener = new EssentialsPlayerListener(this);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
if (getSettings().getNetherPortalsEnabled())
{
pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.High, this);
}
pm.registerEvent(Type.PLAYER_LOGIN, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
blockListener = new EssentialsBlockListener(this);
pm.registerEvent(Type.SIGN_CHANGE, blockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Lowest, this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
entityListener = new EssentialsEntityListener(this);
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_COMBUST, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_DEATH, entityListener, Priority.Lowest, this);
jail = new Jail(this);
jailPlayerListener = new JailPlayerListener(this);
confList.add(jail);
pm.registerEvent(Type.BLOCK_BREAK, jail, Priority.High, this);
pm.registerEvent(Type.BLOCK_DAMAGE, jail, Priority.High, this);
pm.registerEvent(Type.BLOCK_PLACE, jail, Priority.High, this);
pm.registerEvent(Type.PLAYER_INTERACT, jailPlayerListener, Priority.High, this);
attachEcoListeners();
if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2)
{
logger.log(Level.WARNING, "Old nether is disabled until multiworld support in bukkit is fixed.");
getServer().createWorld(settings.getNetherName(), World.Environment.NETHER);
}
timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 50);
if (enableErrorLogging)
{
updateTimer = new EssentialsUpdateTimer(this);
getScheduler().scheduleAsyncRepeatingTask(this, updateTimer, 50, 50 * 60 * (this.getDescription().getVersion().startsWith("Dev") ? 60 : 360));
}
logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), AUTHORS));
}
public void onDisable()
{
instance = null;
logger.removeHandler(errorHandler);
}
public void reload()
{
loadBanList();
for (IConf iConf : confList)
{
iConf.reloadConfig();
}
Util.updateLocale(settings.getLocale(), this.getDataFolder());
for (User user : users.values())
{
user.reloadConfig();
}
// for motd
getConfiguration().load();
try
{
ItemDb.load(getDataFolder(), "items.csv");
}
catch (Exception ex)
{
logger.log(Level.WARNING, Util.i18n("itemsCsvNotLoaded"), ex);
}
}
public String[] getMotd(CommandSender sender, String def)
{
return getLines(sender, "motd", def);
}
public String[] getLines(CommandSender sender, String node, String def)
{
List<String> lines = (List<String>)getConfiguration().getProperty(node);
if (lines == null)
{
return new String[0];
}
String[] retval = new String[lines.size()];
if (lines == null || lines.isEmpty() || lines.get(0) == null)
{
try
{
lines = new ArrayList<String>();
// "[]" in YaML indicates empty array, so respect that
if (!getConfiguration().getString(node, def).equals("[]"))
{
lines.add(getConfiguration().getString(node, def));
retval = new String[lines.size()];
}
}
catch (Throwable ex2)
{
logger.log(Level.WARNING, Util.format("corruptNodeInConfig", node));
return new String[0];
}
}
// if still empty, call it a day
if (lines == null || lines.isEmpty() || lines.get(0) == null)
{
return new String[0];
}
for (int i = 0; i < lines.size(); i++)
{
String m = lines.get(i);
if (m == null)
{
continue;
}
m = m.replace('&', '§').replace("§§", "&");
if (sender instanceof User || sender instanceof Player)
{
User user = getUser(sender);
m = m.replace("{PLAYER}", user.getDisplayName());
m = m.replace("{IP}", user.getAddress().toString());
m = m.replace("{BALANCE}", Double.toString(user.getMoney()));
m = m.replace("{MAILS}", Integer.toString(user.getMails().size()));
}
m = m.replace("{ONLINE}", Integer.toString(getServer().getOnlinePlayers().length));
if (m.matches(".*\\{PLAYERLIST\\}.*"))
{
StringBuilder online = new StringBuilder();
for (Player p : getServer().getOnlinePlayers())
{
if (online.length() > 0)
{
online.append(", ");
}
online.append(p.getDisplayName());
}
m = m.replace("{PLAYERLIST}", online.toString());
}
if (sender instanceof Player)
{
try
{
Class User = getClassLoader().loadClass("bukkit.Vandolis.User");
Object vuser = User.getConstructor(User.class).newInstance((Player)sender);
m = m.replace("{RED:BALANCE}", User.getMethod("getMoney").invoke(vuser).toString());
m = m.replace("{RED:BUYS}", User.getMethod("getNumTransactionsBuy").invoke(vuser).toString());
m = m.replace("{RED:SELLS}", User.getMethod("getNumTransactionsSell").invoke(vuser).toString());
}
catch (Throwable ex)
{
m = m.replace("{RED:BALANCE}", "N/A");
m = m.replace("{RED:BUYS}", "N/A");
m = m.replace("{RED:SELLS}", "N/A");
}
}
retval[i] = m + " ";
}
return retval;
}
@SuppressWarnings("LoggerStringConcat")
public static void previewCommand(CommandSender sender, Command command, String commandLabel, String[] args)
{
if (sender instanceof Player)
{
logger.info(ChatColor.BLUE + "[PLAYER_COMMAND] " + ((Player)sender).getName() + ": /" + commandLabel + " " + EssentialsCommand.getFinalArg(args, 0));
}
}
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
{
return onCommandEssentials(sender, command, commandLabel, args, Essentials.class.getClassLoader(), "com.earth2me.essentials.commands.Command");
}
public boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath)
{
if (("msg".equals(commandLabel.toLowerCase()) || "r".equals(commandLabel.toLowerCase()) || "mail".equals(commandLabel.toLowerCase())) && sender instanceof Player)
{
StringBuilder str = new StringBuilder();
str.append(commandLabel).append(" ");
for (String a : args)
{
str.append(a).append(" ");
}
for (Player player : getServer().getOnlinePlayers())
{
if (getUser(player).isSocialSpyEnabled())
{
player.sendMessage(getUser(sender).getDisplayName() + " : " + str);
}
}
}
// Allow plugins to override the command via onCommand
if (!getSettings().isCommandOverridden(command.getName()) && !commandLabel.startsWith("e"))
{
for (Plugin p : getServer().getPluginManager().getPlugins())
{
if (p.getDescription().getMain().contains("com.earth2me.essentials"))
{
continue;
}
PluginDescriptionFile desc = p.getDescription();
if (desc == null)
{
continue;
}
if (desc.getName() == null)
{
continue;
}
if (!(desc.getCommands() instanceof Map))
{
continue;
}
Map<String, Object> cmds = (Map<String, Object>)desc.getCommands();
if (!cmds.containsKey(command.getName()))
{
continue;
}
return p.onCommand(sender, command, commandLabel, args);
}
}
try
{
previewCommand(sender, command, commandLabel, args);
User user = sender instanceof Player ? getUser(sender) : null;
// New mail notification
if (user != null && !getSettings().isCommandDisabled("mail") && !commandLabel.equals("mail") && user.isAuthorized("essentials.mail"))
{
final List<String> mail = user.getMails();
if (mail != null && !mail.isEmpty())
{
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
}
}
// Check for disabled commands
if (getSettings().isCommandDisabled(commandLabel))
{
return true;
}
IEssentialsCommand cmd;
try
{
cmd = (IEssentialsCommand)classLoader.loadClass(commandPath + command.getName()).newInstance();
cmd.setEssentials(this);
}
catch (Exception ex)
{
sender.sendMessage(Util.format("commandNotLoaded", commandLabel));
logger.log(Level.SEVERE, Util.format("commandNotLoaded", commandLabel), ex);
return true;
}
// Check authorization
if (user != null && !user.isAuthorized(cmd))
{
logger.log(Level.WARNING, Util.format("deniedAccessCommand", user.getName()));
user.sendMessage(Util.i18n("noAccessCommand"));
return true;
}
// Run the command
try
{
if (user == null)
{
cmd.run(getServer(), sender, commandLabel, command, args);
}
else
{
cmd.run(getServer(), user, commandLabel, command, args);
}
return true;
}
catch (NotEnoughArgumentsException ex)
{
sender.sendMessage(command.getDescription());
sender.sendMessage(command.getUsage().replaceAll("<command>", commandLabel));
return true;
}
catch (Throwable ex)
{
sender.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
LogRecord lr = new LogRecord(Level.WARNING, Util.format("errorCallingCommand", commandLabel));
lr.setThrown(ex);
if (getSettings().isDebug())
{
logger.log(lr);
}
else
{
if (enableErrorLogging)
{
errorHandler.publish(lr);
errorHandler.flush();
}
}
return true;
}
}
catch (Throwable ex)
{
logger.log(Level.SEVERE, Util.format("commandFailed", commandLabel), ex);
return true;
}
}
public void loadBanList()
{
//I don't like this but it needs to be done until CB fixors
File file = new File("banned-players.txt");
File ipFile = new File("banned-ips.txt");
try
{
if (!file.exists())
{
throw new FileNotFoundException(Util.i18n("bannedPlayersFileNotFound"));
}
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try
{
bans.clear();
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine().trim().toLowerCase();
if (line.length() > 0 && line.charAt(0) == '#')
{
continue;
}
bans.add(line);
}
}
catch (IOException io)
{
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), io);
}
finally
{
try
{
bufferedReader.close();
}
catch (IOException ex)
{
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), ex);
}
}
}
catch (FileNotFoundException ex)
{
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), ex);
}
try
{
if (!ipFile.exists())
{
throw new FileNotFoundException(Util.i18n("bannedIpsFileNotFound"));
}
final BufferedReader bufferedReader = new BufferedReader(new FileReader(ipFile));
try
{
bannedIps.clear();
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine().trim().toLowerCase();
if (line.length() > 0 && line.charAt(0) == '#')
{
continue;
}
bannedIps.add(line);
}
}
catch (IOException io)
{
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), io);
}
finally
{
try
{
bufferedReader.close();
}
catch (IOException ex)
{
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), ex);
}
}
}
catch (FileNotFoundException ex)
{
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), ex);
}
}
private void attachEcoListeners()
{
PluginManager pm = getServer().getPluginManager();
EssentialsEcoBlockListener ecoBlockListener = new EssentialsEcoBlockListener(this);
EssentialsEcoPlayerListener ecoPlayerListener = new EssentialsEcoPlayerListener(this);
pm.registerEvent(Type.PLAYER_INTERACT, ecoPlayerListener, Priority.High, this);
pm.registerEvent(Type.BLOCK_BREAK, ecoBlockListener, Priority.High, this);
pm.registerEvent(Type.SIGN_CHANGE, ecoBlockListener, Priority.Monitor, this);
}
public CraftScheduler getScheduler()
{
return (CraftScheduler)this.getServer().getScheduler();
}
public Jail getJail()
{
return jail;
}
public Warps getWarps()
{
return warps;
}
public Worth getWorth()
{
return worth;
}
public Backup getBackup()
{
return backup;
}
public Spawn getSpawn()
{
return spawn;
}
public User getUser(Object base)
{
if (base instanceof Player)
{
return getUser((Player)base);
}
return null;
}
private <T extends Player> User getUser(T base)
{
if (base == null)
{
return null;
}
if (base instanceof User)
{
return (User)base;
}
if (users.containsKey(base.getName().toLowerCase()))
{
return users.get(base.getName().toLowerCase()).update(base);
}
User u = new User(base, this);
users.put(u.getName().toLowerCase(), u);
return u;
}
public User getOfflineUser(String name)
{
File userFolder = new File(getDataFolder(), "userdata");
File userFile = new File(userFolder, Util.sanitizeFileName(name) + ".yml");
if (userFile.exists())
{ //Users do not get offline changes saved without being reproccessed as Users! ~ Xeology :)
return getUser((Player)new OfflinePlayer(name));
}
return null;
}
public World getWorld(String name)
{
if (name.matches("[0-9]+"))
{
int id = Integer.parseInt(name);
if (id < getServer().getWorlds().size())
{
return getServer().getWorlds().get(id);
}
}
World w = getServer().getWorld(name);
if (w != null)
{
return w;
}
return null;
}
public void setRegisterFallback(boolean registerFallback)
{
this.registerFallback = registerFallback;
}
public boolean isRegisterFallbackEnabled()
{
return registerFallback;
}
public void addReloadListener(IConf listener)
{
confList.add(listener);
}
public Methods getPaymentMethod()
{
return paymentMethod;
}
public int broadcastMessage(String name, String message)
{
Player[] players = getServer().getOnlinePlayers();
for (Player player : players)
{
User u = getUser(player);
if (!u.isIgnoredPlayer(name))
{
player.sendMessage(message);
}
}
return players.length;
}
public Map<BigInteger, String> getErrors()
{
return errorHandler.getErrors();
}
public int scheduleAsyncDelayedTask(final Runnable run)
{
return this.getScheduler().scheduleAsyncDelayedTask(this, run);
}
public int scheduleSyncDelayedTask(final Runnable run)
{
return this.getScheduler().scheduleSyncDelayedTask(this, run);
}
public int scheduleSyncRepeatingTask(final Runnable run, long delay, long period)
{
return this.getScheduler().scheduleSyncRepeatingTask(this, run, delay, period);
}
public List<String> getBans()
{
return bans;
}
public List<String> getBannedIps()
{
return bannedIps;
}
}

View File

@@ -0,0 +1,388 @@
package com.earth2me.essentials;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
import org.bukkit.event.block.*;
import org.bukkit.inventory.ItemStack;
public class EssentialsBlockListener extends BlockListener
{
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
public final static List<Material> protectedBlocks = new ArrayList<Material>(4);
static
{
protectedBlocks.add(Material.CHEST);
protectedBlocks.add(Material.BURNING_FURNACE);
protectedBlocks.add(Material.FURNACE);
protectedBlocks.add(Material.DISPENSER);
}
public EssentialsBlockListener(IEssentials ess)
{
this.ess = ess;
}
@Override
public void onBlockBreak(BlockBreakEvent event)
{
if (event.isCancelled()) return;
if (ess.getSettings().areSignsDisabled()) return;
User user = ess.getUser(event.getPlayer());
if (protectedBlocks.contains(event.getBlock().getType()) && !user.isAuthorized("essentials.signs.protection.override"))
{
if (isBlockProtected(event.getBlock(), user))
{
event.setCancelled(true);
user.sendMessage(Util.format("noDestroyPermission", event.getBlock().getType().toString().toLowerCase()));
return;
}
}
if (checkProtectionSign(event.getBlock(), user) != NOSIGN &&
checkProtectionSign(event.getBlock(), user) != OWNER)
{
event.setCancelled(true);
user.sendMessage(Util.format("noDestroyPermission", event.getBlock().getType().toString().toLowerCase()));
}
}
@Override
public void onSignChange(SignChangeEvent event)
{
if (event.isCancelled()) return;
if (ess.getSettings().areSignsDisabled()) return;
User user = ess.getUser(event.getPlayer());
String username = user.getName().substring(0, user.getName().length() > 14 ? 14 : user.getName().length());
try
{
if (event.getLine(0).equalsIgnoreCase("[Protection]"))
{
Block block = event.getBlock();
if (user.isAuthorized("essentials.signs.protection.create") && hasAdjacentChest(block) && !isBlockProtected(block, user))
event.setLine(0, "§1[Protection]");
else
event.setLine(0, "§4[Protection]");
event.setLine(3, username);
return;
}
if (event.getLine(0).equalsIgnoreCase("[Disposal]"))
{
if (user.isAuthorized("essentials.signs.disposal.create"))
event.setLine(0, "§1[Disposal]");
else
event.setLine(0, "§4[Disposal]");
return;
}
if (event.getLine(0).equalsIgnoreCase("[Heal]"))
{
event.setLine(0, "§4[Heal]");
if (user.isAuthorized("essentials.signs.heal.create"))
{
if (!event.getLine(1).isEmpty())
{
String[] l1 = event.getLine(1).split("[ :-]+", 2);
boolean m1 = l1[0].matches("^[^0-9][\\.0-9]+");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
if (q1 < 1 || (!m1 && (int)q1 < 1)) throw new Exception(Util.i18n("moreThanZero"));
if (!m1) ItemDb.get(l1[1]);
event.setLine(1, (m1 ? Util.formatCurrency(q1) : (int)q1 + " " + l1[1]));
}
event.setLine(0, "§1[Heal]");
}
return;
}
if (event.getLine(0).equalsIgnoreCase("[Free]"))
{
event.setLine(0, "§4[Free]");
ItemDb.get(event.getLine(1));
if (user.isAuthorized("essentials.signs.free.create"))
event.setLine(0, "§1[Free]");
return;
}
if (event.getLine(0).equalsIgnoreCase("[Mail]"))
{
if (user.isAuthorized("essentials.signs.mail.create"))
event.setLine(0, "§1[Mail]");
else
event.setLine(0, "§4[Mail]");
return;
}
if (event.getLine(0).equalsIgnoreCase("[Balance]"))
{
if (user.isAuthorized("essentials.signs.balance.create"))
event.setLine(0, "§1[Balance]");
else
event.setLine(0, "§4[Balance]");
return;
}
if (event.getLine(0).equalsIgnoreCase("[Warp]"))
{
event.setLine(0, "§4[Warp]");
if (user.isAuthorized("essentials.signs.warp.create")) {
if (!event.getLine(3).isEmpty())
{
String[] l1 = event.getLine(3).split("[ :-]+", 2);
boolean m1 = l1[0].matches("^[^0-9][\\.0-9]+");
if (!m1 && l1.length != 2)
{
throw new Exception(Util.format("invalidSignLine", 4));
}
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
if ((int)q1 < 1) throw new Exception(Util.i18n("moreThanZero"));
if (!m1) ItemDb.get(l1[1]);
event.setLine(3, (m1 ? Util.formatCurrency(q1) : (int)q1 + " " + l1[1]));
}
if (event.getLine(1).isEmpty()) {
event.setLine(1, "§dWarp name!");
return;
} else {
ess.getWarps().getWarp(event.getLine(1));
if (event.getLine(2).equalsIgnoreCase("Everyone")) {
event.setLine(2, "§2Everyone");
}
event.setLine(0, "§1[Warp]");
}
}
return;
}
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
}
@Override
public void onBlockPlace(BlockPlaceEvent event)
{
if (event.isCancelled()) return;
Block signBlock = event.getBlockAgainst();
if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN_POST)
{
Sign sign = new CraftSign(signBlock);
if (sign.getLine(0).matches("§1\\[[a-zA-Z]+\\]"))
{
event.setCancelled(true);
return;
}
}
final User user = ess.getUser(event.getPlayer());
// Do not rely on getItemInHand();
// http://leaky.bukkit.org/issues/663
final ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short)0, event.getBlockPlaced().getData());
switch(is.getType()) {
case WOODEN_DOOR:
is.setType(Material.WOOD_DOOR);
is.setDurability((short)0);
break;
case IRON_DOOR_BLOCK:
is.setType(Material.IRON_DOOR);
is.setDurability((short)0);
break;
case SIGN_POST:
case WALL_SIGN:
is.setType(Material.SIGN);
is.setDurability((short)0);
break;
case CROPS:
is.setType(Material.SEEDS);
is.setDurability((short)0);
break;
case CAKE_BLOCK:
is.setType(Material.CAKE);
is.setDurability((short)0);
break;
case BED_BLOCK:
is.setType(Material.BED);
is.setDurability((short)0);
break;
case REDSTONE_WIRE:
is.setType(Material.REDSTONE);
is.setDurability((short)0);
break;
case REDSTONE_TORCH_OFF:
case REDSTONE_TORCH_ON:
is.setType(Material.REDSTONE_TORCH_ON);
is.setDurability((short)0);
break;
case DIODE_BLOCK_OFF:
case DIODE_BLOCK_ON:
is.setType(Material.DIODE);
is.setDurability((short)0);
break;
case DOUBLE_STEP:
is.setType(Material.STEP);
break;
case TORCH:
case RAILS:
case LADDER:
case WOOD_STAIRS:
case COBBLESTONE_STAIRS:
case LEVER:
case STONE_BUTTON:
case FURNACE:
case DISPENSER:
case PUMPKIN:
case JACK_O_LANTERN:
case WOOD_PLATE:
case STONE_PLATE:
is.setDurability((short)0);
break;
}
boolean unlimitedForUser = user.hasUnlimited(is);
if (unlimitedForUser) {
ess.scheduleSyncDelayedTask(
new Runnable() {
public void run() {
user.getInventory().addItem(is);
user.updateInventory();
}
});
}
}
public boolean hasAdjacentChest(Block block)
{
Block[] faces = getAdjacentBlocks(block);
for (Block b : faces)
{
if (protectedBlocks.contains(b.getType()))
{
return true;
}
}
return false;
}
private static final int NOT_ALLOWED = 0;
private static final int ALLOWED = 1;
private static final int NOSIGN = 2;
private static final int OWNER = 3;
private int checkProtectionSign(Block block, User user)
{
String username = user.getName().substring(0, user.getName().length() > 14 ? 14 : user.getName().length());
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
{
Sign sign = new CraftSign(block);
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]") && !user.isAuthorized("essentials.signs.protection.override"))
{
for (int i = 1; i <= 2; i++) {
String line = sign.getLine(i);
if (line.startsWith("(") && line.endsWith(")")) {
line = line.substring(1, line.length() - 1);
if (user.inGroup(line)) {
return ALLOWED;
}
} else if (line.equalsIgnoreCase(username)) {
return ALLOWED;
}
}
if (sign.getLine(3).equalsIgnoreCase(username))
{
return OWNER;
}
return NOT_ALLOWED;
}
}
return NOSIGN;
}
private static Block[] getAdjacentBlocks(Block block)
{
return new Block[]
{
block.getFace(BlockFace.NORTH),
block.getFace(BlockFace.SOUTH),
block.getFace(BlockFace.EAST),
block.getFace(BlockFace.WEST),
block.getFace(BlockFace.DOWN),
block.getFace(BlockFace.UP)
};
}
public boolean isBlockProtected(Block block, User user)
{
Block[] faces = getAdjacentBlocks(block);
boolean protect = false;
for (Block b : faces)
{
int check = checkProtectionSign(b, user);
if (check == NOT_ALLOWED)
{
protect = true;
}
if (check == ALLOWED || check == OWNER)
{
return false;
}
if (protectedBlocks.contains(b.getType()))
{
Block[] faceChest = getAdjacentBlocks(b);
for (Block a : faceChest)
{
check = checkProtectionSign(a, user);
if (check == NOT_ALLOWED)
{
protect = true;
}
if (check == ALLOWED || check == OWNER)
{
return false;
}
}
}
}
return protect;
}
public static boolean isBlockProtected(Block block)
{
Block[] faces = getAdjacentBlocks(block);
for (Block b : faces)
{
if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN)
{
Sign sign = new CraftSign(b);
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]"))
{
return true;
}
}
if (protectedBlocks.contains(b.getType()))
{
Block[] faceChest = getAdjacentBlocks(b);
for (Block a : faceChest)
{
if (a.getType() == Material.SIGN_POST || a.getType() == Material.WALL_SIGN)
{
Sign sign = new CraftSign(a);
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]"))
{
return true;
}
}
}
}
}
return false;
}
}

View File

@@ -0,0 +1,239 @@
package com.earth2me.essentials;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
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.inventory.ItemStack;
import org.bukkit.util.config.Configuration;
public class EssentialsConf extends Configuration
{
private static final Logger logger = Logger.getLogger("Minecraft");
private File configFile;
private String templateName = null;
private Class<?> resourceClass = EssentialsConf.class;
public EssentialsConf(File configFile)
{
super(configFile);
this.configFile = configFile;
if (this.root == null)
{
this.root = new HashMap<String, Object>();
}
}
@Override
public void load()
{
configFile = configFile.getAbsoluteFile();
if (!configFile.getParentFile().exists())
{
if (!configFile.getParentFile().mkdirs())
{
logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
}
}
if (!configFile.exists())
{
if (templateName != null)
{
logger.log(Level.INFO, Util.format("creatingConfigFromTemplate", configFile.toString()));
createFromTemplate();
}
else
{
try
{
logger.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString()));
if (!configFile.createNewFile())
{
logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
}
}
catch (IOException ex)
{
logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()), ex);
}
}
}
super.load();
if (this.root == null)
{
this.root = new HashMap<String, Object>();
}
}
private void createFromTemplate()
{
InputStream istr = null;
OutputStream ostr = null;
try
{
istr = resourceClass.getResourceAsStream(templateName);
if (istr == null)
{
logger.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName));
return;
}
ostr = new FileOutputStream(configFile);
byte[] buffer = new byte[1024];
int length = 0;
length = istr.read(buffer);
while (length > 0)
{
ostr.write(buffer, 0, length);
length = istr.read(buffer);
}
}
catch (IOException ex)
{
logger.log(Level.SEVERE, Util.format("failedToWriteConfig", configFile.toString()), ex);
return;
}
finally
{
try
{
if (istr != null)
{
istr.close();
}
}
catch (IOException ex)
{
Logger.getLogger(EssentialsConf.class.getName()).log(Level.SEVERE, null, ex);
}
try
{
if (ostr != null)
{
ostr.close();
}
}
catch (IOException ex)
{
logger.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex);
}
}
}
public void setTemplateName(String templateName)
{
this.templateName = templateName;
}
public File getFile()
{
return configFile;
}
public void setTemplateName(String templateName, Class<?> resClass)
{
this.templateName = templateName;
this.resourceClass = resClass;
}
public boolean hasProperty(String path)
{
return getProperty(path) != null;
}
public Location getLocation(String path, Server server)
{
String worldName = getString((path != null ? path + "." : "") + "world");
if (worldName == null || worldName.isEmpty())
{
return null;
}
World world = server.getWorld(worldName);
if (world == null)
{
return null;
}
return new Location(world,
getDouble((path != null ? path + "." : "") + "x", 0),
getDouble((path != null ? path + "." : "") + "y", 0),
getDouble((path != null ? path + "." : "") + "z", 0),
(float)getDouble((path != null ? path + "." : "") + "yaw", 0),
(float)getDouble((path != null ? path + "." : "") + "pitch", 0));
}
public void setProperty(String path, Location loc)
{
setProperty((path != null ? path + "." : "") + "world", loc.getWorld().getName());
setProperty((path != null ? path + "." : "") + "x", loc.getX());
setProperty((path != null ? path + "." : "") + "y", loc.getY());
setProperty((path != null ? path + "." : "") + "z", loc.getZ());
setProperty((path != null ? path + "." : "") + "yaw", loc.getYaw());
setProperty((path != null ? path + "." : "") + "pitch", loc.getPitch());
}
public ItemStack getItemStack(String path)
{
return new ItemStack(
Material.valueOf(getString(path + ".type", "AIR")),
getInt(path + ".amount", 1),
(short)getInt(path + ".damage", 0)/*,
(byte)getInt(path + ".data", 0)*/);
}
public void setProperty(String path, ItemStack stack)
{
Map<String, Object> map = new HashMap<String, Object>();
map.put("type", stack.getType().toString());
map.put("amount", stack.getAmount());
map.put("damage", stack.getDurability());
// getData().getData() is broken
//map.put("data", stack.getDurability());
setProperty(path, map);
}
public long getLong(String path, long def)
{
Number num;
try
{
num = (Number)getProperty(path);
}
catch(ClassCastException ex)
{
return def;
}
if (num == null)
{
return def;
}
return num.longValue();
}
@Override
public double getDouble(String path, double def)
{
Number num;
try
{
num = (Number)getProperty(path);
}
catch(ClassCastException ex)
{
return def;
}
if (num == null)
{
return def;
}
return num.doubleValue();
}
}

View File

@@ -0,0 +1,250 @@
package com.earth2me.essentials;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.inventory.ItemStack;
public class EssentialsEcoBlockListener extends BlockListener
{
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
public EssentialsEcoBlockListener(Essentials ess)
{
this.ess = ess;
}
@Override
public void onBlockBreak(BlockBreakEvent event)
{
if (event.isCancelled())
{
return;
}
if (ess.getSettings().areSignsDisabled())
{
return;
}
User user = ess.getUser(event.getPlayer());
String username = user.getName().substring(0, user.getName().length() > 13 ? 13 : user.getName().length());
if (event.getBlock().getType() != Material.WALL_SIGN && event.getBlock().getType() != Material.SIGN_POST)
{
return;
}
Sign sign = new CraftSign(event.getBlock());
if (sign.getLine(0).equals("§1[Trade]"))
{
if (!sign.getLine(3).substring(2).equals(username))
{
if (!user.isOp())
{
event.setCancelled(true);
}
return;
}
try
{
String[] l1 = sign.getLines()[1].split("[ :-]+");
String[] l2 = sign.getLines()[2].split("[ :-]+");
boolean m1 = l1[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
boolean m2 = l2[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
double q2 = Double.parseDouble(m2 ? l2[0].substring(1) : l2[0]);
double r1 = Double.parseDouble(l1[m1 ? 1 : 2]);
double r2 = Double.parseDouble(l2[m2 ? 1 : 2]);
if ((!m1 & q1 < 1) || (!m2 & q2 < 1))
{
throw new Exception(Util.i18n("moreThanZero"));
}
ItemStack i1 = m1 || r1 <= 0 ? null : ItemDb.get(l1[1], (int)r1);
ItemStack i2 = m2 || r2 <= 0 ? null : ItemDb.get(l2[1], (int)r2);
if (m1)
{
user.giveMoney(r1);
}
else if (i1 != null)
{
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(i1);
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
}
}
if (m2)
{
user.giveMoney(r2);
}
else if (i2 != null)
{
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(i2);
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
}
}
user.updateInventory();
sign.setType(Material.AIR);
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
}
@Override
public void onSignChange(SignChangeEvent event)
{
if (ess.getSettings().areSignsDisabled())
{
return;
}
User user = ess.getUser(event.getPlayer());
String username = user.getName().substring(0, user.getName().length() > 13 ? 13 : user.getName().length());
if ((event.getLine(0).equalsIgnoreCase("[Buy]") || event.getLine(0).equalsIgnoreCase("#1[Buy]")) && user.isAuthorized("essentials.signs.buy.create"))
{
try
{
event.setLine(0, "§1[Buy]");
event.setLine(1, "" + Math.abs(Integer.parseInt(event.getLine(1))));
ItemStack is = ItemDb.get(event.getLine(2));
if (is.getTypeId() == 0 || Math.abs(Integer.parseInt(event.getLine(1))) == 0)
{
throw new Exception("Don't sell air.");
}
double price = Double.parseDouble(event.getLine(3).replaceAll("[^0-9\\.]", ""));
event.setLine(3, Util.formatCurrency(price));
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
event.setLine(0, "§4[Buy]");
event.setLine(1, "#");
event.setLine(2, "Item");
event.setLine(3, "$Price");
}
return;
}
if ((event.getLine(0).equalsIgnoreCase("[Sell]") || event.getLine(0).equalsIgnoreCase("#1[Sell]")) && user.isAuthorized("essentials.signs.sell.create"))
{
try
{
event.setLine(0, "§1[Sell]");
event.setLine(1, "" + Math.abs(Integer.parseInt(event.getLine(1))));
ItemStack is = ItemDb.get(event.getLine(2));
if (is.getTypeId() == 0 || Math.abs(Integer.parseInt(event.getLine(1))) == 0)
{
throw new Exception("Can't buy air.");
}
double price = Double.parseDouble(event.getLine(3).replaceAll("[^0-9\\.]", ""));
event.setLine(3, Util.formatCurrency(price));
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
event.setLine(0, "§4[Sell]");
event.setLine(1, "#");
event.setLine(2, "Item");
event.setLine(3, "$Price");
}
return;
}
if ((event.getLine(0).equalsIgnoreCase("[Trade]") || event.getLine(0).equalsIgnoreCase("#1[Trade]")) && user.isAuthorized("essentials.signs.trade.create"))
{
try
{
String[] l1 = event.getLine(1).split("[ :-]+");
String[] l2 = event.getLine(2).split("[ :-]+");
boolean m1 = l1[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
boolean m2 = l2[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
double q2 = Double.parseDouble(m2 ? l2[0].substring(1) : l2[0]);
if (m1 ? l1.length != 1 : l1.length != 2)
{
throw new Exception(Util.format("invalidSignLine", 2));
}
if (m2 ? l2.length != 2 : l2.length != 3)
{
throw new Exception(Util.format("invalidSignLine", 3));
}
double r2 = Double.parseDouble(l2[m2 ? 1 : 2]);
r2 = m2 ? r2 : r2 - r2 % q2;
if ((!m1 & q1 < 1) || (!m2 & q2 < 1) || r2 < 1)
{
throw new Exception(Util.i18n("moreThanZero"));
}
if (!m1)
{
ItemDb.get(l1[1]);
}
if (m2)
{
if (user.getMoney() < r2)
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
user.takeMoney(r2);
//user.sendMessage("r2: " + r2 + " q2: " + q2);
}
else
{
ItemStack i2 = ItemDb.get(l2[1], (int)r2);
if (!InventoryWorkaround.containsItem(user.getInventory(), true, i2))
{
throw new Exception(Util.format("missingItems", (int)r2, l2[1]));
}
InventoryWorkaround.removeItem(user.getInventory(), true, i2);
user.updateInventory();
}
event.setLine(0, "§1[Trade]");
event.setLine(1, (m1 ? Util.formatCurrency(q1) : (int)q1 + " " + l1[1]) + ":0");
event.setLine(2, (m2 ? Util.formatCurrency(q2) : (int)q2 + " " + l2[1]) + ":" + (m2 ? Util.roundDouble(r2) : "" + (int)r2));
event.setLine(3, "§8" + username);
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
event.setLine(0, "§4[Trade]");
event.setLine(1, "# ItemOr" + ess.getSettings().getCurrencySymbol());
event.setLine(2, "# ItemOr" + ess.getSettings().getCurrencySymbol() + ":#");
event.setLine(3, "§8" + username);
}
return;
}
}
}

View File

@@ -0,0 +1,211 @@
package com.earth2me.essentials;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.inventory.ItemStack;
public class EssentialsEcoPlayerListener extends PlayerListener
{
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
EssentialsEcoPlayerListener(IEssentials ess)
{
this.ess = ess;
}
@Override
public void onPlayerInteract(PlayerInteractEvent event)
{
if (ess.getSettings().areSignsDisabled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
}
User user = ess.getUser(event.getPlayer());
String username = user.getName().substring(0, user.getName().length() > 13 ? 13 : user.getName().length());
if (event.getClickedBlock().getType() != Material.WALL_SIGN && event.getClickedBlock().getType() != Material.SIGN_POST)
{
return;
}
Sign sign = new CraftSign(event.getClickedBlock());
if (sign.getLine(0).equals("§1[Buy]") && user.isAuthorized("essentials.signs.buy.use"))
{
try
{
int amount = Integer.parseInt(sign.getLine(1));
ItemStack item = ItemDb.get(sign.getLine(2), amount);
double cost = Double.parseDouble(sign.getLine(3).substring(1));
if (user.getMoney() < cost)
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
user.takeMoney(cost);
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(item);
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
}
user.updateInventory();
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
if (sign.getLine(0).equals("§1[Sell]") && user.isAuthorized("essentials.signs.sell.use"))
{
try
{
int amount = Integer.parseInt(sign.getLine(1));
ItemStack item = ItemDb.get(sign.getLine(2), amount);
double cost = Double.parseDouble(sign.getLine(3).substring(1));
if (!InventoryWorkaround.containsItem(user.getInventory(), true, item))
{
throw new Exception(Util.format("missingItems", amount, sign.getLine(2)));
}
user.giveMoney(cost);
InventoryWorkaround.removeItem(user.getInventory(), true, item);
user.updateInventory();
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
if (sign.getLine(0).equals("§1[Trade]") && user.isAuthorized("essentials.signs.trade.use"))
{
try
{
String[] l1 = sign.getLine(1).split("[ :-]+");
String[] l2 = sign.getLine(2).split("[ :-]+");
boolean m1 = l1[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
boolean m2 = l2[0].matches("[^0-9][0-9]+(\\.[0-9]+)?");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
double q2 = Double.parseDouble(m2 ? l2[0].substring(1) : l2[0]);
double r1 = Double.parseDouble(l1[m1 ? 1 : 2]);
double r2 = Double.parseDouble(l2[m2 ? 1 : 2]);
r1 = m1 ? r1 : r1 - r1 % q1;
r2 = m2 ? r2 : r2 - r2 % q2;
if ((!m1 & q1 < 1) || (!m2 & q2 < 1))
{
throw new Exception(Util.i18n("moreThanZero"));
}
ItemStack i1 = m1 || r1 <= 0 ? null : ItemDb.get(l1[1], (int)r1);
ItemStack qi1 = m1 ? null : ItemDb.get(l1[1], (int)q1);
ItemStack qi2 = m2 ? null : ItemDb.get(l2[1], (int)q2);
if (username.equals(sign.getLine(3).substring(2)))
{
if (m1)
{
user.giveMoney(r1);
}
else if (i1 != null)
{
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(i1);
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
}
user.updateInventory();
}
r1 = 0;
sign.setLine(1, (m1 ? Util.formatCurrency(q1) : ((int)q1) + " " + l1[1]) + ":0");
sign.update();
}
else
{
if (m1)
{
if (user.getMoney() < q1)
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
}
else
{
if (!InventoryWorkaround.containsItem(user.getInventory(), true, qi1))
{
throw new Exception(Util.format("missingItems", (int)q1, l1[1]));
}
}
if (r2 < q2)
{
throw new Exception(Util.i18n("tradeSignEmpty"));
}
if (m1)
{
user.takeMoney(q1);
}
else
{
InventoryWorkaround.removeItem(user.getInventory(), true, qi1);
}
if (m2)
{
user.giveMoney(q2);
}
else
{
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(qi2);
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
}
}
user.updateInventory();
r1 += q1;
r2 -= q2;
sign.setLine(0, "§1[Trade]");
sign.setLine(1, (m1 ? Util.formatCurrency(q1) : ((int)q1) + " " + l1[1]) + ":" + (m1 ? Util.roundDouble(r1) : "" + (int)r1));
sign.setLine(2, (m2 ? Util.formatCurrency(q2) : ((int)q2) + " " + l2[1]) + ":" + (m2 ? Util.roundDouble(r2) : "" + (int)r2));
sign.update();
user.sendMessage(Util.i18n("tradeCompleted"));
}
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
}
}

View File

@@ -0,0 +1,82 @@
package com.earth2me.essentials;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.inventory.ItemStack;
public class EssentialsEntityListener extends EntityListener
{
private final IEssentials ess;
public EssentialsEntityListener(IEssentials ess)
{
this.ess = ess;
}
@Override
public void onEntityDamage(EntityDamageEvent event)
{
if (event instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
Entity eAttack = edEvent.getDamager();
Entity eDefend = edEvent.getEntity();
if (eDefend instanceof Player && eAttack instanceof Player)
{
User defender = ess.getUser(eDefend);
User attacker = ess.getUser(eAttack);
ItemStack is = attacker.getItemInHand();
String command = attacker.getPowertool(is);
if (command != null && !command.isEmpty())
{
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
event.setCancelled(true);
return;
}
}
}
if (event instanceof EntityDamageEvent || event instanceof EntityDamageByBlockEvent || event instanceof EntityDamageByProjectileEvent)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
CraftPlayer player = (CraftPlayer)event.getEntity();
player.getHandle().fireTicks = 0;
player.setRemainingAir(player.getMaximumAir());
event.setCancelled(true);
}
}
}
@Override
public void onEntityCombust(EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
event.setCancelled(true);
}
}
@Override
public void onEntityDeath(EntityDeathEvent event)
{
if (event.getEntity() instanceof Player)
{
User user = ess.getUser(event.getEntity());
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
user.setLastLocation();
user.sendMessage(Util.i18n("backAfterDeath"));
}
}
}
}

View File

@@ -0,0 +1,128 @@
package com.earth2me.essentials;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
class EssentialsErrorHandler extends Handler
{
private final Map<BigInteger, String> errors = new HashMap<BigInteger, String>();
private final List<LogRecord> records = new LinkedList<LogRecord>();
public EssentialsErrorHandler()
{
}
@Override
public void publish(LogRecord lr)
{
if (lr.getThrown() == null || lr.getLevel().intValue() < Level.WARNING.intValue())
{
return;
}
synchronized (records)
{
records.add(lr);
}
}
@Override
public void flush()
{
synchronized (records)
{
sortRecords();
}
}
@Override
public void close() throws SecurityException
{
synchronized (records)
{
sortRecords();
}
}
private void sortRecords()
{
for (LogRecord lr : records)
{
try
{
if (lr.getThrown() == null)
{
return;
}
Throwable tr = lr.getThrown();
StackTraceElement[] elements = tr.getStackTrace();
if (elements == null || elements.length <= 0)
{
return;
}
boolean essentialsFound = false;
for (StackTraceElement stackTraceElement : elements)
{
if (stackTraceElement.getClassName().contains("com.earth2me.essentials"))
{
essentialsFound = true;
break;
}
}
if (!essentialsFound && tr.getCause() != null)
{
Throwable cause = tr.getCause();
StackTraceElement[] elements2 = cause.getStackTrace();
if (elements2 != null)
{
for (StackTraceElement stackTraceElement : elements2)
{
if (stackTraceElement.getClassName().contains("com.earth2me.essentials"))
{
essentialsFound = true;
break;
}
}
}
}
StringBuilder sb = new StringBuilder();
sb.append("[").append(lr.getLevel().getName()).append("] ").append(lr.getMessage()).append("\n");
sb.append(tr.getMessage()).append("\n");
for (StackTraceElement stackTraceElement : tr.getStackTrace())
{
sb.append(stackTraceElement.toString()).append("\n");
}
if (tr.getCause() != null && tr.getCause().getStackTrace() != null)
{
sb.append(tr.getCause().getMessage()).append("\n");
for (StackTraceElement stackTraceElement : tr.getCause().getStackTrace())
{
sb.append(stackTraceElement.toString()).append("\n");
}
}
String errorReport = sb.toString();
byte[] bytesOfMessage = errorReport.getBytes("UTF-8");
MessageDigest md = MessageDigest.getInstance("MD5");
BigInteger bi = new BigInteger(md.digest(bytesOfMessage));
errors.put(bi, errorReport);
}
catch (Throwable t)
{
//Ignore all exceptions inside the exception handler
}
}
records.clear();
}
Map<BigInteger, String> getErrors()
{
return errors;
}
}

View File

@@ -0,0 +1,596 @@
package com.earth2me.essentials;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.InventoryPlayer;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerAnimationType;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack;
public class EssentialsPlayerListener extends PlayerListener
{
private static final Logger logger = Logger.getLogger("Minecraft");
private final Server server;
private final IEssentials ess;
private final EssentialsBlockListener essBlockListener;
public EssentialsPlayerListener(IEssentials parent)
{
this.ess = parent;
this.server = parent.getServer();
essBlockListener = new EssentialsBlockListener(parent);
}
@Override
public void onPlayerRespawn(PlayerRespawnEvent event)
{
User user = ess.getUser(event.getPlayer());
user.setDisplayName(user.getNick());
updateCompass(user);
if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) {
try
{
event.setRespawnLocation(ess.getJail().getJail(user.getJail()));
}
catch (Exception ex)
{
}
}
}
@Override
public void onPlayerChat(PlayerChatEvent event)
{
User user = ess.getUser(event.getPlayer());
if (user.isMuted())
{
event.setCancelled(true);
logger.info(Util.format("mutedUserSpeaks", user.getName()));
}
Iterator<Player> it = event.getRecipients().iterator();
while (it.hasNext())
{
User u = ess.getUser(it.next());
if (u.isIgnoredPlayer(user.getName()))
{
it.remove();
}
}
}
@Override
public void onPlayerMove(PlayerMoveEvent event)
{
if (event.isCancelled())
{
return;
}
final User user = ess.getUser(event.getPlayer());
if (!ess.getSettings().getNetherPortalsEnabled())
{
return;
}
final Block block = event.getPlayer().getWorld().getBlockAt(event.getTo().getBlockX(), event.getTo().getBlockY(), event.getTo().getBlockZ());
List<World> worlds = server.getWorlds();
if (block.getType() == Material.PORTAL && worlds.size() > 1 && user.isAuthorized("essentials.portal"))
{
if (user.getJustPortaled())
{
return;
}
Location loc = event.getTo();
World nether = server.getWorld(ess.getSettings().getNetherName());
if (nether == null) {
for (World world : worlds)
{
if (world.getEnvironment() == World.Environment.NETHER) {
nether = world;
break;
}
}
if (nether == null) {
return;
}
}
final World world = user.getWorld() == nether ? worlds.get(0) : nether;
double factor;
if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL)
{
factor = ess.getSettings().getNetherRatio();
}
else if (user.getWorld().getEnvironment() != world.getEnvironment())
{
factor = 1.0 / ess.getSettings().getNetherRatio();
}
else
{
factor = 1.0;
}
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
if (user.getWorld().getBlockAt(x, y, z - 1).getType() == Material.PORTAL)
{
z--;
}
if (user.getWorld().getBlockAt(x - 1, y, z).getType() == Material.PORTAL)
{
x--;
}
x = (int)(x * factor);
z = (int)(z * factor);
loc = new Location(world, x + .5, y, z + .5);
Block dest = world.getBlockAt(x, y, z);
NetherPortal portal = NetherPortal.findPortal(dest);
if (portal == null)
{
if (world.getEnvironment() == World.Environment.NETHER || ess.getSettings().getGenerateExitPortals())
{
portal = NetherPortal.createPortal(dest);
logger.info(Util.format("userCreatedPortal", event.getPlayer().getName()));
user.sendMessage(Util.i18n("generatingPortal"));
loc = portal.getSpawn();
}
}
else
{
logger.info(Util.format("userUsedPortal", event.getPlayer().getName()));
user.sendMessage(Util.i18n("usingPortal"));
loc = portal.getSpawn();
}
event.setFrom(loc);
event.setTo(loc);
try
{
user.getTeleport().now(loc, new Charge("portal", ess));
}
catch (Exception ex)
{
user.sendMessage(ex.getMessage());
}
user.setJustPortaled(true);
user.sendMessage(Util.i18n("teleportingPortal"));
event.setCancelled(true);
return;
}
user.setJustPortaled(false);
}
@Override
public void onPlayerQuit(PlayerQuitEvent event)
{
User user = ess.getUser(event.getPlayer());
if (user.getSavedInventory() != null)
{
user.getInventory().setContents(user.getSavedInventory());
user.setSavedInventory(null);
}
if (!ess.getSettings().getReclaimSetting())
{
return;
}
user.dispose();
Thread thread = new Thread(new Runnable()
{
public void run()
{
try
{
Thread.sleep(1000);
Runtime rt = Runtime.getRuntime();
double mem = rt.freeMemory();
rt.runFinalization();
rt.gc();
mem = rt.freeMemory() - mem;
mem /= 1024 * 1024;
logger.log(Level.INFO, Util.format("freedMemory", mem));
}
catch (InterruptedException ex)
{
return;
}
}
});
thread.setPriority(Thread.MIN_PRIORITY);
thread.start();
}
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
ess.getBackup().onPlayerJoin();
User user = ess.getUser(event.getPlayer());
//we do not know the ip address on playerlogin so we need to do this here.
if (user.isIpBanned())
{
String banReason = user.getBanReason();
user.kickPlayer(banReason != null && !banReason.isEmpty() ? banReason : Util.i18n("defaultBanReason"));
return;
}
user.setDisplayName(user.getNick());
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
{
for (String m : ess.getMotd(user, null))
{
if (m == null)
{
continue;
}
user.sendMessage(m);
}
}
if (!ess.getSettings().isCommandDisabled("mail") && user.isAuthorized("essentials.mail"))
{
List<String> mail = user.getMails();
if (mail.isEmpty())
{
user.sendMessage(Util.i18n("noNewMail"));
}
else
{
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
}
}
}
@Override
public void onPlayerLogin(PlayerLoginEvent event)
{
if (event.getResult() != Result.ALLOWED)
{
return;
}
User user = ess.getUser(event.getPlayer());
user.setNPC(false);
if (user.isBanned())
{
String banReason = user.getBanReason();
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() ? banReason : Util.i18n("defaultBanReason"));
return;
}
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver"))
{
event.disallow(Result.KICK_FULL, Util.i18n("serverFull"));
return;
}
user.setLastLogin(System.currentTimeMillis());
updateCompass(user);
}
private void updateCompass(User user)
{
try
{
user.setCompassTarget(user.getHome(user.getLocation()));
}
catch (Exception ex)
{
}
}
@Override
public void onPlayerTeleport(PlayerTeleportEvent event)
{
if (event.isCancelled())
{
return;
}
User user = ess.getUser(event.getPlayer());
if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty())
{
return;
}
try
{
event.setTo(ess.getJail().getJail(user.getJail()));
}
catch (Exception ex)
{
logger.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
}
user.sendMessage(Util.i18n("jailMessage"));
}
@Override
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
}
User user = ess.getUser(event.getPlayer());
if (user.isJailed())
{
event.setCancelled(true);
return;
}
if (!ess.getSettings().areSignsDisabled() && EssentialsBlockListener.protectedBlocks.contains(event.getClickedBlock().getType()))
{
if (!user.isAuthorized("essentials.signs.protection.override"))
{
if (essBlockListener.isBlockProtected(event.getClickedBlock(), user))
{
event.setCancelled(true);
user.sendMessage(Util.format("noAccessPermission", event.getClickedBlock().getType().toString().toLowerCase()));
return;
}
}
}
if (ess.getSettings().getBedSetsHome() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
try
{
user.setHome();
user.sendMessage(Util.i18n("homeSetToBed"));
}
catch (Throwable ex)
{
}
}
if (ess.getSettings().areSignsDisabled())
{
return;
}
if (event.getClickedBlock().getType() != Material.WALL_SIGN && event.getClickedBlock().getType() != Material.SIGN_POST)
{
return;
}
Sign sign = new CraftSign(event.getClickedBlock());
try
{
if (sign.getLine(0).equals("§1[Free]") && user.isAuthorized("essentials.signs.free.use"))
{
ItemStack item = ItemDb.get(sign.getLine(1));
CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(user.getHandle()));
inv.clear();
item.setAmount(9 * 4 * 64);
inv.addItem(item);
user.showInventory(inv);
return;
}
if (sign.getLine(0).equals("§1[Disposal]") && user.isAuthorized("essentials.signs.disposal.use"))
{
CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(user.getHandle()));
inv.clear();
user.showInventory(inv);
return;
}
if (sign.getLine(0).equals("§1[Heal]") && user.isAuthorized("essentials.signs.heal.use"))
{
if (!sign.getLine(1).isEmpty())
{
String[] l1 = sign.getLine(1).split("[ :-]+");
boolean m1 = l1[0].matches("^[^0-9][\\.0-9]+");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
if (!m1 && (int)q1 < 1)
{
throw new Exception(Util.i18n("moreThanZero"));
}
if (m1)
{
if (user.getMoney() < q1)
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
user.takeMoney(q1);
user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(q1)));
}
else
{
ItemStack i = ItemDb.get(l1[1], (int)q1);
if (!InventoryWorkaround.containsItem(user.getInventory(), true, i))
{
throw new Exception(Util.format("missingItems", (int)q1, l1[1]));
}
InventoryWorkaround.removeItem(user.getInventory(), true, i);
user.updateInventory();
}
}
user.setHealth(20);
user.sendMessage(Util.i18n("youAreHealed"));
return;
}
if (sign.getLine(0).equals("§1[Mail]") && user.isAuthorized("essentials.signs.mail.use") && user.isAuthorized("essentials.mail"))
{
List<String> mail = user.getMails();
if (mail.isEmpty())
{
user.sendMessage(Util.i18n("noNewMail"));
return;
}
for (String s : mail)
{
user.sendMessage(s);
}
user.sendMessage(Util.i18n("markMailAsRead"));
return;
}
if (sign.getLine(0).equals("§1[Balance]") && user.isAuthorized("essentials.signs.balance.use"))
{
user.sendMessage(Util.format("balance", user.getMoney()));
return;
}
if (sign.getLine(0).equals("§1[Warp]"))
{
if (!sign.getLine(2).isEmpty())
{
if (sign.getLine(2).equals("§2Everyone"))
{
Charge charge = chargeUserForWarp(sign, user);
user.getTeleport().warp(sign.getLine(1), charge);
return;
}
if (user.inGroup(sign.getLine(2)))
{
Charge charge = chargeUserForWarp(sign, user);
user.getTeleport().warp(sign.getLine(1), charge);
return;
}
}
if (user.isAuthorized("essentials.signs.warp.use")
&& (!ess.getSettings().getPerWarpPermission() || user.isAuthorized("essentials.warp." + sign.getLine(1))))
{
Charge charge = chargeUserForWarp(sign, user);
user.getTeleport().warp(sign.getLine(1), charge);
}
return;
}
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
}
private Charge chargeUserForWarp(Sign sign, User user) throws Exception
{
if (!sign.getLine(3).isEmpty())
{
String[] l1 = sign.getLine(3).split("[ :-]+");
boolean m1 = l1[0].matches("^[^0-9][\\.0-9]+");
double q1 = Double.parseDouble(m1 ? l1[0].substring(1) : l1[0]);
if (!m1 && (int)q1 < 1)
{
throw new Exception(Util.i18n("moreThanZero"));
}
if (m1)
{
return new Charge(q1, ess);
}
else
{
ItemStack i = ItemDb.get(l1[1], (int)q1);
return new Charge(i, ess);
}
}
return new Charge("warpsign", ess);
}
@Override
public void onPlayerEggThrow(PlayerEggThrowEvent event)
{
User user = ess.getUser(event.getPlayer());
ItemStack is = new ItemStack(Material.EGG, 1);
if (user.hasUnlimited(is))
{
user.getInventory().addItem(is);
user.updateInventory();
}
}
@Override
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
{
final User user = ess.getUser(event.getPlayer());
if (user.hasUnlimited(new ItemStack(event.getBucket())))
{
event.getItemStack().setType(event.getBucket());
ess.scheduleSyncDelayedTask(new Runnable()
{
public void run()
{
user.updateInventory();
}
});
}
}
@Override
public void onPlayerAnimation(PlayerAnimationEvent event)
{
usePowertools(event);
}
private void usePowertools(PlayerAnimationEvent event)
{
if (event.getAnimationType() != PlayerAnimationType.ARM_SWING)
{
return;
}
User user = ess.getUser(event.getPlayer());
ItemStack is = user.getItemInHand();
if (is == null || is.getType() == Material.AIR)
{
return;
}
String command = user.getPowertool(is);
if (command == null || command.isEmpty())
{
return;
}
if (command.matches(".*\\{player\\}.*"))
{
//user.sendMessage("Click a player to use this command");
return;
}
if (command.startsWith("c:"))
{
for (Player p : server.getOnlinePlayers())
{
p.sendMessage(user.getDisplayName() + ":" + command.substring(2));
}
}
else
{
user.getServer().dispatchCommand(user, command);
}
}
}

View File

@@ -0,0 +1,45 @@
package com.earth2me.essentials;
import com.earth2me.essentials.register.payment.Methods;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
public class EssentialsPluginListener extends ServerListener
{
private final Methods methods;
private static final Logger logger = Logger.getLogger("Minecraft");
public EssentialsPluginListener(Methods methods)
{
this.methods = methods;
}
@Override
public void onPluginEnable(PluginEnableEvent event)
{
if (!methods.hasMethod())
{
if (methods.setMethod(event.getPlugin()))
{
logger.log(Level.INFO, "[Essentials] Payment method found (" + methods.getMethod().getName() + " version: " + methods.getMethod().getVersion() + ")");
}
}
}
@Override
public void onPluginDisable(PluginDisableEvent event)
{
// Check to see if the plugin thats being disabled is the one we are using
if (methods != null && methods.hasMethod())
{
if (methods.checkDisabled(event.getPlugin()))
{
logger.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
}
}
}
}

View File

@@ -0,0 +1,81 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Player;
public class EssentialsTimer implements Runnable, IConf
{
private final IEssentials ess;
private final Set<User> allUsers = new HashSet<User>();
EssentialsTimer(IEssentials ess)
{
this.ess = ess;
File userdir = new File(ess.getDataFolder(), "userdata");
if (!userdir.exists()) {
return;
}
for (String string : userdir.list())
{
if (!string.endsWith(".yml")) {
continue;
}
String name = string.substring(0, string.length()-4);
User u = ess.getUser(new OfflinePlayer(name));
allUsers.add(u);
}
}
public void run()
{
long currentTime = System.currentTimeMillis();
for (Player player : ess.getServer().getOnlinePlayers())
{
User u = ess.getUser(player);
allUsers.add(u);
u.setLastActivity(currentTime);
}
for (User user: allUsers) {
if (user.getBanTimeout() > 0 && user.getBanTimeout() < currentTime) {
user.setBanTimeout(0);
((CraftServer)ess.getServer()).getHandle().b(user.getName());
ess.loadBanList();
}
if (user.getMuteTimeout() > 0 && user.getMuteTimeout() < currentTime && user.isMuted()) {
user.setMuteTimeout(0);
user.sendMessage(Util.i18n("canTalkAgain"));
user.setMuted(false);
}
if (user.getJailTimeout() > 0 && user.getJailTimeout() < currentTime && user.isJailed()) {
user.setJailTimeout(0);
user.setJailed(false);
user.sendMessage(Util.i18n("haveBeenReleased"));
user.setJail(null);
try
{
user.getTeleport().back();
}
catch (Exception ex)
{
}
}
if (user.getLastActivity() < currentTime && user.getLastActivity() > user.getLastLogout()) {
user.setLastLogout(user.getLastActivity());
}
}
}
public void reloadConfig()
{
for (User user : allUsers)
{
user.reloadConfig();
}
}
}

View File

@@ -0,0 +1,68 @@
package com.earth2me.essentials;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.logging.Level;
import java.util.logging.Logger;
class EssentialsUpdateTimer implements Runnable
{
private URL url;
private final Essentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
public EssentialsUpdateTimer(Essentials ess)
{
this.ess = ess;
try
{
url = new URL("http://127.0.0.1:8080/check");
}
catch (MalformedURLException ex)
{
logger.log(Level.SEVERE, "Invalid url!", ex);
}
}
public void run()
{
try
{
StringBuilder sb = new StringBuilder();
sb.append("v=").append(URLEncoder.encode(ess.getDescription().getVersion(),"UTF-8"));
sb.append("&b=").append(URLEncoder.encode(ess.getServer().getVersion(),"UTF-8"));
sb.append("&jv=").append(URLEncoder.encode(System.getProperty("java.version"),"UTF-8"));
sb.append("&l=").append(URLEncoder.encode(Util.getCurrentLocale().toString(),"UTF-8"));
sb.append("&on=").append(URLEncoder.encode(System.getProperty("os.name"),"UTF-8"));
sb.append("&ov=").append(URLEncoder.encode(System.getProperty("os.version"),"UTF-8"));
for (BigInteger bigInteger : ess.getErrors().keySet())
{
sb.append("&e[]=").append(bigInteger.toString(36));
}
URLConnection conn = url.openConnection();
conn.setConnectTimeout(10000);
conn.setDoOutput(true);
conn.connect();
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(sb.toString());
wr.flush();
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String ret = br.readLine();
wr.close();
br.close();
logger.log(Level.INFO, ret);
}
catch (IOException ex)
{
logger.log(Level.SEVERE, "Failed to open connection", ex);
}
}
}

View File

@@ -0,0 +1,420 @@
package com.earth2me.essentials;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
public class EssentialsUpgrade
{
private static boolean alreadyRun = false;
private final static Logger logger = Logger.getLogger("Minecraft");
private final IEssentials ess;
EssentialsUpgrade(String version, IEssentials essentials)
{
ess = essentials;
if (alreadyRun)
{
return;
}
alreadyRun = true;
}
private void moveWorthValuesToWorthYml()
{
try
{
File configFile = new File(ess.getDataFolder(), "config.yml");
if (!configFile.exists())
{
return;
}
EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
Worth w = new Worth(ess.getDataFolder());
boolean found = false;
for (Material mat : Material.values())
{
int id = mat.getId();
double value = conf.getDouble("worth-" + id, Double.NaN);
if (!Double.isNaN(value))
{
found = true;
w.setPrice(new ItemStack(mat, 1, (short)0, (byte)0), value);
}
}
if (found)
{
removeLinesFromConfig(configFile, "\\s*#?\\s*worth-[0-9]+.*", "# Worth values have been moved to worth.yml");
}
}
catch (Throwable e)
{
logger.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e);
}
}
private void removeLinesFromConfig(File file, String regex, String info) throws Exception
{
boolean needUpdate = false;
BufferedReader br = new BufferedReader(new FileReader(file));
File tempFile = File.createTempFile("essentialsupgrade", ".tmp.yml", ess.getDataFolder());
BufferedWriter bw = new BufferedWriter(new FileWriter(tempFile));
do
{
String line = br.readLine();
if (line == null)
{
break;
}
if (line.matches(regex))
{
if (!needUpdate && info != null)
{
bw.write(info, 0, info.length());
bw.newLine();
}
needUpdate = true;
}
else
{
if (line.endsWith("\r\n"))
{
bw.write(line, 0, line.length() - 2);
}
else if (line.endsWith("\r") || line.endsWith("\n"))
{
bw.write(line, 0, line.length() - 1);
}
else
{
bw.write(line, 0, line.length());
}
bw.newLine();
}
}
while (true);
br.close();
bw.close();
if (needUpdate)
{
if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("." + System.currentTimeMillis() + ".upgradebackup"))))
{
throw new Exception(Util.i18n("configFileMoveError"));
}
if (!tempFile.renameTo(file))
{
throw new Exception(Util.i18n("configFileRenameError"));
}
} else {
tempFile.delete();
}
}
private void updateUsersToNewDefaultHome()
{
File userdataFolder = new File(ess.getDataFolder(), "userdata");
if (!userdataFolder.exists() || !userdataFolder.isDirectory())
{
return;
}
File[] userFiles = userdataFolder.listFiles();
for (File file : userFiles)
{
if (!file.isFile() || !file.getName().endsWith(".yml"))
{
continue;
}
EssentialsConf config = new EssentialsConf(file);
try
{
config.load();
if (config.hasProperty("home") && !config.hasProperty("home.default"))
{
@SuppressWarnings("unchecked")
List<Object> vals = (List<Object>)config.getProperty("home");
if (vals == null) {
continue;
}
World world = ess.getServer().getWorlds().get(0);
if (vals.size() > 5)
{
world = ess.getServer().getWorld((String)vals.get(5));
}
if (world != null)
{
Location loc = new Location(
world,
((Number)vals.get(0)).doubleValue(),
((Number)vals.get(1)).doubleValue(),
((Number)vals.get(2)).doubleValue(),
((Number)vals.get(3)).floatValue(),
((Number)vals.get(4)).floatValue());
String worldName = world.getName().toLowerCase();
if (worldName != null && !worldName.isEmpty())
{
config.removeProperty("home");
config.setProperty("home.default", worldName);
config.setProperty("home.worlds." + worldName, loc);
config.save();
}
}
}
}
catch (RuntimeException ex)
{
logger.log(Level.INFO, "File: "+file.toString());
throw ex;
}
}
}
private void moveUsersDataToUserdataFolder()
{
File usersFile = new File(ess.getDataFolder(), "users.yml");
if (!usersFile.exists())
{
return;
}
EssentialsConf usersConfig = new EssentialsConf(usersFile);
usersConfig.load();
for (String username : usersConfig.getKeys(null))
{
User user = new User(new OfflinePlayer(username), ess);
String nickname = usersConfig.getString(username + ".nickname");
if (nickname != null && !nickname.isEmpty() && !nickname.equals(username))
{
user.setNickname(nickname);
}
List<String> mails = usersConfig.getStringList(username + ".mail", null);
if (mails != null && !mails.isEmpty())
{
user.setMails(mails);
}
if (!user.hasHome())
{
@SuppressWarnings("unchecked")
List<Object> vals = (List<Object>)usersConfig.getProperty(username + ".home");
if (vals != null) {
World world = ess.getServer().getWorlds().get(0);
if (vals.size() > 5)
{
world = getFakeWorld((String)vals.get(5));
}
if (world != null)
{
user.setHome(new Location(world,
((Number)vals.get(0)).doubleValue(),
((Number)vals.get(1)).doubleValue(),
((Number)vals.get(2)).doubleValue(),
((Number)vals.get(3)).floatValue(),
((Number)vals.get(4)).floatValue()), true);
}
}
}
}
usersFile.renameTo(new File(usersFile.getAbsolutePath() + ".old"));
}
private void convertWarps()
{
File warpsFolder = new File(ess.getDataFolder(), "warps");
if (!warpsFolder.exists())
{
warpsFolder.mkdirs();
}
File[] listOfFiles = warpsFolder.listFiles();
if (listOfFiles.length >= 1)
{
for (int i = 0; i < listOfFiles.length; i++)
{
String filename = listOfFiles[i].getName();
if (listOfFiles[i].isFile() && filename.endsWith(".dat"))
{
try
{
BufferedReader rx = new BufferedReader(new FileReader(listOfFiles[i]));
double x, y, z;
float yaw, pitch;
String worldName;
try
{
if (!rx.ready()) continue;
x = Double.parseDouble(rx.readLine().trim());
if (!rx.ready()) continue;
y = Double.parseDouble(rx.readLine().trim());
if (!rx.ready()) continue;
z = Double.parseDouble(rx.readLine().trim());
if (!rx.ready()) continue;
yaw = Float.parseFloat(rx.readLine().trim());
if (!rx.ready()) continue;
pitch = Float.parseFloat(rx.readLine().trim());
worldName = rx.readLine();
}
finally {
rx.close();
}
World w = null;
for (World world : ess.getServer().getWorlds())
{
if (world.getEnvironment() != World.Environment.NETHER)
{
w = world;
break;
}
}
if (worldName != null)
{
worldName = worldName.trim();
World w1 = null;
w1 = getFakeWorld(worldName);
if (w1 != null)
{
w = w1;
}
}
Location loc = new Location(w, x, y, z, yaw, pitch);
ess.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
{
throw new Exception(Util.format("fileRenameError", filename));
}
}
catch (Exception ex)
{
logger.log(Level.SEVERE, null, ex);
}
}
}
}
File warpFile = new File(ess.getDataFolder(), "warps.txt");
if (warpFile.exists())
{
try
{
BufferedReader rx = new BufferedReader(new FileReader(warpFile));
try
{
for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":"))
{
if (parts.length < 6)
{
continue;
}
String name = parts[0];
double x = Double.parseDouble(parts[1].trim());
double y = Double.parseDouble(parts[2].trim());
double z = Double.parseDouble(parts[3].trim());
float yaw = Float.parseFloat(parts[4].trim());
float pitch = Float.parseFloat(parts[5].trim());
if (name.isEmpty())
{
continue;
}
World w = null;
for (World world : ess.getServer().getWorlds())
{
if (world.getEnvironment() != World.Environment.NETHER)
{
w = world;
break;
}
}
Location loc = new Location(w, x, y, z, yaw, pitch);
ess.getWarps().setWarp(name, loc);
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
{
throw new Exception(Util.format("fileRenameError", "warps.txt"));
}
}
}
finally
{
rx.close();
}
}
catch (Exception ex)
{
logger.log(Level.SEVERE, null, ex);
}
}
}
private void sanitizeAllUserFilenames()
{
File usersFolder = new File(ess.getDataFolder(), "userdata");
if (!usersFolder.exists())
{
return;
}
File[] listOfFiles = usersFolder.listFiles();
for (int i = 0; i < listOfFiles.length; i++)
{
String filename = listOfFiles[i].getName();
if (!listOfFiles[i].isFile() || !filename.endsWith(".yml"))
{
continue;
}
String sanitizedFilename = Util.sanitizeFileName(filename.substring(0, filename.length() - 4)) + ".yml";
if (sanitizedFilename.equals(filename))
{
continue;
}
File tmpFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename + ".tmp");
File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename);
if (!listOfFiles[i].renameTo(tmpFile)) {
logger.log(Level.WARNING, Util.format("userdataMoveError", filename, sanitizedFilename));
continue;
}
if (newFile.exists())
{
logger.log(Level.WARNING, Util.format("duplicatedUserdata", filename, sanitizedFilename));
continue;
}
if (!tmpFile.renameTo(newFile)) {
logger.log(Level.WARNING, Util.format("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
}
}
}
private World getFakeWorld(String name)
{
File bukkitDirectory = ess.getDataFolder().getParentFile().getParentFile();
File worldDirectory = new File(bukkitDirectory, name);
if (worldDirectory.exists() && worldDirectory.isDirectory())
{
return new FakeWorld(worldDirectory.getName(), World.Environment.NORMAL);
}
return null;
}
public void beforeSettings()
{
if (!ess.getDataFolder().exists())
{
ess.getDataFolder().mkdirs();
}
moveWorthValuesToWorthYml();
}
public void afterSettings()
{
sanitizeAllUserFilenames();
updateUsersToNewDefaultHome();
moveUsersDataToUserdataFolder();
convertWarps();
}
}

View File

@@ -0,0 +1,359 @@
package com.earth2me.essentials;
import java.util.List;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.Chunk;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.TreeType;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Boat;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.PoweredMinecart;
import org.bukkit.entity.StorageMinecart;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
public class FakeWorld implements World
{
private final String name;
private final Environment env;
FakeWorld(String string, Environment environment)
{
this.name = string;
this.env = environment;
}
public Block getBlockAt(int i, int i1, int i2)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Block getBlockAt(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getBlockTypeIdAt(int i, int i1, int i2)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getBlockTypeIdAt(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getHighestBlockYAt(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getHighestBlockYAt(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Chunk getChunkAt(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Chunk getChunkAt(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Chunk getChunkAt(Block block)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isChunkLoaded(Chunk chunk)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Chunk[] getLoadedChunks()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void loadChunk(Chunk chunk)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isChunkLoaded(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void loadChunk(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean loadChunk(int i, int i1, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean unloadChunk(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean unloadChunk(int i, int i1, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean unloadChunk(int i, int i1, boolean bln, boolean bln1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean unloadChunkRequest(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean unloadChunkRequest(int i, int i1, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean regenerateChunk(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean refreshChunk(int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Item dropItem(Location lctn, ItemStack is)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Item dropItemNaturally(Location lctn, ItemStack is)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Arrow spawnArrow(Location lctn, Vector vector, float f, float f1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean generateTree(Location lctn, TreeType tt)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean generateTree(Location lctn, TreeType tt, BlockChangeDelegate bcd)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Minecart spawnMinecart(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public StorageMinecart spawnStorageMinecart(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public PoweredMinecart spawnPoweredMinecart(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Boat spawnBoat(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public LivingEntity spawnCreature(Location lctn, CreatureType ct)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public LightningStrike strikeLightning(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public LightningStrike strikeLightningEffect(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public List<Entity> getEntities()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public List<LivingEntity> getLivingEntities()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public List<Player> getPlayers()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public String getName()
{
return name;
}
public long getId()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Location getSpawnLocation()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean setSpawnLocation(int i, int i1, int i2)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public long getTime()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setTime(long l)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public long getFullTime()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setFullTime(long l)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean hasStorm()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setStorm(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getWeatherDuration()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setWeatherDuration(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isThundering()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setThundering(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getThunderDuration()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setThunderDuration(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Environment getEnvironment()
{
return env;
}
public long getSeed()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean getPVP()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setPVP(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void save()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean createExplosion(double d, double d1, double d2, float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean createExplosion(Location lctn, float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public ChunkGenerator getGenerator()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public List<BlockPopulator> getPopulators()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void playEffect(Location lctn, Effect effect, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void playEffect(Location lctn, Effect effect, int i, int i1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@@ -0,0 +1,5 @@
package com.earth2me.essentials;
public interface IConf {
public void reloadConfig();
}

View File

@@ -0,0 +1,68 @@
package com.earth2me.essentials;
import com.earth2me.essentials.register.payment.Methods;
import java.io.File;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.plugin.PluginDescriptionFile;
public interface IEssentials
{
void addReloadListener(IConf listener);
void reload();
boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath);
User getUser(Object base);
User getOfflineUser(String name);
World getWorld(String name);
int broadcastMessage(String name, String message);
Settings getSettings();
CraftScheduler getScheduler();
String[] getMotd(CommandSender sender, String def);
String[] getLines(CommandSender sender, String node, String def);
Jail getJail();
Warps getWarps();
Worth getWorth();
Backup getBackup();
Spawn getSpawn();
void loadBanList();
public boolean isRegisterFallbackEnabled();
public Methods getPaymentMethod();
Server getServer();
File getDataFolder();
PluginDescriptionFile getDescription();
int scheduleAsyncDelayedTask(Runnable run);
int scheduleSyncDelayedTask(Runnable run);
int scheduleSyncRepeatingTask(final Runnable run, long delay, long period);
List<String> getBans();
List<String> getBannedIps();
}

View File

@@ -0,0 +1,9 @@
package com.earth2me.essentials;
import org.bukkit.command.CommandSender;
public interface IReplyTo {
public void setReplyTo(CommandSender user);
public CommandSender getReplyTo();
}

View File

@@ -0,0 +1,51 @@
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;
public interface IUser
{
int getHealth();
Location getLocation();
boolean isOnline();
void sendMessage(String string);
long getLastTeleportTimestamp();
boolean isAuthorized(String node);
boolean isAuthorized(IEssentialsCommand cmd);
void setLastTeleportTimestamp(long time);
Location getLastLocation();
Player getBase();
double getMoney();
void takeMoney(double value);
PlayerInventory getInventory();
void updateInventory();
String getGroup();
void setLastLocation();
Location getHome(Location location);
String getName();
InetSocketAddress getAddress();
String getDisplayName();
}

View File

@@ -0,0 +1,192 @@
package com.earth2me.essentials;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/*
* This class can be removed when
* https://github.com/Bukkit/CraftBukkit/pull/193
* is accepted to CraftBukkit
*/
public final class InventoryWorkaround
{
private InventoryWorkaround()
{
}
public static int first(Inventory ci, ItemStack item, boolean forceDurability, boolean forceAmount)
{
return next(ci, item, 0, forceDurability, forceAmount);
}
public static int next(Inventory ci, ItemStack item, int start, boolean forceDurability, boolean forceAmount)
{
ItemStack[] inventory = ci.getContents();
for (int i = start; i < inventory.length; i++)
{
ItemStack cItem = inventory[i];
if (cItem == null)
{
continue;
}
if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()))
{
return i;
}
}
return -1;
}
public static HashMap<Integer, ItemStack> removeItem(Inventory ci, boolean forceDurability, ItemStack... items)
{
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
// TODO: optimization
for (int i = 0; i < items.length; i++)
{
ItemStack item = items[i];
if (item == null)
{
continue;
}
int toDelete = item.getAmount();
while (true)
{
// Bail when done
if (toDelete <= 0)
{
break;
}
// get first Item, ignore the amount
int first = first(ci, item, forceDurability, false);
// Drat! we don't have this type in the inventory
if (first == -1)
{
item.setAmount(toDelete);
leftover.put(i, item);
break;
}
else
{
ItemStack itemStack = ci.getItem(first);
int amount = itemStack.getAmount();
if (amount <= toDelete)
{
toDelete -= amount;
// clear the slot, all used up
ci.clear(first);
}
else
{
// split the stack and store
itemStack.setAmount(amount - toDelete);
ci.setItem(first, itemStack);
toDelete = 0;
}
}
}
}
return leftover;
}
public static boolean containsItem(Inventory ci, boolean forceDurability, ItemStack... items)
{
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
// TODO: optimization
// combine items
ItemStack[] combined = new ItemStack[items.length];
for (int i = 0; i < items.length; i++)
{
if (items[i] == null)
{
continue;
}
for (int j = 0; j < combined.length; j++)
{
if (combined[j] == null)
{
combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability());
break;
}
if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()))
{
combined[j].setAmount(combined[j].getAmount() + items[i].getAmount());
break;
}
}
}
for (int i = 0; i < combined.length; i++)
{
ItemStack item = combined[i];
if (item == null)
{
continue;
}
int mustHave = item.getAmount();
int position = 0;
while (true)
{
// Bail when done
if (mustHave <= 0)
{
break;
}
int slot = next(ci, item, position, forceDurability, false);
// Drat! we don't have this type in the inventory
if (slot == -1)
{
leftover.put(i, item);
break;
}
else
{
ItemStack itemStack = ci.getItem(slot);
int amount = itemStack.getAmount();
if (amount <= mustHave)
{
mustHave -= amount;
}
else
{
mustHave = 0;
}
position = slot + 1;
}
}
}
return leftover.isEmpty();
}
public static Item[] dropItem(Location loc, ItemStack itm)
{
int maxStackSize = itm.getType().getMaxStackSize();
int stacks = itm.getAmount() / maxStackSize;
int leftover = itm.getAmount() % maxStackSize;
Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
for (int i = 0; i < stacks; i++) {
itemStacks[i] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), maxStackSize, itm.getDurability()));
}
if (leftover > 0) {
itemStacks[stacks] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), leftover, itm.getDurability()));
}
return itemStacks;
}
}

View File

@@ -0,0 +1,161 @@
package com.earth2me.essentials;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public final class ItemDb
{
private ItemDb()
{
}
private final static Logger logger = Logger.getLogger("Minecraft");
private static Map<String, Integer> items = new HashMap<String, Integer>();
private static Map<String, Short> durabilities = new HashMap<String, Short>();
public static void load(File folder, String fname) throws IOException
{
folder.mkdirs();
File file = new File(folder, fname);
if (!file.exists())
{
file.createNewFile();
InputStream res = ItemDb.class.getResourceAsStream("/items.csv");
FileWriter tx = null;
try
{
tx = new FileWriter(file);
for (int i = 0; (i = res.read()) > 0;)
{
tx.write(i);
}
tx.flush();
}
finally
{
try
{
res.close();
}
catch (Exception ex)
{
}
try
{
if (tx != null)
{
tx.close();
}
}
catch (Exception ex)
{
}
}
}
BufferedReader rx = new BufferedReader(new FileReader(file));
try
{
items.clear();
for (int i = 0; rx.ready(); i++)
{
try
{
String line = rx.readLine().trim().toLowerCase();
if (line.startsWith("#"))
{
continue;
}
String[] parts = line.split("[^a-z0-9]");
if (parts.length < 2)
{
continue;
}
int numeric = Integer.parseInt(parts[1]);
durabilities.put(parts[0].toLowerCase(), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
items.put(parts[0].toLowerCase(), numeric);
}
catch (Exception ex)
{
logger.warning(Util.format("parseError", fname, i));
}
}
}
finally
{
rx.close();
}
}
public static ItemStack get(String id, int quantity) throws Exception
{
ItemStack retval = get(id.toLowerCase());
retval.setAmount(quantity);
return retval;
}
public static ItemStack get(String id) throws Exception
{
int itemid = 0;
String itemname = null;
short metaData = 0;
if (id.matches("^\\d+[:+',;.]\\d+$"))
{
itemid = Integer.parseInt(id.split("[:+',;.]")[0]);
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
}
else if (id.matches("^\\d+$"))
{
itemid = Integer.parseInt(id);
}
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
{
itemname = id.split("[:+',;.]")[0].toLowerCase();
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
}
else
{
itemname = id.toLowerCase();
}
if (itemname != null)
{
if (items.containsKey(itemname))
{
itemid = items.get(itemname);
if (durabilities.containsKey(itemname) && metaData == 0)
{
metaData = durabilities.get(itemname);
}
}
else
{
throw new Exception(Util.format("unknownItemName", id));
}
}
Material mat = Material.getMaterial(itemid);
if (mat == null)
{
throw new Exception(Util.format("unknownItemId", itemid));
}
ItemStack retval = new ItemStack(mat);
retval.setAmount(Essentials.getStatic().getSettings().getDefaultStackSize());
retval.setDurability(metaData);
return retval;
}
}

View File

@@ -0,0 +1,94 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
public class Jail extends BlockListener implements IConf
{
private static final Logger logger = Logger.getLogger("Minecraft");
private final EssentialsConf config;
private final IEssentials ess;
public Jail(IEssentials ess)
{
this.ess = ess;
config = new EssentialsConf(new File(ess.getDataFolder(), "jail.yml"));
config.load();
}
public void setJail(Location loc, String jailName) throws Exception
{
config.setProperty(jailName.toLowerCase(), loc);
config.save();
}
public Location getJail(String jailName) throws Exception
{
if (config.getProperty(jailName.toLowerCase()) == null)
{
throw new Exception(Util.i18n("jailNotExist"));
}
Location loc = config.getLocation(jailName.toLowerCase(), ess.getServer());
return loc;
}
public void sendToJail(User user, String jail) throws Exception
{
user.getTeleport().now(getJail(jail));
user.setJail(jail);
}
public void delJail(String jail) throws Exception
{
config.removeProperty(jail.toLowerCase());
config.save();
}
public List<String> getJails() throws Exception
{
return config.getKeys(null);
}
public void reloadConfig()
{
config.load();
}
@Override
public void onBlockBreak(BlockBreakEvent event)
{
User user = ess.getUser(event.getPlayer());
if (user.isJailed())
{
event.setCancelled(true);
}
}
@Override
public void onBlockPlace(BlockPlaceEvent event)
{
User user = ess.getUser(event.getPlayer());
if (user.isJailed())
{
event.setCancelled(true);
}
}
@Override
public void onBlockDamage(BlockDamageEvent event)
{
User user = ess.getUser(event.getPlayer());
if (user.isJailed())
{
event.setCancelled(true);
}
}
}

View File

@@ -0,0 +1,25 @@
package com.earth2me.essentials;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
public class JailPlayerListener extends PlayerListener
{
private final IEssentials ess;
public JailPlayerListener(IEssentials parent)
{
this.ess = parent;
}
@Override
public void onPlayerInteract(PlayerInteractEvent event)
{
User user = ess.getUser(event.getPlayer());
if (user.isJailed())
{
event.setCancelled(true);
}
}
}

View File

@@ -0,0 +1,132 @@
package com.earth2me.essentials;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.Entity;
import net.minecraft.server.WorldServer;
import org.bukkit.Server;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Player;
public enum Mob
{
CHICKEN("Chicken", Enemies.FRIENDLY),
COW("Cow", Enemies.FRIENDLY),
CREEPER("Creeper", Enemies.ENEMY),
GHAST("Ghast", Enemies.ENEMY),
GIANT("Giant", "GiantZombie", Enemies.ENEMY),
PIG("Pig", Enemies.FRIENDLY),
PIGZOMB("PigZombie", Enemies.NEUTRAL),
SHEEP("Sheep", Enemies.FRIENDLY, ""),
SKELETON("Skeleton", Enemies.ENEMY),
SLIME("Slime", Enemies.ENEMY),
SPIDER("Spider", Enemies.ENEMY),
SQUID("Squid", Enemies.FRIENDLY),
ZOMBIE("Zombie", Enemies.ENEMY),
MONSTER("Monster", Enemies.ENEMY),
WOLF("Wolf", Enemies.NEUTRAL);
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s)
{
this.s = s;
this.name = n;
this.craftClass = n;
this.entityClass = n;
this.type = en;
}
private Mob(String n, Enemies en)
{
this.name = n;
this.craftClass = n;
this.entityClass = n;
this.type = en;
}
private Mob(String n, String ec, Enemies en)
{
this.name = n;
this.craftClass = n;
this.entityClass = ec;
this.type = en;
}
private Mob(String n, String ec, String cc, Enemies en)
{
this.name = n;
this.entityClass = ec;
this.craftClass = cc;
this.type = en;
}
public String s = "s";
public String name;
public Enemies type;
private String entityClass;
private String craftClass;
private static final Map<String, Mob> hashMap = new HashMap<String, Mob>();
static
{
for (Mob mob : Mob.values())
{
hashMap.put(mob.name, mob);
}
}
@SuppressWarnings(
{
"unchecked", "CallToThreadDumpStack"
})
public CraftEntity spawn(Player player, Server server) throws MobException
{
try
{
WorldServer world = ((org.bukkit.craftbukkit.CraftWorld)player.getWorld()).getHandle();
Constructor<CraftEntity> craft = (Constructor<CraftEntity>)ClassLoader.getSystemClassLoader().loadClass("org.bukkit.craftbukkit.entity.Craft" + craftClass).getConstructors()[0];
Constructor<Entity> entity = (Constructor<Entity>)ClassLoader.getSystemClassLoader().loadClass("net.minecraft.server.Entity" + entityClass).getConstructors()[0];
return craft.newInstance((CraftServer)server, entity.newInstance(world));
}
catch (Exception ex)
{
logger.log(Level.WARNING, Util.i18n("unableToSpawnMob"), ex);
throw new MobException(ex);
}
}
public enum Enemies
{
FRIENDLY("friendly"),
NEUTRAL("neutral"),
ENEMY("enemy");
private Enemies(String t)
{
this.type = t;
}
protected String type;
}
public static class MobException extends Exception
{
private static final long serialVersionUID = 1L;
private MobException(Exception ex)
{
super(ex);
}
}
public static Mob fromName(String n)
{
return hashMap.get(n);
}
}

View File

@@ -0,0 +1,167 @@
/**
* @author SpaceManiac
* @licent MIT
* @origin https://github.com/SpaceManiac/Nether/blob/master/org/innectis/Nether/NetherPortal.java
*/
package com.earth2me.essentials;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.Location;
import org.bukkit.Material;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
public class NetherPortal
{
private Block block;
public NetherPortal(Block b)
{
block = b;
}
public Block getBlock()
{
return block;
}
public void setBlock(Block b)
{
block = b;
}
// Return a random spawnable location
public Location getSpawn()
{
if (block.getWorld().getBlockAt(block.getX() + 1, block.getY(), block.getZ()).getType().equals(Material.PORTAL)
|| block.getWorld().getBlockAt(block.getX() - 1, block.getY(), block.getZ()).getType().equals(Material.PORTAL))
{
// portal is in X direction
return new Location(block.getWorld(), block.getX() + 1,
block.getY(), block.getZ() + 1 - 2 * Math.round(Math.random()));
}
else
{
// portal is in Z direction
return new Location(block.getWorld(), block.getX() + 1 - 2 * Math.round(Math.random()),
block.getY(), block.getZ() + 1);
}
}
// ==============================
// Find a nearby portal within 16 blocks of the given block
// Not guaranteed to be the nearest
public static NetherPortal findPortal(Block dest)
{
World world = dest.getWorld();
// Get list of columns in a circle around the block
ArrayList<Block> columns = new ArrayList<Block>();
for (int x = dest.getX() - 16; x <= dest.getX() + 16; ++x)
{
for (int z = dest.getZ() - 16; z <= dest.getZ() + 16; ++z)
{
int dx = dest.getX() - x, dz = dest.getZ() - z;
if (dx * dx + dz * dz <= 256)
{
columns.add(world.getBlockAt(x, 0, z));
}
}
}
// For each column try to find a portal block
for (Block col : columns)
{
for (int y = 127; y >= 0; --y)
{
Block b = world.getBlockAt(col.getX(), y, col.getZ());
if (b.getType().equals(Material.PORTAL) && Math.abs(dest.getY() - y) <= 16)
{
// Huzzah!
return new NetherPortal(b);
}
}
}
// Nope!
return null;
}
// Create a new portal at the specified block, fudging position if needed
// Will occasionally end up making portals in bad places, but let's hope not
public static NetherPortal createPortal(Block dest)
{
World world = dest.getWorld();
// Try not to spawn within water or lava
Material m = dest.getType();
while (((m.equals(Material.LAVA) || m.equals(Material.WATER) || m.equals(Material.STATIONARY_LAVA)
|| m.equals(Material.STATIONARY_WATER) || m.equals(Material.SAND) || m.equals(Material.GRAVEL))) &&
dest.getY() < 120)
{
dest = world.getBlockAt(dest.getX(), dest.getY() + 4, dest.getZ());
m = dest.getType();
}
// Not too high or too low overall
if (dest.getY() > 120)
{
dest = world.getBlockAt(dest.getX(), 120, dest.getZ());
}
else if (dest.getY() < 8)
{
dest = world.getBlockAt(dest.getX(), 8, dest.getZ());
}
// Create the physical portal
// For now, don't worry about direction
int x = dest.getX(), y = dest.getY(), z = dest.getZ();
Logger.getLogger("Minecraft").log(Level.INFO, Util.format("creatingPortal", x, y, z));
// Clear area around portal
ArrayList<Block> columns = new ArrayList<Block>();
for (int x2 = x - 4; x2 <= x + 4; ++x2)
{
for (int z2 = z - 4; z2 <= z + 4; ++z2)
{
double dx = x + 0.5f - x2, dz = z - z2;
if (dx * dx + dz * dz <= 13)
{
columns.add(world.getBlockAt(x2, 0, z2));
}
}
}
// Clear area around portal
for (Block col : columns)
{
// Stone platform
world.getBlockAt(col.getX(), y - 1, col.getZ()).setType(Material.STONE);
for (int yd = 0; yd < 4; ++yd)
{
world.getBlockAt(col.getX(), y + yd, col.getZ()).setType(Material.AIR);
}
}
// Build obsidian frame
for (int xd = -1; xd < 3; ++xd)
{
for (int yd = -1; yd < 4; ++yd)
{
if (xd == -1 || yd == -1 || xd == 2 || yd == 3)
{
world.getBlockAt(x + xd, y + yd, z).setType(Material.OBSIDIAN);
}
}
}
// Set it alight!
dest.setType(Material.FIRE);
return new NetherPortal(dest);
}
}

View File

@@ -0,0 +1,480 @@
package com.earth2me.essentials;
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import org.bukkit.Achievement;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.Statistic;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.util.Vector;
public class OfflinePlayer implements Player
{
private final String name;
private Location location = new Location(null, 0, 0, 0, 0, 0);
private World world = null;
private UUID uniqueId = UUID.randomUUID();
public OfflinePlayer(String name)
{
this.name = name;
}
public boolean isOnline()
{
return false;
}
public boolean isOp()
{
return false;
}
public void sendMessage(String string)
{
}
public String getDisplayName()
{
return name;
}
public void setDisplayName(String string)
{
}
public void setCompassTarget(Location lctn)
{
}
public InetSocketAddress getAddress()
{
return null;
}
public void kickPlayer(String string)
{
}
public String getName()
{
return name;
}
public PlayerInventory getInventory()
{
return null;
}
public ItemStack getItemInHand()
{
return null;
}
public void setItemInHand(ItemStack is)
{
}
public int getHealth()
{
return 0;
}
public void setHealth(int i)
{
}
public Egg throwEgg()
{
return null;
}
public Snowball throwSnowball()
{
return null;
}
public Arrow shootArrow()
{
return null;
}
public boolean isInsideVehicle()
{
return false;
}
public boolean leaveVehicle()
{
return false;
}
public Vehicle getVehicle()
{
return null;
}
public Location getLocation()
{
return location;
}
public World getWorld()
{
return world;
}
public void setLocation(Location loc)
{
location = loc;
world = loc.getWorld();
}
public void teleportTo(Location lctn)
{
}
public void teleportTo(Entity entity)
{
}
public int getEntityId()
{
return -1;
}
public boolean performCommand(String string)
{
return false;
}
public boolean isPlayer()
{
return false;
}
public int getRemainingAir()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setRemainingAir(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getMaximumAir()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setMaximumAir(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean isSneaking()
{
return false;
}
public void setSneaking(boolean bln)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void updateInventory()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void chat(String string)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public double getEyeHeight()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public double getEyeHeight(boolean bln)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public Block getTargetBlock(HashSet<Byte> hs, int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getFireTicks()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getMaxFireTicks()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setFireTicks(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void remove()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public Server getServer()
{
return Essentials.getStatic() == null ? null : Essentials.getStatic().getServer();
}
public Vector getMomentum()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setMomentum(Vector vector)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setVelocity(Vector vector)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public Vector getVelocity()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void damage(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void damage(int i, Entity entity)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public Location getEyeLocation()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void sendRawMessage(String string) {
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public Location getCompassTarget()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getMaximumNoDamageTicks()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setMaximumNoDamageTicks(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getLastDamage()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setLastDamage(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getNoDamageTicks()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setNoDamageTicks(int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean teleport(Location lctn)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean teleport(Entity entity)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public Entity getPassenger()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean setPassenger(Entity entity)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean isEmpty()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean eject()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void saveData()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void loadData()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean isSleeping()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public int getSleepTicks()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public List<Entity> getNearbyEntities(double d, double d1, double d2)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean isDead()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public float getFallDistance()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setFallDistance(float f)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setSleepingIgnored(boolean bln)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean isSleepingIgnored()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void awardAchievement(Achievement a)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void incrementStatistic(Statistic ststc)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void incrementStatistic(Statistic ststc, int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void incrementStatistic(Statistic ststc, Material mtrl)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void playNote(Location lctn, byte b, byte b1)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void sendBlockChange(Location lctn, Material mtrl, byte b)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void sendBlockChange(Location lctn, int i, byte b)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void setLastDamageCause(EntityDamageEvent ede)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public EntityDamageEvent getLastDamageCause()
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public void playEffect(Location lctn, Effect effect, int i)
{
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
}
public boolean sendChunkChange(Location lctn, int i, int i1, int i2, byte[] bytes)
{
return true;
}
public UUID getUniqueId()
{
return uniqueId;
}
}

View File

@@ -0,0 +1,99 @@
package com.earth2me.essentials;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.IInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.entity.Player;
public class PlayerExtension extends PlayerWrapper
{
protected final IEssentials ess;
public PlayerExtension(Player base, IEssentials ess)
{
super(base);
this.ess = ess;
}
public boolean isBanned()
{
return ess.getBans().contains(getName());
}
public boolean isIpBanned()
{
return ess.getBannedIps().contains(getAddress().getAddress().toString().replace("/", ""));
}
public float getCorrectedYaw()
{
float angle = (getLocation().getYaw() - 90.0f) % 360.0f;
if (angle < 0) {
angle += 360.0f;
}
return angle;
}
public void showInventory(IInventory inventory)
{
getHandle().a(inventory);
}
public void showInventory(CraftInventoryPlayer inventory)
{
showInventory((IInventory)inventory.getInventory());
}
public TargetBlock getTarget()
{
return new TargetBlock(getBase());
}
public String getGroup()
{
try
{
return com.nijikokun.bukkit.Permissions.Permissions.Security.getGroup(getWorld().getName(), getName());
}
catch (Throwable ex)
{
return "default";
}
}
public boolean inGroup(String group)
{
try
{
return com.nijikokun.bukkit.Permissions.Permissions.Security.inGroup(getWorld().getName(), getName(), group);
}
catch (Throwable ex)
{
return false;
}
}
public boolean canBuild()
{
try
{
return isOp() || com.nijikokun.bukkit.Permissions.Permissions.Security.canGroupBuild(getWorld().getName(), getGroup());
}
catch (Throwable ex)
{
return true;
}
}
public EntityPlayer getHandle()
{
return getCraftPlayer().getHandle();
}
public CraftPlayer getCraftPlayer()
{
return (CraftPlayer)base;
}
}

View File

@@ -0,0 +1,533 @@
package com.earth2me.essentials;
import java.net.InetSocketAddress;
import java.util.*;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.*;
import org.bukkit.util.Vector;
public class PlayerWrapper implements Player
{
protected Player base;
public PlayerWrapper(Player base)
{
this.base = base;
}
public final Player getBase()
{
return base;
}
public final Player setBase(Player base)
{
return this.base = base;
}
@Override
public void setDisplayName(String string)
{
base.setDisplayName(string);
}
@Override
public void setCompassTarget(Location lctn)
{
base.setCompassTarget(lctn);
}
@Override
public InetSocketAddress getAddress()
{
return base.getAddress();
}
@Override
public void kickPlayer(String string)
{
base.kickPlayer(string);
}
@Override
public String getName()
{
return base.getName();
}
@Override
public PlayerInventory getInventory()
{
return base.getInventory();
}
@Override
public ItemStack getItemInHand()
{
return base.getItemInHand();
}
@Override
public void setItemInHand(ItemStack is)
{
base.setItemInHand(is);
}
@Override
public int getHealth()
{
return base.getHealth();
}
@Override
public void setHealth(int i)
{
base.setHealth(i);
}
@Override
public Egg throwEgg()
{
return base.throwEgg();
}
@Override
public Snowball throwSnowball()
{
return base.throwSnowball();
}
@Override
public Arrow shootArrow()
{
return base.shootArrow();
}
@Override
public boolean isInsideVehicle()
{
return base.isInsideVehicle();
}
@Override
public boolean leaveVehicle()
{
return base.leaveVehicle();
}
@Override
public Vehicle getVehicle()
{
return base.getVehicle();
}
@Override
public Location getLocation()
{
return base.getLocation();
}
@Override
public World getWorld()
{
return base.getWorld();
}
@Override
public Server getServer()
{
return base.getServer();
}
@Override
public boolean isOnline()
{
return base.isOnline();
}
@Override
public boolean isOp()
{
return base.isOp();
}
@Override
public boolean teleport(Location lctn)
{
return base.teleport(lctn);
}
@Override
public boolean teleport(Entity entity)
{
return base.teleport(entity);
}
@Override
public void sendMessage(String string)
{
base.sendMessage(string);
}
@Override
public void setVelocity(Vector vector)
{
base.setVelocity(vector);
}
@Override
public Vector getVelocity()
{
return base.getVelocity();
}
@Override
public double getEyeHeight()
{
return base.getEyeHeight();
}
@Override
public double getEyeHeight(boolean bln)
{
return base.getEyeHeight(bln);
}
@Override
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
{
return base.getLineOfSight(hs, i);
}
@Override
public Block getTargetBlock(HashSet<Byte> hs, int i)
{
return base.getTargetBlock(hs, i);
}
@Override
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
{
return base.getLastTwoTargetBlocks(hs, i);
}
@Override
public int getFireTicks()
{
return base.getFireTicks();
}
@Override
public int getMaxFireTicks()
{
return base.getMaxFireTicks();
}
@Override
public void setFireTicks(int i)
{
base.setFireTicks(i);
}
@Override
public void remove()
{
base.remove();
}
/**
* This is not deprecated because the underlying method isn't really deprecated; rather, it's just "imperfect". By
* We will continue to use this method even after the underlying CraftBukkit method is changed, so do not deprecate
* it. Chances are Bukkit will also choose to un-deprecate this method at some point.
*/
@Override
public void updateInventory()
{
base.updateInventory();
}
@Override
public void chat(String string)
{
base.chat(string);
}
@Override
public boolean isSneaking()
{
return base.isSneaking();
}
@Override
public void setSneaking(boolean bln)
{
base.setSneaking(bln);
}
@Override
public int getEntityId()
{
return base.getEntityId();
}
@Override
public boolean performCommand(String string)
{
return base.performCommand(string);
}
@Override
public int getRemainingAir()
{
return base.getRemainingAir();
}
@Override
public void setRemainingAir(int i)
{
base.setRemainingAir(i);
}
@Override
public int getMaximumAir()
{
return base.getMaximumAir();
}
@Override
public void setMaximumAir(int i)
{
base.setMaximumAir(i);
}
@Override
public String getDisplayName()
{
if (base.getDisplayName() != null)
return base.getDisplayName();
else
return base.getName();
}
@Override
public void damage(int i)
{
base.damage(i);
}
@Override
public void damage(int i, Entity entity)
{
base.damage(i, entity);
}
@Override
public Location getEyeLocation()
{
return base.getEyeLocation();
}
@Override
public void sendRawMessage(String string) {
base.sendRawMessage(string);
}
@Override
public Location getCompassTarget()
{
return base.getCompassTarget();
}
@Override
public int getMaximumNoDamageTicks()
{
return base.getMaximumNoDamageTicks();
}
@Override
public void setMaximumNoDamageTicks(int i)
{
base.setMaximumNoDamageTicks(i);
}
@Override
public int getLastDamage()
{
return base.getLastDamage();
}
@Override
public void setLastDamage(int i)
{
base.setLastDamage(i);
}
@Override
public int getNoDamageTicks()
{
return base.getNoDamageTicks();
}
@Override
public void setNoDamageTicks(int i)
{
base.setNoDamageTicks(i);
}
@Override
public Entity getPassenger()
{
return base.getPassenger();
}
@Override
public boolean setPassenger(Entity entity)
{
return base.setPassenger(entity);
}
@Override
public boolean isEmpty()
{
return base.isEmpty();
}
@Override
public boolean eject()
{
return base.eject();
}
@Override
@Deprecated
public void teleportTo(Location lctn)
{
base.teleportTo(lctn);
}
@Override
@Deprecated
public void teleportTo(Entity entity)
{
base.teleportTo(entity);
}
public void saveData()
{
base.saveData();
}
public void loadData()
{
base.loadData();
}
public boolean isSleeping()
{
return base.isSleeping();
}
public int getSleepTicks()
{
return base.getSleepTicks();
}
public List<Entity> getNearbyEntities(double d, double d1, double d2)
{
return base.getNearbyEntities(d, d1, d2);
}
public boolean isDead()
{
return base.isDead();
}
public float getFallDistance()
{
return base.getFallDistance();
}
public void setFallDistance(float f)
{
base.setFallDistance(f);
}
public void setSleepingIgnored(boolean bln)
{
base.setSleepingIgnored(bln);
}
public boolean isSleepingIgnored()
{
return base.isSleepingIgnored();
}
public void awardAchievement(Achievement a)
{
base.awardAchievement(a);
}
public void incrementStatistic(Statistic ststc)
{
base.incrementStatistic(ststc);
}
public void incrementStatistic(Statistic ststc, int i)
{
base.incrementStatistic(ststc, i);
}
public void incrementStatistic(Statistic ststc, Material mtrl)
{
base.incrementStatistic(ststc, mtrl);
}
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
{
base.incrementStatistic(ststc, mtrl, i);
}
public void playNote(Location lctn, byte b, byte b1)
{
base.playNote(lctn, b, b1);
}
public void sendBlockChange(Location lctn, Material mtrl, byte b)
{
base.sendBlockChange(lctn, mtrl, b);
}
public void sendBlockChange(Location lctn, int i, byte b)
{
base.sendBlockChange(lctn, i, b);
}
public void setLastDamageCause(EntityDamageEvent ede)
{
base.setLastDamageCause(ede);
}
public EntityDamageEvent getLastDamageCause()
{
return base.getLastDamageCause();
}
public void playEffect(Location lctn, Effect effect, int i)
{
base.playEffect(lctn, effect, i);
}
public boolean sendChunkChange(Location lctn, int i, int i1, int i2, byte[] bytes)
{
return base.sendChunkChange(lctn, i, i1, i2, bytes);
}
public UUID getUniqueId()
{
return base.getUniqueId();
}
}

View File

@@ -0,0 +1,519 @@
package com.earth2me.essentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.entity.CreatureType;
import org.bukkit.inventory.ItemStack;
public class Settings implements IConf
{
private final EssentialsConf config;
private final static Logger logger = Logger.getLogger("Minecraft");
public Settings(File dataFolder)
{
config = new EssentialsConf(new File(dataFolder, "config.yml"));
config.setTemplateName("/config.yml");
config.load();
}
public boolean getRespawnAtHome()
{
return config.getBoolean("respawn-at-home", false);
}
public boolean getBedSetsHome()
{
return config.getBoolean("bed-sethome", false);
}
public int getChatRadius()
{
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
}
public double getTeleportDelay()
{
return config.getDouble("teleport-delay", 0);
}
public int getDefaultStackSize()
{
return config.getInt("default-stack-size", 64);
}
public int getStartingBalance()
{
return config.getInt("starting-balance", 0);
}
public boolean getNetherPortalsEnabled()
{
return isNetherEnabled() && config.getBoolean("nether.portals-enabled", false);
}
public boolean isCommandDisabled(final IEssentialsCommand cmd)
{
return isCommandDisabled(cmd.getName());
}
public boolean isCommandDisabled(String label)
{
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
{
if (!c.equalsIgnoreCase(label)) continue;
return true;
}
return config.getBoolean("disable-" + label.toLowerCase(), false);
}
public boolean isCommandRestricted(IEssentialsCommand cmd)
{
return isCommandRestricted(cmd.getName());
}
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
{
if (!c.equalsIgnoreCase(label)) continue;
return true;
}
return config.getBoolean("restrict-" + label.toLowerCase(), false);
}
public boolean isCommandOverridden(String name)
{
List<String> defaultList = new ArrayList<String>(1);
defaultList.add("god");
for (String c : config.getStringList("overridden-commands", defaultList))
{
if (!c.equalsIgnoreCase(name))
continue;
return true;
}
return config.getBoolean("override-" + name.toLowerCase(), false);
}
public double getCommandCost(IEssentialsCommand cmd)
{
return getCommandCost(cmd.getName());
}
public double getCommandCost(String label)
{
double cost = config.getDouble("command-costs." + label, 0.0);
if (cost == 0.0)
cost = config.getDouble("cost-" + label, 0.0);
return cost;
}
public String getCommandPrefix()
{
return config.getString("command-prefix", "");
}
public String getNicknamePrefix()
{
return config.getString("nickname-prefix", "~");
}
public double getTeleportCooldown()
{
return config.getDouble("teleport-cooldown", 60);
}
public double getHealCooldown()
{
return config.getDouble("heal-cooldown", 60);
}
public Object getKit(String name)
{
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
for (Map.Entry<String, Object> entry : kits.entrySet())
{
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_'))) {
return entry.getValue();
}
}
return null;
}
public Map<String, Object> getKits()
{
return (Map<String, Object>)config.getProperty("kits");
}
public ChatColor getOperatorColor() throws Exception
{
String colorName = config.getString("ops-name-color", null);
if (colorName == null)
return ChatColor.RED;
if("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
throw new Exception();
try
{
return ChatColor.valueOf(colorName.toUpperCase());
}
catch (IllegalArgumentException ex)
{
}
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
}
public boolean getReclaimSetting()
{
return config.getBoolean("reclaim-onlogout", true);
}
public String getNetherName()
{
return config.getString("nether.folder", "nether");
}
public boolean isNetherEnabled()
{
return config.getBoolean("nether.enabled", true);
}
public int getSpawnMobLimit()
{
return config.getInt("spawnmob-limit", 10);
}
public boolean showNonEssCommandsInHelp()
{
return config.getBoolean("non-ess-in-help", true);
}
public Map<String, Boolean> getEpSettings()
{
Map<String, Boolean> epSettings = new HashMap<String, Boolean>();
epSettings.put("protect.protect.signs", config.getBoolean("protect.protect.signs", true));
epSettings.put("protect.protect.rails", config.getBoolean("protect.protect.rails", true));
epSettings.put("protect.protect.block-below", config.getBoolean("protect.protect.block-below", true));
epSettings.put("protect.protect.prevent-block-on-rails", config.getBoolean("protect.protect.prevent-block-on-rails", false));
return epSettings;
}
public Map<String, String> getEpDBSettings()
{
Map<String, String> epSettings = new HashMap<String, String>();
epSettings.put("protect.datatype", config.getString("protect.datatype", "sqlite"));
epSettings.put("protect.username", config.getString("protect.username", "root"));
epSettings.put("protect.password", config.getString("protect.password", "root"));
epSettings.put("protect.mysqlDb", config.getString("protect.mysqlDb", "jdbc:mysql://localhost:3306/minecraft"));
return epSettings;
}
public List<Integer> getEpAlertOnPlacement()
{
final List<Integer> epAlertPlace = new ArrayList<Integer>();
for (String itemName : config.getString("protect.alert.on-placement", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epAlertPlace.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "alert.on-placement"));
}
}
return epAlertPlace;
}
public List<Integer> getEpAlertOnUse()
{
final List<Integer> epAlertUse = new ArrayList<Integer>();
for (String itemName : config.getString("protect.alert.on-use", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epAlertUse.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "alert.on-use"));
}
}
return epAlertUse;
}
public List<Integer> getEpAlertOnBreak()
{
final List<Integer> epAlertPlace = new ArrayList<Integer>();
for (String itemName : config.getString("protect.alert.on-break", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epAlertPlace.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "alert.on-break"));
}
}
return epAlertPlace;
}
public List<Integer> epBlackListPlacement()
{
final List<Integer> epBlacklistPlacement = new ArrayList<Integer>();
for (String itemName : config.getString("protect.blacklist.placement", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epBlacklistPlacement.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "blacklist.placement"));
}
}
return epBlacklistPlacement;
}
public List<Integer> epBlackListUsage()
{
final List<Integer> epBlackListUsage = new ArrayList<Integer>();
for (String itemName : config.getString("protect.blacklist.usage", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epBlackListUsage.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "blacklist.usage"));
}
}
return epBlackListUsage;
}
public Map<String, Boolean> getEpGuardSettings()
{
final Map<String, Boolean> epSettings = new HashMap<String, Boolean>();
epSettings.put("protect.prevent.lava-flow", config.getBoolean("protect.prevent.lava-flow", false));
epSettings.put("protect.prevent.water-flow", config.getBoolean("protect.prevent.water-flow", false));
epSettings.put("protect.prevent.water-bucket-flow", config.getBoolean("protect.prevent.water-bucket-flow", false));
epSettings.put("protect.prevent.fire-spread", config.getBoolean("protect.prevent.fire-spread", true));
epSettings.put("protect.prevent.flint-fire", config.getBoolean("protect.prevent.flint-fire", false));
epSettings.put("protect.prevent.portal-creation", config.getBoolean("protect.prevent.portal-creation", false));
epSettings.put("protect.prevent.lava-fire-spread", config.getBoolean("protect.prevent.lava-fire-spread", true));
epSettings.put("protect.prevent.tnt-explosion", config.getBoolean("protect.prevent.tnt-explosion", false));
epSettings.put("protect.prevent.creeper-explosion", config.getBoolean("protect.prevent.creeper-explosion", false));
epSettings.put("protect.prevent.creeper-playerdamage", config.getBoolean("protect.prevent.creeper-playerdamage", false));
epSettings.put("protect.prevent.creeper-blockdamage", config.getBoolean("protect.prevent.creeper-blockdamage", false));
epSettings.put("protect.prevent.entitytarget", config.getBoolean("protect.prevent.entitytarget", false));
for (CreatureType ct : CreatureType.values()) {
final String name = ct.toString().toLowerCase();
epSettings.put("protect.prevent.spawn."+name, config.getBoolean("protect.prevent.spawn."+name, false));
}
epSettings.put("protect.prevent.lightning-fire-spread", config.getBoolean("protect.prevent.lightning-fire-spread", true));
return epSettings;
}
public Map<String, Boolean> getEpPlayerSettings()
{
final Map<String, Boolean> epPlayerSettings = new HashMap<String, Boolean>();
epPlayerSettings.put("protect.disable.fall", config.getBoolean("protect.disable.fall", false));
epPlayerSettings.put("protect.disable.pvp", config.getBoolean("protect.disable.pvp", false));
epPlayerSettings.put("protect.disable.drown", config.getBoolean("protect.disable.drown", false));
epPlayerSettings.put("protect.disable.suffocate", config.getBoolean("protect.disable.suffocate", false));
epPlayerSettings.put("protect.disable.lavadmg", config.getBoolean("protect.disable.lavadmg", false));
epPlayerSettings.put("protect.disable.projectiles", config.getBoolean("protect.disable.projectiles", false));
epPlayerSettings.put("protect.disable.contactdmg", config.getBoolean("protect.disable.contactdmg", false));
epPlayerSettings.put("protect.disable.firedmg", config.getBoolean("protect.disable.firedmg", false));
epPlayerSettings.put("protect.disable.build", config.getBoolean("protect.disable.build", false));
epPlayerSettings.put("protect.disable.lightning", config.getBoolean("protect.disable.lightning", false));
epPlayerSettings.put("protect.disable.weather.lightning", config.getBoolean("protect.disable.weather.lightning", false));
epPlayerSettings.put("protect.disable.weather.storm", config.getBoolean("protect.disable.weather.storm", false));
epPlayerSettings.put("protect.disable.weather.thunder", config.getBoolean("protect.disable.weather.thunder", false));
return epPlayerSettings;
}
public int getEpCreeperMaxHeight()
{
return config.getInt("protect.creeper.max-height", -1);
}
public boolean areSignsDisabled()
{
return config.getBoolean("signs-disabled", false);
}
public long getBackupInterval()
{
return config.getInt("backup.interval", 1440); // 1440 = 24 * 60
}
public String getBackupCommand()
{
return config.getString("backup.command", null);
}
public String getChatFormat(String group)
{
return config.getString("chat.group-formats." + (group == null ? "Default" : group),
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
}
public boolean getGenerateExitPortals()
{
return config.getBoolean("nether.generate-exit-portals", true);
}
public boolean getAnnounceNewPlayers()
{
return !config.getString("newbies.announce-format", "-").isEmpty();
}
public String getAnnounceNewPlayerFormat(IUser user)
{
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
}
public String format(String format, IUser user)
{
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
}
public String getNewbieSpawn()
{
return config.getString("newbies.spawnpoint", "default");
}
public boolean getPerWarpPermission()
{
return config.getBoolean("per-warp-permission", false);
}
public boolean getSortListByGroups()
{
return config.getBoolean("sort-list-by-groups", true);
}
public void reloadConfig() {
config.load();
}
public ArrayList<Integer> itemSpawnBlacklist()
{
ArrayList<Integer> epItemSpwn = new ArrayList<Integer>();
for (String itemName : config.getString("item-spawn-blacklist", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epItemSpwn.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "item-spawn-blacklist"));
}
}
return epItemSpwn;
}
public ArrayList<Integer> epBlockBreakingBlacklist()
{
ArrayList<Integer> epBreakList = new ArrayList<Integer>();
for (String itemName : config.getString("protect.blacklist.break", "").split(",")) {
itemName = itemName.trim();
if (itemName.isEmpty()) {
continue;
}
ItemStack is;
try {
is = ItemDb.get(itemName);
epBreakList.add(is.getTypeId());
} catch (Exception ex) {
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "blacklist.break"));
}
}
return epBreakList;
}
public boolean spawnIfNoHome()
{
return config.getBoolean("spawn-if-no-home", false);
}
public boolean warnOnBuildDisallow()
{
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
}
public boolean use1to1RatioInNether()
{
return config.getBoolean("nether.use-1to1-ratio", false);
}
public double getNetherRatio()
{
if (config.getBoolean("nether.use-1to1-ratio", false)) {
return 1.0;
}
return config.getDouble("nether.ratio", 16.0);
}
public boolean isDebug()
{
return config.getBoolean("debug", false);
}
public boolean warnOnSmite()
{
return config.getBoolean("warn-on-smite" ,true);
}
public boolean permissionBasedItemSpawn()
{
return config.getBoolean("permission-based-item-spawn", false);
}
public String getLocale()
{
return config.getString("locale", "");
}
public String getCurrencySymbol()
{
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
}
public boolean isTradeInStacks(int id)
{
return config.getBoolean("trade-in-stacks-" + id, false);
}
public boolean isEcoDisabled()
{
return config.getBoolean("disable-eco", false);
}
}

View File

@@ -0,0 +1,87 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.World.Environment;
public class Spawn implements IConf {
private static final Logger logger = Logger.getLogger("Minecraft");
private final EssentialsConf config;
private final Server server;
public Spawn(Server server, File dataFolder) {
File configFile = new File(dataFolder, "spawn.yml");
this.server = server;
config = new EssentialsConf(configFile);
config.load();
}
public void setSpawn(Location loc, String group) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("world", loc.getWorld().getName());
map.put("x", loc.getX());
map.put("y", loc.getY());
map.put("z", loc.getZ());
map.put("yaw", loc.getYaw());
map.put("pitch", loc.getPitch());
config.setProperty(group, map);
config.save();
if ("default".equals(group)) {
loc.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
}
}
public Location getSpawn(String group) {
if (config.getProperty(group) == null) {
group = "default";
}
if (config.getProperty(group) == null) {
for (World w : server.getWorlds()) {
if (w.getEnvironment() != Environment.NORMAL) {
continue;
}
return w.getSpawnLocation();
}
}
String worldId = config.getString(group + ".world", "");
World world = server.getWorlds().get(server.getWorlds().size() > 1 ? 1 : 0);
for (World w : server.getWorlds()) {
if (w.getEnvironment() != Environment.NORMAL) {
continue;
}
world = w;
break;
}
for (World w : server.getWorlds()) {
if (!w.getName().equals(worldId)) {
continue;
}
world = w;
break;
}
double x = config.getDouble(group + ".x", config.getDouble("default.x", 0));
double y = config.getDouble(group + ".y", config.getDouble("default.y", 0));
double z = config.getDouble(group + ".z", config.getDouble("default.z", 0));
float yaw = (float) config.getDouble(group + ".yaw", config.getDouble("default.yaw", 0));
float pitch = (float) config.getDouble(group + ".pitch", config.getDouble("default.pitch", 0));
Location retval = new Location(world, x, y, z, yaw, pitch);
if (y < 1) {
retval.setY(world.getHighestBlockYAt(retval));
}
return retval;
}
public void reloadConfig() {
config.load();
}
}

View File

@@ -0,0 +1,599 @@
package com.earth2me.essentials;
import java.util.ArrayList;
import org.bukkit.block.Block;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/**
* @author toi
* Thanks to Raphfrk for optimization of this class.
*/
public class TargetBlock {
private Location loc;
private double viewHeight;
private int maxDistance;
private int[] blockToIgnore;
private double checkDistance, curDistance;
private double xRotation, yRotation;
private Vector targetPos = new Vector();
private Vector targetPosDouble = new Vector();
private Vector prevPos = new Vector();
private final Vector offset = new Vector();
/**
* Constructor requiring a player, uses default values
*
* @param player Player to work with
*/
public TargetBlock(Player player)
{
this.setValues(player.getLocation(), 300, 1.65, 0.2, null);
}
/**
* Constructor requiring a location, uses default values
*
* @param loc Location to work with
*/
public TargetBlock(Location loc)
{
this.setValues(loc, 300, 0, 0.2, null);
}
/**
* Constructor requiring a player, max distance and a checking distance
*
* @param player Player to work with
* @param maxDistance How far it checks for blocks
* @param checkDistance How often to check for blocks, the smaller the more precise
*/
public TargetBlock(Player player, int maxDistance, double checkDistance)
{
this.setValues(player.getLocation(), maxDistance, 1.65, checkDistance, null);
}
/**
* Constructor requiring a location, max distance and a checking distance
*
* @param loc What location to work with
* @param maxDistance How far it checks for blocks
* @param checkDistance How often to check for blocks, the smaller the more precise
*/
public TargetBlock(Location loc, int maxDistance, double checkDistance) {
this.setValues(loc, maxDistance, 0, checkDistance, null);
}
/**
* Constructor requiring a player, max distance, checking distance and an array of blocks to ignore
*
* @param player What player to work with
* @param maxDistance How far it checks for blocks
* @param checkDistance How often to check for blocks, the smaller the more precise
* @param blocksToIgnore Integer array of what block ids to ignore while checking for viable targets
*/
public TargetBlock (Player player, int maxDistance, double checkDistance, int[] blocksToIgnore)
{
this.setValues(player.getLocation(), maxDistance, 1.65, checkDistance, blocksToIgnore);
}
/**
* Constructor requiring a location, max distance, checking distance and an array of blocks to ignore
*
* @param loc What location to work with
* @param maxDistance How far it checks for blocks
* @param checkDistance How often to check for blocks, the smaller the more precise
* @param blocksToIgnore Array of what block ids to ignore while checking for viable targets
*/
public TargetBlock (Location loc, int maxDistance, double checkDistance, int[] blocksToIgnore)
{
this.setValues(loc, maxDistance, 0, checkDistance, blocksToIgnore);
}
/**
* Constructor requiring a player, max distance, checking distance and an array of blocks to ignore
*
* @param player What player to work with
* @param maxDistance How far it checks for blocks
* @param checkDistance How often to check for blocks, the smaller the more precise
* @param blocksToIgnore String ArrayList of what block ids to ignore while checking for viable targets
*/
public TargetBlock (Player player, int maxDistance, double checkDistance, ArrayList<String> blocksToIgnore)
{
int[] bti = this.convertStringArraytoIntArray(blocksToIgnore);
this.setValues(player.getLocation(), maxDistance, 1.65, checkDistance, bti);
}
/**
* Constructor requiring a location, max distance, checking distance and an array of blocks to ignore
*
* @param loc What location to work with
* @param maxDistance How far it checks for blocks
* @param checkDistance How often to check for blocks, the smaller the more precise
* @param blocksToIgnore String ArrayList of what block ids to ignore while checking for viable targets
*/
public TargetBlock (Location loc, int maxDistance, double checkDistance, ArrayList<String> blocksToIgnore)
{
int[] bti = this.convertStringArraytoIntArray(blocksToIgnore);
this.setValues(loc, maxDistance, 0, checkDistance, bti);
}
/**
* Set the values, all constructors uses this function
*
* @param loc Location of the view
* @param maxDistance How far it checks for blocks
* @param viewPos Where the view is positioned in y-axis
* @param checkDistance How often to check for blocks, the smaller the more precise
* @param blocksToIgnore Ids of blocks to ignore while checking for viable targets
*/
private void setValues(Location loc, int maxDistance, double viewHeight, double checkDistance, int[] blocksToIgnore)
{
this.loc = loc;
this.maxDistance = maxDistance;
this.viewHeight = viewHeight;
this.checkDistance = checkDistance;
this.blockToIgnore = blocksToIgnore;
this.curDistance = 0;
xRotation = (loc.getYaw() + 90) % 360;
yRotation = loc.getPitch() * -1;
double h = (checkDistance * Math.cos(Math.toRadians(yRotation)));
offset.setY((checkDistance * Math.sin(Math.toRadians(yRotation))));
offset.setX((h * Math.cos(Math.toRadians(xRotation))));
offset.setZ((h * Math.sin(Math.toRadians(xRotation))));
targetPosDouble = new Vector(loc.getX(), loc.getY() + viewHeight, loc.getZ());
targetPos = new Vector( targetPosDouble.getBlockX(), targetPosDouble.getBlockY(), targetPosDouble.getBlockZ());
prevPos = targetPos.clone();
}
/**
* Call this to reset checking position to allow you to check for a new target with the same TargetBlock instance.
*/
public void reset()
{
targetPosDouble = new Vector(loc.getX(), loc.getY() + viewHeight, loc.getZ());
targetPos = new Vector( targetPosDouble.getBlockX(), targetPosDouble.getBlockY(), targetPosDouble.getBlockZ());
prevPos = targetPos.clone();
this.curDistance = 0;
}
/**
* Gets the distance to a block. Measures from the block underneath the player to the targetblock
* Should only be used when passing player as an constructor parameter
*
* @return double
*/
public double getDistanceToBlock()
{
Vector blockUnderPlayer = new Vector(
(int) Math.floor(loc.getX() + 0.5),
(int) Math.floor(loc.getY() - 0.5),
(int) Math.floor(loc.getZ() + 0.5));
Block blk = getTargetBlock();
double x = blk.getX() - blockUnderPlayer.getBlockX();
double y = blk.getY() - blockUnderPlayer.getBlockY();
double z = blk.getZ() - blockUnderPlayer.getBlockZ();
return Math.sqrt((Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)));
}
/**
* Gets the rounded distance to a block. Measures from the block underneath the player to the targetblock
* Should only be used when passing player as an constructor parameter
*
* @return int
*/
public int getDistanceToBlockRounded()
{
Vector blockUnderPlayer = new Vector(
(int) Math.floor(loc.getX() + 0.5),
(int) Math.floor(loc.getY() - 0.5),
(int) Math.floor(loc.getZ() + 0.5));
Block blk = getTargetBlock();
double x = blk.getX() - blockUnderPlayer.getBlockX();
double y = blk.getY() - blockUnderPlayer.getBlockY();
double z = blk.getZ() - blockUnderPlayer.getBlockZ();
return (int) Math.round((Math.sqrt((Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)))));
}
/**
* Gets the floored x distance to a block.
*
* @return int
*/
public int getXDistanceToBlock()
{
this.reset();
return (int) Math.floor(getTargetBlock().getX() - loc.getBlockX() + 0.5);
}
/**
* Gets the floored y distance to a block
*
* @return int
*/
public int getYDistanceToBlock()
{
this.reset();
return (int) Math.floor(getTargetBlock().getY() - loc.getBlockY() + viewHeight);
}
/**
* Gets the floored z distance to a block
*
* @return int
*/
public int getZDistanceToBlock()
{
this.reset();
return (int) Math.floor(getTargetBlock().getZ() - loc.getBlockZ() + 0.5);
}
/**
* Returns the block at the sight. Returns null if out of range or if no viable target was found
*
* @return Block
*/
@SuppressWarnings("empty-statement")
public Block getTargetBlock()
{
this.reset();
while ((getNextBlock() != null) && ((getCurrentBlock().getTypeId() == 0) || this.blockToIgnoreHasValue(getCurrentBlock().getTypeId())));
return getCurrentBlock();
}
/**
* Sets the type of the block at the sight. Returns false if the block wasn't set.
*
* @param typeID ID of type to set the block to
* @return boolean
*/
@SuppressWarnings("empty-statement")
public boolean setTargetBlock(int typeID)
{
if (Material.getMaterial(typeID) != null)
{
this.reset();
while (getNextBlock() != null && getCurrentBlock().getTypeId() == 0);
if (getCurrentBlock() != null)
{
Block blk = loc.getWorld().getBlockAt(targetPos.getBlockX(), targetPos.getBlockY(), targetPos.getBlockZ());
blk.setTypeId(typeID);
return true;
}
}
return false;
}
/**
* Sets the type of the block at the sight. Returns false if the block wasn't set.
*
* @param type Material to set the block to
* @return boolean
*/
@SuppressWarnings("empty-statement")
public boolean setTargetBlock(Material type)
{
this.reset();
while ((getNextBlock() != null) && ((getCurrentBlock().getTypeId() == 0) || this.blockToIgnoreHasValue(getCurrentBlock().getTypeId())));
if (getCurrentBlock() != null)
{
Block blk = loc.getWorld().getBlockAt(targetPos.getBlockX(), targetPos.getBlockY(), targetPos.getBlockZ());
blk.setType(type);
return true;
}
return false;
}
/**
* Sets the type of the block at the sight. Returns false if the block wasn't set.
* Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented
*
* @param type Name of type to set the block to
* @return boolean
*/
@SuppressWarnings("empty-statement")
public boolean setTargetBlock(String type)
{
Material mat = Material.valueOf(type);
if (mat != null)
{
this.reset();
while ((getNextBlock() != null) && ((getCurrentBlock().getTypeId() == 0) || this.blockToIgnoreHasValue(getCurrentBlock().getTypeId())));
if (getCurrentBlock() != null)
{
Block blk = loc.getWorld().getBlockAt(targetPos.getBlockX(), targetPos.getBlockY(), targetPos.getBlockZ());
blk.setType(mat);
return true;
}
}
return false;
}
/**
* Returns the block attached to the face at the sight. Returns null if out of range or if no viable target was found
*
* @return Block
*/
@SuppressWarnings("empty-statement")
public Block getFaceBlock()
{
while ((getNextBlock() != null) && ((getCurrentBlock().getTypeId() == 0) || this.blockToIgnoreHasValue(getCurrentBlock().getTypeId())));
if (getCurrentBlock() != null)
{
return getPreviousBlock();
}
else
{
return null;
}
}
/**
* Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set.
*
* @param typeID
* @return boolean
*/
public boolean setFaceBlock(int typeID)
{
if (Material.getMaterial(typeID) != null)
{
if (getCurrentBlock() != null)
{
Block blk = loc.getWorld().getBlockAt(prevPos.getBlockX(), prevPos.getBlockY(), prevPos.getBlockZ());
blk.setTypeId(typeID);
return true;
}
}
return false;
}
/**
* Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set.
*
* @param type
* @return boolean
*/
public boolean setFaceBlock(Material type)
{
if (getCurrentBlock() != null)
{
Block blk = loc.getWorld().getBlockAt(prevPos.getBlockX(), prevPos.getBlockY(), prevPos.getBlockZ());
blk.setType(type);
return true;
}
return false;
}
/**
* Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set.
* Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented
*
* @param type
* @return boolean
*/
public boolean setFaceBlock(String type)
{
Material mat = Material.valueOf(type);
if (mat != null)
{
if (getCurrentBlock() != null)
{
Block blk = loc.getWorld().getBlockAt(prevPos.getBlockX(), prevPos.getBlockY(), prevPos.getBlockZ());
blk.setType(mat);
return true;
}
}
return false;
}
/**
* Get next block
*
* @return Block
*/
public Block getNextBlock()
{
prevPos = targetPos.clone();
do
{
curDistance += checkDistance;
targetPosDouble.setX(offset.getX() + targetPosDouble.getX());
targetPosDouble.setY(offset.getY() + targetPosDouble.getY());
targetPosDouble.setZ(offset.getZ() + targetPosDouble.getZ());
targetPos = new Vector( targetPosDouble.getBlockX(), targetPosDouble.getBlockY(), targetPosDouble.getBlockZ());
}
while (curDistance <= maxDistance && targetPos.getBlockX() == prevPos.getBlockX() && targetPos.getBlockY() == prevPos.getBlockY() && targetPos.getBlockZ() == prevPos.getBlockZ());
if (curDistance > maxDistance)
{
return null;
}
return this.loc.getWorld().getBlockAt(this.targetPos.getBlockX(), this.targetPos.getBlockY(), this.targetPos.getBlockZ());
}
/**
* Returns the current block along the line of vision
*
* @return Block
*/
public Block getCurrentBlock()
{
if (curDistance > maxDistance)
{
return null;
}
else
{
return this.loc.getWorld().getBlockAt(this.targetPos.getBlockX(), this.targetPos.getBlockY(), this.targetPos.getBlockZ());
}
}
/**
* Sets current block type. Returns false if the block wasn't set.
*
* @param typeID
*/
public boolean setCurrentBlock(int typeID)
{
if (Material.getMaterial(typeID) != null)
{
Block blk = getCurrentBlock();
if (blk != null)
{
blk.setTypeId(typeID);
return true;
}
}
return false;
}
/**
* Sets current block type. Returns false if the block wasn't set.
*
* @param type
*/
public boolean setCurrentBlock(Material type)
{
Block blk = getCurrentBlock();
if (blk != null)
{
blk.setType(type);
return true;
}
return false;
}
/**
* Sets current block type. Returns false if the block wasn't set.
* Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented
*
* @param type
*/
public boolean setCurrentBlock(String type)
{
Material mat = Material.valueOf(type);
if (mat != null)
{
Block blk = getCurrentBlock();
if (blk != null)
{
blk.setType(mat);
return true;
}
}
return false;
}
/**
* Returns the previous block in the aimed path
*
* @return Block
*/
public Block getPreviousBlock()
{
return this.loc.getWorld().getBlockAt(prevPos.getBlockX(), prevPos.getBlockY(), prevPos.getBlockZ());
}
/**
* Sets previous block type id. Returns false if the block wasn't set.
*
* @param typeID
*/
public boolean setPreviousBlock(int typeID)
{
if (Material.getMaterial(typeID) != null)
{
Block blk = getPreviousBlock();
if (blk != null)
{
blk.setTypeId(typeID);
return true;
}
}
return false;
}
/**
* Sets previous block type id. Returns false if the block wasn't set.
*
* @param type
*/
public boolean setPreviousBlock(Material type)
{
Block blk = getPreviousBlock();
if (blk != null)
{
blk.setType(type);
return true;
}
return false;
}
/**
* Sets previous block type id. Returns false if the block wasn't set.
* Observe! At the moment this function is using the built-in enumerator function .valueOf(String) but would preferably be changed to smarter function, when implemented
*
* @param type
*/
public boolean setPreviousBlock(String type)
{
Material mat = Material.valueOf(type);
if (mat != null)
{
Block blk = getPreviousBlock();
if (blk != null)
{
blk.setType(mat);
return true;
}
}
return false;
}
private int[] convertStringArraytoIntArray(ArrayList<String> array)
{
if (array != null)
{
int intarray[] = new int[array.size()];
for (int i = 0; i < array.size(); i++)
{
try
{
intarray[i] = Integer.parseInt(array.get(i));
}
catch (NumberFormatException nfe)
{
intarray[i] = 0;
}
}
return intarray;
}
return null;
}
private boolean blockToIgnoreHasValue(int value)
{
if (this.blockToIgnore != null)
{
if (this.blockToIgnore.length > 0)
{
for (int i : this.blockToIgnore)
{
if (i == value)
return true;
}
}
}
return false;
}
}

View File

@@ -0,0 +1,281 @@
package com.earth2me.essentials;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
public class Teleport implements Runnable
{
private static class Target
{
private final Location location;
private final Entity entity;
public Target(Location location)
{
this.location = location;
this.entity = null;
}
public Target(Entity entity)
{
this.entity = entity;
this.location = null;
}
public Location getLocation()
{
if (this.entity != null)
{
return this.entity.getLocation();
}
return location;
}
}
private IUser user;
private int teleTimer = -1;
private long started; // time this task was initiated
private long delay; // 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)
// so, the X/Y/Z values are stored instead and rounded off
private long initX;
private long initY;
private long initZ;
private Target teleportTarget;
private Charge chargeFor;
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
private void initTimer(long delay, Target target, Charge chargeFor)
{
this.started = System.currentTimeMillis();
this.delay = delay;
this.health = user.getHealth();
this.initX = Math.round(user.getLocation().getX() * 10000);
this.initY = Math.round(user.getLocation().getY() * 10000);
this.initZ = Math.round(user.getLocation().getZ() * 10000);
this.teleportTarget = target;
this.chargeFor = chargeFor;
}
public void run()
{
if (user == null || !user.isOnline() || user.getLocation() == null)
{
cancel();
return;
}
if (Math.round(user.getLocation().getX() * 10000) != initX
|| Math.round(user.getLocation().getY() * 10000) != initY
|| Math.round(user.getLocation().getZ() * 10000) != initZ
|| user.getHealth() < health)
{ // user moved, cancel teleport
cancel(true);
return;
}
health = user.getHealth(); // in case user healed, then later gets injured
long now = System.currentTimeMillis();
if (now > started + delay)
{
try
{
cooldown(false);
user.sendMessage(Util.i18n("teleportationCommencing"));
try
{
now(teleportTarget);
if (chargeFor != null)
{
chargeFor.charge(user);
}
}
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
catch (Exception ex)
{
user.sendMessage(Util.format("cooldownWithMessage", ex.getMessage()));
}
}
}
public Teleport(IUser user, IEssentials ess)
{
this.user = user;
this.ess = ess;
}
public void respawn(Spawn spawn, Charge chargeFor) throws Exception
{
teleport(new Target(spawn.getSpawn(user.getGroup())), chargeFor);
}
public void warp(String warp, Charge chargeFor) throws Exception
{
Location loc = ess.getWarps().getWarp(warp);
teleport(new Target(loc), chargeFor);
user.sendMessage(Util.format("warpingTo", warp));
}
public void cooldown(boolean check) throws Exception
{
Calendar now = 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"))
{
throw new Exception(Util.format("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
}
}
// if justCheck is set, don't update lastTeleport; we're just checking
if (!check)
{
user.setLastTeleportTimestamp(now.getTimeInMillis());
}
}
public void cancel(boolean notifyUser)
{
if (teleTimer == -1)
{
return;
}
try
{
ess.getServer().getScheduler().cancelTask(teleTimer);
if (notifyUser)
{
user.sendMessage(Util.i18n("pendingTeleportCancelled"));
}
}
finally
{
teleTimer = -1;
}
}
public void cancel()
{
cancel(false);
}
public void teleport(Location loc, Charge chargeFor) throws Exception
{
teleport(new Target(loc), chargeFor);
}
public void teleport(Entity entity, Charge chargeFor) throws Exception
{
teleport(new Target(entity), chargeFor);
}
private void teleport(Target target, Charge chargeFor) 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);
now(target);
if (chargeFor != null)
{
chargeFor.charge(user);
}
return;
}
cancel();
Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
user.sendMessage(Util.format("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
initTimer((long)(delay * 1000.0), target, chargeFor);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
private void now(Target target) throws Exception
{
cancel();
user.setLastLocation();
user.getBase().teleport(Util.getSafeDestination(target.getLocation()));
}
public void now(Location loc) throws Exception
{
cooldown(false);
now(new Target(loc));
}
public void now(Location loc, Charge chargeFor) throws Exception
{
cooldown(false);
chargeFor.charge(user);
now(new Target(loc));
}
public void now(Entity entity) throws Exception
{
cooldown(false);
now(new Target(entity));
}
public void back(Charge chargeFor) throws Exception
{
teleport(new Target(user.getLastLocation()), chargeFor);
}
public void back() throws Exception
{
back(null);
}
public void home(Charge chargeFor) throws Exception
{
home(user, chargeFor);
}
public void home(IUser user, Charge chargeFor) throws Exception
{
Location loc = user.getHome(this.user.getLocation());
if (loc == null)
{
if (ess.getSettings().spawnIfNoHome())
{
respawn(ess.getSpawn(), chargeFor);
}
else
{
throw new Exception(user == this.user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer"));
}
}
teleport(new Target(loc), chargeFor);
}
}

View File

@@ -0,0 +1,289 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.register.payment.Method;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
private static final Logger logger = Logger.getLogger("Minecraft");
private boolean justPortaled = false;
private CommandSender replyTo = null;
private User teleportRequester;
private boolean teleportRequestHere;
private final Teleport teleport;
private long lastActivity;
User(Player base, IEssentials ess)
{
super(base, ess);
teleport = new Teleport(this, ess);
}
User update(Player base)
{
setBase(base);
return this;
}
public boolean isAuthorized(IEssentialsCommand cmd)
{
return isAuthorized("essentials." + (cmd.getName().equals("r") ? "msg" : cmd.getName()));
}
public boolean isAuthorized(String node)
{
if (isOp())
{
return true;
}
if (isJailed())
{
return false;
}
try
{
return com.nijikokun.bukkit.Permissions.Permissions.Security.permission(base, node);
}
catch (Throwable ex)
{
String[] cmds = node.split("\\.", 2);
return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1]);
}
}
public void healCooldown() throws Exception
{
Calendar now = new GregorianCalendar();
if (getLastHealTimestamp() > 0)
{
double cooldown = ess.getSettings().getHealCooldown();
Calendar cooldownTime = new GregorianCalendar();
cooldownTime.setTimeInMillis(getLastHealTimestamp());
cooldownTime.add(Calendar.SECOND, (int)cooldown);
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
{
throw new Exception(Util.format("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
}
}
setLastHealTimestamp(now.getTimeInMillis());
}
public void giveMoney(double value)
{
if (value == 0)
{
return;
}
setMoney(getMoney() + value);
sendMessage(Util.format("addedToAccount", Util.formatCurrency(value)));
}
public void payUser(User reciever, double value) throws Exception
{
if (value == 0)
{
return;
}
if (!canAfford(value))
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
else
{
setMoney(getMoney() - value);
reciever.setMoney(reciever.getMoney() + value);
sendMessage(Util.format("moneySentTo", Util.formatCurrency(value), reciever.getDisplayName()));
reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value), getDisplayName()));
}
}
public void takeMoney(double value)
{
if (value == 0)
{
return;
}
setMoney(getMoney() - value);
sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value)));
}
public boolean canAfford(double cost)
{
double mon = getMoney();
return mon >= cost || isAuthorized("essentials.eco.loan");
}
public void dispose()
{
this.base = new OfflinePlayer(getName());
}
public boolean getJustPortaled()
{
return justPortaled;
}
public void setJustPortaled(boolean value)
{
justPortaled = value;
}
public void setReplyTo(CommandSender user)
{
replyTo = user;
}
public CommandSender getReplyTo()
{
return replyTo;
}
public int compareTo(User t)
{
return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(t.getDisplayName()));
}
@Override
public boolean equals(Object o)
{
if (!(o instanceof User))
{
return false;
}
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User) o).getDisplayName()));
}
@Override
public int hashCode()
{
return ChatColor.stripColor(this.getDisplayName()).hashCode();
}
public Boolean canSpawnItem(int itemId)
{
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
}
public void setHome()
{
setHome(getLocation(), true);
}
public void setHome(boolean defaultHome)
{
setHome(getLocation(), defaultHome);
}
public void setLastLocation()
{
setLastLocation(getLocation());
}
public void requestTeleport(User player, boolean here)
{
teleportRequester = player;
teleportRequestHere = here;
}
public User getTeleportRequest()
{
return teleportRequester;
}
public boolean isTeleportRequestHere()
{
return teleportRequestHere;
}
public String getNick()
{
String nickname = getNickname();
if (ess.getSettings().isCommandDisabled("nick") || nickname == null || nickname.isEmpty() || nickname.equals(getName()))
{
nickname = getName();
}
else
{
nickname = ess.getSettings().getNicknamePrefix() + nickname;
}
if (isOp())
{
try
{
nickname = ess.getSettings().getOperatorColor().toString() + nickname + "§f";
}
catch(Exception e)
{
}
}
return nickname;
}
public Teleport getTeleport()
{
return teleport;
}
public long getLastActivity()
{
return lastActivity;
}
public void setLastActivity(long timestamp)
{
lastActivity = timestamp;
}
@Override
public double getMoney()
{
if (ess.isRegisterFallbackEnabled() && ess.getPaymentMethod().hasMethod())
{
try
{
Method method = ess.getPaymentMethod().getMethod();
if (!method.hasAccount(this.getName())) {
throw new Exception();
}
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
return account.balance();
}
catch (Throwable ex)
{
}
}
return super.getMoney();
}
@Override
public void setMoney(double value)
{
if (ess.isRegisterFallbackEnabled() && ess.getPaymentMethod().hasMethod())
{
try
{
Method method = ess.getPaymentMethod().getMethod();
if (!method.hasAccount(this.getName())) {
throw new Exception();
}
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
account.set(value);
}
catch (Throwable ex)
{
}
}
super.setMoney(value);
}
}

View File

@@ -0,0 +1,709 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public abstract class UserData extends PlayerExtension implements IConf
{
private final EssentialsConf config;
private static final Logger logger = Logger.getLogger("Minecraft");
protected UserData(Player base, IEssentials ess)
{
super(base, ess);
File folder = new File(ess.getDataFolder(), "userdata");
if (!folder.exists())
{
folder.mkdirs();
}
config = new EssentialsConf(new File(folder, Util.sanitizeFileName(base.getName()) + ".yml"));
reloadConfig();
}
public final void reloadConfig()
{
config.load();
money = _getMoney();
unlimited = _getUnlimited();
powertools = getPowertools();
lastLocation = _getLastLocation();
lastTeleportTimestamp = _getLastTeleportTimestamp();
lastHealTimestamp = _getLastHealTimestamp();
jail = _getJail();
mails = _getMails();
savedInventory = _getSavedInventory();
teleportEnabled = getTeleportEnabled();
ignoredPlayers = getIgnoredPlayers();
godmode = getGodModeEnabled();
muted = getMuted();
muteTimeout = _getMuteTimeout();
jailed = getJailed();
jailTimeout = _getJailTimeout();
lastLogin = _getLastLogin();
lastLogout = _getLastLogout();
afk = getAfk();
newplayer = getNew();
geolocation = _getGeoLocation();
isSocialSpyEnabled = _isSocialSpyEnabled();
isNPC = _isNPC();
}
private double money;
private double _getMoney() {
if (config.hasProperty("money"))
{
return config.getDouble("money", ess.getSettings().getStartingBalance());
}
else
{
return ess.getSettings().getStartingBalance();
}
}
public double getMoney()
{
return money;
}
public void setMoney(double value)
{
money = value;
config.setProperty("money", value);
config.save();
}
public boolean hasHome()
{
if (config.hasProperty("home"))
{
return true;
}
return false;
}
public Location getHome(Location location)
{
if (!hasHome())
{
return null;
}
World world = location.getWorld();
String worldHome = "home.worlds." + world.getName().toLowerCase();
if (!config.hasProperty(worldHome))
{
String defaultWorld = config.getString("home.default");
worldHome = "home.worlds." + defaultWorld;
}
Location loc = config.getLocation(worldHome, getServer());
return loc;
}
public void setHome(Location loc, boolean b)
{
String worldName = loc.getWorld().getName().toLowerCase();
if (worldName == null || worldName.isEmpty())
{
logger.log(Level.WARNING, Util.i18n("emptyWorldName"));
return;
}
if (b || !config.hasProperty("home.default"))
{
config.setProperty("home.default", worldName);
}
config.setProperty("home.worlds." + worldName, loc);
config.save();
}
public String getNickname()
{
return config.getString("nickname");
}
public void setNickname(String nick)
{
config.setProperty("nickname", nick);
config.save();
}
private List<Integer> unlimited;
private List<Integer> _getUnlimited()
{
return config.getIntList("unlimited", new ArrayList<Integer>());
}
public List<Integer> getUnlimited()
{
return unlimited;
}
public boolean hasUnlimited(ItemStack stack)
{
return unlimited.contains(stack.getTypeId());
}
public void setUnlimited(ItemStack stack, boolean state)
{
if (unlimited.contains(stack.getTypeId()))
{
unlimited.remove(Integer.valueOf(stack.getTypeId()));
}
if (state)
{
unlimited.add(stack.getTypeId());
}
config.setProperty("unlimited", unlimited);
config.save();
}
private Map<Integer, String> powertools;
@SuppressWarnings("unchecked")
private Map<Integer, String> getPowertools()
{
Object o = config.getProperty("powertools");
if (o instanceof Map)
{
return (Map<Integer, String>)o;
}
else
{
return new HashMap<Integer, String>();
}
}
public String getPowertool(ItemStack stack)
{
return powertools.get(stack.getTypeId());
}
public void setPowertool(ItemStack stack, String command)
{
if (command == null || command.isEmpty())
{
powertools.remove(stack.getTypeId());
}
else
{
powertools.put(stack.getTypeId(), command);
}
config.setProperty("powertools", powertools);
config.save();
}
private Location lastLocation;
private Location _getLastLocation()
{
return config.getLocation("lastlocation", getServer());
}
public Location getLastLocation()
{
return lastLocation;
}
public void setLastLocation(Location loc)
{
lastLocation = loc;
config.setProperty("lastlocation", loc);
config.save();
}
private long lastTeleportTimestamp;
private long _getLastTeleportTimestamp()
{
return config.getLong("timestamps.lastteleport", 0);
}
public long getLastTeleportTimestamp()
{
return lastTeleportTimestamp;
}
public void setLastTeleportTimestamp(long time)
{
lastTeleportTimestamp = time;
config.setProperty("timestamps.lastteleport", time);
config.save();
}
private long lastHealTimestamp;
private long _getLastHealTimestamp()
{
return config.getLong("timestamps.lastheal", 0);
}
public long getLastHealTimestamp()
{
return lastHealTimestamp;
}
public void setLastHealTimestamp(long time)
{
lastHealTimestamp = time;
config.setProperty("timestamps.lastheal", time);
config.save();
}
private String jail;
private String _getJail()
{
return config.getString("jail");
}
public String getJail()
{
return jail;
}
public void setJail(String jail)
{
if (jail == null || jail.isEmpty())
{
this.jail = null;
config.removeProperty("jail");
}
else
{
this.jail = jail;
config.setProperty("jail", jail);
}
config.save();
}
private List<String> mails;
private List<String> _getMails()
{
return config.getStringList("mail", new ArrayList<String>());
}
public List<String> getMails()
{
return mails;
}
public void setMails(List<String> mails)
{
if (mails == null)
{
config.removeProperty("mail");
mails = _getMails();
}
else
{
config.setProperty("mail", mails);
}
this.mails = mails;
config.save();
}
public void addMail(String mail)
{
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 || 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()
{
return config.getBoolean("teleportenabled", true);
}
public boolean isTeleportEnabled()
{
return teleportEnabled;
}
public void setTeleportEnabled(boolean set)
{
teleportEnabled = set;
config.setProperty("teleportenabled", set);
config.save();
}
public boolean toggleTeleportEnabled()
{
boolean ret = !isTeleportEnabled();
setTeleportEnabled(ret);
return ret;
}
public boolean toggleSocialSpy()
{
boolean ret = !isSocialSpyEnabled();
setSocialSpyEnabled(ret);
return ret;
}
private List<String> ignoredPlayers;
public List<String> getIgnoredPlayers()
{
return config.getStringList("ignore", new ArrayList<String>());
}
public void setIgnoredPlayers(List<String> players)
{
if (players == null || players.isEmpty())
{
ignoredPlayers = new ArrayList<String>();
config.removeProperty("ignore");
}
else
{
ignoredPlayers = players;
config.setProperty("ignore", players);
}
config.save();
}
public boolean isIgnoredPlayer(String name)
{
return ignoredPlayers.contains(name.toLowerCase());
}
public void setIgnoredPlayer(String name, boolean set)
{
if (set)
{
ignoredPlayers.add(name.toLowerCase());
}
else
{
ignoredPlayers.remove(name.toLowerCase());
}
setIgnoredPlayers(ignoredPlayers);
}
private boolean godmode;
private boolean getGodModeEnabled()
{
return config.getBoolean("godmode", false);
}
public boolean isGodModeEnabled()
{
return godmode;
}
public void setGodModeEnabled(boolean set)
{
godmode = set;
config.setProperty("godmode", set);
config.save();
}
public boolean toggleGodModeEnabled()
{
boolean ret = !isGodModeEnabled();
setGodModeEnabled(ret);
return ret;
}
private boolean muted;
private boolean getMuted()
{
return config.getBoolean("muted", false);
}
public boolean isMuted()
{
return muted;
}
public void setMuted(boolean set)
{
muted = set;
config.setProperty("muted", set);
config.save();
}
public boolean toggleMuted()
{
boolean ret = !isMuted();
setMuted(ret);
return ret;
}
private long muteTimeout;
private long _getMuteTimeout()
{
return config.getLong("timestamps.mute", 0);
}
public long getMuteTimeout()
{
return muteTimeout;
}
public void setMuteTimeout(long time)
{
muteTimeout = time;
config.setProperty("timestamps.mute", time);
config.save();
}
private boolean jailed;
private boolean getJailed()
{
return config.getBoolean("jailed", false);
}
public boolean isJailed()
{
return jailed;
}
public void setJailed(boolean set)
{
jailed = set;
config.setProperty("jailed", set);
config.save();
}
public boolean toggleJailed()
{
boolean ret = !isJailed();
setJailed(ret);
return ret;
}
private long jailTimeout;
private long _getJailTimeout()
{
return config.getLong("timestamps.jail", 0);
}
public long getJailTimeout()
{
return jailTimeout;
}
public void setJailTimeout(long time)
{
jailTimeout = time;
config.setProperty("timestamps.jail", time);
config.save();
}
public String getBanReason()
{
return config.getString("ban.reason");
}
public void setBanReason(String reason)
{
config.setProperty("ban.reason", reason);
config.save();
}
public long getBanTimeout()
{
return config.getLong("ban.timeout", 0);
}
public void setBanTimeout(long time)
{
config.setProperty("ban.timeout", time);
config.save();
}
private long lastLogin;
private long _getLastLogin()
{
return config.getLong("timestamps.login", 0);
}
public long getLastLogin()
{
return lastLogin;
}
public void setLastLogin(long time)
{
lastLogin = time;
config.setProperty("timestamps.login", time);
config.save();
}
private long lastLogout;
private long _getLastLogout()
{
return config.getLong("timestamps.logout", 0);
}
public long getLastLogout()
{
return lastLogout;
}
public void setLastLogout(long time)
{
lastLogout = time;
config.setProperty("timestamps.logout", time);
config.save();
}
private boolean afk;
private boolean getAfk()
{
return config.getBoolean("afk", false);
}
public boolean isAfk()
{
return afk;
}
public void setAfk(boolean set)
{
afk = set;
config.setProperty("afk", set);
config.save();
}
public boolean toggleAfk()
{
boolean ret = !isAfk();
setAfk(ret);
return ret;
}
private boolean newplayer;
private boolean getNew()
{
return config.getBoolean("newplayer", true);
}
public boolean isNew()
{
return newplayer;
}
public void setNew(boolean set)
{
newplayer = set;
config.setProperty("newplayer", set);
config.save();
}
private String geolocation;
private String _getGeoLocation()
{
return config.getString("geolocation");
}
public String getGeoLocation()
{
return geolocation;
}
public void setGeoLocation(String geolocation)
{
if (geolocation == null || geolocation.isEmpty())
{
this.geolocation = null;
config.removeProperty("geolocation");
}
else
{
this.geolocation = geolocation;
config.setProperty("geolocation", geolocation);
}
config.save();
}
private boolean isSocialSpyEnabled;
private boolean _isSocialSpyEnabled()
{
return config.getBoolean("socialspy", false);
}
public boolean isSocialSpyEnabled()
{
return isSocialSpyEnabled;
}
public void setSocialSpyEnabled(boolean status)
{
isSocialSpyEnabled = status;
config.setProperty("socialspy", status);
config.save();
}
private boolean isNPC;
private boolean _isNPC()
{
return config.getBoolean("npc", false);
}
public boolean isNPC()
{
return isNPC;
}
public void setNPC(boolean set)
{
isNPC = set;
config.setProperty("npc", set);
config.save();
}
}

View File

@@ -0,0 +1,449 @@
package com.earth2me.essentials;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.MessageFormat;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
public class Util
{
private Util()
{
}
private final static Logger logger = Logger.getLogger("Minecraft");
public static String sanitizeFileName(String name)
{
return name.toLowerCase().replaceAll("[^a-z0-9]", "_");
}
public static String formatDateDiff(long date)
{
Calendar c = new GregorianCalendar();
c.setTimeInMillis(date);
Calendar now = new GregorianCalendar();
return Util.formatDateDiff(now, c);
}
public static String formatDateDiff(Calendar fromDate, Calendar toDate)
{
boolean future = false;
if (toDate.equals(fromDate))
{
return Util.i18n("now");
}
if (toDate.after(fromDate))
{
future = true;
}
StringBuilder sb = new StringBuilder();
int[] types = new int[]
{
Calendar.YEAR,
Calendar.MONTH,
Calendar.DAY_OF_MONTH,
Calendar.HOUR_OF_DAY,
Calendar.MINUTE,
Calendar.SECOND
};
String[] names = new String[]
{
Util.i18n("year"),
Util.i18n("years"),
Util.i18n("month"),
Util.i18n("months"),
Util.i18n("day"),
Util.i18n("days"),
Util.i18n("hour"),
Util.i18n("hours"),
Util.i18n("minute"),
Util.i18n("minutes"),
Util.i18n("second"),
Util.i18n("seconds")
};
for (int i = 0; i < types.length; i++)
{
int diff = dateDiff(types[i], fromDate, toDate, future);
if (diff > 0)
{
sb.append(" ").append(diff).append(" ").append(names[i * 2 + (diff > 1 ? 1 : 0)]);
}
}
if (sb.length() == 0)
{
return "now";
}
return sb.toString();
}
private static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
{
int diff = 0;
long savedDate = fromDate.getTimeInMillis();
while ((future && !fromDate.after(toDate)) || (!future && !fromDate.before(toDate)))
{
savedDate = fromDate.getTimeInMillis();
fromDate.add(type, future ? 1 : -1);
diff++;
}
diff--;
fromDate.setTimeInMillis(savedDate);
return diff;
}
public static long parseDateDiff(String time, boolean future) throws Exception
{
Pattern timePattern = Pattern.compile(
"(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", Pattern.CASE_INSENSITIVE);
Matcher m = timePattern.matcher(time);
int years = 0;
int months = 0;
int weeks = 0;
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
boolean found = false;
while (m.find())
{
if (m.group() == null || m.group().isEmpty())
{
continue;
}
for (int i = 0; i < m.groupCount(); i++)
{
if (m.group(i) != null && !m.group(i).isEmpty())
{
found = true;
break;
}
}
if (found)
{
if (m.group(1) != null && !m.group(1).isEmpty())
{
years = Integer.parseInt(m.group(1));
}
if (m.group(2) != null && !m.group(2).isEmpty())
{
months = Integer.parseInt(m.group(2));
}
if (m.group(3) != null && !m.group(3).isEmpty())
{
weeks = Integer.parseInt(m.group(3));
}
if (m.group(4) != null && !m.group(4).isEmpty())
{
days = Integer.parseInt(m.group(4));
}
if (m.group(5) != null && !m.group(5).isEmpty())
{
hours = Integer.parseInt(m.group(5));
}
if (m.group(6) != null && !m.group(6).isEmpty())
{
minutes = Integer.parseInt(m.group(6));
}
if (m.group(7) != null && !m.group(7).isEmpty())
{
seconds = Integer.parseInt(m.group(7));
}
break;
}
}
if (!found)
{
throw new Exception(Util.i18n("illegalDate"));
}
Calendar c = new GregorianCalendar();
if (years > 0)
{
c.add(Calendar.YEAR, years * (future ? 1 : -1));
}
if (months > 0)
{
c.add(Calendar.MONTH, months * (future ? 1 : -1));
}
if (weeks > 0)
{
c.add(Calendar.WEEK_OF_YEAR, weeks * (future ? 1 : -1));
}
if (days > 0)
{
c.add(Calendar.DAY_OF_MONTH, days * (future ? 1 : -1));
}
if (hours > 0)
{
c.add(Calendar.HOUR_OF_DAY, hours * (future ? 1 : -1));
}
if (minutes > 0)
{
c.add(Calendar.MINUTE, minutes * (future ? 1 : -1));
}
if (seconds > 0)
{
c.add(Calendar.SECOND, seconds * (future ? 1 : -1));
}
return c.getTimeInMillis();
}
public static Location getSafeDestination(Location loc) throws Exception
{
if (loc == null)
{
throw new Exception(Util.i18n("destinationNotSet"));
}
World world = loc.getWorld();
double x = Math.floor(loc.getX()) + 0.5;
double y = Math.floor(loc.getY());
double z = Math.floor(loc.getZ()) + 0.5;
while (isBlockAboveAir(world, x, y, z))
{
y -= 1.0D;
if (y < 0.0D)
{
throw new Exception(Util.i18n("holeInFloor"));
}
}
while (isBlockUnsafe(world, x, y, z))
{
y += 1.0D;
if (y >= 110.0D)
{
x += 1.0D;
break;
}
}
while (isBlockUnsafe(world, x, y, z))
{
y -= 1.0D;
if (y <= 1.0D)
{
y = 110.0D;
x += 1.0D;
}
}
return new Location(world, x, y, z, loc.getYaw(), loc.getPitch());
}
private static boolean isBlockAboveAir(World world, double x, double y, double z)
{
return world.getBlockAt((int)Math.floor(x), (int)Math.floor(y - 1.0D), (int)Math.floor(z)).getType() == Material.AIR;
}
public static boolean isBlockUnsafe(World world, double x, double y, double z)
{
Block below = world.getBlockAt((int)Math.floor(x), (int)Math.floor(y - 1.0D), (int)Math.floor(z));
if (below.getType() == Material.LAVA || below.getType() == Material.STATIONARY_LAVA)
{
return true;
}
if (below.getType() == Material.FIRE)
{
return true;
}
if ((world.getBlockAt((int)Math.floor(x), (int)Math.floor(y), (int)Math.floor(z)).getType() != Material.AIR)
|| (world.getBlockAt((int)Math.floor(x), (int)Math.floor(y + 1.0D), (int)Math.floor(z)).getType() != Material.AIR))
{
return true;
}
return isBlockAboveAir(world, x, y, z);
}
private static DecimalFormat df = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
public static String formatCurrency(double value)
{
String str = Essentials.getStatic().getSettings().getCurrencySymbol() + df.format(value);
if (str.endsWith(".00"))
{
str = str.substring(0, str.length() - 3);
}
return str;
}
public static double roundDouble(double d)
{
return Math.round(d * 100.0) / 100.0;
}
public static Locale getCurrentLocale()
{
return currentLocale;
}
private static class ConfigClassLoader extends ClassLoader
{
private final File dataFolder;
private final ClassLoader cl;
public ConfigClassLoader(File dataFolder, ClassLoader cl)
{
this.dataFolder = dataFolder;
this.cl = cl;
}
@Override
public URL getResource(String string)
{
File file = new File(dataFolder, string);
if (file.exists())
{
try
{
return file.toURI().toURL();
}
catch (MalformedURLException ex)
{
return cl.getResource(string);
}
}
return cl.getResource(string);
}
@Override
public synchronized void clearAssertionStatus()
{
cl.clearAssertionStatus();
}
@Override
public InputStream getResourceAsStream(String string)
{
File file = new File(dataFolder, string);
if (file.exists())
{
try
{
BufferedReader br = new BufferedReader(new FileReader(file));
String version = br.readLine();
br.close();
if (version == null || !version.equals("#version: " + Essentials.getStatic().getDescription().getVersion()))
{
logger.log(Level.WARNING, String.format("Translation file %s is not updated for Essentials version. Will use default.", file));
return cl.getResourceAsStream(string);
}
return new FileInputStream(file);
}
catch (IOException ex)
{
return cl.getResourceAsStream(string);
}
}
return cl.getResourceAsStream(string);
}
@Override
public Enumeration<URL> getResources(String string) throws IOException
{
return cl.getResources(string);
}
@Override
public Class<?> loadClass(String string) throws ClassNotFoundException
{
return cl.loadClass(string);
}
@Override
public synchronized void setClassAssertionStatus(String string, boolean bln)
{
cl.setClassAssertionStatus(string, bln);
}
@Override
public synchronized void setDefaultAssertionStatus(boolean bln)
{
cl.setDefaultAssertionStatus(bln);
}
@Override
public synchronized void setPackageAssertionStatus(String string, boolean bln)
{
cl.setPackageAssertionStatus(string, bln);
}
}
private static final Locale defaultLocale = Locale.getDefault();
private static Locale currentLocale = defaultLocale;
private static ResourceBundle bundle = ResourceBundle.getBundle("messages", defaultLocale);
private static ResourceBundle defaultBundle = ResourceBundle.getBundle("messages", Locale.US);
public static String i18n(String string)
{
try
{
return bundle.getString(string);
}
catch (MissingResourceException ex)
{
logger.log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), bundle.getLocale().toString()), ex);
return defaultBundle.getString(string);
}
}
public static String format(String string, Object... objects)
{
MessageFormat mf = new MessageFormat(i18n(string));
return mf.format(objects);
}
public static void updateLocale(String loc, File dataFolder)
{
if (loc == null || loc.isEmpty())
{
return;
}
String[] parts = loc.split("[_\\.]");
if (parts.length == 1)
{
currentLocale = new Locale(parts[0]);
}
if (parts.length == 2)
{
currentLocale = new Locale(parts[0], parts[1]);
}
if (parts.length == 3)
{
currentLocale = new Locale(parts[0], parts[1], parts[2]);
}
logger.log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
bundle = ResourceBundle.getBundle("messages", currentLocale, new ConfigClassLoader(dataFolder, Util.class.getClassLoader()));
if (!bundle.keySet().containsAll(defaultBundle.keySet()))
{
logger.log(Level.WARNING, String.format("Translation file %s does not contain all translation keys.", currentLocale.toString()));
}
}
}

View File

@@ -0,0 +1,153 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
public class Warps implements IConf
{
private static final Logger logger = Logger.getLogger("Minecraft");
private final Map<StringIgnoreCase, EssentialsConf> warpPoints = new HashMap<StringIgnoreCase, EssentialsConf>();
private final File warpsFolder;
private final Server server;
public Warps(Server server, File dataFolder)
{
this.server = server;
warpsFolder = new File(dataFolder, "warps");
if (!warpsFolder.exists())
{
warpsFolder.mkdirs();
}
reloadConfig();
}
public boolean isEmpty()
{
return warpPoints.isEmpty();
}
public Iterable<String> getWarpNames()
{
List<String> keys = new ArrayList<String>();
for (StringIgnoreCase stringIgnoreCase : warpPoints.keySet())
{
keys.add(stringIgnoreCase.getString());
}
Collections.sort(keys, String.CASE_INSENSITIVE_ORDER);
return keys;
}
public Location getWarp(String warp) throws Exception
{
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp));
if (conf == null)
{
throw new Exception(Util.i18n("warpNotExist"));
}
return conf.getLocation(null, server);
}
public void setWarp(String name, Location loc) throws Exception
{
String filename = Util.sanitizeFileName(name);
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
if (conf == null)
{
File confFile = new File(warpsFolder, filename + ".yml");
if (confFile.exists())
{
throw new Exception(Util.i18n("similarWarpExist"));
}
conf = new EssentialsConf(confFile);
warpPoints.put(new StringIgnoreCase(name), conf);
}
conf.setProperty(null, loc);
conf.setProperty("name", name);
conf.save();
}
public void delWarp(String name) throws Exception
{
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
if (conf == null)
{
throw new Exception(Util.i18n("warpNotExist"));
}
if (!conf.getFile().delete())
{
throw new Exception(Util.i18n("warpDeleteError"));
}
warpPoints.remove(new StringIgnoreCase(name));
}
public final void reloadConfig()
{
warpPoints.clear();
File[] listOfFiles = warpsFolder.listFiles();
if (listOfFiles.length >= 1)
{
for (int i = 0; i < listOfFiles.length; i++)
{
String filename = listOfFiles[i].getName();
if (listOfFiles[i].isFile() && filename.endsWith(".yml"))
{
try
{
EssentialsConf conf = new EssentialsConf(listOfFiles[i]);
conf.load();
String name = conf.getString("name");
if (name != null)
{
warpPoints.put(new StringIgnoreCase(name), conf);
}
}
catch (Exception ex)
{
logger.log(Level.WARNING, Util.format("loadWarpError", filename), ex);
}
}
}
}
}
private static class StringIgnoreCase
{
private final String string;
public StringIgnoreCase(String string)
{
this.string = string;
}
@Override
public int hashCode()
{
return getString().toLowerCase().hashCode();
}
@Override
public boolean equals(Object o)
{
if (o instanceof StringIgnoreCase)
{
return getString().equalsIgnoreCase(((StringIgnoreCase)o).getString());
}
return false;
}
public String getString()
{
return string;
}
}
}

View File

@@ -0,0 +1,54 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.logging.Logger;
import org.bukkit.inventory.ItemStack;
public class Worth implements IConf
{
private static final Logger logger = Logger.getLogger("Minecraft");
private final EssentialsConf config;
public Worth(File dataFolder)
{
config = new EssentialsConf(new File(dataFolder, "worth.yml"));
config.setTemplateName("/worth.yml");
config.load();
}
public double getPrice(ItemStack itemStack)
{
String itemname = itemStack.getType().toString().toLowerCase().replace("_", "");
double result;
result = config.getDouble("worth."+itemname+"."+itemStack.getDurability(), Double.NaN);
if (Double.isNaN(result)) {
result = config.getDouble("worth."+itemname+".0", Double.NaN);
}
if (Double.isNaN(result)) {
result = config.getDouble("worth."+itemname, Double.NaN);
}
if (Double.isNaN(result)) {
result = config.getDouble("worth-"+itemStack.getTypeId(), Double.NaN);
}
return result;
}
public void setPrice(ItemStack itemStack, double price)
{
if (itemStack.getType().getData() == null) {
config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", ""), price);
} else {
// Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0.
config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", "")+"."+itemStack.getDurability(), price);
}
config.removeProperty("worth-"+itemStack.getTypeId());
config.save();
}
public void reloadConfig()
{
config.load();
}
}

View File

@@ -0,0 +1,277 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.User;
import com.earth2me.essentials.UserData;
import com.earth2me.essentials.Util;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
/**
* Instead of using this api directly, we recommend to use the register plugin:
* http://bit.ly/RegisterMethod
*/
public final class Economy
{
private Economy()
{
}
private static final Logger logger = Logger.getLogger("Minecraft");
private static void createNPCFile(String name)
{
File folder = new File(Essentials.getStatic().getDataFolder(), "userdata");
if (!folder.exists())
{
folder.mkdirs();
}
EssentialsConf npcConfig = new EssentialsConf(new File(folder, Util.sanitizeFileName(name) + ".yml"));
npcConfig.load();
npcConfig.setProperty("npc", true);
npcConfig.setProperty("money", Essentials.getStatic().getSettings().getStartingBalance());
npcConfig.save();
}
private static void deleteNPC(String name)
{
File folder = new File(Essentials.getStatic().getDataFolder(), "userdata");
if (!folder.exists())
{
folder.mkdirs();
}
File config = new File(folder, Util.sanitizeFileName(name) + ".yml");
EssentialsConf npcConfig = new EssentialsConf(config);
npcConfig.load();
if (npcConfig.hasProperty("npc") && npcConfig.getBoolean("npc", false)) {
if (!config.delete()) {
logger.log(Level.WARNING, Util.format("deleteFileError", config));
}
}
}
private static User getUserByName(String name)
{
User user;
Player player = Essentials.getStatic().getServer().getPlayer(name);
if (player != null)
{
user = Essentials.getStatic().getUser(player);
}
else
{
user = Essentials.getStatic().getOfflineUser(name);
}
return user;
}
/**
* Returns the balance of a user
* @param name Name of the user
* @return balance
* @throws UserDoesNotExistException
*/
public static double getMoney(String name) throws UserDoesNotExistException
{
User user = getUserByName(name);
if (user == null) {
throw new UserDoesNotExistException(name);
}
// Use UserData to avoid calls to iConomy and Register
return ((UserData)user).getMoney();
}
/**
* Sets the balance of a user
* @param name Name of the user
* @param balance The balance you want to set
* @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException
{
User user = getUserByName(name);
if (user == null) {
throw new UserDoesNotExistException(name);
}
if (balance < 0.0 && !user.isAuthorized("essentials.eco.loan"))
{
throw new NoLoanPermittedException();
}
// Use UserData to avoid calls to iConomy and Register
((UserData)user).setMoney(balance);
}
/**
* Adds money to the balance of a user
* @param name Name of the user
* @param amount The money you want to add
* @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
double result = getMoney(name) + amount;
setMoney(name, result);
}
/**
* Substracts money from the balance of a user
* @param name Name of the user
* @param amount The money you want to substract
* @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
double result = getMoney(name) - amount;
setMoney(name, result);
}
/**
* Divides the balance of a user by a value
* @param name Name of the user
* @param value The balance is divided by this value
* @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
double result = getMoney(name) / value;
setMoney(name, result);
}
/**
* Multiplies the balance of a user by a value
* @param name Name of the user
* @param value The balance is multiplied by this value
* @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
double result = getMoney(name) * value;
setMoney(name, result);
}
/**
* Resets the balance of a user to the starting balance
* @param name Name of the user
* @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
{
setMoney(name, Essentials.getStatic().getSettings().getStartingBalance());
}
/**
* @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more or an equal amount of money
* @throws UserDoesNotExistException If a user by that name does not exists
*/
public static boolean hasEnough(String name, double amount) throws UserDoesNotExistException
{
return amount <= getMoney(name);
}
/**
* @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more money
* @throws UserDoesNotExistException If a user by that name does not exists
*/
public static boolean hasMore(String name, double amount) throws UserDoesNotExistException
{
return amount < getMoney(name);
}
/**
* @param name Name of the user
* @param amount The amount of money the user should not have
* @return true, if the user has less money
* @throws UserDoesNotExistException If a user by that name does not exists
*/
public static boolean hasLess(String name, double amount) throws UserDoesNotExistException
{
return amount > getMoney(name);
}
/**
* Test if the user has a negative balance
* @param name Name of the user
* @return true, if the user has a negative balance
* @throws UserDoesNotExistException If a user by that name does not exists
*/
public static boolean isNegative(String name) throws UserDoesNotExistException
{
return getMoney(name) < 0.0;
}
/**
* Formats the amount of money like all other Essentials functions.
* Example: $100000 or $12345.67
* @param amount The amount of money
* @return Formatted money
*/
public static String format(double amount)
{
return Util.formatCurrency(amount);
}
/**
* Test if a player exists to avoid the UserDoesNotExistException
* @param name Name of the user
* @return true, if the user exists
*/
public static boolean playerExists(String name) {
return getUserByName(name) != null;
}
/**
* Test if a player is a npc
* @param name Name of the player
* @return true, if it's a npc
* @throws UserDoesNotExistException
*/
public static boolean isNPC(String name) throws UserDoesNotExistException
{
User user = getUserByName(name);
if (user == null) {
throw new UserDoesNotExistException(name);
}
return user.isNPC();
}
/**
* Creates dummy files for a npc, if there is no player yet with that name.
* @param name Name of the player
* @return true, if a new npc was created
*/
public static boolean createNPC(String name)
{
User user = getUserByName(name);
if (user == null) {
createNPCFile(name);
return true;
}
return false;
}
/**
* Deletes a user, if it is marked as npc.
* @param name Name of the player
* @throws UserDoesNotExistException
*/
public static void removeNPC(String name) throws UserDoesNotExistException
{
User user = getUserByName(name);
if (user == null) {
throw new UserDoesNotExistException(name);
}
deleteNPC(name);
}
}

View File

@@ -0,0 +1,13 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.Util;
public class NoLoanPermittedException extends Exception
{
public NoLoanPermittedException()
{
super(Util.i18n("negativeBalanceError"));
}
}

View File

@@ -0,0 +1,13 @@
package com.earth2me.essentials.api;
import com.earth2me.essentials.Util;
public class UserDoesNotExistException extends Exception
{
public UserDoesNotExistException(String name)
{
super(Util.format("userDoesNotExist", name));
}
}

View File

@@ -0,0 +1,29 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandafk extends EssentialsCommand
{
public Commandafk()
{
super("afk");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
if (!user.toggleAfk())
{
user.sendMessage(Util.i18n("markedAsNotAway"));
ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName()));
} else {
user.sendMessage(Util.i18n("markedAsAway"));
ess.broadcastMessage(user.getName(), Util.format("userIsAway", user.getDisplayName()));
}
}
}

View File

@@ -0,0 +1,33 @@
package com.earth2me.essentials.commands;
import net.minecraft.server.EntityTNTPrimed;
import net.minecraft.server.World;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftWorld;
import com.earth2me.essentials.User;
import com.earth2me.essentials.TargetBlock;
public class Commandantioch extends EssentialsCommand
{
public Commandantioch()
{
super("antioch");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
ess.broadcastMessage(user.getName(), "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
ess.broadcastMessage(user.getName(), "who being naughty in My sight, shall snuff it.");
Location loc = user.getLocation();
World world = ((CraftWorld)user.getWorld()).getHandle();
loc = new TargetBlock(user).getTargetBlock().getLocation();
EntityTNTPrimed tnt = new EntityTNTPrimed(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
world.addEntity(tnt);
world.makeSound(tnt, "random.fuse", 1.0F, 1.0F);
}
}

View File

@@ -0,0 +1,24 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
public class Commandback extends EssentialsCommand
{
public Commandback()
{
super("back");
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
Charge charge = new Charge(this.getName(), ess);
charge.isAffordableFor(user);
user.sendMessage(Util.i18n("backUsageMsg"));
user.getTeleport().back(charge);
}
}

View File

@@ -0,0 +1,28 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Backup;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandbackup extends EssentialsCommand
{
public Commandbackup()
{
super("backup");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
Backup backup = ess.getBackup();
if (backup == null)
{
return;
}
charge(sender);
backup.run();
sender.sendMessage(Util.i18n("backupStarted"));
}
}

View File

@@ -0,0 +1,37 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.command.CommandSender;
public class Commandbalance extends EssentialsCommand
{
public Commandbalance()
{
super("balance");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
sender.sendMessage(Util.format("balance", Util.formatCurrency(getPlayer(server, args, 0).getMoney())));
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
double bal = (args.length < 1
|| !(user.isAuthorized("essentials.balance.others")
|| user.isAuthorized("essentials.balance.other"))
? user
: getPlayer(server, args, 0)).getMoney();
user.sendMessage(Util.format("balance", Util.formatCurrency(bal)));
}
}

View File

@@ -0,0 +1,45 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandban extends EssentialsCommand
{
public Commandban()
{
super("ban");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
User p = null;
if (server.matchPlayer(args[0]).isEmpty())
{
((CraftServer)server).getHandle().a(args[0]);
sender.sendMessage(Util.format("playerBanned",args[0]));
}
else
{
p = ess.getUser(server.matchPlayer(args[0]).get(0));
String banReason = Util.i18n("defaultBanReason");
if(args.length > 1) {
banReason = getFinalArg(args, 1);
p.setBanReason(commandLabel);
}
p.kickPlayer(banReason);
((CraftServer)server).getHandle().a(p.getName());
sender.sendMessage(Util.format("playerBanned", p.getName()));
}
ess.loadBanList();
}
}

View File

@@ -0,0 +1,29 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
public class Commandbanip extends EssentialsCommand
{
public Commandbanip()
{
super("banip");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
((CraftServer)server).getHandle().c(args[0]);
sender.sendMessage(Util.i18n("banIpAddress"));
ess.loadBanList();
}
}

View File

@@ -0,0 +1,69 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.TreeType;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Location;
public class Commandbigtree extends EssentialsCommand
{
public Commandbigtree()
{
super("bigtree");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
TreeType tree = TreeType.TREE;
if (args.length > 0 && args[0].equalsIgnoreCase("redwood"))
{
tree = TreeType.TALL_REDWOOD;
}
else if (args.length > 0 && args[0].equalsIgnoreCase("tree"))
{
tree = TreeType.BIG_TREE;
}
else
{
throw new NotEnoughArgumentsException();
}
double x = user.getLocation().getX();
double y = user.getLocation().getY();
double z = user.getLocation().getZ();
// offset tree in direction player is facing
int r = (int)user.getCorrectedYaw();
if (r < 68 || r > 292) // north
{
x -= 3.0D;
}
else if (r > 112 && r < 248) // south
{
x += 3.0D;
}
if (r > 22 && r < 158) // east
{
z -= 3.0D;
}
else if (r > 202 && r < 338) // west
{
z += 3.0D;
}
Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z));
boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
if (success)
{
charge(user);
user.sendMessage(Util.i18n("bigTreeSuccess"));
}
else
{
user.sendMessage(Util.i18n("bigTreeFailure"));
}
}
}

View File

@@ -0,0 +1,29 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandbroadcast extends EssentialsCommand
{
public Commandbroadcast()
{
super("broadcast");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
charge(sender);
ess.broadcastMessage(sender instanceof Player ? ((Player)sender).getName() : Console.NAME,
Util.format("broadcast", getFinalArg(args, 0)));
}
}

View File

@@ -0,0 +1,31 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandburn extends EssentialsCommand
{
public Commandburn()
{
super("burn");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
charge(sender);
for (Player p : server.matchPlayer(args[0]))
{
p.setFireTicks(Integer.parseInt(args[1]) * 20);
sender.sendMessage(Util.format("burnMsg", p.getDisplayName(), Integer.parseInt(args[1])));
}
}
}

View File

@@ -0,0 +1,100 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.ChatColor;
public class Commandclearinventory extends EssentialsCommand
{
public Commandclearinventory()
{
super("clearinventory");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length > 0 && user.isAuthorized("essentials.clearinventory.others"))
{
if (args[0].length() >= 3)
{
List<Player> online = server.matchPlayer(args[0]);
if (!online.isEmpty())
{
charge(user);
for (Player p : online)
{
p.getInventory().clear();
user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
}
return;
}
throw new Exception(Util.i18n("playerNotFound"));
}
else
{
Player p = server.getPlayer(args[0]);
if (p != null)
{
charge(user);
p.getInventory().clear();
user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
}
else
{
throw new Exception(Util.i18n("playerNotFound"));
}
}
}
else
{
charge(user);
user.getInventory().clear();
user.sendMessage(Util.i18n("inventoryCleared"));
}
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
if (args[0].length() >= 3)
{
List<Player> online = server.matchPlayer(args[0]);
if (!online.isEmpty())
{
for (Player p : online)
{
p.getInventory().clear();
sender.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
}
return;
}
throw new Exception(Util.i18n("playerNotFound"));
}
else
{
Player u = server.getPlayer(args[0]);
if (u != null)
{
u.getInventory().clear();
sender.sendMessage(Util.format("inventoryClearedOthers", u.getDisplayName()));
}
else
{
throw new Exception(Util.i18n("playerNotFound"));
}
}
}
}

View File

@@ -0,0 +1,32 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandcompass extends EssentialsCommand
{
public Commandcompass()
{
super("compass");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
int r = (int)user.getCorrectedYaw();
String dir;
if (r < 23) dir = "N";
else if (r < 68) dir = "NE";
else if (r < 113) dir = "E";
else if (r < 158) dir = "SE";
else if (r < 203) dir = "S";
else if (r < 248) dir = "SW";
else if (r < 293) dir = "W";
else if (r < 338) dir = "NW";
else dir = "N";
user.sendMessage(Util.format("compassBearing", dir, r));
}
}

View File

@@ -0,0 +1,23 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commanddeljail extends EssentialsCommand {
public Commanddeljail() {
super("deljail");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception {
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
charge(sender);
ess.getJail().delJail(args[0]);
sender.sendMessage(Util.format("deleteJail", args[0]));
}
}

View File

@@ -0,0 +1,26 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.Util;
public class Commanddelwarp extends EssentialsCommand
{
public Commanddelwarp()
{
super("delwarp");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
charge(sender);
ess.getWarps().delWarp(args[0]);
sender.sendMessage(Util.format("deleteWarp", args[0]));
}
}

View File

@@ -0,0 +1,33 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commanddepth extends EssentialsCommand
{
public Commanddepth()
{
super("depth");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
int y = user.getLocation().getBlockY() - 63;
if (y > 0)
{
user.sendMessage(Util.format("depthAboveSea", y));
}
else if (y < 0)
{
user.sendMessage(Util.format("depthBelowSea", (-y)));
}
else
{
user.sendMessage(Util.i18n("depth"));
}
}
}

View File

@@ -0,0 +1,85 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.Essentials;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
public class Commandeco extends EssentialsCommand
{
public Commandeco()
{
super("eco");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
EcoCommands cmd;
double amount;
try
{
cmd = EcoCommands.valueOf(args[0].toUpperCase());
amount = Double.parseDouble(args[2].replaceAll("[^0-9\\.]", ""));
}
catch (Exception ex)
{
throw new NotEnoughArgumentsException(ex);
}
if (args[1].contentEquals("*"))
{
for (Player p : server.getOnlinePlayers())
{
User u = ess.getUser(p);
switch (cmd)
{
case GIVE:
u.giveMoney(amount);
break;
case TAKE:
u.takeMoney(amount);
break;
case RESET:
u.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
break;
}
}
}
else
{
for (Player p : server.matchPlayer(args[1]))
{
User u = ess.getUser(p);
switch (cmd)
{
case GIVE:
u.giveMoney(amount);
break;
case TAKE:
u.takeMoney(amount);
break;
case RESET:
u.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
break;
}
}
}
}
private enum EcoCommands
{
GIVE, TAKE, RESET
}
}

View File

@@ -0,0 +1,22 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandessentials extends EssentialsCommand
{
public Commandessentials()
{
super("essentials");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
ess.reload();
charge(sender);
sender.sendMessage(Util.format("essentialsReload", ess.getDescription().getVersion()));
}
}

View File

@@ -0,0 +1,51 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandext extends EssentialsCommand
{
public Commandext()
{
super("ext");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
extinguishPlayers(server, sender, args[0]);
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
charge(user);
user.setFireTicks(0);
user.sendMessage(Util.i18n("extinguish"));
return;
}
extinguishPlayers(server, user, commandLabel);
}
private void extinguishPlayers(Server server, CommandSender sender, String name) throws Exception
{
for (Player p : server.matchPlayer(name))
{
charge(sender);
p.setFireTicks(0);
sender.sendMessage(Util.format("extinguishOthers", p.getDisplayName()));
}
}
}

View File

@@ -0,0 +1,30 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
public class Commandgc extends EssentialsCommand
{
public Commandgc()
{
super("gc");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
charge(sender);
sender.sendMessage(Util.format("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
sender.sendMessage(Util.format("gcmin", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
for (World w : server.getWorlds())
{
sender.sendMessage(
(w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": "
+ w.getLoadedChunks().length + Util.i18n("gcchunks")
+ w.getEntities().size() + Util.i18n("gcentities"));
}
}
}

View File

@@ -0,0 +1,26 @@
package com.earth2me.essentials.commands;
import org.bukkit.Location;
import org.bukkit.Server;
import com.earth2me.essentials.User;
public class Commandgetpos extends EssentialsCommand
{
public Commandgetpos()
{
super("getpos");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
Location coords = user.getLocation();
user.sendMessage("§7X: " + coords.getBlockX() + " (-North <-> +South)");
user.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
user.sendMessage("§7Z: " + coords.getBlockZ() + " (+East <-> -West)");
user.sendMessage("§7Yaw: " + user.getCorrectedYaw() + " (Rotation)");
user.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
}
}

View File

@@ -0,0 +1,60 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.ItemDb;
import com.earth2me.essentials.User;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class Commandgive extends EssentialsCommand
{
public Commandgive()
{
super("give");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
ItemStack stack = ItemDb.get(args[1]);
String itemname = stack.getType().toString().toLowerCase().replace("_", "");
if (sender instanceof Player
&& (ess.getSettings().permissionBasedItemSpawn()
? (!ess.getUser(sender).isAuthorized("essentials.give.item-all")
&& !ess.getUser(sender).isAuthorized("essentials.give.item-" + itemname)
&& !ess.getUser(sender).isAuthorized("essentials.give.item-" + stack.getTypeId()))
: (!ess.getUser(sender).isAuthorized("essentials.itemspawn.exempt")
&& !ess.getUser(sender).canSpawnItem(stack.getTypeId()))))
{
sender.sendMessage(ChatColor.RED + "You are not allowed to spawn the item " + itemname);
return;
}
if (args.length > 2 && Integer.parseInt(args[2]) > 0)
{
stack.setAmount(Integer.parseInt(args[2]));
}
if (stack.getType() == Material.AIR)
{
sender.sendMessage(ChatColor.RED + "You can't give air.");
return;
}
User giveTo = getPlayer(server, args, 0);
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
charge(sender);
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
giveTo.getInventory().addItem(stack);
giveTo.updateInventory();
}
}

View File

@@ -0,0 +1,51 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandgod extends EssentialsCommand
{
public Commandgod()
{
super("god");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
godOtherPlayers(server, sender, args[0]);
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
charge(user);
if (args.length > 0 && user.isAuthorized("essentials.god.others"))
{
godOtherPlayers(server, user, args[0]);
return;
}
user.sendMessage(Util.format("godMode", (user.toggleGodModeEnabled()? Util.i18n("enabled") : Util.i18n("disabled"))));
}
private void godOtherPlayers(Server server, CommandSender sender, String name)
{
for (Player p : server.matchPlayer(name))
{
User u = ess.getUser(p);
boolean enabled = u.toggleGodModeEnabled();
u.sendMessage(Util.format("godMode", (enabled ? Util.i18n("enabled") : Util.i18n("disabled"))));
sender.sendMessage(Util.format("godMode",Util.format(enabled ? "godEnabledFor": "godDisabledFor", p.getDisplayName())));
}
}
}

View File

@@ -0,0 +1,67 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
public class Commandheal extends EssentialsCommand
{
public Commandheal()
{
super("heal");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length > 0 && user.isAuthorized("essentials.heal.others"))
{
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
{
user.healCooldown();
}
charge(user);
healOtherPlayers(server, user, args[0]);
return;
}
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
{
user.healCooldown();
}
charge(user);
user.setHealth(20);
user.sendMessage(Util.i18n("heal"));
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
healOtherPlayers(server, sender, args[0]);
}
private void healOtherPlayers(Server server, CommandSender sender, String name)
{
List<Player> players = server.matchPlayer(name);
if(players.isEmpty())
{
sender.sendMessage(Util.i18n("playerNotFound"));
return;
}
for (Player p : players)
{
p.setHealth(20);
sender.sendMessage(Util.format("healOther", p.getDisplayName()));
}
}
}

View File

@@ -0,0 +1,147 @@
package com.earth2me.essentials.commands;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Map.Entry;
import java.util.logging.Level;
public class Commandhelp extends EssentialsCommand
{
public final Yaml yaml = new Yaml(new SafeConstructor());
public Commandhelp()
{
super("help");
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
int page;
try
{
page = args.length > 0 ? Integer.parseInt(args[0]) : 1;
}
catch (Exception ex)
{
page = 1;
}
List<String> lines = getHelpLines(user);
int start = (page - 1) * 9;
int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
user.sendMessage(Util.format("helpPages", page, pages));
for (int i = start; i < lines.size() && i < start + 9; i++)
{
user.sendMessage(lines.get(i));
}
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
sender.sendMessage(Util.i18n("helpConsole"));
}
@SuppressWarnings("CallToThreadDumpStack")
private List<String> getHelpLines(User user) throws Exception
{
List<String> retval = new ArrayList<String>();
File helpFile = new File(ess.getDataFolder(), "help_"+Util.sanitizeFileName(user.getName()) +".txt");
if (!helpFile.exists())
{
helpFile = new File(ess.getDataFolder(), "help_"+Util.sanitizeFileName(user.getGroup()) +".txt");
}
if (!helpFile.exists())
{
helpFile = new File(ess.getDataFolder(), "help.txt");
}
if (helpFile.exists())
{
final BufferedReader bufferedReader = new BufferedReader(new FileReader(helpFile));
try {
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine();
retval.add(line.replace('&', '§'));
}
}
finally
{
bufferedReader.close();
}
return retval;
}
boolean reported = false;
String pluginName = "";
for (Plugin p : ess.getServer().getPluginManager().getPlugins())
{
try
{
final PluginDescriptionFile desc = p.getDescription();
final HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands();
for (Entry<String, HashMap<String, String>> k : cmds.entrySet())
{
if (p.getDescription().getName().toLowerCase().contains("essentials"))
{
final String node = "essentials." + k.getKey();
if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node))
{
retval.add("§c" + k.getKey() + "§7: " + k.getValue().get("description"));
}
}
else
{
if (ess.getSettings().showNonEssCommandsInHelp())
{
pluginName = p.getDescription().getName();
final HashMap<String, String> value = k.getValue();
if (value.containsKey("permission") && value.get("permission") != null && !(value.get("permission").equals("")))
{
if (user.isAuthorized(value.get("permission")))
{
retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
}
}
else
{
retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
}
}
}
}
}
catch (NullPointerException ex)
{
continue;
}
catch (Exception ex)
{
if (!reported)
{
logger.log(Level.WARNING, "Error getting help for:" + pluginName, ex);
}
reported = true;
continue;
}
}
return retval;
}
}

View File

@@ -0,0 +1,35 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandhelpop extends EssentialsCommand
{
public Commandhelpop()
{
super("helpop");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
charge(user);
for (Player p : server.getOnlinePlayers())
{
User u = ess.getUser(p);
if (!u.isAuthorized("essentials.helpop.receive"))
{
continue;
}
u.sendMessage(Util.format("helpOp", user.getDisplayName(), getFinalArg(args, 0)));
}
}
}

View File

@@ -0,0 +1,41 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandhome extends EssentialsCommand
{
public Commandhome()
{
super("home");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
Charge charge = new Charge(this.getName(), ess);
charge.isAffordableFor(user);
if(args.length > 0 && user.isAuthorized("essentials.home.others"))
{
User u;
try
{
u = getPlayer(server, args, 0);
}
catch(NoSuchFieldException ex)
{
u = ess.getOfflineUser(args[0]);
}
if (u == null)
{
throw new Exception(Util.i18n("playerNotFound"));
}
user.getTeleport().home(u, charge);
return;
}
user.getTeleport().home(charge);
}
}

View File

@@ -0,0 +1,49 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
public class Commandignore extends EssentialsCommand
{
public Commandignore()
{
super("ignore");
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
User u;
try
{
u = getPlayer(server, args, 0);
}
catch(NoSuchFieldException ex)
{
u = ess.getOfflineUser(args[0]);
}
if (u == null)
{
throw new Exception(Util.i18n("playerNotFound"));
}
String name = u.getName();
if (user.isIgnoredPlayer(name)) {
user.setIgnoredPlayer(name, false);
user.sendMessage(Util.format("unignorePlayer", u.getName()));
}
else
{
user.setIgnoredPlayer(name, true);
user.sendMessage(Util.format("ignorePlayer", u.getName()));
}
}
}

View File

@@ -0,0 +1,192 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandinfo extends EssentialsCommand
{
public Commandinfo()
{
super("info");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
String pageStr = args.length > 0 ? args[0].trim() : null;
List<String> lines = new ArrayList<String>();
List<String> chapters = new ArrayList<String>();
Map<String, Integer> bookmarks = new HashMap<String, Integer>();
File file = null;
if (sender instanceof Player)
{
User user = ess.getUser(sender);
file = new File(ess.getDataFolder(), "info_"+Util.sanitizeFileName(user.getName()) +".txt");
if (!file.exists())
{
file = new File(ess.getDataFolder(), "info_"+Util.sanitizeFileName(user.getGroup()) +".txt");
}
}
if (file == null || !file.exists())
{
file = new File(ess.getDataFolder(), "info.txt");
}
if (file.exists())
{
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try
{
int lineNumber = 0;
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine();
if (line.length() > 0 && line.charAt(0) == '#')
{
bookmarks.put(line.substring(1).toLowerCase().replaceAll("&[0-9a-f]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '§'));
}
lines.add(line.replace('&', '§'));
lineNumber++;
}
}
finally
{
bufferedReader.close();
}
}
else
{
sender.sendMessage(Util.i18n("infoFileDoesNotExist"));
file.createNewFile();
return;
}
if (bookmarks.isEmpty())
{
int page = 1;
try
{
page = Integer.parseInt(pageStr);
}
catch (Exception ex)
{
page = 1;
}
int start = (page - 1) * 9;
int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
charge(sender);
sender.sendMessage(Util.format("infoPages", page, pages ));
for (int i = start; i < lines.size() && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
return;
}
if (pageStr == null || pageStr.isEmpty() || pageStr.matches("[0-9]+"))
{
if (lines.get(0).startsWith("#"))
{
sender.sendMessage(Util.i18n("infoChapter"));
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String string : chapters)
{
if (!first)
{
sb.append(", ");
}
first = false;
sb.append(string);
}
sender.sendMessage(sb.toString());
return;
}
else
{
int page = 1;
try
{
page = Integer.parseInt(pageStr);
}
catch (Exception ex)
{
page = 1;
}
int start = (page - 1) * 9;
int end;
for (end = 0; end < lines.size(); end++)
{
String line = lines.get(end);
if (line.startsWith("#"))
{
break;
}
}
int pages = end / 9 + (end % 9 > 0 ? 1 : 0);
charge(sender);
sender.sendMessage(Util.format("infoPages", page, pages ));
for (int i = start; i < end && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
return;
}
}
int chapterpage = 0;
if (args.length >= 2)
{
try
{
chapterpage = Integer.parseInt(args[1]) - 1;
}
catch (Exception ex)
{
chapterpage = 0;
}
}
if (!bookmarks.containsKey(pageStr.toLowerCase()))
{
sender.sendMessage(Util.i18n("infoUnknownChapter"));
return;
}
int chapterstart = bookmarks.get(pageStr.toLowerCase()) + 1;
int chapterend;
for (chapterend = chapterstart; chapterend < lines.size(); chapterend++)
{
String line = lines.get(chapterend);
if (line.startsWith("#"))
{
break;
}
}
int start = chapterstart + chapterpage * 9;
int page = chapterpage + 1;
int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0);
charge(sender);
sender.sendMessage(Util.format("infoChapterPages", pageStr, page , pages));
for (int i = start; i < chapterend && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
}
}

View File

@@ -0,0 +1,55 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Arrays;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
public class Commandinvsee extends EssentialsCommand
{
public Commandinvsee()
{
super("invsee");
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1 && user.getSavedInventory() == null)
{
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(Util.i18n("invRestored"));
return;
}
charge(user);
if (user.getSavedInventory() == null)
{
user.setSavedInventory(user.getInventory().getContents());
}
ItemStack[] invUserStack = invUser.getInventory().getContents();
int userStackLength = user.getInventory().getContents().length;
if (invUserStack.length < userStackLength) {
invUserStack = Arrays.copyOf(invUserStack, userStackLength);
}
if (invUserStack.length > userStackLength) {
throw new Exception(Util.i18n("invBigger"));
}
user.getInventory().setContents(invUserStack);
user.sendMessage(Util.format("invSee", invUser.getDisplayName()));
user.sendMessage(Util.i18n("invSeeHelp"));
}
}

View File

@@ -0,0 +1,57 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.ItemDb;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class Commanditem extends EssentialsCommand
{
public Commanditem()
{
super("item");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
ItemStack stack = ItemDb.get(args[0]);
String itemname = stack.getType().toString().toLowerCase().replace("_", "");
if (ess.getSettings().permissionBasedItemSpawn()
? (!user.isAuthorized("essentials.itemspawn.item-all")
&& !user.isAuthorized("essentials.itemspawn.item-" + itemname)
&& !user.isAuthorized("essentials.itemspawn.item-" + stack.getTypeId()))
: (!user.isAuthorized("essentials.itemspawn.exempt")
&& !user.canSpawnItem(stack.getTypeId())))
{
user.sendMessage(Util.format("cantSpawnItem", itemname));
return;
}
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
{
stack.setAmount(Integer.parseInt(args[1]));
}
if (stack.getType() == Material.AIR)
{
user.sendMessage(Util.format("cantSpawnItem", "Air"));
return;
}
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
charge(user);
user.sendMessage(Util.format("itemSpawn", stack.getAmount(), itemName));
user.getInventory().addItem(stack);
user.updateInventory();
}
}

View File

@@ -0,0 +1,25 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandjails extends EssentialsCommand
{
public Commandjails()
{
super("jails");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
StringBuilder jailList = new StringBuilder();
for (String j : ess.getJail().getJails())
{
jailList.append(j);
jailList.append(' ');
}
sender.sendMessage("§7" + jailList);
}
}

View File

@@ -0,0 +1,43 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge;
import org.bukkit.Location;
import org.bukkit.Server;
import com.earth2me.essentials.TargetBlock;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandjump extends EssentialsCommand
{
public Commandjump()
{
super("jump");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
Location loc;
Location cloc = user.getLocation();
try
{
loc = new TargetBlock(user, 100, 2.65).getTargetBlock().getLocation();
loc.setYaw(cloc.getYaw());
loc.setPitch(cloc.getPitch());
loc = new TargetBlock(loc).getPreviousBlock().getLocation();
loc.setYaw(cloc.getYaw());
loc.setPitch(cloc.getPitch());
loc.setY(loc.getY() + 1);
}
catch (NullPointerException ex)
{
throw new Exception(Util.i18n("jumpError"), ex);
}
Charge charge = new Charge(this.getName(), ess);
charge.isAffordableFor(user);
user.getTeleport().teleport(loc, charge);
}
}

View File

@@ -0,0 +1,39 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.ChatColor;
public class Commandkick extends EssentialsCommand
{
public Commandkick()
{
super("kick");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
User u;
try
{
u = ess.getUser(server.matchPlayer(args[0]).get(0));
}
catch (Throwable ex)
{
sender.sendMessage(Util.i18n("playerNotFound"));
return;
}
charge(sender);
u.kickPlayer(args.length > 1 ? getFinalArg(args, 1) : Util.i18n("kickDefault"));
}
}

View File

@@ -0,0 +1,33 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandkickall extends EssentialsCommand
{
public Commandkickall()
{
super("kickall");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
charge(sender);
for (Player p : server.getOnlinePlayers())
{
if (sender instanceof Player && p.getName().equalsIgnoreCase(((Player)sender).getName()))
{
continue;
}
else
{
p.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : Util.i18n("kickDefault"));
}
}
}
}

View File

@@ -0,0 +1,31 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandkill extends EssentialsCommand
{
public Commandkill()
{
super("kill");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
charge(sender);
for (Player p : server.matchPlayer(args[0]))
{
p.setHealth(0);
sender.sendMessage(Util.format("kill", p.getDisplayName()));
}
}
}

View File

@@ -0,0 +1,159 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.GregorianCalendar;
import org.bukkit.inventory.ItemStack;
public class Commandkit extends EssentialsCommand
{
static private final Map<User, Map<String, Long>> kitPlayers = new HashMap<User, Map<String, Long>>();
public Commandkit()
{
super("kit");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
try
{
Map<String, Object> kits = ess.getSettings().getKits();
StringBuilder list = new StringBuilder();
for (String k : kits.keySet())
{
if (user.isAuthorized("essentials.kit." + k.toLowerCase()))
{
list.append(" ").append(k);
}
}
if (list.length() > 0)
{
user.sendMessage(Util.format("kits", list.toString()));
}
else
{
user.sendMessage(Util.i18n("noKits"));
}
}
catch (Exception ex)
{
user.sendMessage(Util.i18n("kitError"));
}
}
else
{
try
{
String kitName = args[0].toLowerCase();
Object kit = ess.getSettings().getKit(kitName);
List<String> items;
if (!user.isAuthorized("essentials.kit." + kitName))
{
user.sendMessage(Util.format("noKitPermission", "essentials.kit." + kitName));
return;
}
try
{
//System.out.println("Kit is timed");
Map<String, Object> els = (Map<String, Object>)kit;
items = (List<String>)els.get("items");
double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay*1000.0)%1000.0));
long time = c.getTimeInMillis();
Calendar now = new GregorianCalendar();
Map<String, Long> kitTimes;
if (!kitPlayers.containsKey(user))
{
kitTimes = new HashMap<String, Long>();
kitTimes.put(kitName, time);
kitPlayers.put(user, kitTimes);
}
else
{
kitTimes = kitPlayers.get(user);
if (!kitTimes.containsKey(kitName))
{
kitTimes.put(kitName, time);
}
else if (kitTimes.get(kitName) < now.getTimeInMillis())
{
kitTimes.put(kitName, time);
}
else
{
user.sendMessage(Util.format("kitTimed", Util.formatDateDiff(kitTimes.get(kitName))));
return;
}
}
}
catch (Exception ex)
{
items = (List<String>)kit;
}
Charge charge = new Charge("kit-" + kitName, ess);
try
{
charge.isAffordableFor(user);
}
catch (Exception ex)
{
user.sendMessage(ex.getMessage());
return;
}
boolean spew = false;
for (String d : items)
{
String[] parts = d.split("[^0-9]+", 3);
int id = Integer.parseInt(parts[0]);
int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
for (ItemStack itemStack : overfilled.values())
{
user.getWorld().dropItemNaturally(user.getLocation(), itemStack);
spew = true;
}
}
if (spew)
{
user.sendMessage(Util.i18n("kitInvFull"));
}
try
{
charge(user);
charge.charge(user);
}
catch (Exception ex)
{
user.sendMessage(ex.getMessage());
}
user.sendMessage(Util.format("kitGive", kitName));
}
catch (Exception ex)
{
user.sendMessage(Util.i18n("kitError2"));
user.sendMessage(Util.i18n("kitErrorHelp"));
}
}
}
}

View File

@@ -0,0 +1,56 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandlightning extends EssentialsCommand
{
public Commandlightning()
{
super("lightning");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
User user = null;
if (sender instanceof Player)
{
user = ess.getUser(((Player)sender));
}
if (args.length < 1 & user != null)
{
user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation());
charge(user);
return;
}
if (server.matchPlayer(args[0]).isEmpty())
{
sender.sendMessage(Util.i18n("playerNotFound"));
return;
}
if (user != null)
{
charge(user);
}
for (Player p : server.matchPlayer(args[0]))
{
sender.sendMessage(Util.format("lightningUse", p.getDisplayName()));
p.getWorld().strikeLightning(p.getLocation());
if (!ess.getUser(p).isGodModeEnabled()) {
p.setHealth(p.getHealth() < 5 ? 0 : p.getHealth() - 5);
}
if (ess.getSettings().warnOnSmite())
{
p.sendMessage(Util.i18n("lightningSmited"));
}
}
}
}

View File

@@ -0,0 +1,109 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.Essentials;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
public class Commandlist extends EssentialsCommand
{
public Commandlist()
{
super("list");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
charge(sender);
StringBuilder online = new StringBuilder();
online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
online.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
online.append(ChatColor.BLUE).append(" players online.");
sender.sendMessage(online.toString());
if (ess.getSettings().getSortListByGroups())
{
Map<String, List<User>> sort = new HashMap<String, List<User>>();
for (Player p : server.getOnlinePlayers())
{
User u = ess.getUser(p);
String group = u.getGroup();
List<User> list = sort.get(group);
if (list == null)
{
list = new ArrayList<User>();
sort.put(group, list);
}
list.add(u);
}
String[] groups = sort.keySet().toArray(new String[0]);
Arrays.sort(groups, String.CASE_INSENSITIVE_ORDER);
for (String group : groups)
{
StringBuilder groupString = new StringBuilder();
groupString.append(group).append(": ");
List<User> users = sort.get(group);
Collections.sort(users);
boolean first = true;
for (User user : users)
{
if (!first)
{
groupString.append(", ");
}
else
{
first = false;
}
if (user.isAfk())
{
groupString.append("§7[AFK]§f");
}
groupString.append(user.getDisplayName());
}
sender.sendMessage(groupString.toString());
}
}
else
{
List<User> users = new ArrayList<User>();
for (Player p : server.getOnlinePlayers())
{
users.add(ess.getUser(p));
}
Collections.sort(users);
StringBuilder onlineUsers = new StringBuilder();
onlineUsers.append(Util.i18n("connectedPlayers"));
boolean first = true;
for (User user : users)
{
if (!first)
{
onlineUsers.append(", ");
}
else
{
first = false;
}
if (user.isAfk())
{
onlineUsers.append("§7[AFK]§f");
}
onlineUsers.append(user.getDisplayName());
}
sender.sendMessage(onlineUsers.toString());
}
}
}

View File

@@ -0,0 +1,75 @@
package com.earth2me.essentials.commands;
import java.util.List;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class Commandmail extends EssentialsCommand
{
public Commandmail()
{
super("mail");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
{
List<String> mail = user.getMails();
if (mail.isEmpty())
{
user.sendMessage(Util.i18n("noMail"));
return;
}
for (String s : mail)
{
user.sendMessage(s);
}
user.sendMessage(Util.i18n("mailClear"));
return;
}
if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
{
if (!user.isAuthorized("essentials.mail.send"))
{
user.sendMessage(Util.i18n("noMailSendPerm"));
return;
}
Player player = server.getPlayer(args[1]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[1]);
}
if (u == null)
{
user.sendMessage(Util.format("playerNeverOnServer", args[1]));
return;
}
charge(user);
if (!u.isIgnoredPlayer(user.getName()))
{
u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2));
}
user.sendMessage(Util.i18n("mailSent"));
return;
}
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
{
user.setMails(null);
user.sendMessage(Util.i18n("mailCleared"));
return;
}
throw new NotEnoughArgumentsException();
}
}

View File

@@ -0,0 +1,37 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandme extends EssentialsCommand
{
public Commandme()
{
super("me");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (user.isMuted())
{
user.sendMessage(Util.i18n("voiceSilenced"));
return;
}
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
StringBuilder message = new StringBuilder();
for (int i = 0; i < args.length; i++)
{
message.append(args[i]);
message.append(' ');
}
charge(user);
ess.broadcastMessage(user.getName(), "* " + user.getDisplayName() + " " + message);
}
}

View File

@@ -0,0 +1,24 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmotd extends EssentialsCommand
{
public Commandmotd()
{
super("motd");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
charge(sender);
for (String m : ess.getMotd(sender, Util.i18n("noMotd")))
{
sender.sendMessage(m);
}
}
}

View File

@@ -0,0 +1,64 @@
package com.earth2me.essentials.commands;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import com.earth2me.essentials.Console;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.Util;
import org.bukkit.command.CommandSender;
public class Commandmsg extends EssentialsCommand
{
public Commandmsg()
{
super("msg");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2 || args[0].trim().isEmpty() || args[1].trim().isEmpty())
{
throw new NotEnoughArgumentsException();
}
String message = getFinalArg(args, 1);
String translatedMe = Util.i18n("me");
IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
if (args[0].equalsIgnoreCase(Console.NAME))
{
sender.sendMessage(Util.format("msgFormat", translatedMe, Console.NAME, message));
CommandSender cs = Console.getCommandSender(server);
cs.sendMessage(Util.format("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(cs);
Console.getConsoleReplyTo().setReplyTo(sender);
return;
}
List<Player> matches = server.matchPlayer(args[0]);
if (matches.isEmpty())
{
sender.sendMessage(Util.i18n("playerNotFound"));
return;
}
charge(sender);
for (Player p : matches)
{
sender.sendMessage(Util.format("msgFormat", translatedMe, p.getDisplayName(), message));
if (sender instanceof Player && ess.getUser(p).isIgnoredPlayer(((Player)sender).getName()))
{
continue;
}
p.sendMessage(Util.format("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(p));
ess.getUser(p).setReplyTo(sender);
}
}
}

View File

@@ -0,0 +1,42 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandmute extends EssentialsCommand
{
public Commandmute()
{
super("mute");
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
User p = getPlayer(server, args, 0);
long muteTimestamp = 0;
if (args.length > 1)
{
String time = getFinalArg(args, 1);
muteTimestamp = Util.parseDateDiff(time, true);
}
p.setMuteTimeout(muteTimestamp);
charge(sender);
sender.sendMessage(
p.toggleMuted()
? (muteTimestamp > 0
? Util.format("mutedPlayerFor", p.getDisplayName(), Util.formatDateDiff(muteTimestamp))
: Util.format("mutedPlayer", p.getDisplayName()))
: Util.format("unmutedPlayer", p.getDisplayName()));
}
}

View File

@@ -0,0 +1,105 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandnick extends EssentialsCommand
{
public Commandnick()
{
super("nick");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
if (args.length > 1)
{
if (!user.isAuthorized("essentials.nick.others"))
{
user.sendMessage(Util.i18n("nickOthersPermission"));
return;
}
setOthersNickname(server, user, args);
return;
}
String nick = args[0];
if ("off".equalsIgnoreCase(nick) || user.getName().equalsIgnoreCase(nick))
{
user.setDisplayName(user.getName());
user.setNickname(null);
user.sendMessage(Util.i18n("nickNoMore"));
return;
}
if (nick.matches("[^a-zA-Z_0-9]"))
{
user.sendMessage(Util.i18n("nickNamesAlpha"));
return;
}
for (Player p : server.getOnlinePlayers())
{
if (user == p)
{
continue;
}
String dn = p.getDisplayName().toLowerCase();
String n = p.getName().toLowerCase();
String nk = nick.toLowerCase();
if (nk.equals(dn) || nk.equals(n))
{
user.sendMessage(Util.i18n("nickInUse"));
return;
}
}
charge(user);
user.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
user.setNickname(nick);
user.sendMessage(Util.format("nickSet", user.getDisplayName() + "§7."));
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
setOthersNickname(server, sender, args);
}
private void setOthersNickname(Server server, CommandSender sender, String[] args) throws Exception
{
User target = getPlayer(server, args, 0);
String nick = args[1];
if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
{
target.setDisplayName(target.getName());
target.setNickname(null);
target.sendMessage(Util.i18n("nickNoMore"));
}
else
{
target.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
target.setNickname(nick);
target.sendMessage(Util.format("nickSet", target.getDisplayName() + "§7."));
}
sender.sendMessage(Util.i18n("nickChanged"));
}
}

View File

@@ -0,0 +1,31 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
public class Commandpay extends EssentialsCommand
{
public Commandpay()
{
super("pay");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", ""));
for (Player p : server.matchPlayer(args[0]))
{
User u = ess.getUser(p);
user.payUser(u, amount);
}
}
}

View File

@@ -0,0 +1,20 @@
package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandping extends EssentialsCommand
{
public Commandping()
{
super("ping");
}
@Override
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
{
player.sendMessage(Util.i18n("pong"));
}
}

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