1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 17:53:00 +01:00

Compare commits

...

577 Commits

Author SHA1 Message Date
GJ
7dbb61fad8 Refactoring to match Master branch. 2012-05-16 07:48:44 -04:00
GJ
b1c2616b0e Cleaner way to cancel egg events. 2012-04-19 18:16:19 -04:00
GJ
b9b91403dd Added direct hit effects for all the staves.
*Basic framework for Staves is now done.*
2012-04-19 18:16:19 -04:00
GJ
7f9d5d0183 Changed alt-fire on staves to all use the same function. 2012-04-19 18:16:18 -04:00
GJ
b878d29386 Must have only 1 stave in hand for it to work - no stacks. 2012-04-19 18:16:18 -04:00
GJ
6c70f9e677 Implemented XP drain/transfer for bone alt-fire. 2012-04-19 18:16:18 -04:00
GJ
136debfee5 Accidentally left in some debug stuff. 2012-04-19 18:16:18 -04:00
GJ
abe01a84e5 Eggs no longer spawn chickens. :D 2012-04-19 18:16:18 -04:00
GJ
1b15828d08 More work on Staves. 2012-04-19 18:16:18 -04:00
GJ
45974d2a19 Moved more of the Staves checks into Staves.java, rather than the
mcEntityListener.
2012-04-19 18:16:18 -04:00
GJ
2bf1563b20 Implemented slow/speed effects for Stick alt-fire. 2012-04-19 18:16:18 -04:00
GJ
4965cb2b68 Changed to have all alt-fire be a projectile. Need to implement on-hit
effects.
2012-04-19 18:16:17 -04:00
GJ
00fc5b93d2 Started work on new Staves skill. 2012-04-19 18:16:17 -04:00
GJ
b86d76fcd4 Minor tweaks. 2012-04-19 12:01:38 -04:00
GJ
4f1ee03fe8 Changed Iron Grip slightly. Tweaked Inspect to prevent same bug with {0}
showing up in front of power level.
2012-04-19 09:32:14 -04:00
GJ
e3267f2e0c Added Iron Grip skill to Unarmed which gives players an chance to keep
from being disarmed.
2012-04-18 23:34:46 -04:00
GJ
c265aad6d7 Abstract the chat events a bit. 2012-04-18 17:01:17 -04:00
nossr50
b512fe2003 Made changes to the tree feller threshold 2012-04-18 12:53:02 -07:00
NuclearW
46648e2547 Added ChatAPI
Allows an external plugin to send admin and party chat
In addition to previous events allows for full control of the chat channels
2012-04-18 13:18:25 -04:00
NuclearW
54e945bf14 Admin and Party chat events 2012-04-18 13:01:07 -04:00
NuclearW
7c01fced68 Admin chat dupe fix 2012-04-18 12:49:06 -04:00
NuclearW
64871b4c37 Fix formatting 2012-04-18 12:48:23 -04:00
GJ
e3e2def809 Fixed issue with negative XP on level up. 2012-04-18 08:19:49 -04:00
GJ
ea7d1ce0e2 Fixed issue with non-English locales not displaying power level with
/mcstats & /inspect
2012-04-17 22:17:56 -04:00
GJ
f5ddf1bc0e Fixed bug with only getting one level when there was enough XP for
multiple levels. Fixes MCCORE-191
2012-04-17 16:22:57 -04:00
GJ
f6a6316b7a Fixed bug with fishing treasures throwing an error when treasures list
is empty.
2012-04-17 15:21:23 -04:00
GJ
35f62d4e45 Fixed bug with Nether Wart not awarding XP. 2012-04-17 10:42:22 -04:00
GJ
77efbe39a9 Reverted to old locale strings in master - moved to new branch. 2012-04-17 10:28:13 -04:00
GJ
248f24d4b9 Locale changes, part 1. 2012-04-11 15:28:30 -04:00
GJ
32422646e4 More updates & fixes for party & admin chat. 2012-04-10 22:14:25 -04:00
nossr50
a90e4e9c8d Fixed bugs with Herbalism and permissions 2012-04-10 08:48:59 -07:00
GJ
74188415dd Temp fix for using /p & /a to send messages, fixes build errors. 2012-04-10 02:05:14 -04:00
GJ
11a4fdfcd5 Fixed party & admin chat handling 2012-04-10 01:52:06 -04:00
nossr50
7a119facdf Not entirely sure why passing a String instead of an int fixes this.. 2012-04-07 13:38:10 -07:00
nossr50
4e6cc5ffa0 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	Changelog.txt
2012-04-06 09:50:56 -07:00
nossr50
5a37e3e275 mcremove now works on offline users for flatfile and no longer kicks users 2012-04-06 09:49:20 -07:00
GJ
1edc32c6b0 Fixed bug with repairing wooden tools. 2012-04-05 14:45:35 -04:00
GJ
a01a5a737b More command updates. 2012-04-05 00:44:12 -04:00
GJ
0c22064a94 Cleaner way of doing the axe checks. 2012-04-04 23:30:56 -04:00
nossr50
9ef68d226a You'll need either Tree Feller or Skull Splitter permission to ready tool 2012-04-04 16:20:15 -07:00
GJ
bf361f6824 More command cleaning. 2012-04-04 18:35:39 -04:00
GJ
74ee210514 Fixed some possible errors if bad command arguments were used. 2012-04-04 16:12:13 -04:00
GJ
2b7f21fee4 Fixed nossr50's crappy merge. :D 2012-04-04 11:17:56 -04:00
nossr50
6ad32e487f Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java
2012-04-04 08:07:47 -07:00
nossr50
97fd3eaf64 Fixed mmoupdate not being useable from console 2012-04-04 08:05:41 -07:00
GJ
d9b4647cf5 Command updates 2012-04-04 11:04:09 -04:00
nossr50
03e0c02640 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	Changelog.txt
2012-04-04 08:01:16 -07:00
nossr50
398f8c4318 Daze now deals 4 DMG on proc to help make Archery hit harder 2012-04-04 07:59:37 -07:00
GJ
1c7709a18b Added perm checks to skill commands 2012-04-04 10:57:30 -04:00
nossr50
06c3a588bf Prevent duplicate profiles from being created 2012-04-04 07:46:57 -07:00
GJ
80526c0e06 More command updates, better offline player support. 2012-04-04 10:34:35 -04:00
GJ
86528334d1 Fixed some missing stuff in locale files. 2012-04-03 22:25:14 -04:00
GJ
1cc4f7eaaa Back to new development 2012-04-03 22:20:14 -04:00
GJ
af2a05d0b5 Minor changelog tweak. 2012-04-03 22:15:01 -04:00
nossr50
701daadff5 Getting 1.3.05 ready for release. 2012-04-03 18:31:35 -07:00
nossr50
7442d1c4a5 Fixed bug with mmoedit and offline users 2012-04-03 17:39:55 -07:00
nossr50
f247545fc4 Added 'Skill Shot' to Archery. Updated Archery command. 2012-04-03 14:36:55 -07:00
nossr50
e8817ec9ea Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-04-03 14:13:57 -07:00
nossr50
44d2466422 Updates to /mcmmo links & description 2012-04-03 14:13:34 -07:00
GJ
eb7a0143da More work on commands. 2012-04-03 16:13:16 -04:00
GJ
069e656cde Let's try this. 2012-04-03 15:50:22 -04:00
GJ
f1aa3f5c68 Fix for dupe exploit with Blast Mining 2012-04-03 15:33:57 -04:00
GJ
acc3d7610b More command updates. 2012-04-03 15:33:20 -04:00
nossr50
b2565bedd3 Redundant redundancy :D 2012-04-03 12:30:11 -07:00
nossr50
80c36ca846 Fix for inspect command throwing errors when players are in different
worlds
2012-04-03 12:05:39 -07:00
GJ
00e5e75092 Cleanup of AddXP command 2012-04-03 12:43:53 -04:00
GJ
c8b30b6714 Added permissions nodes for repairing wood, bows, and leather. 2012-04-03 12:34:59 -04:00
nossr50
2c4418e6e6 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-04-03 08:51:53 -07:00
GJ
d0e7e1bbb5 Added check for mobs spawning from Spawner Eggs to deny XP from
spawners.
2012-04-03 11:51:49 -04:00
nossr50
70ce762b5a Removing unused imports 2012-04-03 08:51:34 -07:00
nossr50
e879153df7 Some updates. 2012-04-03 08:49:14 -07:00
GJ
c9db9566cb Cleanup of the AddLevels command. 2012-04-03 11:39:59 -04:00
nossr50
a1283bfc0f Make titles update on levelup 2012-04-03 07:08:37 -07:00
nossr50
378de09ccd Fancy formatting for power levels titles 2012-04-03 07:03:42 -07:00
GJ
20febbc3bc Made power level display also include player name. 2012-04-03 09:27:17 -04:00
GJ
3b0ba43e94 Added config value to enable/disable power level display w/ Spout 2012-04-03 02:52:04 -04:00
GJ
c189a6b489 Removing debug code. 2012-04-03 01:17:25 -04:00
GJ
2082c479f1 Debug testing for BlockBreak errors with Spout. 2012-04-03 00:56:05 -04:00
GJ
b70e868b5c *CLEANUP* - Party.java 2012-04-03 00:06:30 -04:00
GJ
24a50346db ACTUALLY made a power level cap. 2012-04-02 16:46:48 -04:00
GJ
b84a03082e Added ability to cap overall power level. 2012-04-02 13:45:49 -04:00
nossr50
e40e10da61 Some WIP work on Archery, most noteably a damage boost per 50 skill lvl 2012-04-02 04:41:04 -07:00
GJ
6a858dace7 Fixed calculating party bonus XP when players are in different
worlds throwing errors.
2012-04-01 16:30:16 -04:00
GJ
b0fbaa71bf Runnables cleanup 2012-04-01 00:11:57 -04:00
GJ
18a2b686c1 Events cleanup. 2012-03-31 22:20:35 -04:00
GJ
a2f23bd056 More cleanup. Done with Datatypes. Lack Events, Runnables, and...
Commands.
2012-03-31 19:00:41 -04:00
GJ
bb5a9826bc Assorted cleanup. 2012-03-31 18:19:24 -04:00
GJ
9904eb0b0d Assorted cleanup. 2012-03-31 16:40:06 -04:00
GJ
f89f215813 Unfixing my fix. Sorry for not properly checking that before I pulled
it.
2012-03-31 15:39:09 -04:00
GJ
d01bd487f7 *CLEAANUP* - SkillType.java 2012-03-31 15:37:57 -04:00
Grant
3be31dbf90 Merge pull request #195 from fletchto99/master
Static player profile
2012-03-31 09:51:46 -07:00
Fletch to 99
bb1bce879f Update src/main/java/com/gmail/nossr50/mcMMO.java 2012-03-31 12:38:41 -03:00
GJ
dd6082c8a1 Add ability to fire level-up event & notification with ExperienceAPI 2012-03-30 01:01:48 -04:00
GJ
be6d208b8b Changelog update 2012-03-29 23:09:32 -04:00
GJ
f547523c3e Heh, API functions shouldn't be static... 2012-03-29 23:08:51 -04:00
GJ
7de19f8087 Another typo fix with permissions 2012-03-29 22:35:44 -04:00
nossr50
dfdf8b881e Updated changelog. 2012-03-29 18:47:02 -07:00
nossr50
da6755f703 I always forget to add the new file ;_; 2012-03-29 18:44:30 -07:00
nossr50
602bde7bc5 A fix for Spout disabling itself 2012-03-29 18:43:53 -07:00
GJ
e9d1297c17 Fixed bug where Skull Splitter & Serrated Strikes could be used without
permissions.
2012-03-29 18:38:59 -04:00
GJ
8bbee7fe06 Moved some stuff around, added a few functions to PartyAPI 2012-03-29 16:13:43 -04:00
GJ
8b4c86c8ba Fixed some issues with calculating drop chances. 2012-03-29 15:23:12 -04:00
GJ
6c1ee24101 Tweaked some stuff with adding XP, added an ExperienceAPI class. 2012-03-29 14:24:41 -04:00
GJ
26ed6aa840 Fixed issue where adding XP via command without specifying a player
didn't trigger level-ups.
2012-03-29 12:03:29 -04:00
GJ
ef3802f7c2 Fixed bug with non-Spout users trying to update the XP Bar. 2012-03-29 10:44:37 -04:00
GJ
3c9e38d7ad Helps to include the new file. 2012-03-29 10:05:04 -04:00
GJ
2e4aeca0df Moved Party API functions to their own file. 2012-03-29 10:04:48 -04:00
GJ
fd6bf931fc Changed naming for Repair events to be more consistent 2012-03-29 01:41:43 -04:00
GJ
751b795417 Changed bypass node for Arcane Forging to not default to true for OPs 2012-03-29 01:36:51 -04:00
nossr50
8b07b189d4 Fixed XP Bar 2012-03-28 19:45:34 -07:00
GJ
6c6fb117ea Fixed bug where wolves spawned with Call of the Wild only had 8 health 2012-03-28 22:24:32 -04:00
GJ
6fffe10c32 Fixed bug with repairing wooden tools. 2012-03-28 15:53:55 -04:00
GJ
a2d5b97467 Changed Woodcutting durability calulations to ignore leaves and include
abilityDurabiltyLoss
2012-03-28 14:37:17 -04:00
GJ
1cda446063 Back to active development. (1.3.05-dev) 2012-03-28 02:14:11 -04:00
GJ
a5af583a29 Fixed typos in the Party help display 2012-03-28 01:42:42 -04:00
nossr50
4d4638feea Updated POM 2012-03-27 22:33:42 -07:00
GJ
ef3d76fb9f Fixed bug where you could TP to dead players 2012-03-27 23:04:00 -04:00
GJ
5e12979f09 Fix my fix for the BlockBreak event changes (reverted). 2012-03-27 22:54:56 -04:00
GJ
cd64b60ece Fix for some API functions not being callable. 2012-03-27 22:51:12 -04:00
GJ
13951e5806 Fixed NPE due to McMMOPartyChangeEvent. 2012-03-27 19:47:20 -04:00
GJ
6cfc8c7a52 Fixed bug with gaining infinite levels. (Oops.) 2012-03-27 17:12:38 -04:00
GJ
fd6610f966 Added McMMOPartyChangeEvent for API usage - fires whenever a player
joins or leaves a party
2012-03-27 17:09:23 -04:00
GJ
aaa63a7f5d Added McMMOPartyTeleportEvent for API usage - fires before a successful
teleportation would occur.
2012-03-27 15:57:37 -04:00
GJ
f786c4db50 Fixed typo in PlayerProfile that was causing NPEs 2012-03-27 15:32:51 -04:00
GJ
87a0c0b0b6 Changelog update. 2012-03-27 14:52:34 -04:00
GJ
8cfae368c3 ACTUALLY fixed issue with Disarm never working. 2012-03-27 14:52:09 -04:00
GJ
f19b8a88d5 Fixed issue with Disarm never working. 2012-03-27 14:48:36 -04:00
GJ
ac384c5d95 More cleanup on PlayerProfile.java 2012-03-27 14:41:19 -04:00
GJ
83c326fb39 Fixed a rather "critial" typo. 2012-03-27 13:34:28 -04:00
GJ
be31d03733 Fixed typo. 2012-03-27 12:32:42 -04:00
GJ
0fcba5f1ee Fixed spacing issue with /mcc command 2012-03-27 08:51:17 -04:00
GJ
d1041c30db Fixed IllegalArguementException in Fishing when the result stack didn't
have a max durability.
2012-03-27 07:51:30 -04:00
GJ
1642c61b7f Cleanup on PlayerProfile - down to 1228 lines now. :D 2012-03-27 02:33:35 -04:00
GJ
2ff5f2eb46 Rearranged event package structure. 2012-03-27 01:09:28 -04:00
GJ
af4ba976d9 Added McMMOPlayerRepairCheckEvent for API usage - fires before repair
process begins, can be cancelled.
2012-03-27 00:56:31 -04:00
GJ
3fc5a167a4 Added ability to get skill level from McMMOPlayerSkill events 2012-03-27 00:18:04 -04:00
GJ
933449f16b Added ability to get skill level from McMMOPlayerExperience events. 2012-03-27 00:14:20 -04:00
GJ
dd170ec7ef Fixed issue with repair event not returning the proper repair amount. 2012-03-26 23:58:48 -04:00
GJ
2d3b01ba34 Assorted event updates. Created new McMMOPlayerRepairEvent for when a
repair is completed.
2012-03-26 23:01:51 -04:00
GJ
6a8737547f Updates to PlayerProfile.java 2012-03-26 17:31:26 -04:00
nossr50
ae8997b4f3 HUDmmo.java cleanup (formatting stuff, comment removal) 2012-03-26 14:24:11 -07:00
GJ
65e3384a96 Prep for mcLocale update. 2012-03-26 16:17:35 -04:00
GJ
945fb5ed55 Random update. :D 2012-03-26 11:04:17 -04:00
GJ
ca2949dcaf Changelog update 2012-03-26 10:03:56 -04:00
GJ
7b22c6232d Fixed summoned ocelots never changing skins. (Thanks Xackery!) 2012-03-26 10:03:05 -04:00
GJ
3ec5894249 Generic cleanup. 2012-03-26 09:06:48 -04:00
GJ
77462888ff Moved anvil placement handling into Repair.java 2012-03-25 16:26:40 -04:00
GJ
0ee05687d9 Removed old block place workaround code. 2012-03-25 16:13:29 -04:00
GJ
d8dbce7cc9 Updates to Italian locale file. 2012-03-24 23:17:14 -04:00
GJ
adea5a5674 Fixed Green Terra & Super Breaker awarding 4x drops at high levels. 2012-03-24 00:58:46 -04:00
GJ
443b4a193c Fixed Shake dropping bonemeal from Squids.
Stupid DyeColor enum...
2012-03-23 22:30:56 -04:00
nossr50
46c31e1abb Trying to fix formatting... 2012-03-23 12:37:13 -07:00
nossr50
46cdfe992f Version is now 1.3.04-dev modified comments/changelog 2012-03-23 12:34:23 -07:00
nossr50
752cc88270 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-23 12:30:55 -07:00
nossr50
d1f13ddec0 Made MySQL reload all profiles on reconnect, modified
RemoveProfileFromMemoryTask
2012-03-23 12:30:27 -07:00
GJ
5af856a2a0 Updating to for 1.3.03 release. 2012-03-23 00:33:04 -04:00
GJ
ea9c6f4d44 Whoops, typo. 2012-03-22 23:33:11 -04:00
nossr50
631b2342b9 Removing some unused imports from m.java 2012-03-22 15:33:15 -07:00
nossr50
189ae6fcdb Moved convertToMySQL() into MmoupdateCommand class 2012-03-22 15:32:31 -07:00
nossr50
7d70edc0ff Fixing small mistake with grabbing offline profiles 2012-03-22 14:31:48 -07:00
nossr50
9bfbf85b4b Optimizing how we save PlayerProfiles a bit 2012-03-22 14:28:22 -07:00
nossr50
ab50b32f60 We don't want to pass a lowercase playerName to new PlayerProfiles yet... 2012-03-22 14:19:35 -07:00
nossr50
fc4709fe27 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-22 13:59:12 -07:00
nossr50
2cf789d7bf Added console functionality to mctop 2012-03-22 13:58:54 -07:00
GJ
8aad439e99 Fixed Archery pulling the guide string for Axes. 2012-03-22 16:56:35 -04:00
nossr50
0f1f124eb5 Removing unused variables and imports from mmoedit 2012-03-22 13:45:25 -07:00
nossr50
bb06e193bc Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-22 13:43:19 -07:00
nossr50
4377716474 Fixed the bug with mmoedit and mcstats, reworked PlayerProfile hashmaps to
be stored by String instead of Player
2012-03-22 13:42:44 -07:00
GJ
cab9850fe3 Fixed saplings dropping WAY too often from Woodcutting. 2012-03-22 16:36:54 -04:00
nossr50
5ae15bfb71 Fixed exception error when editing offline player with mmoedit 2012-03-22 13:18:59 -07:00
nossr50
1ca57df0c0 Removed 'true/false' debug message from Inspect command 2012-03-22 13:15:19 -07:00
nossr50
86cfa5dcb2 Changes to POM, version is now 1.3.03-dev 2012-03-22 13:00:57 -07:00
nossr50
3c42dd69d5 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-22 12:59:52 -07:00
nossr50
39620f1aab Changes to MySQL reconnection stuff and OnDisable() 2012-03-22 12:59:26 -07:00
GJ
60cbf7b8b9 Fixed bugs with metadata checks. Super Breaker now works again. 2012-03-22 15:48:11 -04:00
GJ
a630022bf0 Generalized some taming stuff to work with Ocelots. 2012-03-22 11:07:20 -04:00
GJ
cd53ba04b0 Updates to Italian locale file. 2012-03-22 09:49:07 -04:00
GJ
b55e9c5c0d Updated FakeBlockBreakEvent to align with recent Bukkit changes. 2012-03-21 21:06:28 -04:00
GJ
6887ddd570 Minor cleanup. 2012-03-20 22:51:02 -04:00
GJ
f2be996e3d Update to SpoutStuff.java 2012-03-20 22:33:58 -04:00
GJ
664c9d9953 mcMMO - now in Italian! 2012-03-20 20:54:19 -04:00
GJ
0fa39c4ace Moved last few hashmaps to mcMMO.java & killed off Misc.java 2012-03-20 18:36:47 -04:00
GJ
9e604aed5e Fixed bug where some combat skills weren't taking into account all
damage modifiers.
2012-03-20 13:22:39 -04:00
GJ
6afcce4b7c Piston listeners weren't tracking the last pushed block. 2012-03-20 13:03:52 -04:00
GJ
3da8955f8a Fix for double drop exploit using pistons. 2012-03-20 00:45:01 -04:00
GJ
49bb7ecba9 Fixed issue with RIGHT_CLICK_AIR & LEFT_CLICK_AIR not firing. 2012-03-19 23:03:48 -04:00
GJ
99e58039a2 MAJOR PERMISSIONS UPDATE. PLEASE CHECK PLUGIN.YML FOR DETAILS. 2012-03-19 22:05:17 -04:00
GJ
d2edbe207d More datatype cleanup. 2012-03-19 13:21:38 -04:00
GJ
05d16e7c15 Assorted datatype cleanup. 2012-03-19 12:54:33 -04:00
GJ
253d0ea4c8 Fixed an issue with Call of the Wild message display. 2012-03-18 23:17:43 -04:00
GJ
397c2cc488 Changelog update.
*IF YOU USE mySQL, YOU NEED TO REDO YOUR CONFIG FILE AS SOME OF THE
OPTIONS HAVE CHANGED*
2012-03-18 22:46:10 -04:00
GJ
4f0c55460d Fixed Excavation not rewarding XP. 2012-03-18 21:13:34 -04:00
NuclearW
8f2c424657 Move bleeding to mcBleedTimer
Put all the logic handling adding/removing/contains there and encapsulate our List
Additionally, should prevent a ConcurrentModificationException by locking, but I'm not 100% on the contiains not throing such an exception.
2012-03-18 16:59:35 -04:00
GJ
b10f599a87 Updates to configs. 2012-03-18 16:35:47 -04:00
GJ
c1cdba4395 clear() is better. 2012-03-18 15:28:41 -04:00
GJ
bc725f46e8 Cleaned up the way we handle bleed tracking. 2012-03-18 15:22:12 -04:00
GJ
6b99d3e5f1 Cleanup of LoadProperties, changed around a few message strings. 2012-03-18 01:42:56 -04:00
GJ
92cc494087 *CLEANUP* - Unarmed.java 2012-03-17 12:52:48 -04:00
GJ
3bb7b05d80 Fixed Lapis dropping the wrong thing (stupid DyeColor enum...) 2012-03-17 12:22:42 -04:00
GJ
ed65842e3d No longer need to specify amount if creating ItemStack of 1 item. 2012-03-16 13:45:30 -04:00
GJ
be4abefd55 More cleanup to Woodcutting. 2012-03-16 13:33:03 -04:00
GJ
9e7209ff47 *CLEANUP* - Woodcutting.java
Also includes a few other minor fixes.
2012-03-16 11:30:23 -04:00
GJ
71d47eacaa Removed lingering traces of old block tracking method. 2012-03-15 17:29:27 -04:00
GJ
ebc87f46f7 Cleanup to Repair.java, fixed bug of Herbalism double drops failing,
fixed bug with Super Repair calculations.
2012-03-15 13:11:56 -04:00
GJ
558e4f4dd0 Added config option to disable wheat replanting. 2012-03-15 10:24:42 -04:00
GJ
3109ee9c2a Start of cleanup on Repair.java - will finish when it's not 3am 2012-03-15 03:10:40 -04:00
GJ
bb5d003430 Updates to metadata, change to use block.getRelative in Woodcutting.java 2012-03-15 00:52:37 -04:00
GJ
058cc3aac9 Changed placed block tracking to use metadata! 2012-03-14 23:31:56 -04:00
GJ
43ff0fa41a Fixed bug with Green Terra not activating 2012-03-14 16:24:14 -04:00
GJ
ab8f1a4ea6 Assorted cleanup, fixed bug with abilities not working. 2012-03-14 13:33:00 -04:00
GJ
9ef1c3b5bf Cleaned up the fishing enchantment checks. 2012-03-14 11:43:18 -04:00
GJ
ea2615aeae Derp. Forgot a file. 2012-03-14 02:10:16 -04:00
GJ
0a927768f5 Fix some issues from the merge. 2012-03-14 02:04:00 -04:00
Grant
1470feb958 Merge pull request #193 from bm01/master
Fix for combat XP gain
2012-03-13 20:46:29 -07:00
GJ
5a54d6e0c5 *CLEANUP* - Swords.java 2012-03-13 15:55:42 -04:00
GJ
dc6a2b654e Assorted cleanup. 2012-03-13 14:09:32 -04:00
GJ
a3da6b7df5 *CLEANUP* - Mining.java 2012-03-13 03:31:07 -04:00
GJ
2c417d28c5 Cleanup on Fishing.java, implemented some Enum values elsewhere. 2012-03-13 03:00:49 -04:00
GJ
71e09423fe Made it so you leave your party if you enter a world where you don't
have party permissions. Also removed some unused stuff from
PlayerProfile.
2012-03-12 22:07:35 -04:00
GJ
0070333b35 *CLEANUP* 2012-03-12 17:57:44 -04:00
GJ
49bb3e0a3c Misc. cleanup, removed old Logger.getLogger stuff.
Logger.getLogger() replaced with Bukkit.getLogger()
2012-03-12 17:28:13 -04:00
GJ
787ee0220a *CLEANUP* - Acrobatics.java & Archery.java 2012-03-12 12:45:03 -04:00
GJ
0093f769f0 Fixed issue with Acrobatics Dodge checks. 2012-03-12 03:26:39 -04:00
GJ
46d0b50c52 Fix endless loop with FoodLevelChange events. 2012-03-12 02:28:24 -04:00
GJ
3e0cc358d0 Fix for Acrobatics leveling exploit - Fixes MCCORE-74 2012-03-12 01:45:08 -04:00
GJ
0a8d34a21f *CLEANUP* - mcSpoutListener.java & mcSpoutScreenListener.java 2012-03-11 01:39:14 -05:00
GJ
def65282dd *CLEANUP* - mcSelfListener.java & mcSpoutInputListener.java 2012-03-11 01:19:19 -05:00
GJ
4359dc764f *CLEANUP* - mcPlayerListener.java
Also moved some stuff around to more appropriate files, created classes
for a few Runnables, and mcLocale'd a couple of strings.
2012-03-10 22:21:53 -05:00
GJ
28c590f079 *CLEANUP* - mcEntityListener.java 2012-03-10 20:15:55 -05:00
GJ
989f12e65b Fixed NPE when breaking placed Herbalism blocks. 2012-03-10 15:43:48 -05:00
GJ
ce8ddded92 Major updates to Herbalism. 2012-03-10 13:03:31 -05:00
GJ
5d55af8183 Fixed Green Terra not working. 2012-03-10 00:20:51 -05:00
nossr50
358c333c70 Merge pull request #194 from bm01/experimental
Alert lone players trying to speak in party chat
2012-03-09 18:44:17 -08:00
bm01
d391d12ab5 Alert lone players trying to speak in party chat 2012-03-10 03:15:29 +01:00
NuclearW
f5a559efa6 Lets add some CONFIG to that cooldown 2012-03-09 19:54:56 -05:00
nossr50
0c8b944b12 Lets add some RED to that message 2012-03-09 16:42:15 -08:00
nossr50
7ff02e51f5 Fixing maths 2012-03-09 16:41:29 -08:00
nossr50
a40d3f5f9c PTP now has a 30 second cooldown from when you were last hurt 2012-03-09 16:40:39 -08:00
GJ
3eb8f6a1a4 Fixed one more thing. 2012-03-09 19:28:33 -05:00
GJ
132388fe3f Fix for stuff not breaking right.
Still an issue with Herbalism & Green Terra, though.
2012-03-09 19:19:49 -05:00
nossr50
0d14918946 .triggerCheck() is only called when it needs to be (NoCheat fix) 2012-03-09 16:11:24 -08:00
bm01
7c3b6b9fb3 Fix for combat XP gain 2012-03-09 22:03:40 +01:00
GJ
37b5991dcc Sand/gravel exploit fix. 2012-03-09 14:00:34 -05:00
GJ
09044016cd Fixed a few issues in mcBlockListener. 2012-03-09 12:43:50 -05:00
nossr50
577badf4d8 Fixed ArrayIndexOutOfBounds with mmoedit 2012-03-09 02:02:45 -08:00
GJ
de1539ac1d Cleanup. 2012-03-09 01:44:29 -05:00
GJ
6e8cfe5ec9 Assorted bug fixes & cleanup. 2012-03-09 01:24:09 -05:00
nossr50
9dfcbf1797 Triple Drop fix 2012-03-08 22:22:25 -08:00
nossr50
74b7aa5340 Added permission node to bypass Arcane Repair and keep enchantments 2012-03-08 18:58:50 -08:00
nossr50
0441b062bd Whoops.. 2012-03-08 18:24:16 -08:00
nossr50
24bdd10f7f PTP Exploit fix attempt #2 2012-03-08 18:23:04 -08:00
nossr50
8669582e8f PTP exploit fix 2012-03-08 18:00:43 -08:00
nossr50
d0f66ece98 Fixing a message with /inspect 2012-03-08 17:53:54 -08:00
nossr50
1107e9f36a Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	Changelog.txt
2012-03-08 17:07:34 -08:00
nossr50
95c15df184 Making mctop update for MySQL when mmoedit is used 2012-03-08 17:06:26 -08:00
GJ
c3e1cf8681 Another leak... 2012-03-08 18:15:14 -05:00
GJ
d393e4d124 Cleanup & a few memory leak fixes. 2012-03-08 18:09:31 -05:00
GJ
bce418bee8 Cleanup. 2012-03-08 17:26:13 -05:00
GJ
052e3cd997 More cleanup. 2012-03-08 16:55:43 -05:00
GJ
9eb5535c75 Fixed the NPE PlayerInteractEvent. 2012-03-08 16:30:50 -05:00
GJ
e9e7d462f7 More generic cleanup. 2012-03-08 16:18:03 -05:00
TheYeti
88ab232ccd Undo Taming fix, attempt fix of block interact NPE 2012-03-08 12:11:09 -08:00
TheYeti
714f829f3e Fix for CraftOfflinePlayer in Taming yet again 2012-03-08 11:33:27 -08:00
NuclearW
7a549ce211 Return after we cancel an event
For EntityDamageByEntity and EntityDamage
2012-03-08 13:22:14 -05:00
nossr50
63bdc16e2f Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-07 16:03:21 -08:00
nossr50
7e9aada919 More fixes 2012-03-07 16:03:02 -08:00
NuclearW
4805097a0c Remove lots of redundant license prefixes from files 2012-03-07 16:53:54 -05:00
nossr50
86e4a4344b Am dissapoint GJ 2012-03-07 13:50:14 -08:00
GJ
9f3e7ba11c Fixed stuff being in wrong package. Start of cleanup to m.java. 2012-03-07 16:38:48 -05:00
GJ
3301fc3d9d Leaderboard.java cleanup 2012-03-07 09:05:08 -05:00
GJ
653e06dd03 Database.java cleanup 2012-03-07 01:42:43 -05:00
GJ
a8aed1bf02 Add Bookshelves to list of blocks that don't trigger abilities.
Increases compatibility with FalseBook & CraftBook.
2012-03-07 00:43:50 -05:00
GJ
d10ff590ec Cleanup on Item.java 2012-03-06 23:43:57 -05:00
GJ
b86cfb595c Whitespace & other formatting fixes for Combat.java 2012-03-06 22:50:36 -05:00
GJ
6733eb93f2 The start of the great whitespace cleanup. 2012-03-06 18:02:33 -05:00
TheYeti
e822515403 Configuration options for MCCORE-16 2012-03-06 14:50:18 -08:00
nossr50
b6a1188bc7 mmoedit now works on offline players 2012-03-06 13:46:04 -08:00
GJ
d401a69560 Fixed NoCheat issue (again). 2012-03-06 14:27:34 -05:00
GJ
798cc3bbb3 Optimizations for Mining & Blast Mining 2012-03-06 01:48:45 -05:00
GJ
e1644d3c08 Changed Blast Mining & Mining to use the same drop function. 2012-03-05 23:29:05 -05:00
GJ
36a706b7b6 Fix for Blast Mining not always activating bonuses. 2012-03-05 21:57:46 -05:00
GJ
36d6221b3b Fixes some Blast Mining stuff. Still issues due to changes in internal
math calculations somewhere...
2012-03-05 18:01:56 -05:00
GJ
99bff1a4f9 Wolf summoning now correctly uses up the bones.
Now to figure out why Ocelot summoning isn't using up the fish.
2012-03-05 01:25:24 -05:00
GJ
7dc1a2ba72 Fix for Ocelot Summoning - still need new locale string for summon
failure.
2012-03-05 00:42:18 -05:00
GJ
4d99fe7230 Fixed ClassCastException with Taming 2012-03-04 23:11:31 -05:00
GJ
dc9acbc3c9 Summon Ocelots! 2012-03-04 22:08:20 -05:00
nossr50
d121358ad2 Merge pull request #192 from bm01/master
Repair.addEnchants() messages fix and optimization
2012-03-04 13:52:30 -08:00
bm01
0295314dce Repair.addEnchants() messages fix and optimization 2012-03-04 22:15:45 +01:00
nossr50
5da59e6f0a Reworked abilityDurabilityLoss() to take an int as dmg dealt 2012-03-04 12:21:24 -08:00
nossr50
07296f14d7 Merge pull request #191 from botskonet/master
Adding db code to help avoid stale connections
2012-03-04 12:06:14 -08:00
Mike Botsko
0a8a843f6e Added autoReconnect props to database to resolve stale connection problems 2012-03-04 11:26:12 -08:00
GJ
3bc317e7b2 Enum more things, fixed some durability issues with abilities. 2012-03-04 03:54:26 -05:00
GJ
a83812d11a Added Ocelots to Taming XP tables. 2012-03-04 03:08:11 -05:00
nossr50
16451550b5 Updating other locale files. 2012-03-03 23:45:39 -08:00
nossr50
c2dc28c2bd Fixing Mining 2012-03-03 23:44:40 -08:00
GJ
c48ac9f596 Mining guide done.
We probably need to clean all these up a bit more later...
2012-03-04 02:41:14 -05:00
nossr50
dfba78a4cb Tweaked changelog 2012-03-03 21:42:28 -08:00
nossr50
a9eed7c31c Replaced unwritten guides with coming soon msg. 2012-03-03 21:36:58 -08:00
nossr50
a9a7719096 Another linebreak for Acrobatics. 2012-03-03 15:24:54 -08:00
nossr50
5038fbadb0 Acrobatics done. 2012-03-03 15:21:39 -08:00
nossr50
a85ca2c984 All thats left is to fill in the locale with information 2012-03-03 13:29:39 -08:00
nossr50
e6e7f10a05 Inform players when they type /skillname that there is a guide 2012-03-03 13:05:52 -08:00
nossr50
212f6ee773 Now you don't need to specify a page number. 2012-03-03 13:04:12 -08:00
nossr50
53d38cc54c Changed some wording for Excavation ? 2012-03-03 13:02:11 -08:00
nossr50
a53c8d5c64 Completed Excavation ? 2012-03-03 12:58:16 -08:00
nossr50
94a02c9a2e Manual merging commence... Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	src/main/resources/locale/locale_en_us.properties
2012-03-03 12:45:57 -08:00
nossr50
07699fa651 Excavation ? WIP 2012-03-03 12:43:50 -08:00
GJ
0aaf02f208 LOCALE ALL THE THINGS! 2012-03-03 14:48:40 -05:00
GJ
0dd9bc1cda Cleaned out more traces of old event system. 2012-03-03 14:13:33 -05:00
nossr50
ccfce843be Updated changelog. for loops > while loops 2012-03-03 10:39:18 -08:00
GJ
cb3bc755a6 Remove MySpawn info from locale files. 2012-03-03 13:35:01 -05:00
GJ
719081a77e Removed some unneeded imports. 2012-03-03 13:30:08 -05:00
nossr50
d1c4efa30d Finalized page system. Moved grabbing pages to Page.java. 2012-03-03 10:24:47 -08:00
nossr50
12fbaa4361 Wip of Skill Help pages, code is ugly but it works. 2012-03-03 09:54:16 -08:00
nossr50
abcd586daa Merge pull request #190 from bm01/master
Taming prevent damage fix
2012-03-03 07:08:16 -08:00
bm01
2f0a3eaadd Taming prevent damage fix 2012-03-03 15:15:30 +01:00
GJ
1814d52680 Starting work on skill help pages. (Excavation) 2012-03-03 01:22:52 -05:00
nossr50
d3ed6bb139 break; break; break; 2012-03-02 17:34:15 -08:00
GJ
8eaa58040e Fixed ShakeMob ability not working. 2012-03-02 20:04:15 -05:00
nossr50
04e2a212d1 Silly git 2012-03-02 16:55:54 -08:00
nossr50
fe7ca65f22 dealDamage() will now send fake EntityDamageEvent which mcMMO will ignore 2012-03-02 16:53:35 -08:00
nossr50
89ab87b6dd Fixed Greater Impact not dealing damage, nerf'd Axes critical chance. 2012-03-02 16:46:38 -08:00
nossr50
e933fbe1bd Removing debug message 2012-03-02 16:36:31 -08:00
nossr50
cb9a9282dd Moving the FakeEntityDamageByEntity event to the top of the listener 2012-03-02 16:34:35 -08:00
nossr50
14f1a91eeb Fixed PVE experience gains not leveling up skills 2012-03-02 16:24:28 -08:00
nossr50
1756031eda Changed pom ver # to 1.3.02 removed ocelots from Taming xp gain 2012-03-02 15:58:40 -08:00
nossr50
bccb321ce1 Fixing isInvincible() thanks bm01! 2012-03-02 15:52:33 -08:00
nossr50
920f091a85 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-02 15:39:14 -08:00
nossr50
c1103a52f0 Too many exploits, need to finalize this as a bugfix 1.3.02 2012-03-02 15:38:50 -08:00
nossr50
4f128ebbef Merge pull request #189 from bm01/master
Impact fix
2012-03-02 15:22:19 -08:00
bm01
3f5b2bdcee Impact fix 2012-03-02 23:22:41 +01:00
nossr50
288e82fbc3 Setup locale for Axe Splintering message 2012-03-02 12:39:18 -08:00
nossr50
feb073d159 Damage from failed Tree Feller is now random (but never kills) 2012-03-02 12:35:12 -08:00
nossr50
505df87014 Finalized durability stuff in tree feller. XP nerf only for jungle now. 2012-03-02 12:31:53 -08:00
nossr50
f6221c1c34 More tweaks to durability stuff in tree feller 2012-03-02 12:19:57 -08:00
nossr50
0a97c1dc62 Updating Tree Feller to use .getMaxDurability() API calls 2012-03-02 11:31:30 -08:00
nossr50
05cea84dcc Can only seem to make the axe splinter some of the time.. 2012-03-02 11:22:29 -08:00
nossr50
1ac544511c Added updateInventory() to Tree Feller 2012-03-02 11:07:20 -08:00
nossr50
292f14bf87 Updated changelog about tree feller 2012-03-02 11:02:55 -08:00
nossr50
ef17ea6231 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-02 11:02:05 -08:00
nossr50
75c49497ac Nerf tree feller XP. You need durability to use tree feller now. 2012-03-02 11:01:09 -08:00
GJ
f9b9dddbc8 Updates to Taming 2012-03-02 13:55:53 -05:00
GJ
5a8b9fc344 Changes to Blast Mining method calls. 2012-03-02 13:55:53 -05:00
nossr50
e9dae0d633 Changelog update 2012-03-02 10:30:10 -08:00
nossr50
1c866a52e5 Reworking our invincibility checks to accomodate for vanilla mc behaviour 2012-03-02 10:18:23 -08:00
nossr50
2f5edb6329 Removing redundancy 2012-03-02 09:40:04 -08:00
nossr50
30e5410906 Adding break; to switch in onEntityDamage 2012-03-02 09:37:55 -08:00
nossr50
4f2a0b8260 Updating onEntityDamageByEntity event listener 2012-03-02 09:35:52 -08:00
GJ
882a457484 Listen to EntityDamageByEntity subevents 2012-03-02 12:19:53 -05:00
GJ
ed5531d44b Cleanup EntityListener.java 2012-03-02 12:13:35 -05:00
GJ
b2989a8bab Added Ocelots to Taming XP tables. 2012-03-02 10:43:08 -05:00
GJ
c032a27d63 Changed Ignition to add fire ticks rather than replace them. (Thanks
bm01!)
2012-03-02 10:11:54 -05:00
GJ
353ceefd4e Changed POM to use latest build. 2012-03-02 10:04:20 -05:00
nossr50
9a7ea3b6d0 Fixed bug where Tree Feller had no cooldown whatsoever. GJJJJ!!!! 2012-03-01 15:52:21 -08:00
nossr50
6a79d9f244 Minor changelog tweak, don't bother promoting this one. 2012-03-01 14:26:40 -08:00
nossr50
2151fbb6c0 Finishing touches on BM 2012-03-01 14:15:16 -08:00
nossr50
3945a681a3 ENUM all the things! 2012-03-01 14:10:50 -08:00
nossr50
592382a5d3 When in doubt use a for loop 2012-03-01 14:09:06 -08:00
GJ
72bfe63ebf Minor tweak to Blast Mining. 2012-03-01 17:04:45 -05:00
nossr50
6d883821a8 Fix for Blast Mining XP (hopefully) 2012-03-01 14:02:23 -08:00
GJ
415786d67e XP gain for Blast Mining. 2012-03-01 16:50:54 -05:00
nossr50
d8aa3a5f14 Updated locale 2012-03-01 13:02:54 -08:00
nossr50
f5fc941916 Cooldowns for Blast Mining are now fully functional (BUILD IS SAFE AGAIN) 2012-03-01 13:01:41 -08:00
GJ
8254a8ab0f Updates to Blast Mining. 2012-03-01 15:33:03 -05:00
nossr50
fadbaf429d Beginning work on cooldowns for BlastMining (DO NOT USE THIS BUILD) 2012-03-01 12:20:35 -08:00
nossr50
a80507078d Taming locale updates 2012-03-01 11:42:44 -08:00
GJ
d13549ff6a Updates to Blast Mining. 2012-03-01 14:37:34 -05:00
nossr50
0f89a9e1e8 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-03-01 10:08:37 -08:00
nossr50
c8f2521670 Updated /mcmmo to be more useful and up to date 2012-03-01 10:08:13 -08:00
GJ
32135d5647 Removed Milking/Shearing from Taming - too easy to abuse 2012-03-01 12:24:30 -05:00
nossr50
dc5b37d560 Fix for dropping AIR 2012-03-01 08:34:56 -08:00
nossr50
e873902e1b Fixing another disarm bug (thanks bm01) 2012-03-01 08:03:29 -08:00
nossr50
fe21aa0aa9 Updating plugin.yml description nodes 2012-03-01 07:32:13 -08:00
GJ
19842ebc35 Update POM to use 1.1-R6 Bukkit 2012-03-01 10:15:12 -05:00
nossr50
ee1e128c5a Changed to dealDamage() 2012-03-01 06:48:59 -08:00
nossr50
d099bc562b Fixed Disarm not working ever 2012-02-29 16:27:58 -08:00
nossr50
69dfd5645a Fixing my fix of Unarmed command display 2012-02-29 16:16:38 -08:00
nossr50
5db7225bc4 Fixing skill messages, fixing unarmed command display 2012-02-29 16:13:15 -08:00
nossr50
80374333b6 Abilities send messages to nearby players when they wear off. 2012-02-29 16:04:31 -08:00
nossr50
885ec70d28 Updated locale 2012-02-29 15:45:09 -08:00
nossr50
8d00468412 Axes gains bonus DMG every 50 levels like Unarmed now. 2012-02-29 15:40:16 -08:00
nossr50
5d9ac614c2 That was too OP. Disarm is 1.5x the rate of 1.2.12 now. 2012-02-29 15:24:03 -08:00
nossr50
0f8a418efd More work on Impact. Tweaked Unarmed's disarm chance to be 2x better. 2012-02-29 15:22:03 -08:00
nossr50
ed2e9a993d Removing whitespace 2012-02-29 13:54:43 -08:00
nossr50
f689f048b2 Updated changelog again 2012-02-29 13:19:22 -08:00
nossr50
906bc01b91 Inspect now checks if player exists in Database 2012-02-29 13:02:24 -08:00
nossr50
4641e4701c Updating usage statistic to work with R5 2012-02-29 12:41:03 -08:00
nossr50
88e40080fb Making Inspect work on offline players 2012-02-29 12:33:33 -08:00
nossr50
e0fa23359f Removed /mcstats usage from console (use inspect instead) 2012-02-29 12:15:23 -08:00
nossr50
4ab71bcf36 Fixed inspect not working from console 2012-02-29 12:07:47 -08:00
nossr50
652a27eb38 Starting work on Impact subskill for Axes 2012-02-29 11:56:15 -08:00
nossr50
d56fe82bfd Updating changelog 2012-02-29 09:29:23 -08:00
nossr50
6c20df7839 Finished changes to Whois -> Inspect 2012-02-29 09:25:48 -08:00
nossr50
423eb97e0f Reverting casting in onEntityDeath 2012-02-29 09:23:04 -08:00
nossr50
0b43dd2747 Replacing Whois command with Inspect command 2012-02-29 09:20:58 -08:00
nossr50
f2fccd4a64 Add casting to onEntityDeath 2012-02-29 09:11:45 -08:00
GJ
a7292c3a2c Fixed typo in config.yml 2012-02-29 11:25:15 -05:00
GJ
0c1072f7cf Changes due to updates to EntityType returned by certain Entity events. 2012-02-29 11:03:24 -05:00
GJ
cea80f98e8 Updates for config files. 2012-02-29 10:45:55 -05:00
GJ
985e69c529 Fixes for Treasures config & Chimera Wing. 2012-02-29 09:59:25 -05:00
nossr50
a2b3e6fa83 Fixed treasures config NPE 2012-02-28 21:00:28 -08:00
GJ
ee986970fe Moving treasures to their own config file.
BUILD IS BROKEN, DO NOT USE.
2012-02-28 23:28:36 -05:00
nossr50
345fa122c5 Added info about the change to getDistance() to changelog 2012-02-28 19:50:18 -08:00
NuclearW
fae5693db8 Merge pull request #187 from bm01/replace-getdistance
Replacement of m.getDistance()
2012-02-28 19:45:16 -08:00
bm01
093f368545 Replaced m.getDistance() 2012-02-29 03:26:19 +01:00
nossr50
a41fc22899 Added MySpawn removal info to changelog 2012-02-28 16:52:47 -08:00
nossr50
5f51f7f9b0 Further removing MySpawn stuff 2012-02-28 15:19:43 -08:00
nossr50
de2a0403d2 Remove MySpawn from DB if exists 2012-02-28 15:15:03 -08:00
GJ
e2d13034a8 Kill it with fire, part 1 - MySpawn 2012-02-28 18:01:35 -05:00
GJ
e55006f662 Fixed the fact that myspawn would clear if you broke ANY bed (not just
your own) - Addresses MCCORE-50
2012-02-28 17:06:13 -05:00
GJ
64b46a88c9 Breaking a bed now clears your spawn, just as if you had used the
/clearmyspawn command.
2012-02-28 16:52:16 -05:00
nossr50
69b7c3077f Tweaked mcremove 2012-02-28 12:53:27 -08:00
nossr50
f158858262 Updated changelog. 2012-02-28 12:36:55 -08:00
nossr50
7aa7de75a2 Made mcremove work for FlatFile (sort of). 2012-02-28 12:33:57 -08:00
nossr50
6cc22a3b63 mcremove command is now fully functional for MySQL 2012-02-28 12:16:23 -08:00
nossr50
649ce1c147 Forgot to commit this, file renamed. 2012-02-28 11:19:12 -08:00
nossr50
1281843d45 Removing redundancy in most commands 2012-02-28 11:17:54 -08:00
nossr50
e31aea3492 Beginning work on mcremove 2012-02-28 11:05:48 -08:00
GJ
26e3403ff4 Fixed Call of The Wild & RIGHT_CLICK_AIR tool activation not working.
Apparently we can't use ignoreCancelled=true on PlayerInteractEvent...
2012-02-28 09:27:14 -05:00
GJ
e5922bf3e7 Fixed my brakes. >.< 2012-02-28 00:18:55 -05:00
GJ
2b9baaf0ea Possible fix for not registering right click air events. 2012-02-27 23:38:33 -05:00
GJ
8ad4e20cab Fixed leaving out a logical check for new skill processing. (Oops.) 2012-02-27 20:40:25 -05:00
GJ
1511c5737b Fixed missing return calls in ToolType.java 2012-02-27 17:37:43 -05:00
GJ
57bf414d59 OPTIMIZE ALL THE SKILLS!
Adds some cool enum features & cleans up Skills.java - may possibly
break some message displays for Axes & Woodcutting.
2012-02-27 17:28:47 -05:00
nossr50
16a0a3364a NPE fix for Bleed Simulation (hopefully) 2012-02-27 07:56:12 -08:00
nossr50
d09512373b Added an isConnected() method 2012-02-27 05:27:59 -08:00
nossr50
dfd1e311d1 Updated changelog 2012-02-27 05:23:56 -08:00
nossr50
26c9ba0c3b Major optimization to how MySQL connection is handled. 2012-02-27 05:20:55 -08:00
nossr50
d7d1d0b58d Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-27 03:53:46 -08:00
nossr50
a0ab16eaa7 Minor tweaks to BleedSimulate() 2012-02-27 03:53:15 -08:00
GJ
cae4b47538 Updates to Unarmed 2012-02-26 14:38:55 -05:00
GJ
dd445dbac5 Updates to Combat - Breaks R4 Compatability. 2012-02-26 14:38:03 -05:00
nossr50
4b26732f51 Removed redundancy 2012-02-26 04:15:50 -08:00
nossr50
bf38fc9819 Merge pull request #184 from bm01/master
Optimization in combatChecks()
2012-02-26 04:07:58 -08:00
bm01
aff6b0925f Optimization in Combat.java 2012-02-26 13:06:47 +01:00
GJ
a7f259ea3c Moved wolf damage checks to Taming.java 2012-02-26 02:38:07 -05:00
GJ
3a1ee58339 Added custom values for mob combat multipliers. 2012-02-26 01:53:54 -05:00
GJ
6b0c46b634 Minor updates/optimizations to PlayerListener 2012-02-26 00:05:32 -05:00
GJ
6b36a030f6 Added back updateInventory() methods.
Even though I updated old inventory methods it still needs these to
reflect the amounts removed...
2012-02-25 21:42:03 -05:00
nossr50
df92c43578 Tweaked changelog 2012-02-25 04:41:53 -08:00
nossr50
f481741bb5 This should make us fully NoCheat compatible. 2012-02-25 04:27:09 -08:00
nossr50
77b0dd725c Fixing unwanted block data changes 2012-02-25 04:07:07 -08:00
nossr50
f850c0ead6 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-25 03:51:49 -08:00
nossr50
7ad9b2ed58 Gutting out the old Party HUD. Lets make a new one. 2012-02-25 03:51:22 -08:00
GJ
695d76dcf4 ENUM ALL THE THINGS! 2012-02-25 02:49:53 -05:00
GJ
19ea6707fe Updated locale files to reflect increases to Blast Mining ore drops. 2012-02-25 00:26:10 -05:00
GJ
649bccb0d0 Added /addlevels command (Implements MCCORE-23) 2012-02-24 21:05:01 -05:00
GJ
73f1c08366 Blast Mining optimization 2012-02-24 18:25:24 -05:00
GJ
b98120192a Removed useless removal checks. 2012-02-24 12:14:35 -05:00
GJ
1cd7181d26 Minor tweaks & fixes. Changed Tree Feller to use custom item drop method
so we fire the event like we're supposed to.
2012-02-24 11:21:07 -05:00
nossr50
fb35e7dd5d Updating changelog. Fixing Herbalism command display. 2012-02-24 07:54:17 -08:00
nossr50
1c4275ce37 Misc formatting. Clarifying something in changelog. 2012-02-24 07:19:55 -08:00
nossr50
3ff9a28fa7 Fixed exploit in Tree Feller 2012-02-24 04:52:30 -08:00
nossr50
04f13ab090 Fixed Tree Feller dropping too many saplings 2012-02-24 03:41:43 -08:00
nossr50
e42b9db159 Fixed bug with Swords command display 2012-02-24 03:37:41 -08:00
nossr50
deb3a3bd48 Fixed bug with Leaf Blower & Tree Feller permission nodes 2012-02-24 03:03:19 -08:00
nossr50
6708947332 Tree Feller is faster. Added limit to tree feller.
Added Jungle Tree to Woodcutting XP Tables.
Renamed Pine to Oak. Modified default Woodcutting XP Tables.
2012-02-24 01:46:34 -08:00
GJ
1f0fcb119d Removed outdated inventory methods 2012-02-24 01:02:23 -05:00
GJ
bdb74d4719 Optimize even more things. 2012-02-23 23:04:41 -05:00
GJ
19ab8b89f5 More optimizing. 2012-02-23 22:26:20 -05:00
GJ
10fa9e5465 Optimize more things. 2012-02-23 21:44:44 -05:00
GJ
1fe259eb7a Archery optimizations. 2012-02-23 21:13:06 -05:00
GJ
cd56dc7f98 Updated changelog 2012-02-23 19:42:22 -05:00
GJ
8cf9601af4 More Repair optimizations. 2012-02-23 19:39:06 -05:00
GJ
b39c02154a Fix Leaf Blower not respecting Shears. (MCCORE-44) 2012-02-23 18:49:56 -05:00
GJ
a2e41f31ed Repair optimizations. LOTS of repair optimizations. 2012-02-23 18:32:32 -05:00
nossr50
5d8b049a45 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-23 10:24:15 -08:00
nossr50
336adf9530 Changed Unarmed to start with a damage bonus 2012-02-23 10:23:04 -08:00
GJ
708cfc23b6 Locale stuff for Blast Mining 2012-02-23 13:09:41 -05:00
NuclearW
06b2a89646 Move to external task
Only remove if we have it to remove
Only add if not already in memory
Don't load something we would immediately unload on removeUser
2012-02-23 11:48:48 -05:00
GJ
b782225dde Removed old Unarmed stuff from locale files. 2012-02-23 11:36:12 -05:00
nossr50
85640f88b2 Stop crying 2012-02-23 08:30:56 -08:00
nossr50
a372ca34e6 Changed how we remove PlayerProfiles to reduce lag 2012-02-23 08:27:36 -08:00
GJ
4acc0b63fd Try that again... 2012-02-23 09:07:51 -05:00
GJ
edf6f7560b Forced POM to update & stop build failures (I hope). 2012-02-23 09:06:00 -05:00
nossr50
66e0cc33bf Change ignition to use Maths 2012-02-23 06:03:49 -08:00
nossr50
498e3eb35c Dat 'y' 2012-02-23 05:44:55 -08:00
nossr50
2aa7e37e13 Reworked Unarmed to be easier to level 2012-02-23 05:38:50 -08:00
GJ
09c5b8727a Events no longer implement Serializable. 2012-02-23 08:31:07 -05:00
GJ
02a67e330a Removed deprecated CreatureType use. 2012-02-23 08:29:34 -05:00
nossr50
37364d6c86 More tweaks to Tree Feller 2012-02-23 01:59:00 -08:00
nossr50
86166a58e1 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-23 01:57:31 -08:00
nossr50
935e494705 Merge pull request #183 from bm01/master
Removed redundant if statement in WoodCutting.java
2012-02-23 01:57:16 -08:00
bm01
94387045e4 Removed redundant if statement 2012-02-23 10:34:34 +01:00
nossr50
20ae2dbeea Updated the changelog again 2012-02-23 00:15:40 -08:00
nossr50
d1b522b534 Green Thumb consumes seeds again
Fixes MCCORE-36
2012-02-23 00:13:55 -08:00
nossr50
89802e23e2 Abilities damage tools again.
Closes MCCORE-30
2012-02-23 00:10:22 -08:00
nossr50
cb4b5d1c71 Tree Feller damages the tool (again) 2012-02-22 23:42:03 -08:00
GJ
472bfa51da Fixed my fix (because Bukkit is stupid & durability counts up). 2012-02-23 02:26:44 -05:00
nossr50
162dbaed0f Removed unused methods from m.java 2012-02-22 23:17:05 -08:00
GJ
6f9fc26ab5 Changed tool ability damage to use built in Bukkit methods. 2012-02-23 02:12:24 -05:00
GJ
b199568ec3 Removed debug messages. 2012-02-23 00:50:45 -05:00
GJ
ff258e0cbf Update changelog. 2012-02-23 00:43:18 -05:00
nossr50
68dd18067e Shutting up an IDE warning. 2012-02-22 21:12:37 -08:00
nossr50
799e11c36c Added temp debug messages about mob spawn removal 2012-02-22 21:00:12 -08:00
nossr50
f274d47c81 Made Tree Feller much less aggressive. 2012-02-22 20:53:20 -08:00
nossr50
ca3b7f2172 Tree Feller now rewards xp based on the type of tree. 2012-02-22 20:25:03 -08:00
nossr50
22c9fca915 Reworked Tree Feller to take down entire tree. 2012-02-22 20:23:42 -08:00
nossr50
e4d312a11f Combat ignores events where entity is dead now. 2012-02-22 18:43:09 -08:00
nossr50
a3f0de1c84 Moved Taming stuff into Taming.java 2012-02-22 18:39:22 -08:00
NuclearW
4826056bbe Cleanup
Monitor is where events that don't need data before other plugins or to cancel go
Ignore cancelled events to respect other protection plugins saying "no"
We need to see if other events are depricated in the future
2012-02-22 19:51:06 -05:00
GJ
6f2f99dda0 Fix for IndexOutOfBounds issue (MCCORE-40) 2012-02-22 17:04:10 -05:00
GJ
d06ec5e452 Get Taming XP for milking cows. 2012-02-22 15:12:01 -05:00
GJ
94cb118a7e Should probably use getMaxHealth() instead of hardcoding... (Addresses
MCCORE-39)
2012-02-22 12:19:22 -05:00
GJ
bebc70634b Fixed Wolves having over max health due to Fast Food Service (Fixes
MCCORE-39)
2012-02-22 12:18:21 -05:00
nossr50
186c9189ca Updated changelog again 2012-02-22 08:35:13 -08:00
nossr50
324b69cba1 Fixed a memory leak I didn't even know about. 2012-02-22 08:32:29 -08:00
nossr50
802af464cd Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-22 08:30:21 -08:00
nossr50
0c8b46acee Change mobspawn track list to use entity id 2012-02-22 08:29:51 -08:00
GJ
182219f00d Added permissions node for Blast Mining - Addresses MCCORE-38 2012-02-22 10:59:39 -05:00
GJ
828f5ad173 Renamed StatsCommand.java to McstatsCommand.java to reflect change to
command name.
2012-02-22 10:27:16 -05:00
nossr50
95da5a4535 Updated changelog to include info about mcstats 2012-02-22 07:03:35 -08:00
nossr50
324bcd9b91 Fix for NPE with mcstats 2012-02-22 07:00:59 -08:00
GJ
98ed75e4e0 Cleaned up some command issues. Renamed /stats to /mcstats for less
plugin conflicts
2012-02-22 09:52:58 -05:00
GJ
3d5bb334f6 Removed all the old Alchemy/Enchanting/Sorcery stuff from the code. 2012-02-22 09:32:08 -05:00
NuclearW
c74f43a1ad Change Changelog to + = ! - system
Cleanup some unneded SuppressWarnings
Monitor is where events that we don't cancel go, also we ignore cancelled events
2012-02-22 06:19:18 -05:00
nossr50
f5451b7d59 Updated 2012-02-21 21:27:38 -08:00
nossr50
3dbaf061ed Added checks on world change for mcgod 2012-02-21 21:25:39 -08:00
nossr50
19ac0e6ba6 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-21 11:23:37 -08:00
nossr50
a509b0e9d3 Removed Master/Apprentice chat spam, and more..
Began modifying party command, still a WIP and probably not working
properly. Modified locale for Taming messages to trim them shorter.
2012-02-21 11:22:31 -08:00
GJ
5c63e9779e Added unlock levels for repairing Iron/Gold/Stone. Added configurable
ranks for Arcane Forging.
2012-02-21 14:19:11 -05:00
GJ
9ef9ffd16f Fishing now uses custom drops. ("Attack of the Giant Config File") 2012-02-21 13:11:06 -05:00
nossr50
93e223b2cc Fix for Taming not leveling up. 2012-02-21 08:54:06 -08:00
GJ
c4a0ae64aa Fixed Excavation not awarding XP unless you found a treasure. 2012-02-21 08:20:08 -05:00
NuclearW
933a7ffc69 4 != 5 2012-02-21 03:17:14 -05:00
GJ
b0253f9913 More fishing stuff. FISHING WILL BE BROKEN TEMPORARILY IN THIS BUILD. 2012-02-21 02:53:34 -05:00
GJ
7eb1d43201 Making fishing drops customizable (WIP) 2012-02-21 02:19:59 -05:00
NuclearW
1f843bc3a2 Validation 2012-02-21 01:31:52 -05:00
GJ
c17bc7d332 Derp. Added that to the changelog twice. 2012-02-21 01:07:37 -05:00
GJ
c308121c47 Added XP for Animal Taming 2012-02-21 01:01:27 -05:00
NuclearW
d0d9868b5f Change priority of sheep shearing
Cleanup
2012-02-21 00:35:09 -05:00
GJ
8f3dce4ee9 Started working on customizing Fishing drops 2012-02-21 00:26:16 -05:00
nossr50
de0a6dd3ee Something odd in PlayerProfile..commenting it out 2012-02-20 17:04:17 -08:00
nossr50
5d06341612 Modified locale to reflect Taming XP gain changes 2012-02-20 16:46:57 -08:00
nossr50
470b29c229 Forgot to change this to pull from the config file 2012-02-20 16:34:55 -08:00
nossr50
c915bb8312 Added Shearing to Taming XP 2012-02-20 16:29:03 -08:00
nossr50
f8869c177f Forgot to put this in the changelog 2012-02-20 15:56:11 -08:00
nossr50
c0a7b276b4 Made many changes to Bleeding. Capped max Bleed ticks at 10. 2012-02-20 15:54:30 -08:00
nossr50
fa35fd9e45 Added Fast Food Service to Taming (Healing) 2012-02-20 15:41:00 -08:00
nossr50
3f8077d615 Ch-ch-ch-CHANGES! (Updated changelog) 2012-02-20 15:07:44 -08:00
nossr50
3b9e85e976 NetherBrick is also not 'Mining' enough for Mining 2012-02-20 15:06:16 -08:00
nossr50
b024b45e02 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-02-20 14:59:12 -08:00
nossr50
a3cf3401bb Stone Brick isn't 'Mining' enough for Mining
Fixes MCCORE-32
2012-02-20 14:58:24 -08:00
GJ
bc12e0d100 Even more old stuff. (MCCORE-1) 2012-02-20 17:56:50 -05:00
GJ
96be29ef63 Removed more old stuff relating to Excavation drops Addresses MCCORE-1 2012-02-20 17:54:42 -05:00
nossr50
0f2029a32d Reorganized the changelog for 1.3.00-dev 2012-02-20 14:43:12 -08:00
nossr50
aa14c1bc1f Renamed Food+ to Farmer's Diet 2012-02-20 14:38:38 -08:00
nossr50
d052af9207 Completely removed HP Regen settings 2012-02-20 14:18:25 -08:00
NuclearW
ad2ed37d0a Change how we do custom drops
Beginnings of fishing drops
2012-02-20 17:10:37 -05:00
GJ
1943ce884a Updated changelog, removed unused import 2012-02-20 14:07:48 -05:00
GJ
b23fa36543 Allow for configuration of custom Excavation drops (WIP) - Addresses
MCCORE-1
2012-02-20 13:58:22 -05:00
GJ
887f8f3e0c Fixed backwards logic in ShakeMob. 2012-02-20 10:25:10 -05:00
GJ
227b554488 Finished removing unused properties from the config file. 2012-02-19 23:25:48 -05:00
nossr50
20064f36ef Removed the HP Regen setting from config since it's useless. 2012-02-19 20:22:17 -08:00
NuclearW
decdddb9ec Reorganized config.yml and cleaned up
Unfortunately, nobody will see our nice super-pretty config.yml copied out properly just yet
Fortunately, maven filtering dark magic lets us stick in when it was copied out.
2012-02-19 18:53:21 -05:00
NuclearW
1b0fac78ae Move version up
y u move down?
2012-02-19 18:29:57 -05:00
NuclearW
d864a2391e Fix levelcaps causing infinite loop
Resolves MCCORE-28
2012-02-19 14:53:07 -05:00
NuclearW
b08aead536 Changed Tree Feller to not rely on external ArrayList
Given Bukkit's behavior of events, it would have never been possible for more than one player's data to occupy the shared arraylist... Still looked ugly, though.
Also helps toward concurrent events, should they ever come.
Also moved from a static boolean flag to a per-use flag
Also removed unused static variable "w"
2012-02-19 00:54:56 -05:00
nossr50
cca04468de Rebalanced Herbalism hunger bonuses. 2012-02-18 12:51:07 -08:00
GJ
e997c32c6c Remove TNT from BlastMining list onBlockBreak (when not broken by Flint
& Steel)
2012-02-18 11:23:03 -05:00
GJ
a1d5eaa846 Added help menu text for Herbalism hunger bonuses (MCCORE-5) 2012-02-17 19:31:10 -05:00
GJ
4e9333e823 Added option to disable Herbalism hunger bonuses 2012-02-17 17:21:54 -05:00
GJ
b75e7470ae Fixed using || where I should have used && 2012-02-17 14:40:57 -05:00
GJ
484cbccc1b Added Herbalism items to the fastQueue. 2012-02-17 00:02:26 -05:00
NuclearW
5d4d4d3498 Queue still needed
Added in beginnings for fastqueue
2012-02-16 23:37:14 -05:00
GJ
82e34a5b02 Reverted to old method of block tracking - appears to be working again. 2012-02-16 16:56:19 -05:00
GJ
a9b1ebb063 Reenabled BlockListener queue - fixes Herbalism but breaks regular
blocks it would seeem.
2012-02-16 12:55:03 -05:00
GJ
c942feb868 Fixed Tree Feller not playing nice with NoCheat 2012-02-16 12:15:05 -05:00
GJ
7003311b7e Updated changelog. 2012-02-15 18:31:10 -05:00
NuclearW
2549e23fd2 Change p and a chat logging
To be more consistent
2012-02-15 17:31:17 -05:00
NuclearW
40af51fc05 Re-added event calling
Re-added other dealDamage methods
Added FakeEntityDamageByEntityEvent for us to filter our own mess out, this was the issue with Skull Splitter and Serrated Strikes earlier (a loop)
Moved FakeBlockBreakEvent to be with other events
Added configuration option to control event calling
Learned how to changelog
Broke those cuffs
2012-02-15 16:57:48 -05:00
GJ
06d3d8a18f Added hunger bonuses to Herbalism. (Still need to add cake). 2012-02-15 16:27:12 -05:00
NuclearW
992e6bce86 Ignore Cancelled Events
Using new addition to Bukkit event system, should provide some speed increase.
2012-02-15 16:17:29 -05:00
GJ
6e59087f6d Back to development on Blast Mining. 2012-02-14 19:01:33 -05:00
nossr50
e94473b21b Back to active development 2012-02-14 15:32:17 -08:00
nossr50
8da49ba796 Updating changelog 2012-02-14 15:24:12 -08:00
nossr50
bc8f073f3f Fixed mcability not respecting permissions. 2012-02-14 15:21:34 -08:00
182 changed files with 18831 additions and 14922 deletions

5
.gitignore vendored
View File

@@ -36,4 +36,7 @@
/src/main/resources/mcMMO
# Other Libraries
*.jar
*.jar
# Atlassian Stuff
/atlassian-ide-plugin.xml

View File

@@ -1,6 +1,192 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Key:
+ Addition
= Fix
! Change
- Removal
Version 1.3.06-dev
+ Added permissions check to skill functions
+ Added API functions for obtaining offline profiles & profiles via player names
+ Added API functions for admin & party chat
+ Added Iron Grip skill to Unarmed which gives players an chance to keep from being disarmed.
= Fixed bug where Herbalism required double drops permission to give XP
= Fixed bug where {0} would be displayed in front of your power level in mcstats
= Fixed mmoupdate not being useable from console
= Fixed bug with repairing wooden tools
= Fixed bug with Nether Wart not awarding XP
= Fixed bug with fishing treasures when treasures list is empty
= Fixed bug with only getting one level when there was enough XP for multiple levels.
! Changed how the tree feller threshold worked for the better
! Changed mcremove to no longer kick players when they are removed from database
! Changed mcremove to work on offline users for FlatFile
! Changed PlayerProfile constructor to always take a boolean
! Changed getPlayerProfile function to work for online & offline users
! Changed Archery's Daze to deal 4 DMG on proc (2 Hearts)
! Changed /addlevel command to work for offline users
! Changed party & admin chat handling to be nicer to developers
! Changed UpdateXPBar function to hopefully avoid errors
Version 1.3.05
+ Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%)
+ Added ExperienceAPI and PartyAPI classes for developer use
+ Added ability to cap overall power level
+ Added showing powerlevel below a persons name if you run Spout (optional)
= Fixed errors when Spout would disable itself after start-up
= Fixed XP bar not updating when XP was gained
= Fixed bug with repairing wooden tools
= Fixed bug where spawned wolves only had 8 health.
= Fixed bug where rare Treasures from Excavation were dropping too often
= Fixed bug where Skull Splitter & Serrated Strikes could be used without permissions.
= Fixed bug where API functions were set to static
= Fixed bug where mmoedit threw errors when modifying an offline user
= Fixed dupe exploit with Blast Mining
! Changed Tree Feller to account for ability durability loss but not leaves.
! Changed bypass node for Arcane Forging to not default to true for OPs
- Removed Ignition from Archery
- Removed McMMOPlayerRepairEvent - was basically a duplicate of McMMOPlayerRepairCheck but couldn't be cancelled.
Version 1.3.04
+ Added McMMOPlayerRepairEvent for API usage - fires after completion of a repair.
+ Added McMMOPlayerRepairCheckEvent for API usage - fires before repair process begins, can be cancelled.
+ Added ability to get skill level from McMMOPlayerExperience events
+ Added McMMOPartyTeleportEvent for API usage - fires before a successful teleportation would occur.
+ Added McMMOPartyChangeEvent for API usage - fires whenever a player joins or leaves a party
= Fixed Shake ability dropping bonemeal instead of ink for squids.
= Fixed Green Terra & Super Breaker awarding 4x drops at high levels.
= Fixed summoned ocelots never changing skins.
= Fixed bug with Disarm not working
= Fixed some API functions not being visible
= Fixed bug where /ptp worked on dead party members
! Changed MySQL to reload all player information on reconnection
! Changed event package structure - be sure to update these if you're using the API in your plugin
Version 1.3.03
+ Added Ocelots to Taming XP tables
+ Added ability to summon Ocelots with Call of the Wild
+ Added offline user functionality to mmoedit
+ Added bookshelves to list of blocks that don't trigger abilities.
+ Added 'mcmmo.repair.arcanebypass' permission node to bypass Arcane Repair and keep your enchantments
+ Added config option to disable Herbalism's instant wheat replanting
+ Added LOTS of new permissions nodes. *CHECK PLUGIN.YML FOR UPDATES*
+ Added Italian locale file - thanks Luxius96!
+ Added ability to inspect Ocelots with Beast Lore
+ Added console functionality to mctop
= Fixed Green Terra not awarding Triple Drops
= Fixed ClassCastException from Taming preventDamage checks
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
= Fixed issue with block interaction returning NPEs
= Fixed issue where every block broken had a mining check applied
= Fixed issue where every block broken had a herbalism check applied
= Fixed issue where blocks weren't being removed from the watchlist
= Fixed exploit where you could use /ptp to teleport to anyone
= Fixed bug where Green Terra didn't work on Stone Brick
= Fixed bug where Tree Feller could be used without permissions
= Fixed exploit where falling sand & gravel weren't tracked
= Fixed exploit where Acrobatics could be leveled via Dodge on party members.
= Fixed exploit where you could gain combat XP on animals summoned by Call of the Wild
! Changed mcMMO to save profiles only when the profile is about to be discarded rather than on player quit
! Changed MySQL to try to reconnect every 60 seconds rather than infinitely which caused server hangs
! Changed mcMMO to be better about saving player information on server shutdown
! Changed PTP to prevent teleporting if you've been hurt in the last 30 seconds (configurable)
! Changed Chimera Wing failure check to use the maxWorldHeight.
! Changed inspect failed message to say inspect rather than whois
! Changed Call of the Wild to activate on left-click rather than right-click
! Changed Blast Mining to track based on Entity ID vs. Location
! Changed mmoedit to save a profile when used (this will make mctop update)
! Changed a few Runnable tasks to have their own classes
! Changed parties so that a player will leave their existing party if they enter a world where they don't have party permissions.
! Changed Call of the Wild to summon animals already tamed.
! Changed mob spawner tracking to use new Metadata API
! Changed block watch list to use new Metadata API
! Changed around a few config options, including the ones for mySQL. *YOU NEED TO REDO YOUR CONFIG FILE*
- Removed 'true/false' debug message from Inspect command
Version 1.3.02
+ Added in game guides for Mining, Excavation, and Acrobatics. Simply type /skillname ? to access them
! Changed Tree Feller to hand out 1/4 of normal XP for each JUNGLE LOG block it fells
! Changed Tree Feller to only fell trees if you have enough durability
! Changed Tree Feller to cause injury if your axe splinters from a failed Tree Feller attempt
! Changed invincibility checks in EntityDamage listeners to accommodate for vanilla MC behaviour
! Changed Ignition to add fire ticks rather than replacing them.
! Changed Axes critical to have a max critical rate of 37.5% down from 75%
= Fixed bug where Taming defensive checks got called twice
= Fixed Shake not working correctly
= Fixed bug with Axes command displaying wrong Greater Impact bonus damage
= Fixed bug where Impact didn't apply bonus damage
= Fixed Impact proccing multiple times in a row
= Fixed bug where PVE skills didn't level
Version 1.3.01
= Fixed bug where Tree Feller had no cooldown
= Fixed bug with activating Skull Splitter after using Tree Feller
Version 1.3.00
+ Added ability to customize drops for Excavation skill (treasures.yml)
+ Added ability to customize drops for Fishing skill (treasures.yml)
+ Added messages to nearby players when your abilities wear off
+ Added jungle trees to Woodcutting XP tables
+ Added player notification for when they stop Bleeding
+ Added configuration option to control mcMMO reporting damage events
+ Added hunger regain bonuses to Herbalism skill
+ Added Blast Mining subskills to Mining
+ Added Fast Food Service subskill to Taming
+ Added size limit to Tree Feller in config as Tree Feller Threshold
+ Added /inspect (works on offline players)
+ Added /addlevels commands
+ Added /mcremove command which lets you remove users from MySQL or FlatFile
+ Added config values for XP multipliers for different hostile mobs
+ Added 'mcmmo.commands.inspect' permission node for the new /inspect command
+ Added Impact & Greater Impact subskills to Axes
+ Re-added mcMMO reporting damage events
= Fixed bug with updating MySQL tables to include fishing on servers using custom table prefixes
= Fixed bug where Disarm didn't work at all ever
= Fixed bug where Swords command showed Bleed Length twice instead of Bleed Chance
= Fixed bug where Tree Feller wasn't checking for Tree Feller permission
= Fixed bug where Leaf Blower required Tree Feller permissions rather than Woodcutting permissions
= Fixed Leaf Blower preventing the use of shears to collect leaves
= Fixed Green Thumb & Green Terra not consuming or requiring seeds to replant Wheat
= Fixed Super Breaker & Giga Drill Breaker failing to damage tools
= Fixed Tree Feller not giving proper XP for different kinds of trees
= Fixed Skill Abilities conflicting with NoCheat
= Fixed memory leak with mob spawner tracking
= Fixed /mcability not respecting permissions
= Prettied up new config files
= Various skill function optimizations
! Changed how mcMMO calculates distance between two points (optimizations)
! Changed how mcMMO handles MySQL connections (optimizations)
! Changed the description /mcmmo provides to be more up to date and relevant
! Changed mcMMO user information to be stored for 2 minutes after log out to reduce lag on rejoins
! Changed Food+ to be named Farmer's Diet in Herbalism
! Changed default values of Woodcutting XP tables
! Changed 'Pine' to be renamed 'Oak' in Woodcutting XP tables
! Changed the name of Unarmed Apprentice/Mastery to Iron Arm Style
! Changed Axes to gain bonus damage every 50 skill levels
! Changed Unarmed to start with a +3 DMG (1 Heart = 2 DMG) bonus from Iron Arm Style to make leveling it more viable
! Changed Unarmed to gain bonus damage every 50 skill levels
! Changed Unarmed to gain more bonus damage total than before
! Changed Unarmed to have a max disarm chance of 33.3% rather than 25%
! Changed Tree Feller to take down entire trees
! Changed mob spawn tracking to use Unique Entity ID instead of Entity Object
! Changed stats command name to mcstats for better plugin compatibility
! Changed god mode to turn off if player enters world where he does not have mcgod permission
! Changed Taming to also gain XP from animal taming
! Changed Swords Bleeding effect to never kill
! Changed Bleeding to never go beyond 10 ticks
! Changed to use Bukkit's built-in ignoreCancelledEvents system
! Changed chat logging for /p & /a
! Changed Tree Feller to use per-use ArrayList
- Removed /mcstats console functionality
- Removed /whois command (replaced with /inspect which has similar functionality)
- Removed Master/Apprentice chat notifications to reduce spam
- Removed MySpawn system (You can still use Chimaera Wings) due to being outdated and unwanted
- Removed duplicate settings in config.yml
- Removed unused settings from config.yml (HP Regen)
- Removed Nether Brick from Mining XP Tables
- Removed Stone Brick from Mining XP Tables
Version 1.2.12
- Fixed issue that caused terrible MySQL performance and negative XP on levelup (Issue #134)
- Fixed addxp command taking xprate and skill modifiers into account
@@ -11,7 +197,7 @@ Version 1.2.12
- Fixed error with Skull Splitter / Serrated Strikes that caused server instability and log spam
- Fixed config.yml not having values for End Stone & other new mining blocks
- Fixed Green Thumb/Green Terra not correctly planting wheat (Issue #133)
Version 1.2.11
- Removed legacy Permission & PEX dependency. (PEX still works fine with mcMMO)
- Made Smooth Brick to Mossy Brick and Dirt to Grass for green thumb configurable (Issue #120)

22
pom.xml
View File

@@ -2,11 +2,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.3.06-dev</version>
<name>mcMMO</name>
<url>https://github.com/TheYeti/mcMMO</url>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/TheYeti/mcMMO/issues</url>
<url>http://issues.mcmmo.org</url>
<system>JIRA</system>
</issueManagement>
<build>
<finalName>mcMMO</finalName>
@@ -94,19 +95,29 @@
</build>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<id>spout-repo</id>
<url>http://nexus.getspout.org/content/groups/public/</url>
<url>http://nexus.spout.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.1-R5-SNAPSHOT</version>
<version>LATEST</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
@@ -121,5 +132,4 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<version>1.2.12</version>
</project>

View File

@@ -1,426 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50;
import org.bukkit.World;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.skills.Acrobatics;
import com.gmail.nossr50.skills.Archery;
import com.gmail.nossr50.skills.Axes;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Swords;
import com.gmail.nossr50.skills.Taming;
import com.gmail.nossr50.skills.Unarmed;
public class Combat
{
public static void combatChecks(EntityDamageEvent event, mcMMO pluginx)
{
if(event.isCancelled() || event.getDamage() == 0)
return;
if(event instanceof EntityDamageByEntityEvent)
{
/*
* OFFENSIVE CHECKS FOR PLAYERS VERSUS ENTITIES
*/
if(((EntityDamageByEntityEvent) event).getDamager() instanceof Player)
{
//Declare Things
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent) event;
Player attacker = (Player)((EntityDamageByEntityEvent) event).getDamager();
PlayerProfile PPa = Users.getProfile(attacker);
//Damage modifiers
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0) //Unarmed
Unarmed.unarmedBonus(attacker, eventb);
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker) && Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
{
int damage = event.getDamage()+4;
event.setDamage(damage);
}
//If there are any abilities to activate
combatAbilityChecks(attacker, PPa, pluginx);
//Check for offensive procs
if(!(((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow))
{
if(mcPermissions.getInstance().axes(attacker))
Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Critical Checks
if(!pluginx.misc.bleedTracker.contains((LivingEntity) event.getEntity())) //Swords Bleed
Swords.bleedCheck(attacker, (LivingEntity)event.getEntity(), pluginx);
if(event.getEntity() instanceof Player && mcPermissions.getInstance().unarmed(attacker))
{
Player defender = (Player)event.getEntity();
Unarmed.disarmProcCheck(attacker, defender);
}
//Modify the event damage if Attacker is Berserk
if(PPa.getBerserkMode())
event.setDamage(event.getDamage() + (event.getDamage() / 2));
//Handle Ability Interactions
if(PPa.getSkullSplitterMode() && m.isAxes(attacker.getItemInHand()))
Axes.applyAoeDamage(attacker, eventb, pluginx);
if(PPa.getSerratedStrikesMode() && m.isSwords(attacker.getItemInHand()))
Swords.applySerratedStrikes(attacker, eventb, pluginx);
//Experience
if(event.getEntity() instanceof Player)
{
Player defender = (Player)event.getEntity();
PlayerProfile PPd = Users.getProfile(defender);
if(attacker != null && defender != null && LoadProperties.pvpxp)
{
if(System.currentTimeMillis() >= (PPd.getRespawnATS()*1000) + 5000
&& ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()
&& defender.getHealth() >= 1)
{
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the mob
int hpLeft = defender.getHealth(), xpinc = 0;
if(hpLeft < event.getDamage())
{
if(hpLeft > 0)
xpinc = hpLeft;
else
xpinc = 0;
} else
xpinc = event.getDamage();
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker))
PPa.addXP(SkillType.AXES, xp*10, attacker);
if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker))
PPa.addXP(SkillType.SWORDS, xp*10, attacker);
if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker))
PPa.addXP(SkillType.UNARMED, xp*10, attacker);
}
}
}
if(!pluginx.misc.mobSpawnerList.contains(event.getEntity()))
{
int xp = getXp(event.getEntity(), event);
if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker))
PPa.addXP(SkillType.SWORDS, xp*10, attacker);
else if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker))
PPa.addXP(SkillType.AXES, xp*10, attacker);
else if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker))
PPa.addXP(SkillType.UNARMED, xp*10, attacker);
}
Skills.XpCheckAll(attacker);
if(event.getEntity() instanceof Wolf)
{
Wolf theWolf = (Wolf)event.getEntity();
if(attacker.getItemInHand().getTypeId() == 352 && mcPermissions.getInstance().taming(attacker))
{
event.setCancelled(true);
if(theWolf.isTamed())
{
attacker.sendMessage(mcLocale.getString("Combat.BeastLore")+" "+
mcLocale.getString("Combat.BeastLoreOwner", new Object[] {Taming.getOwnerName(theWolf)})+" "+
mcLocale.getString("Combat.BeastLoreHealthWolfTamed", new Object[] {theWolf.getHealth()}));
}
else
{
attacker.sendMessage(mcLocale.getString("Combat.BeastLore")+" "+
mcLocale.getString("Combat.BeastLoreHealthWolf", new Object[] {theWolf.getHealth()}));
}
}
}
}
}
}
/*
* OFFENSIVE CHECKS FOR WOLVES VERSUS ENTITIES
*/
if(event instanceof EntityDamageByEntityEvent && ((EntityDamageByEntityEvent) event).getDamager() instanceof Wolf)
{
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent) event;
Wolf theWolf = (Wolf) eventb.getDamager();
if(theWolf.isTamed() && Taming.ownerOnline(theWolf, pluginx))
{
if(Taming.getOwner(theWolf, pluginx) == null)
return;
Player master = Taming.getOwner(theWolf, pluginx);
PlayerProfile PPo = Users.getProfile(master);
if(mcPermissions.getInstance().taming(master))
{
//Sharpened Claws
if(PPo.getSkillLevel(SkillType.TAMING) >= 750)
{
event.setDamage(event.getDamage() + 2);
}
//Gore
if(Math.random() * 1000 <= PPo.getSkillLevel(SkillType.TAMING))
{
event.setDamage(event.getDamage() * 2);
if(event.getEntity() instanceof Player)
{
Player target = (Player)event.getEntity();
target.sendMessage(mcLocale.getString("Combat.StruckByGore")); //$NON-NLS-1$
Users.getProfile(target).setBleedTicks(2);
}
else
pluginx.misc.addToBleedQue((LivingEntity) event.getEntity());
master.sendMessage(mcLocale.getString("Combat.Gore")); //$NON-NLS-1$
}
if(!event.getEntity().isDead() && !pluginx.misc.mobSpawnerList.contains(event.getEntity()))
{
int xp = getXp(event.getEntity(), event);
Users.getProfile(master).addXP(SkillType.TAMING, xp*10, master);
if(event.getEntity() instanceof Player)
{
xp = (event.getDamage() * 2);
Users.getProfile(master).addXP(SkillType.TAMING, (int)((xp*10)*1.5), master);
}
Skills.XpCheckSkill(SkillType.TAMING, master);
}
}
}
}
//Another offensive check for Archery
if(event instanceof EntityDamageByEntityEvent && event.getCause() == DamageCause.PROJECTILE && ((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow)
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
/*
* DEFENSIVE CHECKS
*/
if(event instanceof EntityDamageByEntityEvent && event.getEntity() instanceof Player)
{
Swords.counterAttackChecks((EntityDamageByEntityEvent)event);
Acrobatics.dodgeChecks((EntityDamageByEntityEvent)event);
}
/*
* DEFENSIVE CHECKS FOR WOLVES
*/
if(event.getEntity() instanceof Wolf)
{
Wolf theWolf = (Wolf) event.getEntity();
if(theWolf.isTamed() && Taming.ownerOnline(theWolf, pluginx))
{
if(Taming.getOwner(theWolf, pluginx) == null)
return;
Player master = Taming.getOwner(theWolf, pluginx);
PlayerProfile PPo = Users.getProfile(master);
if(mcPermissions.getInstance().taming(master))
{
//Shock-Proof
if((event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION) && PPo.getSkillLevel(SkillType.TAMING) >= 500)
{
event.setDamage(2);
}
//Thick Fur
if(PPo.getSkillLevel(SkillType.TAMING) >= 250)
event.setDamage(event.getDamage() / 2);
}
}
}
}
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa, Plugin pluginx)
{
//Check to see if any abilities need to be activated
if(PPa.getAxePreparationMode())
Axes.skullSplitterCheck(attacker);
if(PPa.getSwordsPreparationMode())
Swords.serratedStrikesActivationCheck(attacker);
if(PPa.getFistsPreparationMode())
Unarmed.berserkActivationCheck(attacker);
}
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx)
{
Arrow arrow = (Arrow)event.getDamager();
Entity y = arrow.getShooter();
Entity x = event.getEntity();
if(x instanceof Player)
{
Player defender = (Player)x;
PlayerProfile PPd = Users.getProfile(defender);
if(PPd == null)
Users.addUser(defender);
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0)
{
if(defender != null && PPd.getSkillLevel(SkillType.UNARMED) >= 1000)
{
if(Math.random() * 1000 <= 500)
{
event.setCancelled(true);
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); //$NON-NLS-1$
return;
}
} else if(defender != null && Math.random() * 1000 <= (PPd.getSkillLevel(SkillType.UNARMED) / 2))
{
event.setCancelled(true);
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); //$NON-NLS-1$
return;
}
}
}
/*
* If attacker is player
*/
if(y instanceof Player)
{
Player attacker = (Player)y;
PlayerProfile PPa = Users.getProfile(attacker);
if(mcPermissions.getInstance().archery(attacker))
{
Archery.trackArrows(pluginx, x, event, attacker);
/*
* IGNITION
*/
Archery.ignitionCheck(x, event, attacker);
/*
* Defender is Monster
*/
if(!pluginx.misc.mobSpawnerList.contains(x))
{
int xp = getXp(event.getEntity(), event);
PPa.addXP(SkillType.ARCHERY, xp*10, attacker);
}
/*
* Attacker is Player
*/
if(x instanceof Player){
Player defender = (Player)x;
PlayerProfile PPd = Users.getProfile(defender);
/*
* Stuff for the daze proc
*/
if(PPa.inParty() && PPd.inParty())
{
if(Party.getInstance().inSameParty(defender, attacker))
{
event.setCancelled(true);
return;
}
}
/*
* PVP XP
*/
if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender)
&& ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis() && !attacker.getName().equals(defender.getName()))
{
int xp = (int) ((event.getDamage() * 2) * 10);
PPa.addXP(SkillType.ARCHERY, xp, attacker);
}
/*
* DAZE PROC
*/
Archery.dazeCheck(defender, attacker);
}
}
Skills.XpCheckSkill(SkillType.ARCHERY, attacker);
}
}
public static void dealDamage(LivingEntity target, int dmg) {
target.damage(dmg);
}
public static boolean pvpAllowed(EntityDamageByEntityEvent event, World world)
{
if(!event.getEntity().getWorld().getPVP())
return false;
//If it made it this far, pvp is enabled
return true;
}
public static int getXp(Entity entity, EntityDamageEvent event)
{
int xp = 0;
if(entity instanceof LivingEntity)
{
LivingEntity le = (LivingEntity)entity;
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the entity
int hpLeft = le.getHealth(), xpinc = 0;
if(hpLeft < event.getDamage())
{
if(hpLeft > 0)
xpinc = hpLeft;
else
xpinc = 0;
}
else
xpinc = event.getDamage();
if(entity instanceof Animals)
{
xp = (int) (xpinc * 1);
} else
{
if(entity instanceof Enderman)
xp = (xpinc * 2);
else if(entity instanceof Creeper)
xp = (xpinc * 4);
else if(entity instanceof Silverfish)
xp = (xpinc * 3);
else if(entity instanceof CaveSpider)
xp = (xpinc * 3);
else if(entity instanceof Spider)
xp = (xpinc * 3);
else if(entity instanceof Skeleton)
xp = (xpinc * 2);
else if(entity instanceof Zombie)
xp = (xpinc * 2);
else if(entity instanceof PigZombie)
xp = (xpinc * 3);
else if(entity instanceof Slime)
xp = (xpinc * 2);
else if(entity instanceof Ghast)
xp = (xpinc * 3);
else if(entity instanceof Blaze)
xp = (xpinc * 3);
else if(entity instanceof EnderDragon)
xp = (xpinc * 8);
else if(entity instanceof MagmaCube)
xp = (xpinc * 2);
}
}
return xp;
}
}

View File

@@ -1,212 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.ArrayList;
import java.sql.PreparedStatement;
import com.gmail.nossr50.config.LoadProperties;
public class Database {
private mcMMO plugin;
private String connectionString;
public Database(mcMMO instance) {
this.plugin = instance;
this.connectionString = "jdbc:mysql://" + LoadProperties.MySQLserverName + ":" + LoadProperties.MySQLport + "/" + LoadProperties.MySQLdbName + "?user=" + LoadProperties.MySQLuserName + "&password=" + LoadProperties.MySQLdbPass;
// Load the driver instance
try {
Class.forName("com.mysql.jdbc.Driver");
DriverManager.getConnection(connectionString);
} catch (ClassNotFoundException e) {
plugin.getServer().getLogger().warning(e.getLocalizedMessage());
} catch (SQLException e) {
plugin.getServer().getLogger().warning(e.getLocalizedMessage());
System.out.println("SQLException: " + e.getMessage());
System.out.println("SQLState: " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
}
}
//Create the DB structure
public void createStructure() {
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"
+ "`hudtype` varchar(50) NOT NULL DEFAULT '',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
+ "`user` varchar(40) NOT NULL,"
+ "`lastlogin` int(32) unsigned NOT NULL,"
+ "`party` varchar(100) NOT NULL DEFAULT '',"
+ "PRIMARY KEY (`id`),"
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "spawn` (`user_id` int(10) NOT NULL,"
+ "`x` int(64) NOT NULL DEFAULT '0',"
+ "`y` int(64) NOT NULL DEFAULT '0',"
+ "`z` int(64) NOT NULL DEFAULT '0',"
+ "`world` varchar(50) NOT NULL DEFAULT '',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"skills2`");
Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"experience2`");
checkDatabaseStructure();
}
public void checkDatabaseStructure()
{
String sql = "SELECT * FROM `mcmmo_experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
ResultSet rs = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
try {
Connection conn = DriverManager.getConnection(connectionString);
PreparedStatement stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) {
stmt.executeQuery();
rs = stmt.getResultSet();
while (rs.next()) {
ArrayList<String> Col = new ArrayList<String>();
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
Col.add(rs.getString(i));
}
Rows.put(rs.getRow(), Col);
}
}
conn.close();
} catch (SQLException ex) {
System.out.println("Updating mcMMO MySQL tables...");
Write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
Write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
}
}
// write query
public boolean Write(String sql) {
try {
Connection conn = DriverManager.getConnection(connectionString);
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.executeUpdate();
conn.close();
return true;
} catch (SQLException ex) {
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
return false;
}
}
// Get Int
// only return first row / first field
public Integer GetInt(String sql) {
ResultSet rs = null;
Integer result = 0;
try {
Connection conn = DriverManager.getConnection(connectionString);
PreparedStatement stmt = conn.prepareStatement(sql);
stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) {
stmt.executeQuery();
rs = stmt.getResultSet();
if (rs.next()) {
result = rs.getInt(1);
} else {
result = 0;
}
}
conn.close();
} catch (SQLException ex) {
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
return result;
}
// read query
public HashMap<Integer, ArrayList<String>> Read(String sql) {
ResultSet rs = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
try {
Connection conn = DriverManager.getConnection(connectionString);
PreparedStatement stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) {
stmt.executeQuery();
rs = stmt.getResultSet();
while (rs.next()) {
ArrayList<String> Col = new ArrayList<String>();
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
Col.add(rs.getString(i));
}
Rows.put(rs.getRow(), Col);
}
}
conn.close();
} catch (SQLException ex) {
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
return Rows;
}
}

View File

@@ -1,104 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.*;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.*;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class Item {
public static void itemchecks(Player player, Plugin plugin)
{
ItemStack inhand = player.getItemInHand();
if(LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId)
{
chimaerawing(player, plugin);
}
}
@SuppressWarnings("deprecation")
public static void chimaerawing(Player player, Plugin plugin)
{
PlayerProfile PP = Users.getProfile(player);
ItemStack is = player.getItemInHand();
Block block = player.getLocation().getBlock();
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == LoadProperties.chimaeraId)
{
if(Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing)
{
Block derp = player.getLocation().getBlock();
int y = derp.getY();
ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){
if(x != null && x.getTypeId() == LoadProperties.chimaeraId){
if(x.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing + 1)
{
x.setAmount(x.getAmount() - LoadProperties.feathersConsumedByChimaeraWing);
player.getInventory().setContents(inventory);
player.updateInventory();
break;
} else {
x.setAmount(0);
x.setTypeId(0);
player.getInventory().setContents(inventory);
player.updateInventory();
break;
}
}
}
while(y < 127)
{
y++;
if(player != null)
{
if(player.getLocation().getWorld().getBlockAt(block.getX(), y, block.getZ()).getType() != Material.AIR)
{
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail")); //$NON-NLS-1$
player.teleport(player.getLocation().getWorld().getBlockAt(block.getX(), (y - 1), block.getZ()).getLocation());
return;
}
}
}
if(PP.getMySpawn(player) != null)
{
Location mySpawn = PP.getMySpawn(player);
if(mySpawn != null){
player.teleport(mySpawn); //Do it twice to prevent weird stuff
player.teleport(mySpawn);
}
} else {
player.teleport(player.getWorld().getSpawnLocation());
}
player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass")); //$NON-NLS-1$
} else if (!Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10)
{
player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)})); //$NON-NLS-1$
} else if (is.getTypeId() == LoadProperties.chimaeraId && is.getAmount() <= 9){
player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$
}
}
}
}

View File

@@ -1,279 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.Tree;
public class Leaderboard
{
static String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; //$NON-NLS-1$
protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$
/*
* Read from the file
*/
public static void makeLeaderboards()
{
//Make Trees
Tree Mining = new Tree();
Tree WoodCutting = new Tree();
Tree Herbalism = new Tree();
Tree Excavation = new Tree();
Tree Acrobatics = new Tree();
Tree Repair = new Tree();
Tree Swords = new Tree();
Tree Axes = new Tree();
Tree Archery = new Tree();
Tree Unarmed = new Tree();
Tree Taming = new Tree();
Tree Fishing = new Tree();
Tree Enchanting = new Tree();
Tree Alchemy = new Tree();
Tree PowerLevel = new Tree();
//Add Data To Trees
try {
//Open the user file
FileReader file = new FileReader(location);
BufferedReader in = new BufferedReader(file);
String line = ""; //$NON-NLS-1$
ArrayList<String> players = new ArrayList<String>();
while((line = in.readLine()) != null)
{
String[] character = line.split(":"); //$NON-NLS-1$
String p = character[0];
//Prevent the same player from being added multiple times
if(players.contains(p))
continue;
else
players.add(p);
int Plvl = 0;
if(character.length > 1 && m.isInt(character[1]))
{
Mining.add(p, Integer.valueOf(character[1]));
Plvl += Integer.valueOf(character[1]);
}
if(character.length > 5 && m.isInt(character[5])){
WoodCutting.add(p, Integer.valueOf(character[5]));
Plvl += Integer.valueOf(character[5]);
}
if(character.length > 7 && m.isInt(character[7])){
Repair.add(p, Integer.valueOf(character[7]));
Plvl += Integer.valueOf(character[7]);
}
if(character.length > 8 && m.isInt(character[8])){
Unarmed.add(p, Integer.valueOf(character[8]));
Plvl += Integer.valueOf(character[8]);
}
if(character.length > 9 && m.isInt(character[9])){
Herbalism.add(p, Integer.valueOf(character[9]));
Plvl += Integer.valueOf(character[9]);
}
if(character.length > 10 && m.isInt(character[10])){
Excavation.add(p, Integer.valueOf(character[10]));
Plvl += Integer.valueOf(character[10]);
}
if(character.length > 11 && m.isInt(character[11])){
Archery.add(p, Integer.valueOf(character[11]));
Plvl += Integer.valueOf(character[11]);
}
if(character.length > 12 && m.isInt(character[12])){
Swords.add(p, Integer.valueOf(character[12]));
Plvl += Integer.valueOf(character[12]);
}
if(character.length > 13 && m.isInt(character[13])){
Axes.add(p, Integer.valueOf(character[13]));
Plvl += Integer.valueOf(character[13]);
}
if(character.length > 14 && m.isInt(character[14])){
Acrobatics.add(p, Integer.valueOf(character[14]));
Plvl += Integer.valueOf(character[14]);
}
if(character.length > 24 && m.isInt(character[24])){
Taming.add(p, Integer.valueOf(character[24]));
Plvl += Integer.valueOf(character[24]);
}
if(character.length > 34 && m.isInt(character[34]))
{
Fishing.add(p, Integer.valueOf(character[34]));
Plvl += Integer.valueOf(character[34]);
}
PowerLevel.add(p, Plvl);
}
in.close();
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while reading " //$NON-NLS-1$
+ location + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$
}
//Write the leader board files
leaderWrite(Mining.inOrder(), SkillType.MINING); //$NON-NLS-1$
leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING); //$NON-NLS-1$
leaderWrite(Repair.inOrder(), SkillType.REPAIR); //$NON-NLS-1$
leaderWrite(Unarmed.inOrder(), SkillType.UNARMED); //$NON-NLS-1$
leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM); //$NON-NLS-1$
leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION); //$NON-NLS-1$
leaderWrite(Archery.inOrder(), SkillType.ARCHERY); //$NON-NLS-1$
leaderWrite(Swords.inOrder(), SkillType.SWORDS); //$NON-NLS-1$
leaderWrite(Axes.inOrder(), SkillType.AXES); //$NON-NLS-1$
leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS); //$NON-NLS-1$
leaderWrite(Taming.inOrder(), SkillType.TAMING); //$NON-NLS-1$
leaderWrite(Fishing.inOrder(), SkillType.FISHING); //$NON-NLS-1$
leaderWrite(Alchemy.inOrder(), SkillType.ALCHEMY); //$NON-NLS-1$
leaderWrite(Enchanting.inOrder(), SkillType.ENCHANTING); //$NON-NLS-1$
leaderWrite(PowerLevel.inOrder(), SkillType.ALL); //$NON-NLS-1$
}
public static void leaderWrite(PlayerStat[] ps, SkillType skillType)
{
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
//CHECK IF THE FILE EXISTS
File theDir = new File(theLocation);
if(!theDir.exists())
{
//properties = new PropertiesFile(location);
FileWriter writer = null;
try {
writer = new FileWriter(theLocation);
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while creating " + theLocation, e); //$NON-NLS-1$
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e) {
log.log(Level.SEVERE, "Exception while closing writer for " + theLocation, e); //$NON-NLS-1$
}
}
} else {
try {
FileReader file = new FileReader(theLocation);
//HERP
BufferedReader in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
for(PlayerStat p : ps)
{
if(p.name.equals("$mcMMO_DummyInfo")) //$NON-NLS-1$
continue;
if(p.statVal == 0)
continue;
writer.append(p.name + ":" + p.statVal); //$NON-NLS-1$
writer.append("\r\n"); //$NON-NLS-1$
}
in.close();
//Write the new file
FileWriter out = new FileWriter(theLocation);
out.write(writer.toString());
out.close();
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
//Create/open the file
//Loop through backward writing each player
//Close the file
}
public static String[] retrieveInfo(String skillName, int pagenumber)
{
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
try {
FileReader file = new FileReader(theLocation);
BufferedReader in = new BufferedReader(file);
int destination = (pagenumber - 1) * 10; //How many lines to skip through
int x = 0; //how many lines we've gone through
int y = 0; //going through the lines
String line = ""; //$NON-NLS-1$
String[] info = new String[10]; //what to return
while((line = in.readLine()) != null && y < 10)
{
x++;
if(x >= destination && y < 10){
info[y] = line.toString();
y++;
}
}
in.close();
return info;
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while reading " //$NON-NLS-1$
+ theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$
}
return null; //Shouldn't get here
}
public static void updateLeaderboard(PlayerStat ps, SkillType skillType)
{
if(LoadProperties.useMySQL)
return;
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
try {
//Open the file
FileReader file = new FileReader(theLocation);
BufferedReader in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
String line = ""; //$NON-NLS-1$
Boolean inserted = false;
//While not at the end of the file
while((line = in.readLine()) != null)
{
//Insert the player into the line before it finds a smaller one
if(Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) //$NON-NLS-1$
{
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
inserted = true;
}
//Write anything that isn't the player already in the file so we remove the duplicate
if(!line.split(":")[0].equalsIgnoreCase(ps.name)) //$NON-NLS-1$
{
writer.append(line).append("\r\n"); //$NON-NLS-1$
}
}
if(!inserted)
{
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
in.close();
//Write the new file
FileWriter out = new FileWriter(theLocation);
out.write(writer.toString());
out.close();
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}

View File

@@ -1,296 +0,0 @@
/*
* Copyright 2011 Tyler Blair. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and contributors and should not be interpreted as representing official policies,
* either expressed or implied, of anybody else.
*/
package com.gmail.nossr50;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/**
* Tooling to post to metrics.griefcraft.com
*/
public class Metrics {
/**
* Interface used to collect custom data for a plugin
*/
public static abstract class Plotter {
/**
* Get the column name for the plotted point
*
* @return the plotted point's column name
*/
public abstract String getColumnName();
/**
* Get the current value for the plotted point
*
* @return
*/
public abstract int getValue();
/**
* Called after the website graphs have been updated
*/
public void reset() {
}
@Override
public int hashCode() {
return getColumnName().hashCode() + getValue();
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Plotter)) {
return false;
}
Plotter plotter = (Plotter) object;
return plotter.getColumnName().equals(getColumnName()) && plotter.getValue() == getValue();
}
}
/**
* The metrics revision number
*/
private final static int REVISION = 4;
/**
* The base url of the metrics domain
*/
private static final String BASE_URL = "http://metrics.griefcraft.com";
/**
* The url used to report a server's status
*/
private static final String REPORT_URL = "/report/%s";
/**
* The file where guid and opt out is stored in
*/
private static final String CONFIG_FILE = "plugins/PluginMetrics/config.yml";
/**
* Interval of time to ping in minutes
*/
private final static int PING_INTERVAL = 10;
/**
* A map of the custom data plotters for plugins
*/
private Map<Plugin, Set<Plotter>> customData = Collections.synchronizedMap(new HashMap<Plugin, Set<Plotter>>());
/**
* The plugin configuration file
*/
private final YamlConfiguration configuration;
/**
* Unique server id
*/
private String guid;
public Metrics() throws IOException {
// load the config
File file = new File(CONFIG_FILE);
configuration = YamlConfiguration.loadConfiguration(file);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://metrics.griefcraft.com").copyDefaults(true);
configuration.save(file);
}
// Load the guid then
guid = configuration.getString("guid");
}
/**
* Adds a custom data plotter for a given plugin
*
* @param plugin
* @param plotter
*/
public void addCustomData(Plugin plugin, Plotter plotter) {
Set<Plotter> plotters = customData.get(plugin);
if (plotters == null) {
plotters = Collections.synchronizedSet(new LinkedHashSet<Plotter>());
customData.put(plugin, plotters);
}
plotters.add(plotter);
}
/**
* Begin measuring a plugin
*
* @param plugin
*/
public void beginMeasuringPlugin(final Plugin plugin) throws IOException {
// Did we opt out?
if (configuration.getBoolean("opt-out", false)) {
return;
}
// First tell the server about us
postPlugin(plugin, false);
// Ping the server in intervals
plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
public void run() {
try {
postPlugin(plugin, true);
} catch (IOException e) {
System.out.println("[Metrics] " + e.getMessage());
}
}
}, PING_INTERVAL * 1200, PING_INTERVAL * 1200);
}
/**
* Generic method that posts a plugin to the metrics website
*
* @param plugin
*/
private void postPlugin(Plugin plugin, boolean isPing) throws IOException {
// Construct the post data
String response = "ERR No response";
String data = encode("guid") + '=' + encode(guid)
+ '&' + encode("version") + '=' + encode(plugin.getDescription().getVersion())
+ '&' + encode("server") + '=' + encode(Bukkit.getVersion())
+ '&' + encode("players") + '=' + encode(String.valueOf(Bukkit.getServer().getOnlinePlayers().length))
+ '&' + encode("revision") + '=' + encode(REVISION + "");
// If we're pinging, append it
if (isPing) {
data += '&' + encode("ping") + '=' + encode("true");
}
// Add any custom data (if applicable)
Set<Plotter> plotters = customData.get(plugin);
if (plotters != null) {
for (Plotter plotter : plotters) {
data += "&" + encode("Custom" + plotter.getColumnName())
+ "=" + encode(Integer.toString(plotter.getValue()));
}
}
// Create the url
URL url = new URL(BASE_URL + String.format(REPORT_URL, plugin.getDescription().getName()));
// Connect to the website
URLConnection connection;
// Mineshafter creates a socks proxy, so we can safely bypass it
if (isMineshafterPresent()) {
connection = url.openConnection(Proxy.NO_PROXY);
} else {
connection = url.openConnection();
}
connection.setDoOutput(true);
// Write the data
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(data);
writer.flush();
// Now read the response
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
response = reader.readLine();
// close resources
writer.close();
reader.close();
if (response.startsWith("ERR")) {
throw new IOException(response); //Throw the exception
} else {
// Is this the first update this hour?
if (response.contains("OK This is your first update this hour")) {
if (plotters != null) {
for (Plotter plotter : plotters) {
plotter.reset();
}
}
}
}
//if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right
}
/**
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
*
* @return
*/
private boolean isMineshafterPresent() {
try {
Class.forName("mineshafter.MineServer");
return true;
} catch (Exception e) {
return false;
}
}
/**
* Encode text as UTF-8
*
* @param text
* @return
*/
private static String encode(String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8");
}
}

View File

@@ -1,112 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50;
import java.io.*;
import java.util.Properties;
import java.util.logging.Logger;
import java.util.HashMap;
import org.bukkit.entity.*;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class Users {
private static volatile Users instance;
protected static final Logger log = Logger.getLogger("Minecraft");
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
String directory = "plugins/mcMMO/FlatFileStuff/";
String directoryb = "plugins/mcMMO/FlatFileStuff/Leaderboards/";
//public static ArrayList<PlayerProfile> players;
public static HashMap<Player, PlayerProfile> players = new HashMap<Player, PlayerProfile>();
private Properties properties = new Properties();
//To load
public void load() throws IOException {
properties.load(new FileInputStream(location));
}
//To save
public void save()
{
try
{
properties.store(new FileOutputStream(location), null);
}catch(IOException ex) {
}
}
public void loadUsers()
{
new File(directory).mkdir();
new File(directoryb).mkdir();
File theDir = new File(location);
if(!theDir.exists())
{
try {
FileWriter writer = new FileWriter(theDir);
writer.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void addUser(Player player)
{
players.put(player, new PlayerProfile(player));
}
public static void clearUsers()
{
players.clear();
}
public static HashMap<Player, PlayerProfile> getProfiles(){
return players;
}
public static void removeUser(Player player)
{
PlayerProfile PP = Users.getProfile(player);
if(PP != null)
{
PP.save();
if(players.containsKey(player))
players.remove(player);
}
}
public static PlayerProfile getProfile(Player player){
if(players.get(player) != null)
return players.get(player);
else
{
players.put(player, new PlayerProfile(player));
return players.get(player);
}
}
public static Users getInstance() {
if (instance == null) {
instance = new Users();
}
return instance;
}
}

View File

@@ -0,0 +1,68 @@
package com.gmail.nossr50.api;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class ChatAPI {
/**
* Send a message to all members of a party
* </br>
* This function is designed for API usage.
*
* @param sender The name of the sender to display in the chat
* @param party The name of the party to send to
* @param message The message to send
*/
public void sendPartyChat(String sender, String party, String message) {
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
Bukkit.getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return;
}
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") ";
Bukkit.getLogger().info("[P](" + chatEvent.getParty() + ")" + "<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (Users.getProfile(player).inParty()) {
if (Users.getProfile(player).getParty().equalsIgnoreCase(chatEvent.getParty())) {
player.sendMessage(pPrefix + chatEvent.getMessage());
}
}
}
}
/**
* Send a message to administrators
* </br>
* This function is designed for API usage.
*
* @param sender The name of the sender to display in the chat
* @param message The message to send
*/
public void sendAdminChat(String sender, String message) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
Bukkit.getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return;
}
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} ";
Bukkit.getLogger().info("[A]<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(player) || player.isOp())
player.sendMessage(aPrefix + chatEvent.getMessage());
}
}
}

View File

@@ -0,0 +1,136 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
public class ExperienceAPI {
/**
* Check the XP of a player. This should be called after giving XP to process level-ups.
*
* @param player The player to check
* @param skillType The skill to check
*/
private void checkXP(Player player, SkillType skillType) {
if (skillType.equals(SkillType.ALL)) {
Skills.XpCheckAll(player);
}
else {
Skills.XpCheckSkill(skillType, player);
}
}
/**
* Adds XP to the player, doesn't calculate for XP Rate or other modifiers.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public void addRawXP(Player player, SkillType skillType, int XP) {
Users.getProfile(player).addXPOverride(skillType, XP);
checkXP(player, skillType);
}
/**
* Adds XP to the player, calculates for XP Rate but not skill modifiers.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public void addMultipliedXP(Player player, SkillType skillType, int XP) {
Users.getProfile(player).addXPOverrideBonus(skillType, XP);
checkXP(player, skillType);
}
/**
* Adds XP to the player, calculates for XP Rate and skill modifiers.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public void addXP(Player player, SkillType skillType, int XP) {
Users.getProfile(player).addXP(skillType, XP);
checkXP(player, skillType);
}
/**
* Get the amount of XP a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
*/
public int getXP(Player player, SkillType skillType) {
return Users.getProfile(player).getSkillXpLevel(skillType);
}
/**
* Get the amount of XP left before leveling up.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the XP amount for
* @param skillType The skill to get the XP amount for
* @return the amount of XP left before leveling up a specifc skill
*/
public int getXPToNextLevel(Player player, SkillType skillType) {
return Users.getProfile(player).getXpToLevel(skillType);
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @param notify True if this should fire a level up notification, false otherwise.
*/
public void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
Users.getProfile(player).addLevels(skillType, levels);
if (notify) {
checkXP(player, skillType);
}
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the level for
* @param skillType The skill to get the level for
* @return the level of a given skill
*/
public int getLevel(Player player, SkillType skillType) {
return Users.getProfile(player).getSkillLevel(skillType);
}
/**
* Gets the power level of a player.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the power level for
* @return the power level of the player
*/
public int getPowerLevel(Player player) {
return Users.getProfile(player).getPowerLevel();
}
}

View File

@@ -0,0 +1,125 @@
package com.gmail.nossr50.api;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PartyAPI {
/**
* Get the name of the party a player is in.
* </br>
* This function is designed for API usage.
*
* @param player The player to check the party name of
* @return the name of the player's party
*/
public String getPartyName(Player player) {
return Users.getProfile(player).getParty();
}
/**
* Checks if a player is in a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return true if the player is in a party, false otherwise
*/
public boolean inParty(Player player) {
return Users.getProfile(player).inParty();
}
/**
* Check if two players are in the same party.
* </br>
* This function is designed for API usage.
*
* @param playera The first player to check
* @param playerb The second player to check
* @return true if the two players are in the same party, false otherwise
*/
public boolean inSameParty(Player playera, Player playerb) {
return Party.getInstance().inSameParty(playera, playerb);
}
/**
* Get a list of all current party names.
* </br>
* This function is designed for API usage.
*
* @return the list of parties.
*/
public ArrayList<String> getParties() {
String location = "plugins/mcMMO/mcmmo.users";
ArrayList<String> parties = new ArrayList<String>();
try {
//Open the users file
FileReader file = new FileReader(location);
BufferedReader in = new BufferedReader(file);
String line = "";
while((line = in.readLine()) != null) {
String[] character = line.split(":");
String theparty = null;
//Party
if (character.length > 3) {
theparty = character[3];
}
if (!parties.contains(theparty)) {
parties.add(theparty);
}
}
in.close();
}
catch (Exception e) {
Bukkit.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
}
return parties;
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
*/
public ArrayList<Player> getPartyMembers(Player player) {
return Party.getInstance().getPartyMembers(player);
}
/**
* Add a player to a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add to the party
* @param partyName The party to add the player to
*/
public void addToParty(Player player, String partyName) {
Party.getInstance().addToParty(player, Users.getProfile(player), partyName, false, null);
}
/**
* Remove a player from a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to remove
*/
public void removeFromParty(Player player) {
Party.getInstance().removeFromParty(player, Users.getProfile(player));
}
}

View File

@@ -0,0 +1,147 @@
package com.gmail.nossr50.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class CommandHelper {
/**
* Checks for command permissions.
*
* @param sender The command sender
* @param permission The permission to check
* @return true if the sender is a player without permissions, false otherwise
*/
public static boolean noCommandPermissions(CommandSender sender, String permission) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player != null && !mcPermissions.getInstance().permission(player, permission)) {
player.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
}
return false;
}
public static boolean noConsoleUsage(CommandSender sender) {
if (!(sender instanceof Player)) {
sender.sendMessage(mcLocale.getString("Commands.NoConsole"));
return true;
}
return false;
}
/**
* Print out details on Gathering skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param display The sender to display stats to
* @param online true if the player to retrieve stats for is online, false otherwise
*/
public static void printGatheringSkills(Player inspect, CommandSender display) {
if (Skills.hasGatheringSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.GatheringHeader"));
if (mcPermissions.getInstance().excavation(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
}
if (mcPermissions.getInstance().fishing(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
}
if (mcPermissions.getInstance().herbalism(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
}
if (mcPermissions.getInstance().mining(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
}
if (mcPermissions.getInstance().woodcutting(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
}
}
}
public static void printGatheringSkills(Player player) {
printGatheringSkills(player, player);
}
/**
* Print out details on Combat skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param display The sender to display stats to
* @param online true if the player to retrieve stats for is online, false otherwise
*/
public static void printCombatSkills(Player inspect, CommandSender display) {
if (Skills.hasCombatSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.CombatHeader"));
if (mcPermissions.getInstance().axes(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
}
if (mcPermissions.getInstance().archery(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
}
if (mcPermissions.getInstance().swords(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
}
if (mcPermissions.getInstance().taming(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
}
if (mcPermissions.getInstance().unarmed(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
}
}
}
public static void printCombatSkills(Player player) {
printCombatSkills(player, player);
}
/**
* Print out details on Misc skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param display The sender to display stats to
* @param online true if the player to retrieve stats for is online, false otherwise
*/
public static void printMiscSkills(Player inspect, CommandSender display) {
if (Skills.hasMiscSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.MiscHeader"));
if (mcPermissions.getInstance().acrobatics(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
}
if (mcPermissions.getInstance().repair(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
}
}
}
public static void printMiscSkills(Player player) {
printMiscSkills(player, player);
}
}

View File

@@ -0,0 +1,108 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
public class AddlevelsCommand implements CommandExecutor{
private final mcMMO plugin;
public AddlevelsCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer modifiedPlayer;
PlayerProfile PP;
int levels;
SkillType skill;
String skillName;
String usage = ChatColor.RED + "Proper usage is /addlevels [playername] <skill> <level>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true;
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
modifiedPlayer = (Player) sender;
levels = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
PP = Users.getProfile(modifiedPlayer);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = m.getCapitalized(skill.toString());
}
PP.addLevels(skill, levels);
sender.sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale.
}
}
else {
sender.sendMessage(usage);
}
return true;
case 3:
modifiedPlayer = plugin.getServer().getOfflinePlayer(args[0]);
String playerName = modifiedPlayer.getName();
PP = Users.getProfile(modifiedPlayer);
if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist"));
return true;
}
if (m.isInt(args[2]) && Skills.isSkill(args[1])) {
levels = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]);
String message;
Users.getProfile(modifiedPlayer).addLevels(skill, levels);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
}
else {
skillName = m.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
}
sender.sendMessage(message);
if (modifiedPlayer.isOnline()) {
((Player) modifiedPlayer).sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale.
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -6,84 +6,105 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
//TODO: Any way we can make this work for offline use?
public class AddxpCommand implements CommandExecutor {
private final mcMMO plugin;
private final mcMMO plugin;
public AddxpCommand(mcMMO instance) {
this.plugin = instance;
}
public AddxpCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player modifiedPlayer;
int xp;
SkillType skill;
String skillName;
String usage = ChatColor.RED + "Proper usage is /addxp [player] <skill> <xp>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true;
}
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
sender.sendMessage("This command requires permissions.");
return true;
}
if (!LoadProperties.addxpEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
modifiedPlayer = (Player) sender;
xp = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
if (!(sender instanceof Player)) {
if (args.length < 2) {
// No console aliasing yet
// System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp");
System.out.println("Usage is /addxp playername skillname xp");
return true;
} else if (args.length == 3) {
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
int newvalue = Integer.valueOf(args[2]);
Users.getProfile(plugin.getServer().getPlayer(args[0])).addXPOverrideNoBonus(Skills.getSkillType(args[1]), newvalue);
plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!");
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
Skills.XpCheckAll(plugin.getServer().getPlayer(args[0]));
}
} else {
// No console aliasing yet
// System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp");
System.out.println("Usage is /addxp playername skillname xp");
}
return true;
}
Users.getProfile(modifiedPlayer).addXPOverride(skill, xp);
if (!mcPermissions.getInstance().mmoedit(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (args.length < 2) {
player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp");
return true;
}
if (args.length == 3) {
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
int newvalue = Integer.valueOf(args[2]);
Users.getProfile(plugin.getServer().getPlayer(args[0])).addXP(Skills.getSkillType(args[1]), newvalue, plugin.getServer().getPlayer(args[0]));
plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!");
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
Skills.XpCheckAll(plugin.getServer().getPlayer(args[0]));
}
} else if (args.length == 2 && m.isInt(args[1]) && Skills.isSkill(args[0])) {
int newvalue = Integer.valueOf(args[1]);
Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue, player);
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
} else {
player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp");
}
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = m.getCapitalized(skill.toString());
}
return true;
}
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
if (skill.equals(SkillType.ALL)) {
Skills.XpCheckAll(modifiedPlayer);
}
else {
Skills.XpCheckSkill(skill, modifiedPlayer);
}
}
}
else {
sender.sendMessage(usage);
}
return true;
case 3:
modifiedPlayer = plugin.getServer().getPlayer(args[0]);
String playerName = modifiedPlayer.getName();
if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) {
xp = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]);
String message;
Users.getProfile(modifiedPlayer).addXPOverride(skill, xp);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
}
else {
skillName = m.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
}
sender.sendMessage(message);
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
if (skill.equals(SkillType.ALL)) {
Skills.XpCheckAll(modifiedPlayer);
}
else {
Skills.XpCheckSkill(skill, modifiedPlayer);
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,46 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
public class ClearmyspawnCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.clearmyspawnEnable || !LoadProperties.enableMySpawn) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (!mcPermissions.getInstance().mySpawn(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX();
double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY();
double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ();
String worldname = Bukkit.getServer().getWorlds().get(0).getName();
PP.setMySpawn(x, y, z, worldname);
player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnCleared"));
return true;
}
}

View File

@@ -0,0 +1,94 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
public class InspectCommand implements CommandExecutor {
private final mcMMO plugin;
public InspectCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer target;
PlayerProfile PP;
String usage = "Proper usage is /inspect <player>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
return true;
}
switch (args.length) {
case 1:
target = plugin.getServer().getOfflinePlayer(args[0]);
PP = Users.getProfile(target);
if (target.isOnline()) {
Player player = (Player) target;
if (sender instanceof Player && !sender.isOp() && !m.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0)) {
sender.sendMessage(mcLocale.getString("Inspect.TooFar"));
return true;
}
sender.sendMessage(mcLocale.getString("Inspect.Stats", new Object[] { target.getName() }));
CommandHelper.printGatheringSkills(player, sender);
CommandHelper.printCombatSkills(player, sender);
CommandHelper.printMiscSkills(player, sender);
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel", new Object[] { PP.getPowerLevel() }));
return true;
}
else {
if (sender instanceof Player && !sender.isOp()) {
sender.sendMessage(mcLocale.getString("Inspect.Offline"));
return true;
}
if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(mcLocale.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(mcLocale.getString("Stats.GatheringHeader"));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(mcLocale.getString("Stats.CombatHeader"));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(mcLocale.getString("Stats.MiscHeader"));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
return true;
}
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -0,0 +1,35 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
public class McstatsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
CommandHelper.printGatheringSkills(player);
CommandHelper.printCombatSkills(player);
CommandHelper.printMiscSkills(player);
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel", new Object[] { PP.getPowerLevel() }));
return true;
}
}

View File

@@ -1,87 +1,108 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
public class MmoeditCommand implements CommandExecutor {
private final mcMMO plugin;
private final mcMMO plugin;
public MmoeditCommand(mcMMO instance) {
this.plugin = instance;
}
public MmoeditCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer modifiedPlayer;
PlayerProfile PP;
int newValue;
SkillType skill;
String skillName;
String usage = ChatColor.RED + "Proper usage is /mmoedit [player] <skill> <level>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true;
}
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
sender.sendMessage("This command requires permissions.");
return true;
}
if (!LoadProperties.mmoeditEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
modifiedPlayer = (Player) sender;
newValue = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
PP = Users.getProfile(modifiedPlayer);
if (!(sender instanceof Player)) {
if (args.length < 2) {
System.out.println("Usage is /mmoedit playername skillname newvalue");
return true;
} else if (args.length == 3) {
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
int newvalue = Integer.valueOf(args[2]);
Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue);
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
}
} else {
System.out.println("Usage is /mmoedit playername skillname newvalue");
}
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = m.getCapitalized(skill.toString());
}
return true;
}
PP.modifySkill(skill, newValue);
sender.sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
}
}
else {
sender.sendMessage(usage);
}
PlayerProfile PP = Users.getProfile(player);
return true;
if (!mcPermissions.getInstance().mmoedit(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (args.length < 2) {
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
return true;
}
if (args.length == 3) {
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
int newvalue = Integer.valueOf(args[2]);
Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue);
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
}
} else if (args.length == 2) {
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
int newvalue = Integer.valueOf(args[1]);
PP.modifyskill(Skills.getSkillType(args[0]), newvalue);
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
}
} else {
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
}
case 3:
modifiedPlayer = plugin.getServer().getOfflinePlayer(args[0]);
String playerName = modifiedPlayer.getName();
PP = Users.getProfile(modifiedPlayer);
return true;
}
if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist"));
return true;
}
if (m.isInt(args[2]) && Skills.isSkill(args[1])) {
newValue = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]);
String message;
Users.getProfile(modifiedPlayer).modifySkill(skill, newValue);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
}
else {
skillName = m.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
}
sender.sendMessage(message);
if (modifiedPlayer.isOnline()) {
((Player) modifiedPlayer).sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -7,33 +7,40 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.runnables.SQLConversionTask;
import com.gmail.nossr50.util.Users;
public class MmoupdateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
Player player = (Player) sender;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
if (!mcPermissions.getInstance().admin(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
player.sendMessage(ChatColor.GRAY + "Starting conversion...");
Users.clearUsers();
m.convertToMySQL();
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
player.sendMessage(ChatColor.GREEN + "Conversion finished!");
sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
Users.clearUsers();
convertToMySQL();
return true;
}
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
sender.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale.
return true;
}
/**
* Convert FlatFile data to MySQL data.
*/
private void convertToMySQL() {
if (!LoadProperties.useMySQL) {
return;
}
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
}
}

View File

@@ -1,58 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
public class MyspawnCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.myspawnEnable || !LoadProperties.enableMySpawn) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (!mcPermissions.getInstance().mySpawn(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (System.currentTimeMillis() < (PP.getMySpawnATS() * 1000) + 3600000) {
long x = (((PP.getMySpawnATS() * 1000) + 3600000) - System.currentTimeMillis());
int y = (int) (x / 60000);
int z = (int) ((x / 1000) - (y * 60));
player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnTimeNotice", new Object[] { y, z }));
return true;
}
PP.setMySpawnATS(System.currentTimeMillis());
if (PP.getMySpawn(player) != null) {
Location mySpawn = PP.getMySpawn(player);
if (mySpawn != null) {
// It's done twice because it acts oddly when you are in another world
player.teleport(mySpawn);
player.teleport(mySpawn);
}
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnNotExist"));
}
return true;
}
}

View File

@@ -1,105 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
public class StatsCommand implements CommandExecutor {
private final mcMMO plugin;
public StatsCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.statsEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (!(sender instanceof Player)) {
if(args.length != 1) {
sender.sendMessage("Usage: stats <username>");
return true;
} else {
Player temp = plugin.getServer().getPlayer(args[0]);
if(temp == null) {
sender.sendMessage("Could not find player: " + args[0]);
return true;
} else {
player = temp;
}
}
}
PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
ChatColor header = ChatColor.GOLD;
if (Skills.hasGatheringSkills(player)) {
player.sendMessage(header + "-=GATHERING SKILLS=-");
if (mcPermissions.getInstance().excavation(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION)));
if (mcPermissions.getInstance().fishing(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING)));
if (mcPermissions.getInstance().herbalism(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM)));
if (mcPermissions.getInstance().mining(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING)));
if (mcPermissions.getInstance().woodcutting(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING)));
}
if (Skills.hasCombatSkills(player)) {
player.sendMessage(header + "-=COMBAT SKILLS=-");
if (mcPermissions.getInstance().axes(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES)));
if (mcPermissions.getInstance().archery(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY)));
// if(mcPermissions.getInstance().sorcery(player))
// player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PP.getSkill("sorcery"), PP.getSkill("sorceryXP"), PP.getXpToLevel("excavation")));
if (mcPermissions.getInstance().swords(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS)));
if (mcPermissions.getInstance().taming(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING)));
if (mcPermissions.getInstance().unarmed(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED)));
}
if (Skills.hasMiscSkills(player)) {
player.sendMessage(header + "-=MISC SKILLS=-");
if (mcPermissions.getInstance().acrobatics(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS)));
// if(mcPermissions.getInstance().alchemy(player))
// player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PP.getSkillLevel(SkillType.ALCHEMY), PP.getSkillXpLevel(SkillType.ALCHEMY), PP.getXpToLevel(SkillType.ALCHEMY)));
// if(mcPermissions.getInstance().enchanting(player))
// player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PP.getSkillLevel(SkillType.ENCHANTING), PP.getSkillXpLevel(SkillType.ENCHANTING), PP.getXpToLevel(SkillType.ENCHANTING)));
if (mcPermissions.getInstance().repair(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR)));
}
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(player)));
return true;
}
}

View File

@@ -1,106 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
public class WhoisCommand implements CommandExecutor {
private final mcMMO plugin;
public WhoisCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.whoisEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && !mcPermissions.getInstance().whois(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
return true;
}
// if split[1] is a player
if (plugin.getServer().getPlayer(args[0]) != null) {
Player target = plugin.getServer().getPlayer(args[0]);
PlayerProfile PPt = Users.getProfile(target);
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
player.sendMessage(target.getName());
if (PPt.inParty())
player.sendMessage("Party: " + PPt.getParty());
player.sendMessage("Health: " + target.getHealth() + ChatColor.GRAY + " (20 is full health)");
player.sendMessage("OP: " + target.isOp());
player.sendMessage(ChatColor.GREEN + "mcMMO Stats for " + ChatColor.YELLOW + target.getName());
player.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-");
if (mcPermissions.getInstance().excavation(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION)));
if (mcPermissions.getInstance().fishing(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING)));
if (mcPermissions.getInstance().herbalism(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM)));
if (mcPermissions.getInstance().mining(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING)));
if (mcPermissions.getInstance().woodcutting(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING)));
player.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-");
if (mcPermissions.getInstance().axes(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES)));
if (mcPermissions.getInstance().archery(player))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY)));
// if(mcPermissions.getInstance().sorcery(target))
// player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PPt.getSkill("sorcery"), PPt.getSkill("sorceryXP"), PPt.getXpToLevel("excavation")));
if (mcPermissions.getInstance().swords(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS)));
if (mcPermissions.getInstance().taming(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING)));
if (mcPermissions.getInstance().unarmed(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED)));
player.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-");
if (mcPermissions.getInstance().acrobatics(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS)));
// if(mcPermissions.getInstance().alchemy(target))
// player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PPt.getSkillLevel(SkillType.ALCHEMY), PPt.getSkillXpLevel(SkillType.ALCHEMY), PPt.getXpToLevel(SkillType.ALCHEMY)));
// if(mcPermissions.getInstance().enchanting(target))
// player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PPt.getSkillLevel(SkillType.ENCHANTING), PPt.getSkillXpLevel(SkillType.ENCHANTING), PPt.getXpToLevel(SkillType.ENCHANTING)));
if (mcPermissions.getInstance().repair(target))
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(target)));
}
return true;
}
}

View File

@@ -1,128 +1,88 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.m;
public class XprateCommand implements CommandExecutor {
private static int oldrate = LoadProperties.xpGainMultiplier;
public static boolean xpevent = false;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.xprateEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
private static int oldrate = LoadProperties.xpGainMultiplier;
public static boolean xpevent = false;
if (!(sender instanceof Player)) {
if(args.length <= 0)
{
System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {"xprate"}));
System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {"xprate"}));
}
if(args.length == 1 && args[0].equalsIgnoreCase("reset"))
{
if(xpevent)
{
for(Player x : Bukkit.getServer().getOnlinePlayers())
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
xpevent = !xpevent;
LoadProperties.xpGainMultiplier = oldrate;
} else
{
LoadProperties.xpGainMultiplier = oldrate;
}
}
if(args.length >= 1 && m.isInt(args[0]))
{
oldrate = LoadProperties.xpGainMultiplier;
if(args.length >= 2 && (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")))
{
if(args[1].equalsIgnoreCase("true"))
xpevent = true;
else
xpevent = false;
} else
{
System.out.println(mcLocale.getString("Commands.xprate.proper3"));
return true;
}
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
if(xpevent = true)
for(Player x : Bukkit.getServer().getOnlinePlayers())
{
x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!");
x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!");
}
System.out.println("The XP RATE was modified to "+LoadProperties.xpGainMultiplier);
}
return true;
}
Player player = (Player) sender;
if(!mcPermissions.getInstance().admin(player))
{
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(args.length <= 0)
{
player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {"xprate"}));
player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {"xprate"}));
}
if(args.length == 1 && args[0].equalsIgnoreCase("reset"))
{
if(xpevent)
{
for(Player x : Bukkit.getServer().getOnlinePlayers())
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
xpevent = !xpevent;
LoadProperties.xpGainMultiplier = oldrate;
} else
{
LoadProperties.xpGainMultiplier = oldrate;
}
}
if(args.length >= 1 && m.isInt(args[0]))
{
oldrate = LoadProperties.xpGainMultiplier;
if(args.length >= 2 && (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")))
{
if(args[1].equalsIgnoreCase("true"))
xpevent = true;
else
xpevent = false;
} else
{
player.sendMessage(mcLocale.getString("Commands.xprate.proper3"));
return true;
}
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
if(xpevent = true)
for(Player x : Bukkit.getServer().getOnlinePlayers())
{
x.sendMessage(mcLocale.getString("Commands.xprate.started"));
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
}
}
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage1 = mcLocale.getString("Commands.xprate.proper");
String usage2 = mcLocale.getString("Commands.xprate.proper2");
String usage3 = mcLocale.getString("Commands.xprate.proper3");
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("reset")) {
if (xpevent) {
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
}
xpevent = !xpevent;
LoadProperties.xpGainMultiplier = oldrate;
}
else {
LoadProperties.xpGainMultiplier = oldrate;
}
}
else if (m.isInt(args[0])) {
sender.sendMessage(usage3);
}
else {
sender.sendMessage(usage2);
}
return true;
case 2:
if (m.isInt(args[0])) {
oldrate = LoadProperties.xpGainMultiplier;
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
xpevent = Boolean.valueOf(args[1]);
}
else {
sender.sendMessage(usage3);
}
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
if (xpevent) {
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.started"));
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
}
}
else {
sender.sendMessage("The XP RATE was modified to " + LoadProperties.xpGainMultiplier); //TODO: Locale
}
}
else {
sender.sendMessage(usage1);
sender.sendMessage(usage2);
}
return true;
default:
sender.sendMessage(usage1);
sender.sendMessage(usage2);
return true;
}
}
}

View File

@@ -5,44 +5,34 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
public class McabilityCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (player != null && player.hasPermission("mcmmo.commands.ability")) {
sender.sendMessage("This command requires permissions.");
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
if (!LoadProperties.mcabilityEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
PlayerProfile PP = Users.getProfile((Player) sender);
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (PP.getAbilityUse()) {
sender.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
}
else {
sender.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
}
PlayerProfile PP = Users.getProfile(player);
PP.toggleAbilityUse();
if (PP.getAbilityUse()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
PP.toggleAbilityUse();
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
PP.toggleAbilityUse();
}
return true;
}
return true;
}
}

View File

@@ -6,68 +6,67 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.mcPermissions;
//TODO: Rework this whole thing. It's ugly.
public class MccCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mccEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
Player player = (Player) sender;
player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---");
player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---"); //TODO: Needs more locale.
if (mcPermissions.getInstance().party(player)) {
player.sendMessage(mcLocale.getString("m.mccPartyCommands"));
player.sendMessage("/party " + mcLocale.getString("m.mccParty"));
player.sendMessage("/party q " + mcLocale.getString("m.mccPartyQ"));
if (mcPermissions.getInstance().party(player)) {
player.sendMessage(mcLocale.getString("m.mccPartyCommands"));
player.sendMessage("/party " + mcLocale.getString("m.mccParty"));
player.sendMessage("/party q " + mcLocale.getString("m.mccPartyQ"));
if (mcPermissions.getInstance().partyChat(player))
player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle"));
if (mcPermissions.getInstance().partyChat(player)) {
player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle"));
}
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyInvite"));
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyAccept"));
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyInvite"));
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyAccept"));
if (mcPermissions.getInstance().partyTeleport(player))
player.sendMessage("/ptp " + mcLocale.getString("m.mccPartyTeleport"));
}
player.sendMessage(mcLocale.getString("m.mccOtherCommands"));
player.sendMessage("/stats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats"));
player.sendMessage("/mctop <skillname> <page> " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards"));
if (mcPermissions.getInstance().partyTeleport(player)) {
player.sendMessage("/ptp " + mcLocale.getString("m.mccPartyTeleport"));
}
}
if (mcPermissions.getInstance().mySpawn(player)) {
player.sendMessage("/myspawn " + ChatColor.RED + mcLocale.getString("m.mccMySpawn"));
player.sendMessage("/clearmyspawn " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn"));
}
player.sendMessage(mcLocale.getString("m.mccOtherCommands"));
player.sendMessage("/mcstats " + ChatColor.RED + mcLocale.getString("m.mccStats"));
player.sendMessage("/mctop <skillname> <page> " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards"));
if (mcPermissions.getInstance().mcAbility(player))
player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility"));
if (mcPermissions.getInstance().mcAbility(player)) {
player.sendMessage("/mcability " + ChatColor.RED + mcLocale.getString("m.mccToggleAbility"));
}
if (mcPermissions.getInstance().adminChat(player))
player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle"));
if (mcPermissions.getInstance().adminChat(player)) {
player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle"));
}
if (mcPermissions.getInstance().whois(player))
player.sendMessage("/whois " + mcLocale.getString("m.mccWhois"));
if (mcPermissions.getInstance().inspect(player)) {
player.sendMessage("/inspect " + mcLocale.getString("m.mccInspect"));
}
if (mcPermissions.getInstance().mmoedit(player))
player.sendMessage("/mmoedit" + mcLocale.getString("m.mccMmoedit"));
if (mcPermissions.getInstance().mmoedit(player)) {
player.sendMessage("/mmoedit " + mcLocale.getString("m.mccMmoedit"));
}
if (mcPermissions.getInstance().mcgod(player))
player.sendMessage("/mcgod" + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod"));
if (mcPermissions.getInstance().mcgod(player)) {
player.sendMessage("/mcgod " + ChatColor.RED + mcLocale.getString("m.mccMcGod"));
}
player.sendMessage(mcLocale.getString("m.mccSkillInfo"));
player.sendMessage("/mcmmo " + mcLocale.getString("m.mccModDescription"));
player.sendMessage(mcLocale.getString("m.mccSkillInfo"));
player.sendMessage("/mcmmo " + mcLocale.getString("m.mccModDescription"));
return true;
}
return true;
}
}

View File

@@ -1,48 +1,38 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
public class McgodCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcgodEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcgod")) {
return true;
}
if (!mcPermissions.getInstance().mcgod(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
PlayerProfile PP = Users.getProfile((Player) sender);
if (mcPermissions.getInstance().mcgod(player)) {
if (PP.getGodMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
PP.toggleGodMode();
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled"));
PP.toggleGodMode();
}
}
if (PP.getGodMode()) {
sender.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
}
else {
sender.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled"));
}
return true;
}
PP.toggleGodMode();
return true;
}
}

View File

@@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.config.LoadProperties;
@@ -12,37 +12,26 @@ import com.gmail.nossr50.locale.mcLocale;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcmmoEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String description = mcLocale.getString("mcMMO.Description", new Object[] { "mcc" });
String[] mcSplit = description.split(",");
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
for (String x : mcSplit) {
sender.sendMessage(x);
}
Player player = (Player) sender;
if (LoadProperties.donateMessage) {
if (LoadProperties.spoutEnabled && sender instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) sender;
player.sendMessage(ChatColor.RED + "-----[]" + ChatColor.GREEN + "mcMMO" + ChatColor.RED + "[]-----");
String description = mcLocale.getString("mcMMO.Description", new Object[] { "mcc" });
String[] mcSplit = description.split(",");
sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "nossr50@gmail.com", Material.DIAMOND);
}
for (String x : mcSplit) {
player.sendMessage(x);
}
sender.sendMessage(ChatColor.DARK_AQUA + "Donation Info:");
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
}
if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) player;
if (LoadProperties.donateMessage)
sPlayer.sendMessage(ChatColor.GREEN + "[mcMMO] Donate! Paypal theno1yeti@gmail.com");
} else {
if (LoadProperties.donateMessage)
player.sendMessage(ChatColor.GREEN + "If you like my work you can donate via Paypal: theno1yeti@gmail.com");
}
return true;
}
return true;
}
}

View File

@@ -6,12 +6,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.ToolType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class McrefreshCommand implements CommandExecutor {
private final mcMMO plugin;
@@ -22,13 +23,9 @@ public class McrefreshCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcrefreshEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
@@ -40,7 +37,7 @@ public class McrefreshCommand implements CommandExecutor {
return true;
}
if (args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
player.sendMessage("You have refreshed " + args[0] + "'s cooldowns!");
player.sendMessage("You have refreshed " + args[0] + "'s cooldowns!"); //TODO: Needs more locale.
player = plugin.getServer().getPlayer(args[0]);
}
@@ -49,21 +46,20 @@ public class McrefreshCommand implements CommandExecutor {
*/
PP = Users.getProfile(player);
PP.setRecentlyHurt((long) 0);
PP.setHoePreparationMode(false);
PP.setAxePreparationMode(false);
PP.setFistsPreparationMode(false);
PP.setSwordsPreparationMode(false);
PP.setPickaxePreparationMode(false);
PP.setToolPreparationMode(ToolType.AXE, false);
PP.setToolPreparationMode(ToolType.FISTS, false);
PP.setToolPreparationMode(ToolType.HOE, false);
PP.setToolPreparationMode(ToolType.PICKAXE, false);
PP.setToolPreparationMode(ToolType.SWORD, false);
//RESET COOLDOWNS
PP.resetCooldowns();
PP.setGreenTerraMode(false);
PP.setGigaDrillBreakerMode(false);
PP.setSerratedStrikesMode(false);
PP.setSuperBreakerMode(false);
PP.setTreeFellerMode(false);
PP.setBerserkMode(false);
PP.setAbilityMode(AbilityType.GREEN_TERRA, false);
PP.setAbilityMode(AbilityType.GIGA_DRILL_BREAKER, false);
PP.setAbilityMode(AbilityType.SERRATED_STRIKES, false);
PP.setAbilityMode(AbilityType.SUPER_BREAKER, false);
PP.setAbilityMode(AbilityType.TREE_FELLER, false);
PP.setAbilityMode(AbilityType.BERSERK, false);
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));

View File

@@ -0,0 +1,125 @@
package com.gmail.nossr50.commands.mc;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class McremoveCommand implements CommandExecutor {
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && !mcPermissions.getInstance().mcremove(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(args.length == 0)
{
sender.sendMessage("Correct usage is /mcremove [Player Name]"); //TODO: Needs more locale.
return true;
}
String playerName = args[0]; //Player that we are going to remove
//If the server is using MySQL
if(LoadProperties.useMySQL)
{
int userId = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
//Remove user from tables
mcMMO.database.write("DELETE FROM "
+LoadProperties.MySQLdbName+"."
+LoadProperties.MySQLtablePrefix+"users WHERE "
+LoadProperties.MySQLtablePrefix+"users.id="+userId);
mcMMO.database.write("DELETE FROM "
+LoadProperties.MySQLdbName+"."
+LoadProperties.MySQLtablePrefix+"cooldowns WHERE "
+LoadProperties.MySQLtablePrefix+"cooldowns.user_id="+userId);
mcMMO.database.write("DELETE FROM "
+LoadProperties.MySQLdbName+"."
+LoadProperties.MySQLtablePrefix+"huds WHERE "
+LoadProperties.MySQLtablePrefix+"huds.user_id="+userId);
mcMMO.database.write("DELETE FROM "
+LoadProperties.MySQLdbName+"."
+LoadProperties.MySQLtablePrefix+"skills WHERE "
+LoadProperties.MySQLtablePrefix+"skills.user_id="+userId);
mcMMO.database.write("DELETE FROM "
+LoadProperties.MySQLdbName+"."
+LoadProperties.MySQLtablePrefix+"experience WHERE "
+LoadProperties.MySQLtablePrefix+"experience.user_id="+userId);
sender.sendMessage("User "+playerName+" removed from MySQL DB!"); //TODO: Needs more locale.
} else {
if(removeFlatFileUser(playerName)) {
sender.sendMessage(ChatColor.GREEN+"[mcMMO] It worked! User was removed.");
} else {
sender.sendMessage(ChatColor.RED+"[mcMMO] Couldn't find the user, remember its case sensitive!");
}
}
//Force PlayerProfile stuff to update
if(Bukkit.getServer().getPlayer(playerName) != null && Users.players.containsKey(playerName.toLowerCase()))
{
Users.players.remove(playerName.toLowerCase());
Users.addUser(Bukkit.getServer().getPlayer(playerName));
}
sender.sendMessage("[mcMMO] mcremove operation completed."); //TODO: Needs more locale.
return true;
}
private boolean removeFlatFileUser(String playerName) {
boolean worked = false;
try {
FileReader file = new FileReader(location);
BufferedReader in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null) {
/* Write out the same file but when we get to the player we want to remove we skip his line */
if(!line.split(":")[0].equalsIgnoreCase(playerName))
{
writer.append(line).append("\r\n");
} else {
System.out.println("User found, removing...");
worked = true;
continue; //Skip the player
}
}
in.close();
FileWriter out = new FileWriter(location); //Write out the new file
out.write(writer.toString());
out.close();
return worked;
} catch (Exception e) {
Bukkit.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
return worked;
}
}
}

View File

@@ -7,30 +7,17 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Leaderboard;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.m;
public class MctopCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mctopEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
Player player = (Player) sender;
if (LoadProperties.useMySQL == false) {
/*
@@ -39,7 +26,7 @@ public class MctopCommand implements CommandExecutor {
if (args.length == 0) {
int p = 1;
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
int n = 1 * p; // Position
for (String x : info) {
if (x != null) {
@@ -48,7 +35,7 @@ public class MctopCommand implements CommandExecutor {
digit = "0" + String.valueOf(n);
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
@@ -68,7 +55,7 @@ public class MctopCommand implements CommandExecutor {
pt = 10;
}
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
int n = 1 * pt; // Position
for (String x : info) {
if (x != null) {
@@ -77,7 +64,7 @@ public class MctopCommand implements CommandExecutor {
digit = "0" + String.valueOf(n);
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
@@ -104,7 +91,7 @@ public class MctopCommand implements CommandExecutor {
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
String[] info = Leaderboard.retrieveInfo(args[0].toUpperCase(), p);
player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
int n = 1 * pt; // Position
for (String x : info) {
if (x != null) {
@@ -113,7 +100,7 @@ public class MctopCommand implements CommandExecutor {
digit = "0" + String.valueOf(n);
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
@@ -132,7 +119,7 @@ public class MctopCommand implements CommandExecutor {
String remainder = args[0].substring(1); // Get remainder of word.
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
if (args.length >= 2 && m.isInt(args[1])) {
int n = 1; // For the page number
int n2 = Integer.valueOf(args[1]);
@@ -142,28 +129,28 @@ public class MctopCommand implements CommandExecutor {
n = n * (n2 - 1);
}
// If a page number is specified
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
for (int i = n; i <= n + 10; i++) {
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
break;
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
}
return true;
}
// If no page number is specified
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
for (int i = 1; i <= 10; i++) { // i<=userslist.size()
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
break;
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
}
return true;
}
if (args.length >= 0) {
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
if (args.length >= 1 && m.isInt(args[0])) {
int n = 1; // For the page number
int n2 = Integer.valueOf(args[0]);
@@ -173,21 +160,21 @@ public class MctopCommand implements CommandExecutor {
n = n * (n2 - 1);
}
// If a page number is specified
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
for (int i = n; i <= n + 10; i++) {
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
break;
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
}
return true;
}
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
for (int i = 1; i <= 10; i++) {
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
break;
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
// System.out.println(username.get(1).get(0));
// System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1));
}

View File

@@ -1,8 +1,5 @@
package com.gmail.nossr50.commands.party;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -10,18 +7,15 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class ACommand implements CommandExecutor {
private Logger log;
public ACommand() {
this.log = Logger.getLogger("Minecraft");
}
public ACommand() {}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@@ -33,9 +27,16 @@ public class ACommand implements CommandExecutor {
aMessage = aMessage + " " + args[i];
}
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", aMessage);
Bukkit.getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return true;
aMessage = chatEvent.getMessage();
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
log.log(Level.INFO, "[A]<*Console*> " + aMessage);
Bukkit.getLogger().info("[A]<*Console*> " + aMessage);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
@@ -61,14 +62,11 @@ public class ACommand implements CommandExecutor {
for (int i = 1; i <= args.length - 1; i++) {
aMessage = aMessage + " " + args[i];
}
Users.getProfile(player).toggleAdminChat();
player.chat(aMessage);
Users.getProfile(player).toggleAdminChat();
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
log.log(Level.INFO, "[A]<" + name + "> " + aMessage);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
herp.sendMessage(aPrefix + aMessage);
}
return true;
}
@@ -83,10 +81,8 @@ public class ACommand implements CommandExecutor {
if (PP.getAdminChatMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
}
}
return true;

View File

@@ -1,28 +1,26 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class AcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.acceptEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
@@ -38,10 +36,25 @@ public class AcceptCommand implements CommandExecutor {
Party Pinstance = Party.getInstance();
if (PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), PP.getInvite(), EventReason.CHANGED_PARTIES);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
Pinstance.removeFromParty(player, PP);
}
PP.acceptInvite();
Pinstance.addToParty(player, PP, PP.getParty(), true);
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, PP.getInvite(), EventReason.JOINED_PARTY);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
}
PP.acceptInvite();
Pinstance.addToParty(player, PP, PP.getParty(), true, null);
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites"));

View File

@@ -6,13 +6,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class InviteCommand implements CommandExecutor {
private final mcMMO plugin;
@@ -23,13 +22,9 @@ public class InviteCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.inviteEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
@@ -48,7 +43,7 @@ public class InviteCommand implements CommandExecutor {
return true;
}
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Usage is /invite <playername>");
player.sendMessage(ChatColor.RED + "Usage is /invite <playername>"); //TODO: Needs more locale.
return true;
}
if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
@@ -58,10 +53,8 @@ public class InviteCommand implements CommandExecutor {
PPt.modifyInvite(PP.getParty());
player.sendMessage(mcLocale.getString("mcPlayerListener.InviteSuccess"));
// target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName());
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] { PPt.getInvite(), player.getName() }));
// target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+LoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { "/accept" }));
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { "accept" }));
} else {
player.sendMessage(mcLocale.getString("Party.Locked"));
return true;

View File

@@ -1,8 +1,5 @@
package com.gmail.nossr50.commands.party;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -10,26 +7,17 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class PCommand implements CommandExecutor {
private Logger log;
public PCommand() {
this.log = Logger.getLogger("Minecraft");
}
public PCommand() {}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.partyEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
// Console message?
if (!(sender instanceof Player)) {
@@ -40,9 +28,16 @@ public class PCommand implements CommandExecutor {
pMessage = pMessage + " " + args[i];
}
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], pMessage);
Bukkit.getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return true;
pMessage = chatEvent.getMessage();
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
log.log(Level.INFO, "[P](" + args[0] + ")" + "<*Console*> " + pMessage);
Bukkit.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + pMessage);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (Users.getProfile(herp).inParty()) {
@@ -65,21 +60,19 @@ public class PCommand implements CommandExecutor {
// Not a toggle, a message
if (args.length >= 1) {
if(!PP.inParty()) {
player.sendMessage("You're not in a party."); //TODO: Use mcLocale
return true;
}
String pMessage = args[0];
for (int i = 1; i <= args.length - 1; i++) {
pMessage = pMessage + " " + args[i];
}
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") ";
log.log(Level.INFO, "[P](" + PP.getParty() + ")" + "<" + name + "> " + pMessage);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (Users.getProfile(herp).inParty()) {
if (Party.getInstance().inSameParty(herp, player))
herp.sendMessage(pPrefix + pMessage);
}
}
PP.togglePartyChat();
player.chat(pMessage);
PP.togglePartyChat();
return true;
}
@@ -90,10 +83,8 @@ public class PCommand implements CommandExecutor {
PP.togglePartyChat();
if (PP.getPartyChatMode()) {
// player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On");
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOn"));
} else {
// player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOff"));
}

View File

@@ -7,23 +7,20 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class PartyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.partyEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
@@ -38,20 +35,20 @@ public class PartyCommand implements CommandExecutor {
Party Pinstance = Party.getInstance();
if (PP.inParty() && (!Pinstance.isParty(PP.getParty()) || !Pinstance.isInParty(player, PP))) {
Pinstance.addToParty(player, PP, PP.getParty(), false);
Pinstance.addToParty(player, PP, PP.getParty(), false, null);
}
if (args.length == 0 && !PP.inParty()) {
player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { "/party "}));
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party "}));
player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { "party "}));
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "party "}));
player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { "party " }));
return true;
} else if (args.length == 0 && PP.inParty()) {
String tempList = "";
int x = 0;
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
if (p != null && x + 1 >= Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) {
if (p != null && x + 1 >= Pinstance.partyCount(player)) {
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
tempList += ChatColor.GOLD + p.getName();
x++;
@@ -60,7 +57,7 @@ public class PartyCommand implements CommandExecutor {
x++;
}
}
if (p != null && x < Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) {
if (p != null && x < Pinstance.partyCount(player)) {
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
tempList += ChatColor.GOLD + p.getName() + ", ";
x++;
@@ -73,21 +70,67 @@ public class PartyCommand implements CommandExecutor {
}
player.sendMessage(mcLocale.getString("mcPlayerListener.YouAreInParty", new Object[] { PP.getParty() }));
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyMembers") + " (" + tempList + ChatColor.GREEN + ")");
//Master Apprentice Stuff
//Show the player all their bonuses when they type /party
/*
for(Player a : Party.getInstance().getPartyMembers(player))
{
if(Party.getInstance().isPartyLeader(a.getName(), PP.getParty()) && !a.getName().equals(player.getName()))
{
PlayerProfile LP = Users.getProfile(a);
for(SkillType type : SkillType.values())
{
//Skip this one
if(type == SkillType.ALL)
continue;
if(LP.getSkillLevel(type) > PP.getSkillLevel(type))
{
//Tell them what their skill bonus is for this skill
int leaderLevel = LP.getSkillLevel(type);
int difference = leaderLevel - PP.getSkillLevel(type);
double bonusModifier = (difference*0.75D)/100D;
double trueBonus = bonusModifier * 100;
player.sendMessage("You get "+trueBonus+"% more XP from "+type.toString());
//double percent = (trueBonus/100)*100;
} else
{
//Tell them they have no bonus.. or not
}
}
} else if(Party.getInstance().isPartyLeader(a.getName(), PP.getParty()) && a.getName().equals(player.getName()))
{
//Tell them they are providing bonuses
}
}
*/
return true;
} else if (args.length == 1) {
if (args[0].equals("q") && PP.inParty()) {
Pinstance.removeFromParty(player, PP);
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), null, EventReason.LEFT_PARTY);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
Pinstance.removeFromParty(player, PP);
player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
return true;
} else if (args[0].equalsIgnoreCase("?")) {
player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { "/party " }));
player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { "party " }));
} else if (args[0].equalsIgnoreCase("lock")) {
if (PP.inParty()) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
@@ -115,9 +158,24 @@ public class PartyCommand implements CommandExecutor {
// Pinstance.dump(player);
} else {
if (PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
Pinstance.removeFromParty(player, PP);
}
Pinstance.addToParty(player, PP, args[0], false);
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
}
Pinstance.addToParty(player, PP, args[0], false, null);
return true;
}
} else if (args.length == 2 && PP.inParty()) {
@@ -153,6 +211,13 @@ public class PartyCommand implements CommandExecutor {
}
PlayerProfile tPP = Users.getProfile(tPlayer);
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, tPP.getParty(), null, EventReason.KICKED_FROM_PARTY);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
Pinstance.removeFromParty(tPlayer, tPP);
tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
@@ -180,10 +245,22 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
Pinstance.removeFromParty(player, PP);
Pinstance.addToParty(player, PP, args[0], false, args[1]);
}
} else if (args.length == 2 && !PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
Pinstance.addToParty(player, PP, args[0], false, args[1]);
}

View File

@@ -1,17 +1,20 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class PtpCommand implements CommandExecutor {
private final mcMMO plugin;
@@ -22,13 +25,9 @@ public class PtpCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.ptpEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
@@ -39,24 +38,51 @@ public class PtpCommand implements CommandExecutor {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(!Party.getInstance().isParty(PP.getParty()))
{
player.sendMessage(ChatColor.RED+"You are not in a party!"); //TODO: Needs more locale.
return true;
}
if(PP.getRecentlyHurt()+(LoadProperties.ptpCommandCooldown*1000) > System.currentTimeMillis())
{
player.sendMessage(ChatColor.RED+"You've been hurt in the last " + LoadProperties.ptpCommandCooldown + " seconds and cannnot teleport."); //TODO: Needs more locale.
return true;
}
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>");
player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>"); //TODO: Needs more locale.
return true;
}
if (plugin.getServer().getPlayer(args[0]) == null) {
player.sendMessage("That is not a valid player");
player.sendMessage("That is not a valid player"); //TODO: Needs more locale.
}
if (plugin.getServer().getPlayer(args[0]) != null) {
Player target = plugin.getServer().getPlayer(args[0]);
PlayerProfile PPt = Users.getProfile(target);
if (target.isDead()) {
player.sendMessage(ChatColor.RED + "You can't teleport to dead players."); //TODO: Needs more locale.
return true;
}
if (PP.getParty().equals(PPt.getParty())) {
player.teleport(target);
player.sendMessage(ChatColor.GREEN + "You have teleported to " + target.getName());
target.sendMessage(ChatColor.GREEN + player.getName() + " has teleported to you.");
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, PP.getParty());
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
player.teleport(target);
player.sendMessage(ChatColor.GREEN + "You have teleported to " + target.getName()); //TODO: Needs more locale.
target.sendMessage(ChatColor.GREEN + player.getName() + " has teleported to you."); //TODO: Needs more locale.
}
} else {
player.sendMessage(ChatColor.RED + "That player is in a different party than you."); //TODO: Needs more locale.
}
}
return true;
}
}
}

View File

@@ -5,20 +5,27 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class AcrobaticsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
if (!(sender instanceof Player))
{
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.acrobatics")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -46,7 +53,9 @@ public class AcrobaticsCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.AcrobaticsRollChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.AcrobaticsGracefulRollChance", new Object[] { gracepercentage }));
player.sendMessage(mcLocale.getString("m.AcrobaticsDodgeChance", new Object[] { dodgepercentage }));
Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args);
return true;
}
}
}

View File

@@ -5,37 +5,38 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class ArcheryCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.archery")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
float skillvalue = (float) PP.getSkillLevel(SkillType.ARCHERY);
String percentage = String.valueOf((skillvalue / 1000) * 100);
int ignition = 20;
if (PP.getSkillLevel(SkillType.ARCHERY) >= 200)
ignition += 20;
if (PP.getSkillLevel(SkillType.ARCHERY) >= 400)
ignition += 20;
if (PP.getSkillLevel(SkillType.ARCHERY) >= 600)
ignition += 20;
if (PP.getSkillLevel(SkillType.ARCHERY) >= 800)
ignition += 20;
if (PP.getSkillLevel(SkillType.ARCHERY) >= 1000)
ignition += 20;
double dmgBonusPercent = ((PP.getSkillLevel(SkillType.ARCHERY) / 50) * 0.1D);
/* Cap maximum bonus at 200% */
if(dmgBonusPercent > 2)
dmgBonusPercent = 2;
dmgBonusPercent = dmgBonusPercent * 100; //Convert to percentage
String percentagedaze;
if (PP.getSkillLevel(SkillType.ARCHERY) < 1000)
@@ -54,9 +55,11 @@ public class ArcheryCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery4_0"), mcLocale.getString("m.EffectsArchery4_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.ArcherySkillShot", new Object[] { dmgBonusPercent }));
player.sendMessage(mcLocale.getString("m.ArcheryDazeChance", new Object[] { percentagedaze }));
player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] { (ignition / 20) }));
Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args);
return true;
}

View File

@@ -5,20 +5,24 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class AxesCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.axes")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -26,11 +30,17 @@ public class AxesCommand implements CommandExecutor {
float skillvalue = (float) PP.getSkillLevel(SkillType.AXES);
if (PP.getSkillLevel(SkillType.AXES) < 750)
percentage = String.valueOf((skillvalue / 1000) * 100);
percentage = String.valueOf((skillvalue / 2000) * 100);
else
percentage = "75";
percentage = "37.5";
int bonusDmg = Users.getProfile(player).getSkillLevel(SkillType.AXES)/50;
if(bonusDmg > 4)
bonusDmg = 4;
int ticks = 2;
short durDmg = 5;
durDmg+=Users.getProfile(player).getSkillLevel(SkillType.AXES)/30;
int x = PP.getSkillLevel(SkillType.AXES);
while (x >= 50) {
x -= 50;
@@ -47,15 +57,15 @@ public class AxesCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes1_0"), mcLocale.getString("m.EffectsAxes1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes2_0"), mcLocale.getString("m.EffectsAxes2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes3_0"), mcLocale.getString("m.EffectsAxes3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes4_0"), mcLocale.getString("m.EffectsAxes4_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes5_0"), mcLocale.getString("m.EffectsAxes5_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.AxesCritChance", new Object[] { percentage }));
if (PP.getSkillLevel(SkillType.AXES) < 500)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockAxes1") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1") }));
player.sendMessage(mcLocale.getString("m.AxesSkullLength", new Object[] { ticks }));
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1", new Object[] {bonusDmg}) }));
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes2_0"), mcLocale.getString("m.AbilBonusAxes2_1", new Object[] {durDmg}) }));
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes3_0"), mcLocale.getString("m.AbilBonusAxes3_1", new Object[] {2}) }));
player.sendMessage(mcLocale.getString("m.AxesSkullLength", new Object[] { ticks }));
return true;
}

View File

@@ -5,20 +5,25 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class ExcavationCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.excavation")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -29,6 +34,7 @@ public class ExcavationCommand implements CommandExecutor {
ticks++;
}
player.sendMessage("");
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillExcavation") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainExcavation") }));
@@ -39,8 +45,10 @@ public class ExcavationCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] { ticks }));
player.sendMessage(mcLocale.getString("m.ExcavationGigaDrillBreakerLength", new Object[] { ticks }));
Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args);
return true;
}
}

View File

@@ -5,21 +5,27 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Fishing;
import com.gmail.nossr50.skills.gathering.Fishing;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class FishingCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.fishing")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -41,6 +47,8 @@ public class FishingCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockFishing1") }));
else
player.sendMessage(mcLocale.getString("m.ShakeInfo", new Object[] { Fishing.getFishingLootTier(PP) }));
Page.grabGuidePageForSkill(SkillType.FISHING, player, args);
return true;
}

View File

@@ -5,20 +5,26 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class HerbalismCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.herbalism")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -29,6 +35,10 @@ public class HerbalismCommand implements CommandExecutor {
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600)
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 800)
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 1000)
bonus++;
int ticks = 2;
int x = PP.getSkillLevel(SkillType.HERBALISM);
@@ -51,12 +61,16 @@ public class HerbalismCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism3_0"), mcLocale.getString("m.EffectsHerbalism3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism4_0"), mcLocale.getString("m.EffectsHerbalism4_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism5_0"), mcLocale.getString("m.EffectsHerbalism5_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.HerbalismGreenTerraLength", new Object[] { ticks }));
player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbChance", new Object[] { gpercentage }));
player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbStage", new Object[] { bonus }));
player.sendMessage(mcLocale.getString("m.HerbalismFoodPlus", new Object[] { bonus } ));
player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] { percentage }));
Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args);
return true;
}

View File

@@ -5,20 +5,26 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class MiningCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.mining")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -30,6 +36,46 @@ public class MiningCommand implements CommandExecutor {
x -= 50;
ticks++;
}
int rank = 0;
int damage = 0;
int radius = 0;
if(PP.getSkillLevel(SkillType.MINING) >= 125 && PP.getSkillLevel(SkillType.MINING) < 250)
rank = 1;
if(PP.getSkillLevel(SkillType.MINING) >= 250 && PP.getSkillLevel(SkillType.MINING) < 375){
rank = 2;
radius = 1;
}
if(PP.getSkillLevel(SkillType.MINING) >= 375 && PP.getSkillLevel(SkillType.MINING) < 500){
rank = 3;
radius = 1;
}
if(PP.getSkillLevel(SkillType.MINING) >= 500 && PP.getSkillLevel(SkillType.MINING) < 625){
rank = 4;
damage = 25;
radius = 2;
}
if(PP.getSkillLevel(SkillType.MINING) >= 625 && PP.getSkillLevel(SkillType.MINING) < 750){
rank = 5;
damage = 25;
radius = 2;
}
if(PP.getSkillLevel(SkillType.MINING) >= 750 && PP.getSkillLevel(SkillType.MINING) < 875){
rank = 6;
damage = 50;
radius = 3;
}
if(PP.getSkillLevel(SkillType.MINING) >= 875 && PP.getSkillLevel(SkillType.MINING) < 1000){
rank = 7;
damage = 50;
radius = 3;
}
if(PP.getSkillLevel(SkillType.MINING) >= 1000){
rank = 8;
damage = 100;
radius = 4;
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillMining") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainMining") }));
@@ -39,10 +85,53 @@ public class MiningCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining1_0"), mcLocale.getString("m.EffectsMining1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining2_0"), mcLocale.getString("m.EffectsMining2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining3_0"), mcLocale.getString("m.EffectsMining3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining4_0"), mcLocale.getString("m.EffectsMining4_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining5_0"), mcLocale.getString("m.EffectsMining5_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.MiningDoubleDropChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.MiningSuperBreakerLength", new Object[] { ticks }));
if (PP.getSkillLevel(SkillType.MINING) < 125)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockMining1") }));
else{
switch (rank){
case 1:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining1") }));
break;
case 2:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining2") }));
break;
case 3:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining3") }));
break;
case 4:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining4") }));
break;
case 5:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining5") }));
break;
case 6:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining6") }));
break;
case 7:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining7") }));
break;
case 8:
player.sendMessage(mcLocale.getString("m.MiningBlastMining", new Object[] { rank, mcLocale.getString("m.BlastMining8") }));
break;
}
}
if (PP.getSkillLevel(SkillType.MINING) < 250)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockMining2") }));
else
player.sendMessage(mcLocale.getString("m.MiningBiggerBombs", new Object[] { radius }));
if (PP.getSkillLevel(SkillType.MINING) < 500)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockMining3") }));
else
player.sendMessage(mcLocale.getString("m.MiningDemolitionsExpertDamageDecrease", new Object[] { damage }));
Page.grabGuidePageForSkill(SkillType.MINING, player, args);
return true;
}
}

View File

@@ -5,22 +5,27 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Repair;
import com.gmail.nossr50.skills.misc.Repair;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class RepairCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.repair")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -42,12 +47,12 @@ public class RepairCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] { repairmastery }));
player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] { Repair.getArcaneForgingRank(PP) }));
player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] { Repair.getEnchantChance(Repair.getArcaneForgingRank(PP)) }));
player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] { Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP)) }));
player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones"));
player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones2"));
player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] { Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR)) }));
player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] { Repair.getEnchantChance(Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR))) }));
player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] { Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR))) }));
Page.grabGuidePageForSkill(SkillType.REPAIR, player, args);
return true;
}
}

View File

@@ -5,20 +5,25 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class SwordsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.swords")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -61,8 +66,10 @@ public class SwordsCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.SwordsCounterAttChance", new Object[] { counterattackpercentage }));
player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] { bleedrank }));
player.sendMessage(mcLocale.getString("m.SwordsTickNote"));
player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.SwordsBleedChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] { ticks }));
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);
return true;
}

View File

@@ -5,21 +5,26 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class TamingCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.taming")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -40,6 +45,7 @@ public class TamingCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming7_0"), mcLocale.getString("m.EffectsTaming7_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming8_0"), mcLocale.getString("m.EffectsTaming8_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTaming7_2", new Object[] { LoadProperties.bonesConsumedByCOTW }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
@@ -62,8 +68,14 @@ public class TamingCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming4") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming4_0"), mcLocale.getString("m.AbilBonusTaming4_1") }));
if (PP.getSkillLevel(SkillType.TAMING) < 50)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming5") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming5_0"), mcLocale.getString("m.AbilBonusTaming5_1") }));
player.sendMessage(mcLocale.getString("m.TamingGoreChance", new Object[] { percentage }));
Page.grabGuidePageForSkill(SkillType.TAMING, player, args);
return true;
}

View File

@@ -5,20 +5,26 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class UnarmedCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.unarmed")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -26,12 +32,12 @@ public class UnarmedCommand implements CommandExecutor {
float skillvalue = (float) PP.getSkillLevel(SkillType.UNARMED);
if (PP.getSkillLevel(SkillType.UNARMED) < 1000)
percentage = String.valueOf((skillvalue / 4000) * 100);
percentage = String.valueOf((skillvalue / 3000) * 100);
else
percentage = "25";
percentage = "33.3";
if (PP.getSkillLevel(SkillType.UNARMED) < 1000)
arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
arrowpercentage = String.valueOf((skillvalue / 2000) * 100);
else
arrowpercentage = "50";
@@ -41,6 +47,11 @@ public class UnarmedCommand implements CommandExecutor {
x -= 50;
ticks++;
}
int bonus = 3 + (PP.getSkillLevel(SkillType.UNARMED)/50);
if(bonus > 8)
bonus = 8;
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillUnarmed") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainUnarmed") }));
@@ -52,22 +63,16 @@ public class UnarmedCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed1_0"), mcLocale.getString("m.EffectsUnarmed1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed2_0"), mcLocale.getString("m.EffectsUnarmed2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed3_0"), mcLocale.getString("m.EffectsUnarmed3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed4_0"), mcLocale.getString("m.EffectsUnarmed4_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed5_0"), mcLocale.getString("m.EffectsUnarmed5_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.UnarmedArrowDeflectChance", new Object[] { arrowpercentage }));
player.sendMessage(mcLocale.getString("m.UnarmedDisarmChance", new Object[] { percentage }));
if (PP.getSkillLevel(SkillType.UNARMED) < 250) {
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockUnarmed1") }));
} else if (PP.getSkillLevel(SkillType.UNARMED) >= 250 && PP.getSkillLevel(SkillType.UNARMED) < 500) {
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed1_0"), mcLocale.getString("m.AbilBonusUnarmed1_1") }));
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockUnarmed2") }));
} else {
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1") }));
}
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1", new Object[] {bonus}) }));
player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] { ticks }));
Page.grabGuidePageForSkill(SkillType.UNARMED, player, args);
return true;
}

View File

@@ -5,20 +5,25 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class WoodcuttingCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.woodcutting")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@@ -51,6 +56,8 @@ public class WoodcuttingCommand implements CommandExecutor {
player.sendMessage(mcLocale.getString("m.WoodCuttingDoubleDropChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.WoodCuttingTreeFellerLength", new Object[] { ticks }));
Page.grabGuidePageForSkill(SkillType.WOODCUTTING, player, args);
return true;
}
}

View File

@@ -5,23 +5,23 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class MchudCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.spoutEnabled) {
sender.sendMessage("This command is not enabled.");
sender.sendMessage("This command is not enabled."); //TODO: Needs more locale.
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}

View File

@@ -6,25 +6,25 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
import com.gmail.nossr50.util.mcPermissions;
public class XplockCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.spoutEnabled || !LoadProperties.xpbar || !LoadProperties.xplockEnable) {
sender.sendMessage("This command is not enabled.");
sender.sendMessage("This command is not enabled."); //TODO: Needs more locale.
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
return true;
}

View File

@@ -0,0 +1,55 @@
package com.gmail.nossr50.config;
import java.io.File;
import java.io.IOException;
import org.bukkit.configuration.file.FileConfiguration;
import com.gmail.nossr50.mcMMO;
public abstract class ConfigLoader {
protected static File configFile;
protected static File dataFolder;
protected final mcMMO plugin;
protected static FileConfiguration config;
public ConfigLoader(mcMMO plugin, String fileName){
this.plugin = plugin;
dataFolder = plugin.getDataFolder();
configFile = new File(dataFolder, File.separator + fileName);
}
/**
* Load this config file.
*/
protected abstract void load();
/**
* Save this config file.
*/
private static void saveConfig() {
try {
config.save(configFile);
}
catch (IOException e) {
e.printStackTrace();
}
}
/**
* Add the defaults to this config file.
*/
protected void addDefaults() {
// Load from included config.yml
config.options().copyDefaults(true);
saveConfig();
}
/**
* Load the keys from this config file.
*/
protected abstract void loadKeys();
}

View File

@@ -1,440 +1,481 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import java.io.File;
import java.io.IOException;
import org.bukkit.configuration.file.FileConfiguration;
import com.gmail.nossr50.datatypes.HUDType;
public class LoadProperties {
public static Boolean enableOnlyActivateWhenSneaking,
enableAbilityMessages, enableAbilities, showDisplayName, showFaces,
watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web,
xprateEnable, slimeballs, spoutEnabled, donateMessage,
chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable,
mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable,
statsEnable, addxpEnable, ptpEnable, mmoeditEnable,
clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
mcrefreshEnable, aEnable, pEnable, enableMotd, enableMySpawn,
enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, mushrooms,
toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe,
excavationRequiresShovel, woodcuttingrequiresaxe, eggs, apples,
cake, music, diamond, glowstone, slowsand, sulphur, netherrack,
bones, coal, clay, anvilmessages, mayDowngradeEnchants,
mayLoseEnchants, fishingDrops, leatherArmor, ironArmor, goldArmor,
diamondArmor, woodenTools, stoneTools, ironTools, goldTools,
diamondTools, enderPearl, blazeRod, records, glowstoneDust,
fishingDiamonds, aDisplayNames, pDisplayNames, enableSmoothToMossy,
enableDirtToGrass, statsTracking;
public class LoadProperties extends ConfigLoader{
public static String MySQLtablePrefix, MySQLuserName,
MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone,
nIron, nGold, nDiamond, locale, nString, nLeather;
/*
* GENERAL SETTINGS
*/
public static int mfishing, mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y,
mstring, mbucket, mweb, chimaeraId, msandstone, mcocoa,
water_thunder, cure_self, cure_other, mslimeballs, mbones,
msulphur, mslowsand, mmushroom2, mglowstone2, mmelon, mmusic,
mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce,
mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold,
mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack,
mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier,
superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown,
treeFellerCooldown, berserkCooldown, serratedStrikeCooldown,
skullSplitterCooldown, abilityDurabilityLoss,
feathersConsumedByChimaeraWing, bonesConsumedByCOTW,
repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond, rString,
rLeather, downgradeRank1, downgradeRank2, downgradeRank3,
downgradeRank4, keepEnchantsRank1, keepEnchantsRank2,
keepEnchantsRank3, keepEnchantsRank4, fishingDropChanceTier1,
fishingDropChanceTier2, fishingDropChanceTier3,
fishingDropChanceTier4, fishingDropChanceTier5, mnetherwart,
mvines, mlilypad, mnetherbrick, mendstone, mmossstone, mstonebrick,
levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting,
anvilID, saveInterval;
/* General Settings */
public static String locale;
public static Boolean enableMotd, statsTracking, eventCallback;
public static int saveInterval;
public static double xpbackground_r, xpbackground_g, xpbackground_b,
xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g,
fishing_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r,
archery_g, archery_b, axes_r, axes_g, axes_b, excavation_r,
excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b,
mining_r, mining_g, mining_b, repair_r, repair_g, repair_b,
swords_r, swords_g, swords_b, taming_r, taming_g, taming_b,
unarmed_r, unarmed_g, unarmed_b, woodcutting_r, woodcutting_g,
woodcutting_b, pvpxprewardmodifier, tamingxpmodifier,
miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier,
excavationxpmodifier, archeryxpmodifier, swordsxpmodifier,
axesxpmodifier, acrobaticsxpmodifier;
/* mySQL */
public static Boolean useMySQL;
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass;
public static int MySQLport;
public static HUDType defaulthud;
protected static File configFile;
protected static File dataFolder;
protected final mcMMO plugin;
protected static FileConfiguration config;
/* Commands */
public static Boolean xplockEnable, xprateEnable, mccEnable, mcmmoEnable,
partyEnable, inviteEnable, acceptEnable, inspectEnable,
mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable,
mcremoveEnable, mcgodEnable, mcabilityEnable, mctopEnable,
addlevelsEnable, mcrefreshEnable, aEnable, pEnable;
public static int ptpCommandCooldown;
public static Boolean donateMessage;
public LoadProperties(mcMMO plugin) {
this.plugin = plugin;
dataFolder = plugin.getDataFolder();
configFile = new File(dataFolder, File.separator + "config.yml");
config = plugin.getConfig();
}
/* Tool Level Requirements */
public static Boolean perLevelTools;
public static int sAxe, sHoe, sShovel, sSword, sPickaxe;
public static int iAxe, iHoe, iShovel, iSword, iPickaxe;
public static int gAxe, gHoe, gShovel, gSword, gPickaxe;
public static int dAxe, dHoe, dShovel, dSword, dPickaxe;
public void load() {
// If not exist, copy from the jar
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveDefaultConfig();
}
addDefaults();
loadKeys();
}
/* Items */
public static Boolean chimaeraWingEnable;
public static int chimaeraId, feathersConsumedByChimaeraWing;
private Boolean readBoolean(String root, Boolean def) {
Boolean result = config.getBoolean(root, def);
return result;
}
/*
* ABILITY SETTINGS
*/
private Double readDouble(String root, Double def) {
Double result = config.getDouble(root, def);
return result;
}
/* General Settings */
public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities;
private Integer readInteger(String root, Integer def) {
Integer result = config.getInt(root, def);
return result;
}
/* Durability Settings */
public static Boolean toolsLoseDurabilityFromAbilities;
public static int abilityDurabilityLoss;
public static String readString(String root, String def) {
String result = config.getString(root, def);
return result;
}
/* Cooldowns */
public static int superBreakerCooldown, blastMiningCooldown, greenTerraCooldown,
gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown,
serratedStrikeCooldown, skullSplitterCooldown;
private static void saveConfig() {
try {
config.save(configFile);
} catch (IOException e) {
e.printStackTrace();
}
}
/* Thresholds */
public static int treeFellerThreshold;
private void addDefaults() {
// Load from included config.yml
config.options().copyDefaults(true);
saveConfig();
}
/*
* SKILL SETTINGS
*/
private void loadKeys() {
plugin.getLogger().info("Loading Config File...");
/* Tool Requirements */
public static Boolean miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe;
// Setup default HUD
String temp = readString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().equalsIgnoreCase(temp)) {
defaulthud = x;
}
}
/* Excavation */
public static int mbase;
enableAbilityMessages = readBoolean("Abilities.Messages", true);
enableAbilities = readBoolean("Abilities.Enabled", true);
/* Fishing */
public static Boolean fishingDrops;
public static int fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5;
public static int mfishing;
donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true);
xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false);
/* Herbalism */
public static Boolean herbalismHungerBonus, wheatRegrowth;
public static int mmelon, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mvines, mlilypad, mnetherwart;
public static Boolean enableCobbleToMossy, enableSmoothToMossy, enableDirtToGrass;
bonesConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10);
/* Mining */
public static int msandstone, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, mendstone, mmossstone;
public static int detonatorID;
xpbar = readBoolean("Spout.XP.Bar.Enabled", true);
// web_url = readString("Spout.Images.URL_DIR",
// "http://mcmmo.rycochet.net/mcmmo/");
xpicon = readBoolean("Spout.XP.Icon.Enabled", true);
xpbar_x = readInteger("Spout.XP.Bar.X_POS", 95);
xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6);
xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78);
xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2);
/* Repair */
public static Boolean repairArmor, repairTools;
public static Boolean anvilmessages;
public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather;
public static int anvilID;
public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel, repairBowLevel;
showFaces = readBoolean("Spout.Party.HUD.Show_Faces", true);
showDisplayName = readBoolean("Spout.Party.HUD.Show_Display_Name", false);
partybar = readBoolean("Spout.Party.HUD.Enabled", true);
/* Taming */
public static int mtameWolf, mtameOcelot;
public static int bonesConsumedByCOTW, fishConsumedByCOTW;
acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
fishing_r = readDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3);
fishing_g = readDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3);
fishing_b = readDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75);
/* Woodcutting */
public static int moak, mbirch, mspruce, mjungle;
xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
/* Arcane Forging */
public static Boolean mayDowngradeEnchants, mayLoseEnchants;
public static int arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4;
public static int downgradeRank1, downgradeRank2, downgradeRank3, downgradeRank4;
public static int keepEnchantsRank1, keepEnchantsRank2, keepEnchantsRank3, keepEnchantsRank4;
msulphur = readInteger("Experience.Excavation.Sulphur", 30);
mbones = readInteger("Experience.Excavation.Bones", 30);
mbase = readInteger("Experience.Excavation.Base", 40);
mmushroom2 = readInteger("Experience.Excavation.Mushroom", 80);
mslowsand = readInteger("Experience.Excavation.Slowsand", 80);
mglowstone2 = readInteger("Experience.Excavation.Glowstone", 80);
mmusic = readInteger("Experience.Excavation.Music", 3000);
mdiamond2 = readInteger("Experience.Excavation.Diamond", 1000);
mapple = readInteger("Experience.Excavation.Apple", 100);
meggs = readInteger("Experience.Excavation.Eggs", 100);
mcake = readInteger("Experience.Excavation.Cake", 3000);
mcocoa = readInteger("Experience.Excavation.Cocoa_Beans", 100);
mslimeballs = readInteger("Experience.Excavation.Slimeballs", 100);
mstring = readInteger("Experience.Excavation.String", 200);
mbucket = readInteger("Experience.Excavation.Bucket", 100);
mweb = readInteger("Experience.Excavation.Web", 150);
mwatch = readInteger("Experience.Excavation.Watch", 200);
/* Level Caps */
public static int levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting,
powerLevelCap;
msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30);
mwheat = readInteger("Experience.Herbalism.Wheat", 50);
mcactus = readInteger("Experience.Herbalism.Cactus", 30);
mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 20);
mflower = readInteger("Experience.Herbalism.Flowers", 100);
mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150);
mmelon = readInteger("Experience.Herbalism.Melon", 20);
mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50);
mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100);
mvines = readInteger("Experience.Herbalism.Vines", 10);
/*
* XP SETTINGS
*/
mpine = readInteger("Experience.Woodcutting.Pine", 70);
mbirch = readInteger("Experience.Woodcutting.Birch", 80);
mspruce = readInteger("Experience.Woodcutting.Spruce", 90);
/* General Settings */
public static Boolean xpGainsMobSpawners, pvpxp;
public static int xpGainMultiplier;
mgold = readInteger("Experience.Mining.Gold", 250);
mdiamond = readInteger("Experience.Mining.Diamond", 750);
miron = readInteger("Experience.Mining.Iron", 250);
mredstone = readInteger("Experience.Mining.Redstone", 150);
mlapis = readInteger("Experience.Mining.Lapis", 400);
mobsidian = readInteger("Experience.Mining.Obsidian", 150);
mnetherrack = readInteger("Experience.Mining.Netherrack", 30);
mglowstone = readInteger("Experience.Mining.Glowstone", 30);
mcoal = readInteger("Experience.Mining.Coal", 100);
mstone = readInteger("Experience.Mining.Stone", 30);
msandstone = readInteger("Experience.Mining.Sandstone", 30);
mnetherbrick = readInteger("Experience.Mining.Nether_Brick", 30);
mendstone = readInteger("Experience.Mining.End_Stone", 150);
mmossstone = readInteger("Experience.Mining.Moss_Stone", 30);
mstonebrick = readInteger("Experience.Mining.Stone_Brick", 30);
/* Combat XP Multipliers */
public static double pvpxprewardmodifier;
public static double animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP,
zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP,
blazeXP, magmacubeXP, enderdragonXP;
mfishing = readInteger("Experience.Fishing.Base", 800);
/* XP Formula Multiplier */
public static double tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
enableOnlyActivateWhenSneaking = readBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
/*
* SPOUT SETTINGS
*/
greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240);
superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240);
gigaDrillBreakerCooldown = readInteger("Abilities.Cooldowns.Giga_Drill_Breaker", 240);
treeFellerCooldown = readInteger("Abilities.Cooldowns.Tree_Feller", 240);
berserkCooldown = readInteger("Abilities.Cooldowns.Berserk", 240);
serratedStrikeCooldown = readInteger("Abilities.Cooldowns.Serrated_Strikes", 240);
skullSplitterCooldown = readInteger("Abilities.Cooldowns.Skull_Splitter", 240);
public static boolean spoutEnabled;
public static boolean showPowerLevel;
MySQLserverName = readString("MySQL.Server.Address", "localhost");
if (readString("MySQL.Database.User.Password", null) != null)
MySQLdbPass = readString("MySQL.Database.User.Password", null);
else
MySQLdbPass = "";
/* Spout Party HUD */
public static Boolean showDisplayName, showFaces, partybar;
MySQLdbName = readString("MySQL.Database.Name", "DatabaseName");
MySQLuserName = readString("MySQL.Database.User.Name", "UserName");
MySQLtablePrefix = readString("MySQL.Database.TablePrefix", "mcmmo_");
MySQLport = readInteger("MySQL.Server.Port", 3306);
useMySQL = readBoolean("MySQL.Enabled", false);
/* Spout XP Bar */
public static Boolean xpbar, xpicon;
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y;
locale = readString("General.Locale", "en_us");
enableMotd = readBoolean("General.MOTD.Enabled", true);
enableMySpawn = readBoolean("General.MySpawn.Enabled", true);
enableRegen = readBoolean("General.HP_Regeneration.Enabled", true);
saveInterval = readInteger("General.Save_Interval", 10);
statsTracking = readBoolean("General.Stats_Tracking", true);
/* Spout HUD Colors */
public static double xpbackground_r, xpbackground_g, xpbackground_b;
public static double xpborder_r, xpborder_g, xpborder_b;
public static double fishing_r, fishing_g, fishing_b;
public static double acrobatics_r, acrobatics_g, acrobatics_b;
public static double archery_r, archery_g, archery_b;
public static double axes_r, axes_g, axes_b;
public static double excavation_r, excavation_g, excavation_b;
public static double herbalism_r, herbalism_g, herbalism_b;
public static double mining_r, mining_g, mining_b;
public static double repair_r, repair_g, repair_b;
public static double swords_r, swords_g, swords_b;
public static double taming_r, taming_g, taming_b;
public static double unarmed_r, unarmed_g, unarmed_b;
public static double woodcutting_r, woodcutting_g, woodcutting_b;
enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
enableSmoothToMossy = readBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
enableDirtToGrass = readBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
/*
* CONFIG LOADING
*/
xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1);
toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2);
public static HUDType defaulthud;
feathersConsumedByChimaeraWing = readInteger("Items.Chimaera_Wing.Feather_Cost", 10);
chimaeraId = readInteger("Items.Chimaera_Wing.Item_ID", 288);
chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true);
public LoadProperties(mcMMO plugin) {
super(plugin, "config.yml");
config = plugin.getConfig();
}
pvpxp = readBoolean("XP.PVP.Rewards", true);
pvpxprewardmodifier = readDouble("Experience.Gains.Multiplier.PVP", 1.0);
miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true);
excavationRequiresShovel = readBoolean("Skills.Excavation.Requires_Shovel", true);
woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true);
repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50);
@Override
public void load() {
sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0);
tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0);
miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0);
repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0);
woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0);
archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0);
swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0);
axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0);
acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
// If it doesn't exist, copy it from the .jar
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveDefaultConfig();
}
anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true);
anvilID = readInteger("Skills.Repair.Anvil_ID", 42);
addDefaults();
loadKeys();
}
rGold = readInteger("Skills.Repair.Gold.ID", 266);
nGold = readString("Skills.Repair.Gold.Name", "Gold Bars");
rStone = readInteger("Skills.Repair.Stone.ID", 4);
nStone = readString("Skills.Repair.Stone.Name", "Cobblestone");
rWood = readInteger("Skills.Repair.Wood.ID", 5);
nWood = readString("Skills.Repair.Wood.Name", "Wood Planks");
rDiamond = readInteger("Skills.Repair.Diamond.ID", 264);
nDiamond = readString("Skills.Repair.Diamond.Name", "Diamond");
rIron = readInteger("Skills.Repair.Iron.ID", 265);
nIron = readString("Skills.Repair.Iron.Name", "Iron Bars");
rString = readInteger("Skills.Repair.String.ID", 287);
nString = readString("Skills.Repair.String.Name", "String");
rLeather = readInteger("Skills.Repair.Leather.ID", 334);
nLeather = readString("Skills.Repair.Leather.Name", "Leather");
levelCapAcrobatics = readInteger("Skills.Acrobatics.Level_Cap", 0);
levelCapArchery = readInteger("Skills.Archery.Level_Cap", 0);
levelCapAxes = readInteger("Skills.Axes.Level_Cap", 0);
levelCapExcavation = readInteger("Skills.Excavation.Level_Cap", 0);
levelCapFishing = readInteger("Skills.Fishing.Level_Cap", 0);
levelCapHerbalism = readInteger("Skills.Herbalism.Level_Cap", 0);
levelCapMining = readInteger("Skills.Mining.Level_Cap", 0);
levelCapRepair = readInteger("Skills.Repair.Level_Cap", 0);
levelCapSwords = readInteger("Skills.Swords.Level_Cap", 0);
levelCapTaming = readInteger("Skills.Taming.Level_Cap", 0);
levelCapUnarmed = readInteger("Skills.Unarmed.Level_Cap", 0);
levelCapWoodcutting = readInteger("Skills.Woodcutting.Level_Cap", 0);
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO config.yml File...");
mayDowngradeEnchants = readBoolean("Arcane_Forging.Downgrades.Enabled", true);
downgradeRank1 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
downgradeRank2 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_2", 50);
downgradeRank3 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_3", 25);
downgradeRank4 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_4", 15);
mayLoseEnchants = readBoolean("Arcane_Forging.May_Lose_Enchants.Enabled", true);
keepEnchantsRank1 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10);
keepEnchantsRank2 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20);
keepEnchantsRank3 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30);
keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40);
// Setup default HUD
String temp = config.getString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().equalsIgnoreCase(temp)) {
defaulthud = x;
}
}
cocoabeans = readBoolean("Excavation.Drops.Cocoa_Beans", true);
mushrooms = readBoolean("Excavation.Drops.Mushrooms", true);
glowstone = readBoolean("Excavation.Drops.Glowstone", true);
eggs = readBoolean("Excavation.Drops.Eggs", true);
apples = readBoolean("Excavation.Drops.Apples", true);
cake = readBoolean("Excavation.Drops.Cake", true);
music = readBoolean("Excavation.Drops.Music", true);
diamond = readBoolean("Excavation.Drops.Diamond", true);
slowsand = readBoolean("Excavation.Drops.Slowsand", true);
sulphur = readBoolean("Excavation.Drops.Sulphur", true);
netherrack = readBoolean("Excavation.Drops.Netherrack", true);
bones = readBoolean("Excavation.Drops.Bones", true);
slimeballs = readBoolean("Excavation.Drops.Slimeballs", true);
watch = readBoolean("Excavation.Drops.Watch", true);
string = readBoolean("Excavation.Drops.String", true);
bucket = readBoolean("Excavation.Drops.Bucket", true);
web = readBoolean("Excavation.Drops.Web", true);
enableAbilityMessages = config.getBoolean("Abilities.Messages", true);
enableAbilities = config.getBoolean("Abilities.Enabled", true);
fishingDrops = readBoolean("Fishing.Drops.Item_Drops_Enabled", true);
fishingDropChanceTier1 = readInteger("Fishing.Drops.Drop_Chance.Tier_1", 20);
fishingDropChanceTier2 = readInteger("Fishing.Drops.Drop_Chance.Tier_2", 25);
fishingDropChanceTier3 = readInteger("Fishing.Drops.Drop_Chance.Tier_3", 30);
fishingDropChanceTier4 = readInteger("Fishing.Drops.Drop_Chance.Tier_4", 35);
fishingDropChanceTier5 = readInteger("Fishing.Drops.Drop_Chance.Tier_5", 40);
leatherArmor = readBoolean("Fishing.Drops.Leather_Armor", true);
ironArmor = readBoolean("Fishing.Drops.Iron_Armor", true);
goldArmor = readBoolean("Fishing.Drops.Gold_Armor", true);
diamondArmor = readBoolean("Fishing.Drops.Diamond_Armor", true);
woodenTools = readBoolean("Fishing.Drops.Wooden_Tools", true);
stoneTools = readBoolean("Fishing.Drops.Stone_Tools", true);
ironTools = readBoolean("Fishing.Drops.Iron_Tools", true);
goldTools = readBoolean("Fishing.Drops.Gold_Tools", true);
diamondTools = readBoolean("Fishing.Drops.Diamond_Tools", true);
enderPearl = readBoolean("Fishing.Drops.Ender_Pearl", true);
blazeRod = readBoolean("Fishing.Drops.Blaze_Rod", true);
records = readBoolean("Fishing.Drops.Records", true);
glowstoneDust = readBoolean("Fishing.Drops.Glowstone_Dust", true);
fishingDiamonds = readBoolean("Fishing.Drops.Diamonds", true);
donateMessage = config.getBoolean("Commands.mcmmo.Donate_Message", true);
xpGainsMobSpawners = config.getBoolean("Experience.Gains.Mobspawners.Enabled", false);
xplockEnable = readBoolean("Commands.xplock.Enabled", true);
xprateEnable = readBoolean("Commands.xprate.Enabled", true);
mctopEnable = readBoolean("Commands.mctop.Enabled", true);
addxpEnable = readBoolean("Commands.addxp.Enabled", true);
mcabilityEnable = readBoolean("Commands.mcability.Enabled", true);
mcrefreshEnable = readBoolean("Commands.mcrefresh.Enabled", true);
mcmmoEnable = readBoolean("Commands.mcmmo.Enabled", true);
mccEnable = readBoolean("Commands.mcc.Enabled", true);
mcgodEnable = readBoolean("Commands.mcgod.Enabled", true);
statsEnable = readBoolean("Commands.stats.Enabled", true);
mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true);
ptpEnable = readBoolean("Commands.ptp.Enabled", true);
partyEnable = readBoolean("Commands.party.Enabled", true);
myspawnEnable = readBoolean("Commands.myspawn.Enabled", true);
whoisEnable = readBoolean("Commands.whois.Enabled", true);
inviteEnable = readBoolean("Commands.invite.Enabled", true);
acceptEnable = readBoolean("Commands.accept.Enabled", true);
clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true);
aEnable = readBoolean("Commands.a.Enabled", true);
pEnable = readBoolean("Commands.p.Enabled", true);
aDisplayNames = readBoolean("Commands.a.Display_Names", true);
pDisplayNames = readBoolean("Commands.p.Display_Names", true);
}
bonesConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10);
fishConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10);
xpbar = config.getBoolean("Spout.XP.Bar.Enabled", true);
xpicon = config.getBoolean("Spout.XP.Icon.Enabled", true);
xpbar_x = config.getInt("Spout.XP.Bar.X_POS", 95);
xpbar_y = config.getInt("Spout.XP.Bar.Y_POS", 6);
xpicon_x = config.getInt("Spout.XP.Icon.X_POS", 78);
xpicon_y = config.getInt("Spout.XP.Icon.Y_POS", 2);
showFaces = config.getBoolean("Spout.Party.HUD.Show_Faces", true);
showDisplayName = config.getBoolean("Spout.Party.HUD.Show_Display_Name", false);
partybar = config.getBoolean("Spout.Party.HUD.Enabled", true);
showPowerLevel = config.getBoolean("Spout.HUD.Show_Power_Level", true);
acrobatics_r = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
acrobatics_g = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
acrobatics_b = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
archery_r = config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
archery_g = config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
archery_b = config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
axes_r = config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
axes_g = config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
axes_b = config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
excavation_r = config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
excavation_g = config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
excavation_b = config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
herbalism_r = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
herbalism_g = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
herbalism_b = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
mining_r = config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
mining_g = config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
mining_b = config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
repair_r = config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
repair_g = config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
repair_b = config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
swords_r = config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
swords_g = config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
swords_b = config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
taming_r = config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
taming_g = config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
taming_b = config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
unarmed_r = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
unarmed_g = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
unarmed_b = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
woodcutting_r = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
woodcutting_g = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
woodcutting_b = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
fishing_r = config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3);
fishing_g = config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3);
fishing_b = config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75);
xpborder_r = config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
xpborder_g = config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
xpborder_b = config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
xpbackground_r = config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
xpbackground_g = config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
xpbackground_b = config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
mbase = config.getInt("Experience.Excavation.Base", 40);
msugar = config.getInt("Experience.Herbalism.Sugar_Cane", 30);
mwheat = config.getInt("Experience.Herbalism.Wheat", 50);
mcactus = config.getInt("Experience.Herbalism.Cactus", 30);
mpumpkin = config.getInt("Experience.Herbalism.Pumpkin", 20);
mflower = config.getInt("Experience.Herbalism.Flowers", 100);
mmushroom = config.getInt("Experience.Herbalism.Mushrooms", 150);
mmelon = config.getInt("Experience.Herbalism.Melon", 20);
mnetherwart = config.getInt("Experience.Herbalism.Nether_Wart", 50);
mlilypad = config.getInt("Experience.Herbalism.Lily_Pads", 100);
mvines = config.getInt("Experience.Herbalism.Vines", 10);
herbalismHungerBonus = config.getBoolean("Skills.Herbalism.Hunger_Bonus", true);
wheatRegrowth = config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true);
moak = config.getInt("Experience.Woodcutting.Oak", 70);
mbirch = config.getInt("Experience.Woodcutting.Birch", 90);
mspruce = config.getInt("Experience.Woodcutting.Spruce", 80);
mjungle = config.getInt("Experience.Woodcutting.Jungle", 100);
mgold = config.getInt("Experience.Mining.Gold", 250);
mdiamond = config.getInt("Experience.Mining.Diamond", 750);
miron = config.getInt("Experience.Mining.Iron", 250);
mredstone = config.getInt("Experience.Mining.Redstone", 150);
mlapis = config.getInt("Experience.Mining.Lapis", 400);
mobsidian = config.getInt("Experience.Mining.Obsidian", 150);
mnetherrack = config.getInt("Experience.Mining.Netherrack", 30);
mglowstone = config.getInt("Experience.Mining.Glowstone", 30);
mcoal = config.getInt("Experience.Mining.Coal", 100);
mstone = config.getInt("Experience.Mining.Stone", 30);
msandstone = config.getInt("Experience.Mining.Sandstone", 30);
mendstone = config.getInt("Experience.Mining.End_Stone", 150);
mmossstone = config.getInt("Experience.Mining.Moss_Stone", 30);
mtameWolf = config.getInt("Experience.Taming.Animal_Taming.Wolf", 250);
mtameOcelot = config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500);
mfishing = config.getInt("Experience.Fishing.Base", 800);
enableOnlyActivateWhenSneaking = config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
greenTerraCooldown = config.getInt("Abilities.Cooldowns.Green_Terra", 240);
superBreakerCooldown = config.getInt("Abilities.Cooldowns.Super_Breaker", 240);
gigaDrillBreakerCooldown = config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240);
treeFellerThreshold = config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500);
treeFellerCooldown = config.getInt("Abilities.Cooldowns.Tree_Feller", 240);
berserkCooldown = config.getInt("Abilities.Cooldowns.Berserk", 240);
serratedStrikeCooldown = config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240);
skullSplitterCooldown = config.getInt("Abilities.Cooldowns.Skull_Splitter", 240);
blastMiningCooldown = config.getInt("Abilities.Cooldowns.Blast_Mining", 60);
MySQLserverName = config.getString("MySQL.Server.Address", "localhost");
if (config.getString("MySQL.Database.User_Password", null) != null) {
MySQLdbPass = config.getString("MySQL.Database.User_Password", null);
}
else {
MySQLdbPass = "";
}
MySQLdbName = config.getString("MySQL.Database.Name", "DatabaseName");
MySQLuserName = config.getString("MySQL.Database.User_Name", "UserName");
MySQLtablePrefix = config.getString("MySQL.Database.TablePrefix", "mcmmo_");
MySQLport = config.getInt("MySQL.Server.Port", 3306);
useMySQL = config.getBoolean("MySQL.Enabled", false);
locale = config.getString("General.Locale", "en_us");
enableMotd = config.getBoolean("General.MOTD_Enabled", true);
saveInterval = config.getInt("General.Save_Interval", 10);
statsTracking = config.getBoolean("General.Stats_Tracking", true);
eventCallback = config.getBoolean("General.Event_Callback", true);
perLevelTools = config.getBoolean("General.Per_Level_Tools", false);
powerLevelCap = config.getInt("General.Power_Level_Cap", 0);
enableCobbleToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
enableSmoothToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
enableDirtToGrass = config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
xpGainMultiplier = config.getInt("Experience.Gains.Multiplier.Global", 1);
toolsLoseDurabilityFromAbilities = config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
abilityDurabilityLoss = config.getInt("Abilities.Tools.Durability_Loss", 2);
feathersConsumedByChimaeraWing = config.getInt("Items.Chimaera_Wing.Feather_Cost", 10);
chimaeraId = config.getInt("Items.Chimaera_Wing.Item_ID", 288);
chimaeraWingEnable = config.getBoolean("Items.Chimaera_Wing.Enabled", true);
dAxe = config.getInt("Items.Diamond.Axe", 750);
dHoe = config.getInt("Items.Diamond.Hoe", 750);
dShovel = config.getInt("Items.Diamond.Shovel", 750);
dSword = config.getInt("Items.Diamond.Sword", 750);
dPickaxe = config.getInt("Items.Diamond.Pickaxe", 750);
gAxe = config.getInt("Items.Gold.Axe", 500);
gHoe = config.getInt("Items.Gold.Hoe", 500);
gShovel = config.getInt("Items.Gold.Shovel", 500);
gSword = config.getInt("Items.Gold.Sword", 500);
gPickaxe = config.getInt("Items.Gold.Pickaxe", 500);
iAxe = config.getInt("Items.Iron.Axe", 250);
iHoe = config.getInt("Items.Iron.Hoe", 250);
iShovel = config.getInt("Items.Iron.Shovel", 250);
iSword = config.getInt("Items.Iron.Sword", 250);
iPickaxe = config.getInt("Items.Iron.Pickaxe", 250);
sAxe = config.getInt("Items.Stone.Axe", 0);
sHoe = config.getInt("Items.Stone.Hoe", 0);
sShovel = config.getInt("Items.Stone.Shovel", 0);
sSword = config.getInt("Items.Stone.Sword", 0);
sPickaxe = config.getInt("Items.Stone.Pickaxe", 0);
pvpxp = config.getBoolean("Experience.PVP.Rewards", true);
pvpxprewardmodifier = config.getDouble("Experience.Gains.Multiplier.PVP", 1.0);
miningrequirespickaxe = config.getBoolean("Skills.Mining.Requires_Pickaxe", true);
excavationRequiresShovel = config.getBoolean("Skills.Excavation.Requires_Shovel", true);
woodcuttingrequiresaxe = config.getBoolean("Skills.Woodcutting.Requires_Axe", true);
repairArmor = config.getBoolean("Skills.Repair.Can_Repair_Armor", true);
repairTools = config.getBoolean("Skills.Repair.Can_Repair_Tools", true);
repairdiamondlevel = config.getInt("Skills.Repair.Diamond.Level_Required", 50);
repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0);
repairGoldLevel = config.getInt("Skills.Repair.Gold.Level_Required", 0);
repairStoneLevel = config.getInt("Skills.Repair.Stone.Level_Required", 0);
repairBowLevel = config.getInt("Skills.Repair.String.Level_Required", 0);
tamingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Taming", 1.0);
miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0);
repairxpmodifier = config.getDouble("Experience.Formula.Multiplier.Repair", 1.0);
woodcuttingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
unarmedxpmodifier = config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
herbalismxpmodifier = config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
excavationxpmodifier = config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0);
archeryxpmodifier = config.getDouble("Experience.Formula.Multiplier.Archery", 1.0);
swordsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Swords", 1.0);
axesxpmodifier = config.getDouble("Experience.Formula.Multiplier.Axes", 1.0);
acrobaticsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
fishingxpmodifier = config.getDouble("Experience.Forumla.Multiplier.Fishing", 1.0);
anvilmessages = config.getBoolean("Skills.Repair.Anvil_Messages", true);
anvilID = config.getInt("Skills.Repair.Anvil_ID", 42);
rGold = config.getInt("Skills.Repair.Gold.ID", 266);
rStone = config.getInt("Skills.Repair.Stone.ID", 4);
rWood = config.getInt("Skills.Repair.Wood.ID", 5);
rDiamond = config.getInt("Skills.Repair.Diamond.ID", 264);
rIron = config.getInt("Skills.Repair.Iron.ID", 265);
rString = config.getInt("Skills.Repair.String.ID", 287);
rLeather = config.getInt("Skills.Repair.Leather.ID", 334);
levelCapAcrobatics = config.getInt("Skills.Acrobatics.Level_Cap", 0);
levelCapArchery = config.getInt("Skills.Archery.Level_Cap", 0);
levelCapAxes = config.getInt("Skills.Axes.Level_Cap", 0);
levelCapExcavation = config.getInt("Skills.Excavation.Level_Cap", 0);
levelCapFishing = config.getInt("Skills.Fishing.Level_Cap", 0);
levelCapHerbalism = config.getInt("Skills.Herbalism.Level_Cap", 0);
levelCapMining = config.getInt("Skills.Mining.Level_Cap", 0);
levelCapRepair = config.getInt("Skills.Repair.Level_Cap", 0);
levelCapSwords = config.getInt("Skills.Swords.Level_Cap", 0);
levelCapTaming = config.getInt("Skills.Taming.Level_Cap", 0);
levelCapUnarmed = config.getInt("Skills.Unarmed.Level_Cap", 0);
levelCapWoodcutting = config.getInt("Skills.Woodcutting.Level_Cap", 0);
mayDowngradeEnchants = config.getBoolean("Arcane_Forging.Downgrades.Enabled", true);
downgradeRank1 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
downgradeRank2 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50);
downgradeRank3 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25);
downgradeRank4 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15);
mayLoseEnchants = config.getBoolean("Arcane_Forging.May_Lose_Enchants", true);
keepEnchantsRank1 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10);
keepEnchantsRank2 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20);
keepEnchantsRank3 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30);
keepEnchantsRank4 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40);
arcaneRank1 = config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100);
arcaneRank2 = config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250);
arcaneRank3 = config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500);
arcaneRank4 = config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750);
fishingDrops = config.getBoolean("Fishing.Drops_Enabled", true);
fishingTier1 = config.getInt("Fishing.Tier_Levels.Tier1", 0);
fishingTier2 = config.getInt("Fishing.Tier_Levels.Tier2", 200);
fishingTier3 = config.getInt("Fishing.Tier_Levels.Tier3", 400);
fishingTier4 = config.getInt("Fishing.Tier_Levels.Tier4", 600);
fishingTier5 = config.getInt("Fishing.Tier_Levels.Tier5", 800);
xplockEnable = config.getBoolean("Commands.xplock.Enabled", true);
xprateEnable = config.getBoolean("Commands.xprate.Enabled", true);
mctopEnable = config.getBoolean("Commands.mctop.Enabled", true);
addxpEnable = config.getBoolean("Commands.addxp.Enabled", true);
addlevelsEnable = config.getBoolean("Commands.addlevels.Enabled", true);
mcabilityEnable = config.getBoolean("Commands.mcability.Enabled", true);
mcrefreshEnable = config.getBoolean("Commands.mcrefresh.Enabled", true);
mcmmoEnable = config.getBoolean("Commands.mcmmo.Enabled", true);
mccEnable = config.getBoolean("Commands.mcc.Enabled", true);
mcgodEnable = config.getBoolean("Commands.mcgod.Enabled", true);
mcstatsEnable = config.getBoolean("Commands.mcstats.Enabled", true);
mmoeditEnable = config.getBoolean("Commands.mmoedit.Enabled", true);
mcremoveEnable = config.getBoolean("Commands.mcremove.Enable", true);
ptpEnable = config.getBoolean("Commands.ptp.Enabled", true);
partyEnable = config.getBoolean("Commands.party.Enabled", true);
inspectEnable = config.getBoolean("Commands.inspect.Enabled", true);
inviteEnable = config.getBoolean("Commands.invite.Enabled", true);
acceptEnable = config.getBoolean("Commands.accept.Enabled", true);
aEnable = config.getBoolean("Commands.a.Enabled", true);
pEnable = config.getBoolean("Commands.p.Enabled", true);
ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30);
animalXP = config.getDouble("Experience.Combat.Multiplier.Animals", 1.0);
creeperXP = config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0);
skeletonXP = config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0);
spiderXP = config.getDouble("Experience.Combat.Multiplier.Spider", 3.0);
ghastXP = config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0);
slimeXP = config.getDouble("Experience.Combat.Multiplier.Slime", 2.0);
zombieXP = config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0);
pigzombieXP = config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0);
endermanXP = config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0);
cavespiderXP = config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0);
silverfishXP = config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0);
blazeXP = config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0);
magmacubeXP = config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0);
enderdragonXP = config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0);
detonatorID = config.getInt("Skills.Mining.Detonator_ID", 259);
}
}

View File

@@ -0,0 +1,286 @@
package com.gmail.nossr50.config;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
import com.gmail.nossr50.datatypes.treasure.Treasure;
public class LoadTreasures extends ConfigLoader{
public static List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
public static List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
public static List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
public static List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
public static List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
public static List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
public static List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
public static List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
public static List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
public static List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
public static List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
public static List<FishingTreasure> fishingRewardsTier5 = new ArrayList<FishingTreasure>();
public LoadTreasures(mcMMO plugin) {
super(plugin, "treasures.yml");
config = plugin.getTreasuresConfig();
}
@Override
public void load() {
// If it doesn't exist, copy it from the .jar
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveTreasuresConfig();
}
addDefaults();
loadKeys();
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO treasures.yml File...");
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
Set<String> treasureConfigSet = treasureSection.getKeys(false);
Iterator<String> iterator = treasureConfigSet.iterator();
while (iterator.hasNext()) {
String treasureName = iterator.next();
// Validate all the things!
List<String> reason = new ArrayList<String>();
/*
* ID, Amount, and Data
*/
if (!config.contains("Treasures." + treasureName + ".ID")) {
reason.add("Missing ID");
}
if (!config.contains("Treasures." + treasureName + ".Amount")) {
reason.add("Missing Amount");
}
if (!config.contains("Treasures." + treasureName + ".Data")) {
reason.add("Missing Data");
}
int id = config.getInt("Treasures." + treasureName + ".ID");
int amount = config.getInt("Treasures." + treasureName + ".Amount");
int data = config.getInt("Treasures." + treasureName + ".Data");
if (Material.getMaterial(id) == null) {
reason.add("Invlid id: " + id);
}
if (amount < 1) {
reason.add("Invalid amount: " + amount);
}
if (data > 127 || data < -128) {
reason.add("Invalid data: " + data);
}
/*
* XP, Drop Chance, and Drop Level
*/
if (!config.contains("Treasures." + treasureName + ".XP")) {
reason.add("Missing XP");
}
if (!config.contains("Treasures." + treasureName + ".Drop_Chance")) {
reason.add("Missing Drop_Chance");
}
if (!config.contains("Treasures." + treasureName + ".Drop_Level")) {
reason.add("Missing Drop_Level");
}
int xp = config.getInt("Treasures." + treasureName + ".XP");
Double dropChance = config.getDouble("Treasures." + treasureName + ".Drop_Chance");
int dropLevel = config.getInt("Treasures." + treasureName + ".Drop_Level");
if (xp < 0) {
reason.add("Invalid xp: " + xp);
}
if (dropChance < 0) {
reason.add("Invalid Drop_Chance: " + dropChance);
}
if (dropLevel < 0) {
reason.add("Invalid Drop_Level: " + dropLevel);
}
/*
* Drops From & Max Level
*/
ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data);
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
reason.add("Fishing drops cannot also be excavation drops");
}
if (!config.contains("Treasures." + treasureName + ".Max_Level")) {
reason.add("Missing Max_Level");
}
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
if (maxLevel < 0) {
reason.add("Invalid Max_Level: " + maxLevel);
}
if (noErrorsInTreasure(reason)) {
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
treasures.put(treasureName, fTreasure);
}
}
else {
ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) {
eTreasure.setDropsFromDirt();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Grass", false)) {
eTreasure.setDropsFromGrass();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Sand", false)) {
eTreasure.setDropsFromSand();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Gravel", false)) {
eTreasure.setDropsFromGravel();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Clay", false)) {
eTreasure.setDropsFromClay();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Mycelium", false)) {
eTreasure.setDropsFromMycel();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Soul_Sand", false)) {
eTreasure.setDropsFromSoulSand();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
reason.add("Excavation drops cannot also be fishing drops");
}
if (noErrorsInTreasure(reason)) {
treasures.put(treasureName, eTreasure);
}
}
}
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
Iterator<String> treasureIterator = treasures.keySet().iterator();
while (treasureIterator.hasNext()) {
String treasureKey = treasureIterator.next();
Treasure treasure = treasures.get(treasureKey);
if (treasure instanceof FishingTreasure) {
if (!fishingTreasures.contains(treasureKey)) {
continue;
}
FishingTreasure fTreasure = (FishingTreasure) treasure;
int dropLevel = fTreasure.getDropLevel();
int maxLevel = fTreasure.getMaxLevel();
if(dropLevel <= LoadProperties.fishingTier1 && maxLevel >= LoadProperties.fishingTier1) {
fishingRewardsTier1.add(fTreasure);
}
if(dropLevel <= LoadProperties.fishingTier2 && maxLevel >= LoadProperties.fishingTier2) {
fishingRewardsTier2.add(fTreasure);
}
if (dropLevel <= LoadProperties.fishingTier3 && maxLevel >= LoadProperties.fishingTier3) {
fishingRewardsTier3.add(fTreasure);
}
if (dropLevel <= LoadProperties.fishingTier4 && maxLevel >= LoadProperties.fishingTier4) {
fishingRewardsTier4.add(fTreasure);
}
if (dropLevel <= LoadProperties.fishingTier5 && maxLevel >= LoadProperties.fishingTier5) {
fishingRewardsTier5.add(fTreasure);
}
}
else if (treasure instanceof ExcavationTreasure) {
if (!excavationTreasures.contains(treasureKey)) {
continue;
}
ExcavationTreasure eTreasure = (ExcavationTreasure) treasure;
if (eTreasure.getDropsFromDirt()) {
excavationFromDirt.add(eTreasure);
}
if (eTreasure.getDropsFromGrass()) {
excavationFromGrass.add(eTreasure);
}
if (eTreasure.getDropsFromSand()) {
excavationFromSand.add(eTreasure);
}
if (eTreasure.getDropsFromGravel()) {
excavationFromGravel.add(eTreasure);
}
if (eTreasure.getDropsFromClay()) {
excavationFromClay.add(eTreasure);
}
if (eTreasure.getDropsFromMycel()) {
excavationFromMycel.add(eTreasure);
}
if (eTreasure.getDropsFromSoulSand()) {
excavationFromSoulSand.add(eTreasure);
}
}
}
}
private boolean noErrorsInTreasure(List<String> issues) {
if (issues.isEmpty()) {
return true;
}
else {
for (String issue : issues) {
Bukkit.getLogger().warning(issue);
}
return false;
}
}
}

View File

@@ -1,92 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.config;
import java.util.*;
import java.util.logging.Logger;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import com.gmail.nossr50.mcMMO;
public class Misc
{
String location = "mcmmo.properties";
protected static final Logger log = Logger.getLogger("Minecraft");
public ArrayList<Entity> mobSpawnerList = new ArrayList<Entity>();
public HashSet<Block> blockWatchList = new HashSet<Block>();
public ArrayList<Block> treeFeller = new ArrayList<Block>();
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
public HashMap<Block, Integer> tntTracker = new HashMap<Block, Integer>();
mcMMO plugin = null;
//BLEED QUE STUFF
public LivingEntity[] bleedQue = new LivingEntity[20];
public int bleedQuePos = 0;
public LivingEntity[] bleedRemovalQue = new LivingEntity[20];
public int bleedRemovalQuePos = 0;
public Misc(mcMMO mcMMO)
{
plugin = mcMMO;
}
public void addToBleedQue(LivingEntity entity)
{
//Assign entity to empty position
bleedQue[bleedQuePos] = entity;
//Move position up by 1 increment
bleedQuePos++;
//Check if array is full
if(bleedQuePos >= bleedQue.length)
{
//Create new temporary array
LivingEntity[] temp = new LivingEntity[bleedQue.length*2];
//Copy data from bleedQue to temporary array
System.arraycopy(bleedQue, 0, temp, 0, bleedQue.length);
//Point bleedQue to new array
bleedQue = temp;
}
}
public void addToBleedRemovalQue(LivingEntity entity)
{
//Assign entity to empty position
bleedRemovalQue[bleedRemovalQuePos] = entity;
//Move position up by 1 increment
bleedRemovalQuePos++;
//Check if array is full
if(bleedRemovalQuePos >= bleedRemovalQue.length)
{
//Create new temporary array
LivingEntity[] temp = new LivingEntity[bleedRemovalQue.length*2];
//Copy data from bleedRemovalQue to temporary array
System.arraycopy(bleedRemovalQue, 0, temp, 0, bleedRemovalQue.length);
//Point bleedRemovalQue to new array
bleedRemovalQue = temp;
}
}
}

View File

@@ -1,11 +1,134 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.gathering.Excavation;
import com.gmail.nossr50.skills.gathering.Herbalism;
import com.gmail.nossr50.skills.gathering.Mining;
import com.gmail.nossr50.util.mcPermissions;
public enum AbilityType {
BERSERK,
SUPER_BREAKER,
GIGA_DRILL_BREAKER,
GREEN_TERRA,
SKULL_SPLIITER,
TREE_FELLER,
SERRATED_STRIKES;
}
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"),
SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"),
GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"),
GREEN_TERRA(LoadProperties.greenTerraCooldown, mcLocale.getString("Skills.GreenTerraOn"), mcLocale.getString("Skills.GreenTerraOff"), "Skills.GreenTerraPlayer", mcLocale.getString("Skills.YourGreenTerra"), mcLocale.getString("Skills.GreenTerraPlayerOff")),
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
LEAF_BLOWER(0, null, null, null, null, null);
private int cooldown;
private String abilityOn;
private String abilityOff;
private String abilityPlayer;
private String abilityRefresh;
private String abilityPlayerOff;
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
this.cooldown = cooldown;
this.abilityOn = abilityOn;
this.abilityOff = abilityOff;
this.abilityPlayer = abilityPlayer;
this.abilityRefresh = abilityRefresh;
this.abilityPlayerOff = abilityPlayerOff;
}
public int getCooldown() {
return this.cooldown;
}
public String getAbilityOn() {
return this.abilityOn;
}
public String getAbilityOff() {
return this.abilityOff;
}
public String getAbilityPlayer(Player player) {
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
}
public String getAbilityPlayerOff(Player player) {
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
}
public String getAbilityRefresh() {
return this.abilityRefresh;
}
/**
* Get the permissions for this ability.
*
* @param player Player to check permissions for
* @return true if the player has permissions, false otherwise
*/
public boolean getPermissions(Player player) {
switch (this) {
case BERSERK:
return mcPermissions.getInstance().berserk(player);
case BLAST_MINING:
return mcPermissions.getInstance().blastMining(player);
case GIGA_DRILL_BREAKER:
return mcPermissions.getInstance().gigaDrillBreaker(player);
case GREEN_TERRA:
return mcPermissions.getInstance().greenTerra(player);
case LEAF_BLOWER:
return mcPermissions.getInstance().leafBlower(player);
case SERRATED_STRIKES:
return mcPermissions.getInstance().serratedStrikes(player);
case SKULL_SPLIITER:
return mcPermissions.getInstance().skullSplitter(player);
case SUPER_BREAKER:
return mcPermissions.getInstance().superBreaker(player);
case TREE_FELLER:
return mcPermissions.getInstance().treeFeller(player);
default:
return false;
}
}
/**
* Check if a block is affected by this ability.
*
* @param material The block type to check
* @return true if the block is affected by this ability, false otherwise
*/
public boolean blockCheck(Material material) {
switch (this) {
case BERSERK:
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
case GIGA_DRILL_BREAKER:
return Excavation.canBeGigaDrillBroken(material);
case GREEN_TERRA:
return Herbalism.makeMossy(material);
case LEAF_BLOWER:
return material.equals(Material.LEAVES);
case SUPER_BREAKER:
return Mining.canBeSuperBroken(material);
case TREE_FELLER:
return material.equals(Material.LOG);
default:
return false;
}
}
}

View File

@@ -0,0 +1,6 @@
package com.gmail.nossr50.datatypes;
public enum DatabaseUpdate {
FISHING,
BLAST_MINING;
}

View File

@@ -1,29 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
public class FakeBlockBreakEvent extends BlockBreakEvent {
private static final long serialVersionUID = 1L;
public FakeBlockBreakEvent(Block theBlock, Player player) {
super(theBlock, player);
}
}

View File

@@ -1,25 +1,8 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
public enum HUDType
{
DISABLED,
STANDARD,
SMALL,
RETRO;
public enum HUDType {
DISABLED,
STANDARD,
SMALL,
RETRO;
}

View File

@@ -1,19 +1,3 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
import org.bukkit.Bukkit;
@@ -26,262 +10,405 @@ import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
public class HUDmmo
{
int center_x = 427/2;
int center_y = 240/2;
String playerName = null;
Widget xpbar = null;
GenericGradient xpfill = null;
GenericGradient xpbg = null;
GenericGradient xpicon_bg = null;
GenericGradient xpicon_border = null;
GenericTexture xpicon = null;
mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
public HUDmmo(Player player)
{
playerName = player.getName();
initializeHUD(player);
}
public void initializeHUD(Player player)
{
//PlayerProfile PP = Users.getProfile(player);
HUDType type = Users.getProfile(player).getHUDType();
//if(LoadProperties.partybar && PP.getPartyHUD())
//mmoHelper.initialize(SpoutManager.getPlayer(player), plugin); //PARTY HUD
switch(type)
{
case RETRO:
{
initializeXpBarDisplayRetro(SpoutManager.getPlayer(player));
break;
}
case STANDARD:
{
initializeXpBarDisplayStandard(SpoutManager.getPlayer(player));
break;
}
case SMALL:
{
initializeXpBarDisplaySmall(SpoutManager.getPlayer(player));
break;
}
case DISABLED:
{
//Do nothing.. :)
}
}
}
public void updateXpBarDisplay(HUDType type, Player player)
{
switch(type)
{
case RETRO:
{
updateXpBarRetro(player, Users.getProfile(player));
break;
}
case STANDARD:
{
updateXpBarStandard(player, Users.getProfile(player));
break;
}
case SMALL:
{
updateXpBarStandard(player, Users.getProfile(player));
break;
}
case DISABLED:
{
//Do nothing.. :)
}
}
}
public void resetHUD()
{
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
//PlayerProfile PP = Users.getProfile(sPlayer);
if(sPlayer != null)
{
sPlayer.getMainScreen().removeWidgets(plugin);
//Reset the objects
xpbar = null;
xpfill = null;
xpbg = null;
xpicon = null;
//if(LoadProperties.partybar && PP.getPartyHUD())
//mmoHelper.initialize(sPlayer, plugin);
sPlayer.getMainScreen().setDirty(true);
}
}
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer)
{
Color border = new Color((float)LoadProperties.xpborder_r, (float)LoadProperties.xpborder_g, (float)LoadProperties.xpborder_b, 1f);
Color green = new Color(0, 1f, 0, 1f);
Color background = new Color((float)LoadProperties.xpbackground_r, (float)LoadProperties.xpbackground_g, (float)LoadProperties.xpbackground_b, 1f);
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
xpicon = new GenericTexture();
xpbar = new GenericGradient();
xpfill = new GenericGradient();
xpbg = new GenericGradient();
xpicon_bg = new GenericGradient();
xpicon_border = new GenericGradient();
xpicon_bg.setBottomColor(darkbg).setTopColor(darkbg).setWidth(4).setHeight(4).setPriority(RenderPriority.High).setX(142).setY(10).setDirty(true);
xpicon_border.setBottomColor(border).setTopColor(border).setWidth(6).setHeight(6).setPriority(RenderPriority.Highest).setX(141).setY(9).setDirty(true);
xpicon.setWidth(6).setHeight(6).setX(141).setY(9).setPriority(RenderPriority.Normal).setDirty(true);
xpicon.setUrl("Icon_r.png");
xpbar.setWidth(128).setHeight(4).setX(149).setY(10);
((GenericGradient) xpbar).setBottomColor(border).setTopColor(border).setPriority(RenderPriority.Highest).setDirty(true);
xpfill.setWidth(0).setHeight(2).setX(150).setY(11);
xpfill.setBottomColor(green).setTopColor(green).setPriority(RenderPriority.Lowest).setDirty(true);
xpbg.setWidth(126).setHeight(2).setX(150).setY(11);
xpbg.setBottomColor(background).setTopColor(background).setPriority(RenderPriority.Low).setDirty(true);
if(LoadProperties.xpbar)
{
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbar);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpfill);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbg);
if(LoadProperties.xpicon)
{
sPlayer.getMainScreen().attachWidget(plugin, (GenericTexture)xpicon);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_bg);
}
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_border);
}
sPlayer.getMainScreen().setDirty(true);
}
private void initializeXpBarDisplayStandard(SpoutPlayer sPlayer)
{
//Setup xp bar
xpbar = new GenericTexture();
if(LoadProperties.xpbar && LoadProperties.xpicon)
{
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(16).setWidth(32).setX(LoadProperties.xpicon_x).setY(LoadProperties.xpicon_y);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
if(LoadProperties.xpbar)
{
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(LoadProperties.xpbar_x).setY(LoadProperties.xpbar_y).setHeight(8).setWidth(256);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
}
sPlayer.getMainScreen().setDirty(true);
}
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer)
{
//Setup xp bar
xpbar = new GenericTexture();
if(LoadProperties.xpbar && LoadProperties.xpicon)
{
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(8).setWidth(16).setX(center_x-(8+64)).setY(LoadProperties.xpicon_y+2);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
if(LoadProperties.xpbar)
{
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(center_x-64).setY(LoadProperties.xpbar_y).setHeight(4).setWidth(128);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
}
sPlayer.getMainScreen().setDirty(true);
}
private void updateXpBarStandard(Player player, PlayerProfile PP)
{
if(!LoadProperties.xpbar)
return;
SkillType theType = null;
if(PP.getXpBarLocked())
theType=PP.getSkillLock();
else
theType=PP.getLastGained();
if(theType == null)
return;
((GenericTexture) xpicon).setUrl(m.getCapitalized(theType.toString())+".png");
xpicon.setDirty(true);
public class HUDmmo {
private int center_x = 427 / 2;
((GenericTexture) xpbar).setUrl(SpoutStuff.getUrlBar(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
xpbar.setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
private void updateXpBarRetro(Player player, PlayerProfile PP)
{
if(!LoadProperties.xpbar)
return;
SkillType theType = null;
if(PP.getXpBarLocked() && PP.getSkillLock() != null)
theType=PP.getSkillLock();
else
theType=PP.getLastGained();
if(theType == null)
return;
Color color = SpoutStuff.getRetroColor(theType);
if(xpicon != null && theType != null)
xpicon.setUrl(m.getCapitalized(theType.toString())+"_r.png");
if(theType != null)
xpfill.setBottomColor(color).setTopColor(color).setWidth(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true);
else
System.out.println("theType was null!");
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
}
private String playerName = null;
private Widget xpbar = null;
private GenericGradient xpfill = null;
private GenericGradient xpbg = null;
private GenericGradient xpicon_bg = null;
private GenericGradient xpicon_border = null;
private GenericTexture xpicon = null;
private mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
public HUDmmo(Player player) {
playerName = player.getName();
initializeHUD(player);
}
/**
* Initialize the HUD.
*
* @param player Player whose HUD to initialize
*/
public void initializeHUD(Player player) {
HUDType type = Users.getProfile(player).getHUDType();
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
switch (type) {
case RETRO:
initializeXpBarDisplayRetro(sPlayer);
break;
case STANDARD:
initializeXpBarDisplayStandard(sPlayer);
break;
case SMALL:
initializeXpBarDisplaySmall(sPlayer);
break;
case DISABLED:
break;
default:
break;
}
}
/**
* Update the XP bar.
*
* @param type Type of XP bar
* @param player Player whose XP bar to update
*/
public void updateXpBarDisplay(HUDType type, Player player) {
PlayerProfile PP = Users.getProfile(player);
switch (type) {
case RETRO:
updateXpBarRetro(player, PP);
break;
case STANDARD:
updateXpBarStandard(player, PP);
break;
case SMALL:
updateXpBarStandard(player, PP);
break;
case DISABLED:
break;
default:
break;
}
}
/**
* Reset a player's HUD.
*/
public void resetHUD() {
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
if (sPlayer != null) {
sPlayer.getMainScreen().removeWidgets(plugin);
//Reset the objects
xpbar = null;
xpfill = null;
xpbg = null;
xpicon = null;
sPlayer.getMainScreen().setDirty(true);
}
}
/**
* Initialize Retro XP bar.
*
* @param sPlayer Player to initialize XP bar for
*/
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) {
Color border = new Color((float) LoadProperties.xpborder_r, (float) LoadProperties.xpborder_g, (float) LoadProperties.xpborder_b, 1f);
Color green = new Color(0f, 1f, 0f, 1f);
Color background = new Color((float) LoadProperties.xpbackground_r, (float) LoadProperties.xpbackground_g, (float) LoadProperties.xpbackground_b, 1f);
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
xpicon = new GenericTexture();
xpbar = new GenericGradient();
xpfill = new GenericGradient();
xpbg = new GenericGradient();
xpicon_bg = new GenericGradient();
xpicon_border = new GenericGradient();
xpicon_bg.setBottomColor(darkbg);
xpicon_bg.setTopColor(darkbg);
xpicon_bg.setWidth(4);
xpicon_bg.setHeight(4);
xpicon_bg.setPriority(RenderPriority.High);
xpicon_bg.setX(142);
xpicon_bg.setY(10);
xpicon_bg.setDirty(true);
xpicon_border.setBottomColor(border);
xpicon_border.setTopColor(border);
xpicon_border.setWidth(6);
xpicon_border.setHeight(6);
xpicon_border.setPriority(RenderPriority.Highest);
xpicon_border.setX(141);
xpicon_border.setY(9);
xpicon_border.setDirty(true);
xpicon.setWidth(6);
xpicon.setHeight(6);
xpicon.setX(141);
xpicon.setY(9);
xpicon.setPriority(RenderPriority.Normal);
xpicon.setDirty(true);
xpicon.setUrl("Icon_r.png");
xpbar.setWidth(128);
xpbar.setHeight(4);
xpbar.setX(149);
xpbar.setY(10);
((GenericGradient) xpbar).setBottomColor(border);
((GenericGradient) xpbar).setTopColor(border);
xpbar.setPriority(RenderPriority.Highest);
xpbar.setDirty(true);
xpfill.setWidth(0);
xpfill.setHeight(2);
xpfill.setX(150);
xpfill.setY(11);
xpfill.setBottomColor(green);
xpfill.setTopColor(green);
xpfill.setPriority(RenderPriority.Lowest);
xpfill.setDirty(true);
xpbg.setWidth(126);
xpbg.setHeight(2);
xpbg.setX(150);
xpbg.setY(11);
xpbg.setBottomColor(background);
xpbg.setTopColor(background);
xpbg.setPriority(RenderPriority.Low);
xpbg.setDirty(true);
if (LoadProperties.xpbar) {
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpfill);
sPlayer.getMainScreen().attachWidget(plugin, xpbg);
if (LoadProperties.xpicon) {
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
sPlayer.getMainScreen().attachWidget(plugin, xpicon_bg);
sPlayer.getMainScreen().attachWidget(plugin, xpicon_border);
}
}
sPlayer.getMainScreen().setDirty(true);
}
/**
* Initialize Standard XP bar.
*
* @param sPlayer Player to initialize XP bar for
*/
public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) {
if (LoadProperties.xpbar) {
xpbar = new GenericTexture();
((GenericTexture) xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(LoadProperties.xpbar_x);
xpbar.setY(LoadProperties.xpbar_y);
xpbar.setHeight(8);
xpbar.setWidth(256);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (LoadProperties.xpicon) {
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(16);
xpicon.setWidth(32);
xpicon.setX(LoadProperties.xpicon_x);
xpicon.setY(LoadProperties.xpicon_y);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
}
sPlayer.getMainScreen().setDirty(true);
}
/**
* Initialize Small XP bar.
*
* @param sPlayer Player to initialize XP bar for
*/
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) {
if (LoadProperties.xpbar) {
xpbar = new GenericTexture();
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(center_x - 64);
xpbar.setY(LoadProperties.xpbar_y);
xpbar.setHeight(4);
xpbar.setWidth(128);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (LoadProperties.xpicon) {
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(8);
xpicon.setWidth(16);
xpicon.setX(center_x - (8 + 64));
xpicon.setY(LoadProperties.xpicon_y + 2);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
}
sPlayer.getMainScreen().setDirty(true);
}
/**
* Update XP bar for Standard & Small styles.
*
* @param player Player whose XP bar to update
* @param PP Profile of the given player
*/
private void updateXpBarStandard(Player player, PlayerProfile PP) {
if (!LoadProperties.xpbar) {
return;
}
SkillType theType = getType(PP);
if (theType == null) { //Can this ever actually BE null? (Yes, it's null when the player has just logged in. It's not null when they gain XP in anything)
return;
}
((GenericTexture) xpicon).setUrl(m.getCapitalized(theType.toString()) + ".png");
xpicon.setDirty(true);
((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
xpbar.setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
/**
* Update XP bar for Retro styles.
*
* @param player Player whose XP bar to update
* @param PP Profile of the given player
*/
private void updateXpBarRetro(Player player, PlayerProfile PP) {
if (!LoadProperties.xpbar) {
return;
}
SkillType theType = getType(PP);
if (theType == null) { //Can this ever actually BE null? (Yes, it's null when the player has just logged in. It's not null when they gain XP in anything)
return;
}
Color color = getRetroColor(theType);
xpicon.setUrl(m.getCapitalized(theType.toString()) + "_r.png");
xpfill.setBottomColor(color);
xpfill.setTopColor(color);
xpfill.setWidth(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO));
xpfill.setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
private static Color getRetroColor(SkillType type) {
switch (type) {
case ACROBATICS:
return new Color((float) LoadProperties.acrobatics_r, (float) LoadProperties.acrobatics_g, (float) LoadProperties.acrobatics_b, 1f);
case ARCHERY:
return new Color((float) LoadProperties.archery_r, (float) LoadProperties.archery_g, (float) LoadProperties.archery_b, 1f);
case AXES:
return new Color((float) LoadProperties.axes_r, (float) LoadProperties.axes_g, (float) LoadProperties.axes_b, 1f);
case EXCAVATION:
return new Color((float) LoadProperties.excavation_r, (float) LoadProperties.excavation_g, (float) LoadProperties.excavation_b, 1f);
case HERBALISM:
return new Color((float) LoadProperties.herbalism_r, (float) LoadProperties.herbalism_g, (float) LoadProperties.herbalism_b, 1f);
case MINING:
return new Color((float) LoadProperties.mining_r, (float) LoadProperties.mining_g, (float) LoadProperties.mining_b, 1f);
case REPAIR:
return new Color((float) LoadProperties.repair_r, (float) LoadProperties.repair_g, (float) LoadProperties.repair_b, 1f);
case SWORDS:
return new Color((float) LoadProperties.swords_r, (float) LoadProperties.swords_g, (float) LoadProperties.swords_b, 1f);
case TAMING:
return new Color((float) LoadProperties.taming_r, (float) LoadProperties.taming_g, (float) LoadProperties.taming_b, 1f);
case UNARMED:
return new Color((float) LoadProperties.unarmed_r, (float) LoadProperties.unarmed_g, (float) LoadProperties.unarmed_b, 1f);
case WOODCUTTING:
return new Color((float) LoadProperties.woodcutting_r, (float) LoadProperties.woodcutting_g, (float) LoadProperties.woodcutting_b, 1f);
case FISHING:
return new Color((float) LoadProperties.fishing_r, (float) LoadProperties.fishing_g, (float) LoadProperties.fishing_b, 1f);
default:
return new Color(0.3f, 0.3f, 0.75f, 1f);
}
}
private static String getUrlBar(Integer number) {
char[] num = number.toString().toCharArray();
switch (num.length) {
case 1:
return "xpbar_inc00" + number + ".png";
case 2:
return "xpbar_inc0" + number + ".png";
default:
return "xpbar_inc" + number + ".png";
}
}
private static Integer getXpInc(int skillxp, int xptolevel, HUDType hud) {
double percentage = (double) skillxp / xptolevel;
double inc;
switch (hud) {
case RETRO:
inc = 0.0079365079365079;
break;
case STANDARD:
inc = 0.0039370078740157;
break;
default:
return 1;
}
return (int) (percentage / inc);
}
private static SkillType getType(PlayerProfile PP) {
if (PP.getXpBarLocked()) {
return PP.getSkillLock();
}
else {
return PP.getLastGained();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,6 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
public class PlayerStat
{
public String name;
public int statVal = 0;
public class PlayerStat {
public String name;
public int statVal = 0;
}

View File

@@ -1,36 +1,131 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
public enum SkillType
{
ACROBATICS,
ALCHEMY,
ALL, //This one is just for convenience
ARCHERY,
AXES,
EXCAVATION,
ENCHANTING,
FISHING,
HERBALISM,
MINING,
REPAIR,
SWORDS,
TAMING,
UNARMED,
WOODCUTTING;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public enum SkillType {
ACROBATICS(LoadProperties.levelCapAcrobatics, LoadProperties.acrobaticsxpmodifier),
ALL, //This one is just for convenience
ARCHERY(LoadProperties.levelCapArchery, LoadProperties.archeryxpmodifier),
AXES(AbilityType.SKULL_SPLIITER, LoadProperties.levelCapAxes, ToolType.AXE, LoadProperties.axesxpmodifier),
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, LoadProperties.levelCapExcavation, ToolType.SHOVEL, LoadProperties.excavationxpmodifier),
FISHING(LoadProperties.levelCapFishing, LoadProperties.fishingxpmodifier),
HERBALISM(AbilityType.GREEN_TERRA, LoadProperties.levelCapHerbalism, ToolType.HOE, LoadProperties.herbalismxpmodifier),
MINING(AbilityType.SUPER_BREAKER, LoadProperties.levelCapMining, ToolType.PICKAXE, LoadProperties.miningxpmodifier),
REPAIR(LoadProperties.levelCapRepair, LoadProperties.repairxpmodifier),
SWORDS(AbilityType.SERRATED_STRIKES, LoadProperties.levelCapSwords, ToolType.SWORD, LoadProperties.swordsxpmodifier),
TAMING(LoadProperties.levelCapTaming, LoadProperties.tamingxpmodifier),
UNARMED(AbilityType.BERSERK, LoadProperties.levelCapUnarmed, ToolType.FISTS, LoadProperties.unarmedxpmodifier),
WOODCUTTING(AbilityType.TREE_FELLER, LoadProperties.levelCapWoodcutting, ToolType.AXE, LoadProperties.woodcuttingxpmodifier);
private AbilityType ability;
private int maxLevel;
private ToolType tool;
private double xpModifier;
private SkillType() {
this.ability = null;
this.maxLevel = 0;
this.tool = null;
this.xpModifier = 0;
}
private SkillType(AbilityType ability, int maxLevel, ToolType tool, double xpModifier) {
this.ability = ability;
this.maxLevel = maxLevel;
this.tool = tool;
this.xpModifier = xpModifier;
}
private SkillType(int maxLevel, double xpModifier) {
this(null, maxLevel, null, xpModifier);
}
public AbilityType getAbility() {
return ability;
}
/**
* Get the max level of this skill.
*
* @return the max level of this skill
*/
public int getMaxLevel() {
if (maxLevel > 0) {
return maxLevel;
}
else {
return Integer.MAX_VALUE;
}
}
public ToolType getTool() {
return tool;
}
/**
* Get the base permissions associated with this skill.
*
* @param player The player to check the permissions for
* @return true if the player has permissions, false otherwise
*/
public boolean getPermissions(Player player) {
switch (this) {
case ACROBATICS:
return mcPermissions.getInstance().acrobatics(player);
case ARCHERY:
return mcPermissions.getInstance().archery(player);
case AXES:
return mcPermissions.getInstance().axes(player);
case EXCAVATION:
return mcPermissions.getInstance().excavation(player);
case FISHING:
return mcPermissions.getInstance().fishing(player);
case HERBALISM:
return mcPermissions.getInstance().herbalism(player);
case MINING:
return mcPermissions.getInstance().mining(player);
case REPAIR:
return mcPermissions.getInstance().repair(player);
case SWORDS:
return mcPermissions.getInstance().swords(player);
case TAMING:
return mcPermissions.getInstance().taming(player);
case UNARMED:
return mcPermissions.getInstance().unarmed(player);
case WOODCUTTING:
return mcPermissions.getInstance().woodcutting(player);
default:
return false;
}
}
public double getXpModifier() {
return xpModifier;
}
/**
* Get the skill level for this skill.
*
* @param player The player to check
* @return
*/
public int getSkillLevel(Player player) {
return Users.getProfile(player).getSkillLevel(this);
}
}

View File

@@ -0,0 +1,7 @@
package com.gmail.nossr50.datatypes;
public enum StaffType {
BLAZE_ROD,
STICK,
BONE;
}

View File

@@ -0,0 +1,63 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.ItemChecks;
public enum ToolType {
AXE(mcLocale.getString("Skills.LowerAxe"), mcLocale.getString("Skills.ReadyAxe")),
FISTS(mcLocale.getString("Skills.LowerFists"), mcLocale.getString("Skills.ReadyFists")),
HOE(mcLocale.getString("Skills.LowerHoe"), mcLocale.getString("Skills.ReadyHoe")),
PICKAXE(mcLocale.getString("Skills.LowerPickAxe"), mcLocale.getString("Skills.ReadyPickAxe")),
SHOVEL(mcLocale.getString("Skills.LowerShovel"), mcLocale.getString("Skills.ReadyShovel")),
SWORD(mcLocale.getString("Skills.LowerSword"), mcLocale.getString("Skills.ReadySword"));
private String lowerTool;
private String raiseTool;
private ToolType(String lowerTool, String raiseTool) {
this.lowerTool = lowerTool;
this.raiseTool = raiseTool;
}
public String getLowerTool() {
return lowerTool;
}
public String getRaiseTool() {
return raiseTool;
}
/**
* Check to see if the item is of the appropriate type.
*
* @param is The item to check
* @return true if the item is the right type, false otherwise
*/
public boolean inHand(ItemStack is) {
switch (this) {
case AXE:
return ItemChecks.isAxe(is);
case FISTS:
return is.getType().equals(Material.AIR);
case HOE:
return ItemChecks.isHoe(is);
case PICKAXE:
return ItemChecks.isMiningPick(is);
case SHOVEL:
return ItemChecks.isShovel(is);
case SWORD:
return ItemChecks.isSword(is);
default:
return false;
}
}
}

View File

@@ -1,19 +1,3 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
import java.util.ArrayList;
@@ -22,34 +6,47 @@ import com.gmail.nossr50.datatypes.PlayerStat;
public class Tree {
TreeNode root = null;
private TreeNode root = null;
public Tree(){}
/**
* Add a node to this tree.
*
* @param p Player name
* @param in Stat value
*/
public void add(String p, int in) {
if (root == null) {
root = new TreeNode(p, in);
}
else {
root.add(p, in);
}
}
public void add(String p, int in)
{
if(root == null){
root = new TreeNode(p, in);
}
else
root.add(p,in);
}
public PlayerStat[] inOrder()
{
if(root != null){
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
return order.toArray(new PlayerStat[order.size()]);
} else {
//Throw some dummy info in case the users file is empty
//It's not a good fix but its better than rewriting the whole system
ArrayList<PlayerStat> x = new ArrayList<PlayerStat>();
PlayerStat y = new PlayerStat();
y.name = "$mcMMO_DummyInfo";
y.statVal = 0;
x.add(y);
return x.toArray(new PlayerStat[x.size()]);
}
}
/**
* Retrieve an array of PlayerStats from the Tree.
*
* @return the player stats of this tree, in order
*/
public PlayerStat[] inOrder() {
if (root != null) {
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
return order.toArray(new PlayerStat[order.size()]);
}
else {
/*
* Throw some dummy info in case the users file is empty.
* It's not a good fix but its better than rewriting the whole system.
*/
ArrayList<PlayerStat> x = new ArrayList<PlayerStat>();
PlayerStat y = new PlayerStat();
y.name = "$mcMMO_DummyInfo";
y.statVal = 0;
x.add(y);
return x.toArray(new PlayerStat[x.size()]);
}
}
}

View File

@@ -1,65 +1,52 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
import java.util.ArrayList;
import com.gmail.nossr50.datatypes.PlayerStat;
public class TreeNode
{
TreeNode left = null
, right = null;
PlayerStat ps = new PlayerStat();
public class TreeNode {
TreeNode left = null;
TreeNode right = null;
PlayerStat ps = new PlayerStat();
public TreeNode(String p, int in) {ps.statVal = in; ps.name = p;}
public TreeNode(String p, int in) {
ps.statVal = in;
ps.name = p;
}
public void add (String p, int in)
{
if (in >= ps.statVal)
{
if (left == null)
left = new TreeNode(p,in);
else
left.add(p, in);
}
else if(in < ps.statVal)
{
if (right == null)
right = new TreeNode(p,in);
else
right.add(p, in);
}
}
public ArrayList<PlayerStat> inOrder(ArrayList<PlayerStat> a)
{
//if left node is not null than assign arrayList(a) to left.inOrder()
//GOES THROUGH THE ENTIRE LEFT BRANCH AND GRABS THE GREATEST NUMBER
if(left != null)
a = left.inOrder(a);
a.add(ps);
if(right != null)
a = right.inOrder(a);
return a;
}
public void add (String p, int in) {
if (in >= ps.statVal) {
if (left == null) {
left = new TreeNode(p, in);
}
else {
left.add(p, in);
}
}
else if(in < ps.statVal) {
if (right == null) {
right = new TreeNode(p, in);
}
else {
right.add(p, in);
}
}
}
public ArrayList<PlayerStat> inOrder(ArrayList<PlayerStat> a) {
//if left node is not null than assign arrayList(a) to left.inOrder()
//GOES THROUGH THE ENTIRE LEFT BRANCH AND GRABS THE GREATEST NUMBER
if (left != null) {
a = left.inOrder(a);
}
a.add(ps);
if (right != null) {
a = right.inOrder(a);
}
return a;
}
}

View File

@@ -1,29 +1,13 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes.buttons;
import org.getspout.spoutapi.gui.GenericButton;
public class ButtonEscape extends GenericButton
{
public ButtonEscape()
{
this.setText("EXIT");
this.setWidth(60).setHeight(20);
this.setDirty(true);
}
}
public class ButtonEscape extends GenericButton {
public ButtonEscape() {
this.setText("EXIT");
this.setWidth(60);
this.setHeight(20);
this.setDirty(true);
}
}

View File

@@ -1,37 +1,14 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes.buttons;
import org.getspout.spoutapi.gui.GenericButton;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class ButtonHUDStyle extends GenericButton
{
public ButtonHUDStyle(PlayerProfile PP)
{
this.setText("HUD Type: "+PP.getHUDType().toString());
this.setTooltip("Change your HUD style!");
this.setWidth(120).setHeight(20);
this.setDirty(true);
}
public void updateText(PlayerProfile PP)
{
this.setText("HUD Type: "+PP.getHUDType().toString());
this.setDirty(true);
}
}
public class ButtonHUDStyle extends ButtonToggle {
public ButtonHUDStyle(PlayerProfile PP) {
super("HUD Type: ", PP.getHUDType().toString(), "Change your HUD style!"); //TODO: Needs more locale
}
public void updateText(PlayerProfile PP) {
super.updateText("HUD Type: ", PP.getHUDType().toString()); //TODO: Needs more locale
}
}

View File

@@ -1,37 +1,14 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes.buttons;
import org.getspout.spoutapi.gui.GenericButton;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class ButtonPartyToggle extends GenericButton
{
public ButtonPartyToggle(PlayerProfile PP)
{
this.setText("Party HUD: "+PP.getPartyHUD());
this.setTooltip("Toggle the Party HUD!");
this.setWidth(120).setHeight(20);
this.setDirty(true);
}
public void updateText(PlayerProfile PP)
{
this.setText("Party HUD: "+PP.getPartyHUD());
this.setDirty(true);
}
}
public class ButtonPartyToggle extends ButtonToggle {
public ButtonPartyToggle(PlayerProfile PP) {
super("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString(), "Toggle the Party HUD!"); //TODO: Needs more locale
}
public void updateText(PlayerProfile PP) {
super.updateText("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString()); //TODO: Needs more locale
}
}

View File

@@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.buttons;
import org.getspout.spoutapi.gui.GenericButton;
public class ButtonToggle extends GenericButton{
public ButtonToggle(String text1, String text2, String tooltip) {
this.setText(text1 + text2);
this.setTooltip(tooltip);
this.setWidth(120);
this.setHeight(20);
this.setDirty(true);
}
public void updateText(String text1, String text2) {
this.setText(text1 + text2);
this.setDirty(true);
}
}

View File

@@ -1,19 +1,3 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes.popups;
import org.bukkit.ChatColor;
@@ -27,49 +11,58 @@ import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
public class PopupMMO extends GenericPopup
{
ButtonHUDStyle HUDButton = null;
ButtonPartyToggle PartyButton = null;
ButtonEscape EscapeButton = null;
GenericLabel mcMMO_label = new GenericLabel();
GenericLabel tip_escape = new GenericLabel();
int center_x = 427/2;
int center_y = 240/2;
public PopupMMO(Player player, PlayerProfile PP, mcMMO plugin)
{
//240, 427 are the bottom right
mcMMO_label.setText(ChatColor.GOLD+"~mcMMO Menu~");
mcMMO_label.setX(center_x-35).setY((center_y/2)-20).setDirty(true);
tip_escape.setText(ChatColor.GRAY+"Press ESCAPE to exit!");
tip_escape.setX(mcMMO_label.getX()-15).setY(mcMMO_label.getY()+10).setDirty(true);
HUDButton = new ButtonHUDStyle(PP);
HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true);
if(LoadProperties.partybar)
{
PartyButton = new ButtonPartyToggle(PP);
PartyButton.setX(center_x-(PartyButton.getWidth()/2)).setY(center_y/2+PartyButton.getHeight()).setDirty(true);
this.attachWidget(plugin, PartyButton);
}
EscapeButton = new ButtonEscape();
EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+(HUDButton.getHeight()*2)+5).setDirty(true);
this.attachWidget(plugin, HUDButton);
this.attachWidget(plugin, mcMMO_label);
this.attachWidget(plugin, tip_escape);
this.attachWidget(plugin, EscapeButton);
this.setDirty(true);
}
public void updateButtons(PlayerProfile PP)
{
HUDButton.updateText(PP);
this.setDirty(true);
}
public class PopupMMO extends GenericPopup {
private ButtonHUDStyle HUDButton = null;
private ButtonPartyToggle PartyButton = null;
private ButtonEscape EscapeButton = null;
private GenericLabel mcMMO_label = new GenericLabel();
private GenericLabel tip_escape = new GenericLabel();
private int center_x = 427 / 2;
private int center_y = 240 / 2;
public PopupMMO(Player player, PlayerProfile PP, mcMMO plugin) {
//240, 427 are the bottom right
mcMMO_label.setText(ChatColor.GOLD + "~mcMMO Menu~"); //TODO: Needs more locale
mcMMO_label.setX(center_x - 35);
mcMMO_label.setY((center_y / 2) - 20);
mcMMO_label.setDirty(true);
tip_escape.setText(ChatColor.GRAY + "Press ESCAPE to exit!"); //TODO: Needs more locale
tip_escape.setX(mcMMO_label.getX() - 15);
tip_escape.setY(mcMMO_label.getY() + 10);
tip_escape.setDirty(true);
HUDButton = new ButtonHUDStyle(PP);
HUDButton.setX(center_x - (HUDButton.getWidth() / 2));
HUDButton.setY(center_y / 2);
HUDButton.setDirty(true);
if (LoadProperties.partybar) {
PartyButton = new ButtonPartyToggle(PP);
PartyButton.setX(center_x - (PartyButton.getWidth() / 2));
PartyButton.setY((center_y / 2) + PartyButton.getHeight());
PartyButton.setDirty(true);
this.attachWidget(plugin, PartyButton);
}
EscapeButton = new ButtonEscape();
EscapeButton.setX(center_x - (EscapeButton.getWidth() / 2));
EscapeButton.setY((center_y / 2) + (HUDButton.getHeight() * 2) + 5);
EscapeButton.setDirty(true);
this.attachWidget(plugin, HUDButton);
this.attachWidget(plugin, mcMMO_label);
this.attachWidget(plugin, tip_escape);
this.attachWidget(plugin, EscapeButton);
this.setDirty(true);
}
public void updateButtons(PlayerProfile PP) {
HUDButton.updateText(PP);
PartyButton.updateText(PP);
this.setDirty(true);
}
}

View File

@@ -0,0 +1,128 @@
package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class ExcavationTreasure extends Treasure {
// dirt | grass | sand | gravel | clay | mycel | soulsand
// 00000001 - dirt 1
// 00000010 - grass 2
// 00000100 - sand 4
// 00001000 - gravel 8
// 00010000 - clay 16
// 00100000 - mycel 32
// 01000000 - soulsand 64
private byte dropsFrom = 0x0;
public ExcavationTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
super(drop, xp, dropChance, dropLevel);
}
// Raw getters and setters
public byte getDropsFrom() {
return dropsFrom;
}
public void setDropsFrom(byte dropsFrom) {
this.dropsFrom = dropsFrom;
}
// Getters
public boolean getDropsFromDirt() {
return getDropFromMask(1);
}
public boolean getDropsFromGrass() {
return getDropFromMask(2);
}
public boolean getDropsFromSand() {
return getDropFromMask(4);
}
public boolean getDropsFromGravel() {
return getDropFromMask(8);
}
public boolean getDropsFromClay() {
return getDropFromMask(16);
}
public boolean getDropsFromMycel() {
return getDropFromMask(32);
}
public boolean getDropsFromSoulSand() {
return getDropFromMask(64);
}
private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false;
}
// Setters
public void setDropsFromDirt() {
setDropFromMask(1);
}
public void setDropsFromGrass() {
setDropFromMask(2);
}
public void setDropsFromSand() {
setDropFromMask(4);
}
public void setDropsFromGravel() {
setDropFromMask(8);
}
public void setDropsFromClay() {
setDropFromMask(16);
}
public void setDropsFromMycel() {
setDropFromMask(32);
}
public void setDropsFromSoulSand() {
setDropFromMask(64);
}
private void setDropFromMask(int mask) {
dropsFrom |= mask;
}
// Un-setters
public void unsetDropsFromDirt() {
unsetDropFromMask(1);
}
public void unsetDropsFromGrass() {
unsetDropFromMask(2);
}
public void unsetDropsFromSand() {
unsetDropFromMask(4);
}
public void unsetDropsFromGravel() {
unsetDropFromMask(8);
}
public void unsetDropsFromClay() {
unsetDropFromMask(16);
}
public void unsetDropsFromMycel() {
unsetDropFromMask(32);
}
public void unsetDropsFromSoulSand() {
unsetDropFromMask(64);
}
private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask;
}
}

View File

@@ -0,0 +1,20 @@
package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class FishingTreasure extends Treasure {
private int maxLevel;
public FishingTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel, int maxLevel) {
super(drop, xp, dropChance, dropLevel);
this.setMaxLevel(maxLevel);
}
public int getMaxLevel() {
return maxLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
}

View File

@@ -0,0 +1,49 @@
package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public abstract class Treasure {
private int xp;
private Double dropChance;
private int dropLevel;
private ItemStack drop;
public Treasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
this.drop = drop;
this.xp = xp;
this.dropChance = dropChance;
this.dropLevel = dropLevel;
}
public ItemStack getDrop() {
return drop;
}
public void setDrop(ItemStack drop) {
this.drop = drop;
}
public int getXp() {
return xp;
}
public void setXp(int xp) {
this.xp = xp;
}
public Double getDropChance() {
return dropChance;
}
public void setDropChance(Double dropChance) {
this.dropChance = dropChance;
}
public int getDropLevel() {
return dropLevel;
}
public void setDropLevel(int dropLevel) {
this.dropLevel = dropLevel;
}
}

View File

@@ -1,89 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.events;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Called when mcMMO is preparing to drop an item
*/
@SuppressWarnings("serial")
public class McMMOItemSpawnEvent extends Event implements Cancellable {
private Location location;
private ItemStack itemStack;
private boolean cancelled;
public McMMOItemSpawnEvent(Location location, ItemStack itemStack) {
this.location = location;
this.itemStack = itemStack;
this.cancelled = false;
}
/**
* @return Location where the item will be dropped
*/
public Location getLocation() {
return location;
}
/**
* @param location Location where to drop the item
*/
public void setLocation(Location location) {
this.location = location;
}
/**
* @return ItemStack that will be dropped
*/
public ItemStack getItemStack() {
return itemStack;
}
/**
* @param itemStack ItemStack to drop
*/
public void setItemStack(ItemStack itemStack) {
this.itemStack = itemStack;
}
/** Following are required for Cancellable **/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -1,71 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.gmail.nossr50.datatypes.SkillType;
/**
* Called when a user levels up in a skill
*/
@SuppressWarnings("serial")
public class McMMOPlayerLevelUpEvent extends Event {
private Player player;
private SkillType skill;
private int levelsGained;
public McMMOPlayerLevelUpEvent(Player player, SkillType skill) {
this.player = player;
this.skill = skill;
this.levelsGained = 1; // Always 1 for now as we call in the loop where the levelups are calculated, could change later!
}
/**
* @return Player leveling up
*/
public Player getPlayer() {
return player;
}
/**
* @return SkillType that is being leveled up
*/
public SkillType getSkill() {
return skill;
}
/**
* @return The number of levels gained in this event
*/
public int getLevelsGained() {
return levelsGained;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -1,68 +0,0 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.gmail.nossr50.datatypes.SkillType;
@SuppressWarnings("serial")
public class McMMOPlayerXpGainEvent extends Event {
private Player player;
private SkillType skill;
private int xpGained;
public McMMOPlayerXpGainEvent(Player player, SkillType skill, int xpGained) {
this.player = player;
this.skill = skill;
this.xpGained = xpGained;
}
/**
* @return Player gaining experience (can be null)
*/
public Player getPlayer() {
return player;
}
/**
* @return SkillType that is gaining experience
*/
public SkillType getSkill() {
return skill;
}
/**
* @return The number experience gained in this event
*/
public int getXpGained() {
return xpGained;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,11 @@
package com.gmail.nossr50.events.chat;
/**
* Called when a chat is sent to the admin chat channel
*/
public class McMMOAdminChatEvent extends McMMOChatEvent{
public McMMOAdminChatEvent(String sender, String message) {
super(sender, message);
}
}

View File

@@ -0,0 +1,60 @@
package com.gmail.nossr50.events.chat;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class McMMOChatEvent extends Event implements Cancellable{
private boolean cancelled;
private String sender;
private String message;
public McMMOChatEvent(String sender, String message) {
this.sender = sender;
this.message = message;
}
/**
* @return String name of the player who sent the chat, or "Console"
*/
public String getSender() {
return sender;
}
/**
* @return String message that will be sent
*/
public String getMessage() {
return message;
}
/**
* @param message String message to be sent in chat
*/
public void setMessage(String message) {
this.message = message;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** Following are required for Cancellable **/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@@ -0,0 +1,20 @@
package com.gmail.nossr50.events.chat;
/**
* Called when a chat is sent to a party channel
*/
public class McMMOPartyChatEvent extends McMMOChatEvent{
private String party;
public McMMOPartyChatEvent(String sender, String party, String message) {
super(sender, message);
this.party = party;
}
/**
* @return String name of the party the message will be sent to
*/
public String getParty() {
return party;
}
}

View File

@@ -0,0 +1,47 @@
package com.gmail.nossr50.events.experience;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import com.gmail.nossr50.datatypes.SkillType;
/**
* Generic event for mcMMO experience events.
*/
public class McMMOPlayerExperienceEvent extends PlayerEvent {
protected SkillType skill;
protected int skillLevel;
public McMMOPlayerExperienceEvent(Player player, SkillType skill) {
super(player);
this.skill = skill;
this.skillLevel = skill.getSkillLevel(player);
}
/**
* @return The skill involved in this event
*/
public SkillType getSkill() {
return skill;
}
/**
* @return The skill level of the skill involved in this event
*/
public int getSkillLevel() {
return skillLevel;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,24 @@
package com.gmail.nossr50.events.experience;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.SkillType;
/**
* Called when a user levels up in a skill
*/
public class McMMOPlayerLevelUpEvent extends McMMOPlayerExperienceEvent {
private int levelsGained;
public McMMOPlayerLevelUpEvent(Player player, SkillType skill) {
super(player, skill);
this.levelsGained = 1; // Always 1 for now as we call in the loop where the levelups are calculated, could change later!
}
/**
* @return The number of levels gained in this event
*/
public int getLevelsGained() {
return levelsGained;
}
}

View File

@@ -0,0 +1,24 @@
package com.gmail.nossr50.events.experience;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.SkillType;
/**
* Called when a player gains XP in a skill
*/
public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
private int xpGained;
public McMMOPlayerXpGainEvent(Player player, SkillType skill, int xpGained) {
super(player, skill);
this.xpGained = xpGained;
}
/**
* @return The amount of experience gained in this event
*/
public int getXpGained() {
return xpGained;
}
}

View File

@@ -0,0 +1,15 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
/**
* Called when mcMMO breaks a block due to a special ability.
*/
public class FakeBlockBreakEvent extends BlockBreakEvent {
public FakeBlockBreakEvent(Block theBlock, Player player) {
super(theBlock, player);
}
}

View File

@@ -0,0 +1,14 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
/**
* Called when mcMMO applies damage from an entity due to special abilities.
*/
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage) {
super(damager, damagee, cause, damage);
}
}

View File

@@ -0,0 +1,14 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageEvent;
/**
* Called when mcMMO applies damage due to special abilities.
*/
public class FakeEntityDamageEvent extends EntityDamageEvent {
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, int damage) {
super(damagee, cause, damage);
}
}

View File

@@ -0,0 +1,14 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerAnimationEvent;
/**
* Called when handling extra drops to avoid issues with NoCheat.
*/
public class FakePlayerAnimationEvent extends PlayerAnimationEvent {
public FakePlayerAnimationEvent(Player player) {
super(player);
}
}

View File

@@ -0,0 +1,72 @@
package com.gmail.nossr50.events.items;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Called when mcMMO is preparing to drop an item.
*/
public class McMMOItemSpawnEvent extends Event implements Cancellable {
private Location location;
private ItemStack itemStack;
private boolean cancelled;
public McMMOItemSpawnEvent(Location location, ItemStack itemStack) {
this.location = location;
this.itemStack = itemStack;
this.cancelled = false;
}
/**
* @return Location where the item will be dropped
*/
public Location getLocation() {
return location;
}
/**
* @param location Location where to drop the item
*/
public void setLocation(Location location) {
this.location = location;
}
/**
* @return ItemStack that will be dropped
*/
public ItemStack getItemStack() {
return itemStack;
}
/**
* @param itemStack ItemStack to drop
*/
public void setItemStack(ItemStack itemStack) {
this.itemStack = itemStack;
}
/** Following are required for Cancellable **/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,104 @@
package com.gmail.nossr50.events.party;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* Called when a player attempts to join, leave, or change parties.
*/
public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable{
protected String oldParty;
protected String newParty;
protected EventReason reason;
protected boolean cancelled;
public McMMOPartyChangeEvent(Player player, String oldParty, String newParty, EventReason reason) {
super(player);
if (newParty != null) {
newParty = newParty.replace(":", ".");
}
this.oldParty = oldParty;
this.newParty = newParty;
this.reason = reason;
this.cancelled = false;
}
/**
* @return The party being left, or null if the player was not in a party
*/
public String getOldParty() {
return oldParty;
}
/**
* @return The party being joined, or null if the player is not joining a new party
*/
public String getNewParty() {
return newParty;
}
/**
* @return The reason for the event being fired
*/
public EventReason getReason() {
return reason;
}
/**
* A list of reasons why the event may have been fired
*/
public enum EventReason{
/**
* Joined a party for the first time.
*/
JOINED_PARTY,
/**
* Left a party and did not join a new one.
*/
LEFT_PARTY,
/**
* Was kicked from a party.
*/
KICKED_FROM_PARTY,
/**
* Left one party to join another.
*/
CHANGED_PARTIES,
/**
* Any reason that doesn't fit elsewhere.
*/
CUSTOM;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** Following are required for Cancellable **/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@@ -0,0 +1,45 @@
package com.gmail.nossr50.events.party;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerTeleportEvent;
/**
* Called just before a player teleports using the /ptp command.
*/
public class McMMOPartyTeleportEvent extends PlayerTeleportEvent{
private String party;
private Player target;
public McMMOPartyTeleportEvent(Player player, Player target, String party) {
super(player, player.getLocation(), target.getLocation(), TeleportCause.COMMAND);
this.party = party;
this.target = target;
}
/**
* @return The party the teleporting player is in
*/
public String getParty() {
return party;
}
/**
* @return The player being teleported to
*/
public Player getTarget() {
return target;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,57 @@
package com.gmail.nossr50.events.skills;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.SkillType;
/**
* Called just before a player repairs an object with mcMMO.
*/
public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implements Cancellable{
private short repairAmount;
private ItemStack repairMaterial;
private ItemStack repairedObject;
private boolean cancelled;
public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) {
super(player, SkillType.REPAIR);
this.repairAmount = repairAmount;
this.repairMaterial = repairMaterial;
this.repairedObject = repairedObject;
this.cancelled = false;
}
/**
* @return The amount this item will be repaired.
*/
public short getRepairAmount() {
return repairAmount;
}
/**
* @return The material used to repair this item
*/
public ItemStack getRepairMaterial() {
return repairMaterial;
}
/**
* @return The item that was repaired
*/
public ItemStack getRepairedObject() {
return repairedObject;
}
/** Following are required for Cancellable **/
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@@ -0,0 +1,47 @@
package com.gmail.nossr50.events.skills;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import com.gmail.nossr50.datatypes.SkillType;
/**
* Generic event for mcMMO skill handling.
*/
public class McMMOPlayerSkillEvent extends PlayerEvent {
protected SkillType skill;
protected int skillLevel;
public McMMOPlayerSkillEvent(Player player, SkillType skill) {
super(player);
this.skill = skill;
this.skillLevel = skill.getSkillLevel(player);
}
/**
* @return The skill involved in this event
*/
public SkillType getSkill() {
return skill;
}
/**
* @return The level of the skill involved in this event
*/
public int getSkillLevel() {
return skillLevel;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,305 @@
package com.gmail.nossr50.listeners;
import java.util.List;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.ToolType;
import com.gmail.nossr50.skills.gathering.Excavation;
import com.gmail.nossr50.skills.gathering.Herbalism;
import com.gmail.nossr50.skills.gathering.Mining;
import com.gmail.nossr50.skills.gathering.WoodCutting;
import com.gmail.nossr50.skills.misc.Repair;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import org.bukkit.Bukkit;
import org.bukkit.CropState;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.getspout.spoutapi.sound.SoundEffect;
public class BlockListener implements Listener {
private final mcMMO plugin;
public BlockListener(final mcMMO plugin) {
this.plugin = plugin;
}
/**
* Monitor BlockPistonExtend events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
List<Block> blocks = event.getBlocks();
BlockFace direction = event.getDirection();
for (Block b : blocks) {
if (b.hasMetadata("mcmmoPlacedBlock")) {
b.getRelative(direction).setMetadata("mcmmoNeedsTracking", new FixedMetadataValue(plugin, true));
b.removeMetadata("mcmmoPlacedBlock", plugin);
}
}
for (Block b : blocks) {
if (b.getRelative(direction).hasMetadata("mcmmoNeedsTracking")) {
b.getRelative(direction).setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
b.getRelative(direction).removeMetadata("mcmmoNeedsTracking", plugin);
}
}
}
/**
* Monitor BlockPistonRetract events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
Block block = event.getRetractLocation().getBlock();
if (block.hasMetadata("mcmmoPlacedBlock")) {
block.removeMetadata("mcmmoPlacedBlock", plugin);
event.getBlock().getRelative(event.getDirection()).setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
}
}
/**
* Monitor BlockPlace events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
Block block = event.getBlock();
Player player = event.getPlayer();
int id = block.getTypeId();
Material mat = block.getType();
/* Code to prevent issues with placed falling Sand/Gravel not being tracked */
if (mat.equals(Material.SAND) || mat.equals(Material.GRAVEL)) {
for (int y = -1; y + block.getY() >= 0; y--) {
if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
continue;
}
else {
Block newLocation = block.getRelative(0, y + 1, 0);
newLocation.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
break;
}
}
}
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
if (BlockChecks.shouldBeWatched(mat)) {
block.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
}
if (id == LoadProperties.anvilID && LoadProperties.anvilmessages) {
Repair.placedAnvilCheck(player, id);
}
}
/**
* Monitor BlockBreak events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
PlayerProfile PP = Users.getProfile(player);
Block block = event.getBlock();
Material mat = block.getType();
ItemStack inhand = player.getItemInHand();
if (event instanceof FakeBlockBreakEvent) {
return;
}
/*
* HERBALISM
*/
/* Green Terra */
if (PP.getToolPreparationMode(ToolType.HOE) && mcPermissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || Herbalism.canBeGreenTerra(mat))) {
Skills.abilityCheck(player, SkillType.HERBALISM);
}
/* Triple drops */
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Herbalism.canBeGreenTerra(mat)) {
Herbalism.herbalismProcCheck(block, player, event, plugin);
}
if (mcPermissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(mat)) {
Herbalism.herbalismProcCheck(block, player, event, plugin);
}
/*
* MINING
*/
if (mcPermissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) {
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
Mining.miningBlockCheck(player, block);
}
else if (!LoadProperties.miningrequirespickaxe) {
Mining.miningBlockCheck(player, block);
}
}
/*
* WOOD CUTTING
*/
if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) {
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
WoodCutting.woodcuttingBlockCheck(player, block);
}
else if (!LoadProperties.woodcuttingrequiresaxe) {
WoodCutting.woodcuttingBlockCheck(player, block);
}
}
if (PP.getAbilityMode(AbilityType.TREE_FELLER) && mcPermissions.getInstance().treeFeller(player)) {
WoodCutting.treeFeller(event);
}
/*
* EXCAVATION
*/
if (Excavation.canBeGigaDrillBroken(mat) && mcPermissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) {
if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
Excavation.excavationProcCheck(block, player);
}
else if (!LoadProperties.excavationRequiresShovel) {
Excavation.excavationProcCheck(block, player);
}
}
//Remove metadata when broken
if (block.hasMetadata("mcmmoPlacedBlock") && BlockChecks.shouldBeWatched(mat)) {
block.removeMetadata("mcmmoPlacedBlock", plugin);
}
}
/**
* Monitor BlockDamage events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockDamage(BlockDamageEvent event) {
final int LEAF_BLOWER_LEVEL = 100;
Player player = event.getPlayer();
PlayerProfile PP = Users.getProfile(player);
ItemStack inhand = player.getItemInHand();
Block block = event.getBlock();
Material mat = block.getType();
/*
* ABILITY PREPARATION CHECKS
*/
if (BlockChecks.abilityBlockCheck(mat)) {
if (PP.getToolPreparationMode(ToolType.HOE) && (Herbalism.canBeGreenTerra(mat) || Herbalism.makeMossy(mat))) {
Skills.abilityCheck(player, SkillType.HERBALISM);
}
else if (PP.getToolPreparationMode(ToolType.AXE) && mat.equals(Material.LOG) && mcPermissions.getInstance().treeFeller(player)) { //Why are we checking the permissions here?
Skills.abilityCheck(player, SkillType.WOODCUTTING);
}
else if (PP.getToolPreparationMode(ToolType.PICKAXE) && Mining.canBeSuperBroken(mat)) {
Skills.abilityCheck(player, SkillType.MINING);
}
else if (PP.getToolPreparationMode(ToolType.SHOVEL) && Excavation.canBeGigaDrillBroken(mat)) {
Skills.abilityCheck(player, SkillType.EXCAVATION);
}
else if (PP.getToolPreparationMode(ToolType.FISTS) && (Excavation.canBeGigaDrillBroken(mat) || mat.equals(Material.SNOW))) {
Skills.abilityCheck(player, SkillType.UNARMED);
}
}
/* TREE FELLER SOUNDS */
if (LoadProperties.spoutEnabled && mat.equals(Material.LOG) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
}
/*
* ABILITY TRIGGER CHECKS
*/
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && mcPermissions.getInstance().greenTerra(player) && Herbalism.makeMossy(mat)) {
Herbalism.greenTerra(player, block);
}
else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block);
}
else if (!LoadProperties.excavationRequiresShovel) {
event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block);
}
}
else if (PP.getAbilityMode(AbilityType.BERSERK) && Skills.triggerCheck(player, block, AbilityType.BERSERK)) {
if (inhand.getType().equals(Material.AIR)) {
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
Bukkit.getPluginManager().callEvent(armswing);
event.setInstaBreak(true);
}
if (LoadProperties.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
event.setInstaBreak(true);
Mining.SuperBreakerBlockCheck(player, block);
}
else if (!LoadProperties.miningrequirespickaxe) {
event.setInstaBreak(true);
Mining.SuperBreakerBlockCheck(player, block);
}
}
else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && mat.equals(Material.LEAVES)) {
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
event.setInstaBreak(true);
WoodCutting.leafBlower(player, block);
}
}
else if (!LoadProperties.woodcuttingrequiresaxe && !inhand.getType().equals(Material.SHEARS)) {
if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
event.setInstaBreak(true);
WoodCutting.leafBlower(player, block);
}
}
}
}
}

View File

@@ -0,0 +1,318 @@
package com.gmail.nossr50.listeners;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.mcBleedTimer;
import com.gmail.nossr50.skills.combat.Archery;
import com.gmail.nossr50.skills.combat.Staves;
import com.gmail.nossr50.skills.combat.Taming;
import com.gmail.nossr50.skills.gathering.BlastMining;
import com.gmail.nossr50.skills.misc.Acrobatics;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.m;
import com.gmail.nossr50.util.mcPermissions;
public class EntityListener implements Listener {
private final mcMMO plugin;
public EntityListener(final mcMMO plugin) {
this.plugin = plugin;
}
/**
* Monitor EntityDamageByEntity events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (event instanceof FakeEntityDamageByEntityEvent) {
return;
}
Entity defender = event.getEntity();
Entity attacker = event.getDamager();
if (attacker instanceof Player && defender instanceof Player) {
if (!defender.getWorld().getPVP()) {
return;
}
if (Party.getInstance().inSameParty((Player)defender, (Player)attacker)) {
event.setCancelled(true);
return;
}
}
/* Check for invincibility */
if (defender instanceof LivingEntity) {
LivingEntity livingDefender = (LivingEntity)defender;
if (!m.isInvincible(livingDefender, event)) {
Combat.combatChecks(event, plugin);
Staves.altFireCheck(event);
}
}
}
/**
* Monitor EntityDamage events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
if (event instanceof FakeEntityDamageEvent) {
return;
}
Entity entity = event.getEntity();
EntityType type = entity.getType();
DamageCause cause = event.getCause();
switch(type) {
case PLAYER:
/* Check for invincibility */
Player player = (Player) entity;
PlayerProfile PP = Users.getProfile(player);
if (PP.getGodMode()) {
event.setCancelled(true);
return;
}
if (!m.isInvincible(player, event)) {
if (cause == DamageCause.FALL && mcPermissions.getInstance().acrobatics(player)) {
Acrobatics.acrobaticsCheck(player, event);
}
else if (cause == DamageCause.BLOCK_EXPLOSION && mcPermissions.getInstance().demolitionsExpertise(player)) {
BlastMining.demolitionsExpertise(player, event);
}
if (event.getDamage() >= 1) {
PP.setRecentlyHurt(System.currentTimeMillis());
}
}
break;
case WOLF:
Wolf wolf = (Wolf) entity;
if ((!m.isInvincible(wolf, event)) && wolf.isTamed() && (wolf.getOwner() instanceof Player)) {
Taming.preventDamage(event);
}
break;
default:
break;
}
}
/**
* Monitor EntityDeath events.
*
* @param event The event to monitor
*/
@EventHandler (priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event) {
LivingEntity x = event.getEntity();
x.setFireTicks(0);
/* Remove bleed track */
mcBleedTimer.remove(x);
Archery.arrowRetrievalCheck(x, plugin);
if (x instanceof Player) {
Users.getProfile((Player)x).resetBleedTicks();
}
}
/**
* Monitor CreatureSpawn events.
*
* @param event The event to monitor
*/
@EventHandler (priority = EventPriority.MONITOR)
public void onCreatureSpawn(CreatureSpawnEvent event) {
SpawnReason reason = event.getSpawnReason();
if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !LoadProperties.xpGainsMobSpawners) {
event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true));
}
}
/**
* Monitor ExplosionPrime events.
*
* @param event The event to monitor
*/
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {
Entity entity = event.getEntity();
if (entity instanceof TNTPrimed) {
int id = entity.getEntityId();
if (plugin.tntTracker.containsKey(id)) {
Player player = plugin.tntTracker.get(id);
if (mcPermissions.getInstance().biggerBombs(player)) {
BlastMining.biggerBombs(player, event);
}
}
}
}
/**
* Monitor EntityExplode events.
*
* @param event The event to monitor
*/
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEnitityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (event.getEntity() instanceof TNTPrimed) {
int id = entity.getEntityId();
if (plugin.tntTracker.containsKey(id)) {
Player player = plugin.tntTracker.get(id);
BlastMining.dropProcessing(player, event);
plugin.tntTracker.remove(id);
}
}
}
/**
* Monitor FoodLevelChange events.
*
* @param event The event to monitor
*/
@EventHandler (priority = EventPriority.LOW)
public void onFoodLevelChange(FoodLevelChangeEvent event) {
if (LoadProperties.herbalismHungerBonus) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
PlayerProfile PP = Users.getProfile(player);
int currentFoodLevel = player.getFoodLevel();
int newFoodLevel = event.getFoodLevel();
/* Some foods have 3 ranks
* Some foods have 5 ranks
* The number of ranks is based on how 'common' the item is
* We can adjust this quite easily if we find something is giving too much of a bonus
*/
if (newFoodLevel > currentFoodLevel) {
Material food = player.getItemInHand().getType();
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
int foodChange = newFoodLevel - currentFoodLevel;
int rankChange = 0;
switch (food) {
case BREAD:
/* BREAD RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
rankChange = 200;
break;
case COOKIE:
/* COOKIE RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
rankChange = 400;
break;
case MELON:
/* MELON RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
rankChange = 400;
break;
case MUSHROOM_SOUP:
/* MUSHROOM SOUP RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
rankChange = 200;
break;
default:
return;
}
for (int i = 200; i <= 1000; i += rankChange) {
if (herbLevel >= i) {
foodChange++;
}
}
/* Make sure we don't go over the max value */
newFoodLevel = currentFoodLevel + foodChange;
if (newFoodLevel > 20) {
event.setFoodLevel(20);
}
else {
event.setFoodLevel(newFoodLevel);
}
}
}
}
}
/**
* Monitor EntityTame events.
*
* @param event The event to watch
*/
@EventHandler (priority = EventPriority.MONITOR)
public void onEntityTame(EntityTameEvent event) {
Player player = (Player) event.getOwner();
if (mcPermissions.getInstance().taming(player) && !event.getEntity().hasMetadata("mcmmoSummoned")) {
PlayerProfile PP = Users.getProfile(player);
EntityType type = event.getEntityType();
int xp = 0;
switch (type) {
case WOLF:
xp = LoadProperties.mtameWolf;
break;
case OCELOT:
xp = LoadProperties.mtameOcelot;
break;
default:
break;
}
PP.addXP(SkillType.TAMING, xp);
Skills.XpCheckSkill(SkillType.TAMING, player);
}
}
}

View File

@@ -0,0 +1,392 @@
package com.gmail.nossr50.listeners;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.general.XprateCommand;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.skills.combat.Staves;
import com.gmail.nossr50.skills.combat.Taming;
import com.gmail.nossr50.skills.gathering.BlastMining;
import com.gmail.nossr50.skills.gathering.Fishing;
import com.gmail.nossr50.skills.gathering.Herbalism;
import com.gmail.nossr50.skills.misc.Repair;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Item;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.util.mcPermissions;
public class PlayerListener implements Listener {
private mcMMO plugin;
public PlayerListener(mcMMO instance) {
plugin = instance;
}
/**
* Monitor PlayerChangedWorld events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
PlayerProfile PP = Users.getProfile(player);
if (PP.getGodMode()) {
if (!mcPermissions.getInstance().mcgod(player)) {
PP.toggleGodMode();
player.sendMessage(mcLocale.getString("GodMode.Forbidden"));
}
}
if (PP.inParty()) {
if (!mcPermissions.getInstance().party(player)) {
PP.removeParty();
player.sendMessage(mcLocale.getString("Party.Forbidden"));
}
}
}
/**
* Monitor PlayerFish events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerFish(PlayerFishEvent event) {
Player player = event.getPlayer();
if (mcPermissions.getInstance().fishing(player)) {
State state = event.getState();
switch (state) {
case CAUGHT_FISH:
Fishing.processResults(event);
break;
case CAUGHT_ENTITY:
if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= 150 && mcPermissions.getInstance().shakeMob(player)) {
Fishing.shakeMob(event);
}
break;
default:
break;
}
}
}
/**
* Monitor PlaterPickupItem events.
*
* @param event The event to watch
*/
@EventHandler(ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
if (Users.getProfile(event.getPlayer()).getAbilityMode(AbilityType.BERSERK)) {
event.setCancelled(true);
}
}
/**
* Monitor PlayerLogin events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) {
Users.addUser(event.getPlayer());
}
/**
* Monitor PlayerQuit events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
PlayerProfile PP = Users.getProfile(player);
/* GARBAGE COLLECTION */
//Remove Spout Stuff
if (LoadProperties.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
SpoutStuff.playerHUDs.remove(player);
}
//Bleed it out
if(PP.getBleedTicks() > 0) {
Combat.dealDamage(player, PP.getBleedTicks()*2);
}
//Schedule PlayerProfile removal 2 minutes after quitting
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveProfileFromMemoryTask(player), 2400);
}
/**
* Monitor PlayerJoin events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd) {
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "mcmmo"}));
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
}
//THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY
if (XprateCommand.xpevent) {
player.sendMessage(mcLocale.getString("XPRate.Event", new Object[] {LoadProperties.xpGainMultiplier}));
}
}
/**
* Monitor PlayerInteract events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
Block block = event.getClickedBlock();
ItemStack is = player.getItemInHand();
Material mat;
/* Fix for NPE on interacting with air */
if (block == null) {
mat = Material.AIR;
}
else {
mat = block.getType();
}
switch (action) {
case RIGHT_CLICK_BLOCK:
/* REPAIR CHECKS */
if (mcPermissions.getInstance().repair(player) && block.getTypeId() == LoadProperties.anvilID && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) {
Repair.repairCheck(player, is);
event.setCancelled(true);
player.updateInventory();
}
/* ACTIVATION CHECKS */
if (LoadProperties.enableAbilities && BlockChecks.abilityBlockCheck(mat)) {
if (!mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL)) {
Skills.activationCheck(player, SkillType.HERBALISM);
}
Skills.activationCheck(player, SkillType.AXES);
Skills.activationCheck(player, SkillType.EXCAVATION);
Skills.activationCheck(player, SkillType.MINING);
Skills.activationCheck(player, SkillType.SWORDS);
Skills.activationCheck(player, SkillType.UNARMED);
Skills.activationCheck(player, SkillType.WOODCUTTING);
}
/* GREEN THUMB CHECK */
if (mcPermissions.getInstance().greenThumbBlocks(player) && Herbalism.makeMossy(mat) && is.getType().equals(Material.SEEDS)) {
Herbalism.greenThumbBlocks(is, player, block);
}
/* ITEM CHECKS */
if (BlockChecks.abilityBlockCheck(mat)) {
Item.itemchecks(player);
}
/* BLAST MINING CHECK */
if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == LoadProperties.detonatorID) {
BlastMining.remoteDetonation(player, plugin);
}
/* STAFF CHECKS */
Staves.altFire(is.getType(), player, plugin);
break;
case RIGHT_CLICK_AIR:
/* ACTIVATION CHECKS */
if (LoadProperties.enableAbilities) {
Skills.activationCheck(player, SkillType.AXES);
Skills.activationCheck(player, SkillType.EXCAVATION);
Skills.activationCheck(player, SkillType.HERBALISM);
Skills.activationCheck(player, SkillType.MINING);
Skills.activationCheck(player, SkillType.SWORDS);
Skills.activationCheck(player, SkillType.UNARMED);
Skills.activationCheck(player, SkillType.WOODCUTTING);
}
/* ITEM CHECKS */
Item.itemchecks(player);
/* BLAST MINING CHECK */
if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == LoadProperties.detonatorID) {
BlastMining.remoteDetonation(player, plugin);
}
/* STAFF CHECKS */
Staves.altFire(is.getType(), player, plugin);
break;
case LEFT_CLICK_AIR:
case LEFT_CLICK_BLOCK:
/* CALL OF THE WILD CHECKS */
if (player.isSneaking() && mcPermissions.getInstance().taming(player)) {
if (is.getType().equals(Material.RAW_FISH)) {
Taming.animalSummon(EntityType.OCELOT, player, plugin);
}
else if (is.getType().equals(Material.BONE)) {
Taming.animalSummon(EntityType.WOLF, player, plugin);
}
}
break;
default:
break;
}
}
/**
* Monitor PlayerChat events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerChat(PlayerChatEvent event) {
Player player = event.getPlayer();
PlayerProfile PP = Users.getProfile(player);
boolean partyChat = PP.getPartyChatMode();
boolean adminChat = PP.getAdminChatMode();
Set<Player> recipients = event.getRecipients();
Set<Player> intendedRecipients = new HashSet<Player>();
ChatColor color = null;
if (partyChat || adminChat) {
if (partyChat) {
if (!PP.inParty()) {
player.sendMessage("You're not in a party, type /p to leave party chat mode."); //TODO: Use mcLocale
return;
}
color = ChatColor.GREEN;
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(player.getName(), PP.getParty(), event.getMessage());
plugin.getServer().getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return;
event.setMessage(chatEvent.getMessage());
for (Player x : plugin.getServer().getOnlinePlayers()) {
if (Party.getInstance().inSameParty(player, x)) {
intendedRecipients.add(x);
}
}
event.setFormat(color + "(" + ChatColor.WHITE + "%1$s" + color + ") %2$s");
}
if (adminChat) {
color = ChatColor.AQUA;
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), event.getMessage());
plugin.getServer().getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return;
event.setMessage(chatEvent.getMessage());
for (Player x : plugin.getServer().getOnlinePlayers()) {
if (x.isOp() || mcPermissions.getInstance().adminChat(x)) {
intendedRecipients.add(x);
}
}
event.setFormat(color + "{" + ChatColor.WHITE + "%1$s" + color + "} %2$s");
}
recipients.retainAll(intendedRecipients);
}
}
// Dynamically aliasing commands need to be re-done.
// For now, using a command with an alias will send both the original command, and the mcMMO command
/**
* Monitor PlayerCommandPreprocess events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
String message = event.getMessage();
if (!message.startsWith("/")) {
return;
}
String command = message.substring(1).split(" ")[0];
if (plugin.aliasMap.containsKey(command)) {
if (command.equalsIgnoreCase(plugin.aliasMap.get(command))) {
return;
}
event.getPlayer().chat(message.replaceFirst(command, plugin.aliasMap.get(command)));
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
if (event.getEgg().hasMetadata("mcmmoFiredFromStaff") && event.isHatching()) {
event.setHatching(false);
}
}
}

View File

@@ -0,0 +1,32 @@
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
/**
* Listener for listening to our own events, only really useful for catching errors
*/
public class SelfListener implements Listener {
/**
* Monitor internal XP gain events.
*
* @param event The event to watch
*/
@EventHandler
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
int xp = event.getXpGained();
if(xp < 0) {
try {
throw new Exception("Gained negative XP!");
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,48 @@
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.getspout.spoutapi.event.input.KeyPressedEvent;
import org.getspout.spoutapi.gui.ScreenType;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class SpoutInputListener implements Listener {
private mcMMO plugin;
public SpoutInputListener(mcMMO plugin) {
this.plugin = plugin;
}
/**
* Monitor Spout KeyPressed events.
*
* @param event The event to watch
*/
@EventHandler
public void onKeyPressedEvent(KeyPressedEvent event) {
SpoutPlayer sPlayer = event.getPlayer();
if (!sPlayer.isSpoutCraftEnabled() || sPlayer.getMainScreen().getActivePopup() != null || event.getScreenType() != ScreenType.GAME_SCREEN) {
return;
}
if (event.getKey() == SpoutStuff.keypress) {
if (!SpoutStuff.playerScreens.containsKey(sPlayer)) {
PopupMMO mmoPop = new PopupMMO(sPlayer, Users.getProfile(sPlayer), plugin);
SpoutStuff.playerScreens.put(sPlayer, mmoPop);
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
sPlayer.getMainScreen().setDirty(true);
}
else {
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
sPlayer.getMainScreen().setDirty(true);
}
}
}
}

View File

@@ -0,0 +1,46 @@
package com.gmail.nossr50.listeners;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class SpoutListener implements Listener {
//Why do we have this here? We never use it...
mcMMO plugin = null;
public SpoutListener(mcMMO pluginx) {
plugin = pluginx;
}
/**
* Monitor SpoutCraftEnable events.
*
* @param event The event to watch
*/
@EventHandler
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
SpoutPlayer sPlayer = event.getPlayer();
PlayerProfile PPs = Users.getProfile(sPlayer);
//TODO: Add custom titles based on skills
if (LoadProperties.showPowerLevel) {
sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl"
+ ChatColor.WHITE+"." + ChatColor.GREEN + String.valueOf(PPs.getPowerLevel()));
}
if (sPlayer.isSpoutCraftEnabled()) {
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer)); //Setup Party HUD stuff
PPs.toggleSpoutEnabled();
}
}
}

View File

@@ -0,0 +1,91 @@
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.getspout.spoutapi.event.screen.ButtonClickEvent;
import org.getspout.spoutapi.event.screen.ScreenCloseEvent;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class SpoutScreenListener implements Listener {
//Why do we have this here? We never use it...
mcMMO plugin = null;
public SpoutScreenListener(mcMMO pluginx) {
plugin = pluginx;
}
/**
* Monitor Spout ButtonClick events.
*
* @param event The event to watch
*/
@EventHandler
public void onButtonClick(ButtonClickEvent event) {
SpoutPlayer sPlayer = event.getPlayer();
PlayerProfile PP = Users.getProfile(sPlayer);
if (event.getButton() instanceof ButtonHUDStyle) {
if (SpoutStuff.playerHUDs.containsKey(sPlayer)) {
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
SpoutStuff.playerHUDs.remove(sPlayer);
switch (PP.getHUDType()) {
case RETRO:
PP.setHUDType(HUDType.STANDARD);
break;
case STANDARD:
PP.setHUDType(HUDType.SMALL);
break;
case SMALL:
PP.setHUDType(HUDType.DISABLED);
break;
case DISABLED:
PP.setHUDType(HUDType.RETRO);
break;
default:
break;
}
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
}
}
else if (event.getButton() instanceof ButtonEscape) {
sPlayer.getMainScreen().closePopup();
}
else if (event.getButton() instanceof ButtonPartyToggle) {
PP.togglePartyHUD();
ButtonPartyToggle bpt = (ButtonPartyToggle) event.getButton();
bpt.updateText(PP);
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
SpoutStuff.playerHUDs.get(sPlayer).initializeHUD(sPlayer);
}
}
/**
* Monitor Spout ScreenClose events.
*
* @param event The event to watch
*/
@EventHandler
public void onScreenClose(ScreenCloseEvent event) {
if (event.getScreen() instanceof PopupMMO) {
SpoutStuff.playerScreens.remove(event.getPlayer());
}
}
}

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