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

Compare commits

..

602 Commits

Author SHA1 Message Date
bm01
dc48d467f5 Return to HashMap! 2012-06-24 22:46:45 +02:00
nossr50
0b0390620e Whoops :D 2012-06-24 13:26:49 -07:00
nossr50
24eb34c182 Back to the old way of doing things 2012-06-24 13:26:21 -07:00
nossr50
1a5bd1b6a2 Getting ready for release 2012-06-24 12:59:54 -07:00
nossr50
ab7b6ce460 Fixed bug that caused NPE when trying to compare null parties 2012-06-24 12:48:03 -07:00
GJ
c4cd677021 Added new methods to replace deprecation in latest Bukkit. Commented out
until RB.
2012-06-23 12:13:51 -04:00
bm01
6b84d39dda Fixed AE abilities not being applied correctly 2012-06-22 23:10:17 +02:00
bm01
e61342177d Simplified combat ability checks 2012-06-22 20:20:28 +02:00
bm01
d51fa92b46 Made 'shooterless' arrows dodgeable 2012-06-22 19:39:14 +02:00
bm01
3e20dc7de6 combatChecks optimization 2012-06-22 18:54:49 +02:00
GJ
dce1d7ba39 Fixed calculations on Reduced Cooldown perk 2012-06-22 10:57:51 -04:00
GJ
adffea1d52 Increased the seconds for activation time perk. 2012-06-22 10:13:37 -04:00
GJ
20b73dcc84 Fixed not checking if an Entity was a LivingEntity before applying the
Counter-Attack ability.
2012-06-22 09:47:18 -04:00
GJ
b331fa353b Added increased activate time donor perks 2012-06-21 23:01:02 -04:00
GJ
9fe14609af Locale update. 2012-06-21 22:26:29 -04:00
GJ
f6973b8907 Changelog update. 2012-06-21 21:51:43 -04:00
GJ
8738036f6f Added Reduced Cooldown perk for donors. 2012-06-21 21:50:48 -04:00
GJ
fce02dc0e5 Fixed possible NPE with Acrobatics fall checks. 2012-06-21 21:04:19 -04:00
GJ
2bef0e833f Rework of Swords handling 2012-06-21 09:04:45 -04:00
GJ
9040a2a2e3 Optimizations to Combat.java 2012-06-18 08:50:14 -04:00
NuclearW
4407ed0a6f Fixed bug with Chunklets not being reloaded on /reload 2012-06-16 21:43:04 -04:00
GJ
09721518b0 Fixed Unarmed using Taming levels.
My copy-paste skills are failing.
2012-06-15 11:11:57 -04:00
GJ
8ad6337dde Avoid calling the same thing 3 times. 2012-06-15 10:58:38 -04:00
bm01
271740d2ac Re-added mcMMO.getPlayerProfile(Player) 2012-06-15 10:03:00 +02:00
GJ
48dd537257 More reworking of Unarmed, renamed ArcheryBonusDamageEventHandler for
clarity's sake.
2012-06-14 23:59:36 -04:00
GJ
77b4aaa50d Updating Unarmed (WIP) 2012-06-14 23:59:35 -04:00
bm01
1014316581 Whoops D: 2012-06-15 03:32:46 +02:00
bm01
739cd83155 Forgot to cancel the task 2012-06-15 03:30:36 +02:00
bm01
df08bc4da0 Changelog update 2012-06-15 02:56:36 +02:00
bm01
55e832d4f6 Do not track arrow if the bow has Infinity 2012-06-15 02:53:11 +02:00
bm01
032472dcb3 Avoid unnecessary iteration 2012-06-15 02:46:41 +02:00
bm01
68bf93d1ac Remove inactive entities from the arrow tracker 2012-06-15 02:43:13 +02:00
bm01
ba133f94fc Extra equals 2012-06-15 02:34:24 +02:00
bm01
064c16f4d7 Reverted last commit 2012-06-15 02:14:53 +02:00
bm01
5a394ee744 Fixed killed entities not being removed from arrowTracker 2012-06-15 02:08:15 +02:00
bm01
3bc2f5dc55 Fixed Archery using Taming skill level 2012-06-15 02:06:06 +02:00
GJ
6f63818e5f Check for the block before throwing the fake break event. 2012-06-14 10:24:58 -04:00
GJ
a5d7bee939 Spacing 2012-06-14 00:01:31 -04:00
bm01
9d396162f1 Hardcore.java cleanup 2012-06-14 01:22:35 +02:00
bm01
4a0d9a96ab Fixed minor bug with Vampirism notification 2012-06-14 00:48:40 +02:00
GJ
9f65e5a9ab PermissionsHandler was a stupid idea. 2012-06-13 12:31:20 -04:00
GJ
c71f4e438b Organize imports. 2012-06-13 08:54:02 -04:00
GJ
14d13eb4c7 Archery rework. 2012-06-13 08:53:18 -04:00
GJ
29c629eb22 WIP on Archery rework. 2012-06-12 21:36:17 -04:00
bm01
050b794b42 Fixed NPE with /mmoedit 2012-06-12 23:31:32 +02:00
NuclearW
89b5f8c275 Changelog 2012-06-12 17:01:18 -04:00
NuclearW
f589197321 Load the lowest chunklets right now.
Thanks for @Glitchfinder for finding this glitch.

Closes #205
2012-06-12 17:00:05 -04:00
NuclearW
09575a68f0 Handle corrupt chunklets by making a new one and not throw stacktrace 2012-06-12 16:45:28 -04:00
NuclearW
c1b838e356 Typo fix 2012-06-12 16:45:00 -04:00
GJ
8ed2696315 Fix issue with trying to remove all of the item in hand. 2012-06-12 15:11:13 -04:00
GJ
ab138bdba2 Javadocs, added Lighting to the damage types affected by Shock Proof 2012-06-12 14:48:28 -04:00
GJ
5ba9fb78fd More tweaks to Taming. 2012-06-12 14:42:38 -04:00
GJ
2d47447375 Begin rework of Taming skill 2012-06-12 11:07:51 -04:00
GJ
d9eaede4c2 Spacing 2012-06-12 11:07:27 -04:00
GJ
c6db11a10b Use EntityDamage event instead of EntityDamageByEnitity 2012-06-12 10:23:34 -04:00
GJ
2225e542ad Spacing issues. 2012-06-12 09:20:39 -04:00
GJ
975e13d45f Tweaked how we check XP gain permissions. 2012-06-12 08:10:18 -04:00
bm01
534a165c45 Tweaked a few things 2012-06-12 06:18:00 +02:00
bm01
5cff6ed67b Removed xpGainATS, it actually never worked 2012-06-12 05:59:26 +02:00
bm01
3448733834 Removed unused variable 2012-06-12 05:40:07 +02:00
bm01
c382c95d24 Re-added respawnATS 2012-06-12 05:38:32 +02:00
GJ
0034226fa7 Reorder constructors to avoid errors 2012-06-11 21:03:49 -04:00
GJ
5f067a6bb5 More tweaks to Acrobatics. 2012-06-11 20:37:09 -04:00
GJ
6ab1996440 Reworking of Acrobatics, plus an Acrobatics bugfix. 2012-06-11 16:11:23 -04:00
bm01
5bff6d63f2 Removed unneeded reference 2012-06-11 08:26:48 +02:00
bm01
5fe227b874 Forgot to change getParties 2012-06-11 08:26:22 +02:00
bm01
cbaf2f8370 More work on parties 2012-06-11 07:50:10 +02:00
bm01
393ac886e2 Removed unneeded method 2012-06-10 06:57:55 +02:00
bm01
c9082083d1 Merged ProfileSaveTask and RemoveProfileFromMemory 2012-06-10 06:56:39 +02:00
bm01
5d0d89e74d Changed party name restriction 2012-06-09 22:24:04 +02:00
bm01
e9c3583fd8 Added few forgotten things 2012-06-09 20:11:11 +02:00
bm01
81eadc1418 No longer use/save party name in database and users flat file 2012-06-09 19:48:18 +02:00
bm01
dfff0efc0b Cleanup 2012-06-09 19:29:44 +02:00
bm01
3732db2226 Reworked Party 2012-06-09 03:08:36 +02:00
bm01
e9ccdcfbbe Missing space! 2012-06-08 20:04:45 +02:00
bm01
01345a5dc4 Fixed /mcremove on existing PlayerProfile 2012-06-08 20:03:02 +02:00
bm01
90c8e57ed7 Reworked a little Users.java 2012-06-08 20:00:02 +02:00
GJ
d644b4c331 Fixed NPE with repairing items that rely on metadata. 2012-06-06 18:27:52 -04:00
GJ
2f15c71412 Because making it upper case broke all the things. 2012-06-06 18:02:22 -04:00
GJ
0a44a74f59 Cleanup (Yes, I'm that picky). 2012-06-06 16:49:42 -04:00
bm01
f876fe8d25 Made API classes 'statics' 2012-06-06 22:04:21 +02:00
GJ
290032646f Protect our hashmaps from bad people. 2012-06-06 15:38:44 -04:00
GJ
e5d2ed4bb2 Because lowercase class names are evil. 2012-06-06 14:49:07 -04:00
GJ
e9ea0e0389 Created a variable for player name. 2012-06-06 09:32:01 -04:00
bm01
35565bb021 Removed PlayerProfile save on User.removeUser, it's already done in RemoveProfileFromMemoryTask 2012-06-06 02:20:33 +02:00
bm01
56aff1d191 Replaced playerName fields in PlayerProfile and Users by the Player object 2012-06-06 02:03:27 +02:00
GJ
b8be1d1866 Fix the Javadocs 2012-06-05 11:05:51 -04:00
GJ
1d7d2cd52e Make it static. 2012-06-05 11:05:44 -04:00
GJ
71446a12af Static ALL the things! 2012-06-05 10:42:56 -04:00
GJ
ca6cafaebd Cleanup 2012-06-05 10:42:56 -04:00
GJ
c97be335ee Avoid using mcMMO.p when we can 2012-06-05 10:42:56 -04:00
GJ
fd1227b87e No need for public constructor 2012-06-05 10:42:56 -04:00
bm01
7ef72c501e Cleanup 2012-06-05 16:32:26 +02:00
GJ
f7ee96aa99 Fixed bug where admin chat was displayed to the whole server. 2012-06-05 10:19:23 -04:00
GJ
b84478898d Cleanup. 2012-06-05 10:18:05 -04:00
GJ
6afe0e8a34 Organize imports. 2012-06-05 10:13:10 -04:00
GJ
6e4f4b5c8d More cleanup. 2012-06-05 10:07:45 -04:00
bm01
f86fe4a138 Changelog update 2012-06-05 16:03:08 +02:00
bm01
63c663b8c1 Fixed Archery PVP/PVE enablement not being used properly 2012-06-05 16:00:32 +02:00
bm01
a1296596fa Fixed possible NPE when a projectile doesn't have a shooter 2012-06-05 16:00:27 +02:00
GJ
1cca4de9e5 Cleanup! 2012-06-05 09:57:10 -04:00
GJ
7ada587df3 More Spout tool stuff. 2012-06-04 10:36:24 -04:00
GJ
1e58c32a5f Change XP processing to use a single function. 2012-06-04 09:30:51 -04:00
GJ
2a27048174 Functions that start with capital letters are bad. 2012-06-04 09:08:41 -04:00
GJ
2b291954cf Javadocs. 2012-06-04 09:03:25 -04:00
GJ
8f8bfc62ca Cleanup. 2012-06-04 08:51:10 -04:00
GJ
38d4d448a9 Remove unused imports. 2012-06-04 08:46:12 -04:00
nossr50
d5d11ca4bd Whoops 2012-06-03 15:39:13 -07:00
nossr50
e3e400f376 This should make us AntiCheat friendly. 2012-06-03 14:38:33 -07:00
GJ
6637758ad0 Fixed Spout item checks. 2012-06-01 15:29:16 -04:00
GJ
41e9bd3cb5 WIP - Spout custom tool support 2012-05-31 16:02:11 -04:00
GJ
c2d1909379 Changelog update. 2012-05-31 16:00:20 -04:00
GJ
77688f297f Fixed a few permissions errors. 2012-05-31 15:23:38 -04:00
GJ
714f665cc7 Woodcutting to SkillCommand 2012-05-31 15:15:00 -04:00
GJ
ec138d5741 Unarmed to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
560e5aa19a Taming to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
ad162f3366 Swords to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
5d07830339 Repair to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
b310d25ee3 Cleanup. 2012-05-31 15:14:59 -04:00
GJ
443ccbd807 Mining to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
8cdecf80c7 Herbalism to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
a16d5435de Removed unneeded function call. 2012-05-31 15:14:59 -04:00
GJ
ec02422226 Fishing to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
cc5d438550 Excavation to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
806d116501 Axes to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
066c9d9fec Archery to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
5b3b9fbc30 Tweak the way SkillCommands are constructed. 2012-05-31 15:14:58 -04:00
GJ
d15e189b7c Acrobatics to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
1bd9974f89 Abstract Skill Commands 2012-05-31 15:14:58 -04:00
NuclearW
90296d87df Similarly return admin chat to ye olden method 2012-05-30 11:18:47 -04:00
NuclearW
75b287771a Return party chat to ye olden method 2012-05-30 11:18:46 -04:00
GJ
5765504796 Locale updates. 2012-05-30 11:11:07 -04:00
GJ
dda8c0c9e0 Fixed bug with Tree Feller changing durability too soon. 2012-05-30 10:48:25 -04:00
GJ
ce9d668602 Fixed bug with locale strings and party teleport. 2012-05-30 10:41:22 -04:00
NuclearW
39c2c5f25f Handle EOFException in Chunklets by returning a new empty ChunkletStore and printing an error. 2012-05-29 21:02:36 -04:00
nossr50
12a7d794b4 Always forget the changelog 2012-05-28 17:02:02 -04:00
nossr50
ff8b0300ae Make the MOTD prettier about the perks 2012-05-28 16:49:21 -04:00
NuclearW
f882df4cb7 Fix this yaml error 2012-05-28 16:43:06 -04:00
nossr50
e1300005cb Notify users of their perks on login (if MOTD enabled) 2012-05-28 13:14:10 -07:00
nossr50
e599ab9214 Added permissions that will grant users 4x 3x or 2x XP 2012-05-28 13:07:52 -07:00
GJ
92acf62884 More mod fixes for Woodcutting. 2012-05-27 14:40:35 -04:00
GJ
c2fb57fce9 Fix Tree Feller not working with custom axes 2012-05-27 14:31:37 -04:00
GJ
3699d26e5d Only try to back up the mod files if they exist... 2012-05-27 10:23:13 -04:00
GJ
6eb0159ea1 More tracking of falling sand/gravel. (WIP) 2012-05-27 10:21:00 -04:00
GJ
433913c77a Another fix for falling sand/gravel tracking issues. 2012-05-27 09:42:38 -04:00
bm01
d955feef61 Fixed piston tracking 2012-05-27 10:34:04 +02:00
GJ
5377b9b618 Remove debug messages. 2012-05-26 21:11:50 -04:00
GJ
5c9371c575 Fixed falling sand/gravel stuff not being tracked 2012-05-26 19:52:24 -04:00
GJ
23d916f191 Fixed dupe exploit with pistons (again). 2012-05-26 10:50:12 -04:00
GJ
35d4914518 This has to be Arrow to keep Potions from giving XP. 2012-05-24 15:26:01 -04:00
GJ
eb2ec71d2b More priority tweaks. 2012-05-24 14:17:51 -04:00
GJ
dc50758dc9 Minor priority tweaks to the Spout XP bar. 2012-05-24 14:02:23 -04:00
GJ
9775d71c28 Cleanup. 2012-05-24 10:35:46 -04:00
GJ
c40e4ee9ee Cleanup. 2012-05-24 10:30:07 -04:00
GJ
2b469c385c Changelog update 2012-05-24 08:39:13 -04:00
GJ
a104fe45aa Fix for NoCheatPlus fight.noswing checks 2012-05-24 08:38:44 -04:00
bm01
257df25a67 Fixed NPE, Config.defaulthud was used instead of SpoutConfig.defaulthud 2012-05-24 06:58:11 +02:00
bm01
2a977557c2 Made sure that SpoutConfig.load is called when the instance is created, for safety 2012-05-24 06:18:43 +02:00
bm01
d0e9f03311 Reverted last commit from NuclearW 2012-05-24 05:29:05 +02:00
bm01
97ca699170 Removed unneeded method override 2012-05-24 05:27:29 +02:00
NuclearW
702537e8fd We don't need this 2012-05-23 15:33:08 -04:00
NuclearW
83a3488d0d Because loading a config we hadn't made yet makes sense 2012-05-23 15:32:58 -04:00
GJ
450e938092 Change Spout Config file to only load if Spout is enabled.
Removed unused imports.
2012-05-23 14:31:03 -04:00
GJ
b88e076f27 Updates to config loading. 2012-05-23 13:52:33 -04:00
GJ
0fe90df01e Cleanup. 2012-05-23 11:16:23 -04:00
GJ
66ad909908 Cleanup. 2012-05-23 11:08:56 -04:00
GJ
77d74717d2 Moved all Spout checks into one listener. 2012-05-23 11:06:02 -04:00
GJ
63f683982f Moved Spout stuff to its own config file. 2012-05-23 10:50:47 -04:00
GJ
9525ce8299 Cleanup. 2012-05-23 09:35:16 -04:00
GJ
d7b8ec1274 Cleanup. 2012-05-23 07:33:19 -04:00
GJ
96cd16faf7 Cleanup 2012-05-23 07:32:03 -04:00
NuclearW
9ddc7501fe Derp 2012-05-22 09:16:40 -04:00
NuclearW
301c496fb2 Onward to 1.3.09 2012-05-22 08:45:21 -04:00
NuclearW
3eb265c5f7 1.3.08
Minor addition to changelog
2012-05-22 08:42:06 -04:00
GJ
049338e83b Remove unused variables & methods from old repair system 2012-05-22 08:37:32 -04:00
GJ
a336e9f460 Removed unused imports. 2012-05-22 08:31:32 -04:00
GJ
0294cf8c4a Implement new repairable stuff for custom tools/armor. 2012-05-22 08:21:05 -04:00
NuclearW
c5183309ae New line on the factory floor
For RepairableFactory
2012-05-22 08:10:22 -04:00
NuclearW
0a15cb1e13 Modify custom items loading to permit registering of repairables from these configs.
Move loading of the main repairables to below the custom items so that repair.*.yml will over-write any custom items when the list is processed and repairables registered.
2012-05-22 07:57:09 -04:00
nossr50
9546cc42b2 Redundant 2012-05-22 02:57:54 -07:00
NuclearW
ac01262655 Fix error in config 2012-05-22 05:46:40 -04:00
nossr50
6ea962c1fa Changing the MOTD again, modified a few messages. Now hardcore mode only
tells you about itself when motd is enabled.
2012-05-22 02:45:42 -07:00
nossr50
9e35283273 Changelog updates 2012-05-22 02:41:19 -07:00
NuclearW
9c8e1d9c9f Some changelog for @nossr50 2012-05-22 05:34:23 -04:00
NuclearW
7d324b3fd4 Changelog
and supercomment to default repair.vanilla.yml
2012-05-22 05:33:05 -04:00
NuclearW
badc5738ff Fix up repair command as best as possible given what it is... 2012-05-22 05:33:05 -04:00
NuclearW
8feaf4410f getRepairable by id 2012-05-22 05:33:04 -04:00
NuclearW
4e224d761e Cleanup Repair.java 2012-05-22 05:33:04 -04:00
NuclearW
e775abdc5a Remove all the old stuff from the config 2012-05-22 05:33:04 -04:00
NuclearW
60754c9380 Implement xp 2012-05-22 05:33:04 -04:00
NuclearW
c890ff5605 Use new system! 2012-05-22 05:33:04 -04:00
NuclearW
9f9c0059a5 Change xpHandler for new system usage
This commit marks the first breaking change for this new system
2012-05-22 05:33:03 -04:00
NuclearW
4eabd417b9 Level check 2012-05-22 05:33:03 -04:00
NuclearW
c218de9567 Change to new line in locale 2012-05-22 05:33:03 -04:00
NuclearW
4b5ca5ecf4 Logic fix 2012-05-22 05:33:02 -04:00
NuclearW
edbf46a751 Unused import 2012-05-22 05:33:02 -04:00
NuclearW
c9c90bb86a New line in locale 2012-05-22 05:33:02 -04:00
NuclearW
437a608d2b Return on this error 2012-05-22 05:33:01 -04:00
nossr50
b638eef1c6 Players are now informed about Hardcore mode when logging in 2012-05-22 02:31:01 -07:00
NuclearW
b7cec8a0c4 Most of handleRepair() done, level checking still needed
- Move Repair
- Change visibility of a few methods for repurposing Repair soon
2012-05-22 04:22:29 -04:00
NuclearW
28578bd6b0 Convenience method for RepairManager 2012-05-22 02:59:10 -04:00
nossr50
160004fa7e Hardcore mode now has some exploit prevention and much more information 2012-05-21 23:56:08 -07:00
nossr50
f4332761f9 Many changes to Hardcore / Vampirism 2012-05-21 23:30:16 -07:00
NuclearW
a4d1a18850 Example repair config for chainmail 2012-05-22 01:11:56 -04:00
NuclearW
c3e1e55e9c Fix for minimumQuantity default 2012-05-22 01:08:29 -04:00
NuclearW
e20bcd19b9 Make our RepairManager, load configs, and register them all 2012-05-22 00:57:24 -04:00
NuclearW
1fbf213ada Load message 2012-05-22 00:56:57 -04:00
NuclearW
c2d2359a8c RepairConfig loader
and small fix for RepairConfigManager
2012-05-22 00:56:14 -04:00
NuclearW
586a2a065e Shears 2012-05-22 00:00:02 -04:00
NuclearW
adf43b7e35 String 2012-05-22 00:00:02 -04:00
NuclearW
45a4cddeef Leather 2012-05-22 00:00:02 -04:00
NuclearW
69f62551c7 Your repair is now diamonds 2012-05-22 00:00:02 -04:00
NuclearW
f1bdf502be Gold
and fix for minQuantity on iron armor
2012-05-22 00:00:02 -04:00
NuclearW
e89b3795f8 Save vanilla from jar 2012-05-22 00:00:02 -04:00
NuclearW
20b169e8eb Typo 2012-05-22 00:00:01 -04:00
NuclearW
1480ee2779 Changelog 2012-05-22 00:00:01 -04:00
GJ
41c9741b72 Fixed exploit where you could gain tons of Acrobatics XP from spamming
Ender Pearls
2012-05-21 23:41:11 -04:00
GJ
f9e5096ceb Cleanup 2012-05-21 10:31:24 -04:00
NuclearW
a9b2a4940e Max_Ticks to Max_Seconds 2012-05-21 10:04:07 -04:00
GJ
f66c6ab8fc Cleanup 2012-05-21 09:33:21 -04:00
GJ
73902d5f92 Minor cleanup / refactoring 2012-05-21 09:21:26 -04:00
NuclearW
0bb5f9f297 Max ticks for abilities 2012-05-21 09:17:16 -04:00
GJ
16ad8502d2 Cleanup, changed order of some logic checks. 2012-05-21 09:04:51 -04:00
GJ
ad68e6057e More cleanup. 2012-05-21 08:45:33 -04:00
GJ
54b4faeeff Minor cleanup. 2012-05-21 08:39:27 -04:00
NuclearW
a7f69545f2 Emulate unbreaking properly 2012-05-21 08:31:29 -04:00
NuclearW
93ea558ec3 Cleanup 2012-05-21 08:27:26 -04:00
GJ
d0cdc208e3 Avoid a duplicate config call. 2012-05-21 07:53:52 -04:00
NuclearW
0d7c483bd5 Tameable not a part of combat checks at the moment, only wolves 2012-05-21 07:25:20 -04:00
NuclearW
3f211c6277 Generalize Wolf to Tameable
Also generalize Arrow to Projectile
For MCCORE-263
2012-05-21 04:44:48 -04:00
NuclearW
79e93edfef Switch order of sticky check and placeStore check.
sticky check is much less expensive than placeStore, so it's better to ensure that the piston is sticky before doing a placeStore check
2012-05-21 02:19:45 -04:00
Travis Ralston
44e8efda36 Check for sticky pistons 2012-05-19 08:00:34 -06:00
NuclearW
9726ac6f12 Send metrics information on if this server uses timings 2012-05-19 00:42:50 -04:00
NuclearW
898d8c6449 Changelog 2012-05-18 22:09:28 -04:00
NuclearW
01006ed76d Hidden config and use of NullChunkletManager
ChunkletManagerFactory now produces NullChunkletManagers if Chunklets are disabeld in the hidden.yml
2012-05-18 22:01:15 -04:00
NuclearW
2936823d03 NullChunkletManager 2012-05-18 21:44:25 -04:00
GJ
7d05d53f9e Whoops. Can't initialize something that doesn't exist. 2012-05-18 14:40:48 -04:00
GJ
f3074461ed More cleanup. 2012-05-18 14:29:53 -04:00
GJ
146f832919 Minor refactoring & cleanup. 2012-05-18 13:40:21 -04:00
GJ
a622707608 Cleanup & Silk Touch changes. 2012-05-18 11:15:30 -04:00
NuclearW
6da43b15c8 Move to a more ideal location.
Not as efficient as I would like, but certainly better than it was before
2012-05-18 03:14:19 -04:00
NuclearW
d0bb7b075e This was a bad idea 2012-05-18 03:12:40 -04:00
NuclearW
c1ecd74644 Actually remove from map on unload 2012-05-18 03:12:16 -04:00
NuclearW
a1aada0777 Iron armor 2012-05-17 23:53:25 -04:00
NuclearW
c55a8eeccd Iron tools 2012-05-17 23:40:34 -04:00
NuclearW
73cc8adcab Beginnings of repair.vanilla.yml 2012-05-17 23:16:59 -04:00
NuclearW
7bb05f7f26 Update version for development
towards a stronger nation defense system
2012-05-17 22:41:40 -04:00
NuclearW
7f0803c3f6 Add in xpMultiplier 2012-05-17 22:40:46 -04:00
NuclearW
1185ea4f96 Beginnings of RepairConfig 2012-05-17 22:40:46 -04:00
NuclearW
43db51a664 RepairConfigManager 2012-05-17 22:40:46 -04:00
GJ
d35cdc91f8 Think it's finally right... 2012-05-17 22:24:45 -04:00
GJ
8d643277c0 Locale update. 2012-05-17 22:22:53 -04:00
GJ
5be1858b45 Stupid file... 2012-05-17 22:20:25 -04:00
GJ
13d6e16630 Stupid file... 2012-05-17 22:18:44 -04:00
GJ
dcb1cbbdb7 Locale update. 2012-05-17 22:11:16 -04:00
nossr50
f7f077be3e Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-05-17 19:00:14 -07:00
nossr50
3d79416520 Getting ready for promotions in this good economy 2012-05-17 18:59:51 -07:00
GJ
c559e70270 Mod support - able to define tiers for custom blocks now.
Tier 1 - breaks with wood/gold
Tier 2 - breaks with stone
Tier 3 - breaks with iron
Tier 4 - breaks with diamond
2012-05-17 21:57:41 -04:00
GJ
efcc15d89d Custom blocks should now work right with Super Breaker. 2012-05-17 21:37:14 -04:00
GJ
d17fe6bb7a Mod Support - Item Tiers.
1 is Wood, 2 is Stone, 3 is Iron, 4 is Diamond.
2012-05-17 21:19:17 -04:00
NuclearW
01235ff398 isInJar 2012-05-17 21:02:26 -04:00
NuclearW
3d6e490505 Expunge this line 2012-05-17 20:49:43 -04:00
NuclearW
bd3491d210 Registration 2012-05-17 20:01:37 -04:00
NuclearW
d139146e0b Too much space 2012-05-17 19:57:56 -04:00
GJ
b36da06fad Mod Support - Custom blocks now allow for the setting of how many items
they drop when broken.
2012-05-17 17:21:59 -04:00
GJ
d20c5e1773 Mod Support - Woodcutting now works. Still need to add # of drops from a
given block.
2012-05-17 17:03:56 -04:00
GJ
0afc0d59a4 Config refactoring. 2012-05-17 10:26:21 -04:00
NuclearW
26481c547a Beginnings of RepairManager implementation
Plus more factories for a stronger economy
2012-05-17 09:43:42 -04:00
NuclearW
45fe8c182b Put new permissions to good use 2012-05-17 09:43:42 -04:00
NuclearW
c25ddd0dbc <GJ> MOAR PERMISSIONS! 2012-05-17 09:43:42 -04:00
NuclearW
efc9a10fdf Make use of enum 2012-05-17 09:43:42 -04:00
NuclearW
a8eb9dfedf <GJ> All hail the enum! 2012-05-17 09:43:42 -04:00
NuclearW
87cf5cb932 Add metadata value for repair material 2012-05-17 09:43:41 -04:00
GJ
e1ca2c0b98 Mod support - Fixed blocks config not loading or generating. 2012-05-17 08:33:50 -04:00
NuclearW
a9295751c8 Beginnings of RepairManager interface
Not sure yet exactly what to leave in Repair and what to have in the Manager implementation.

I'm fairly sure that the xpHandler should be in Repair, but that's private at the moment so usage from the Manager is impossible except with public modifier, which is unacceptable.

Considering moving Repair to the new repair package, perhaps eventually all skills will have packages and skills.  Moving it seems like the logical solution with protected modifier.
2012-05-17 04:32:14 -04:00
NuclearW
2a46a5c00a Remove boost from the repair xpHandler
Replace old false values with doubles which will produce identical results

While the boost value will remain confusing in configs later, it will now at least be easier.
2012-05-17 04:28:31 -04:00
NuclearW
d3b7af3c5f Beginnings of the repairable 2012-05-17 04:01:47 -04:00
NuclearW
db59f24873 Cleanup 2012-05-17 03:57:16 -04:00
GJ
5645bf7982 Mod support - XP gain & double drops should now work for custom blocks
EXCEPT Woodcutting. Custom excavation blocks will also never drop
treasures.
2012-05-17 00:24:33 -04:00
GJ
6cbf87b52c Fixed custom tools & armor not being repairable. 2012-05-16 15:48:52 -04:00
GJ
bc642deebd Custom armor can now be repaired. 2012-05-15 16:12:59 -04:00
GJ
e84a9643f8 Enchanted custom tools should now support Arcane Forging. 2012-05-15 14:39:39 -04:00
GJ
e9af0ebdc5 Custom tools - modify XP gain from breaking blocks on a per tool basis. 2012-05-15 14:21:21 -04:00
GJ
29ee8a035b Custom tools - should now support enabling/disabling ability activation
per tool.
2012-05-15 13:44:39 -04:00
GJ
81ac4e8d01 WIP on custom mod support - should now be able to repair custom tools at
an anvil.
2012-05-15 10:44:57 -04:00
NuclearW
ecc68d373f Typo fix in Acrobatics guide 2012-05-15 04:06:05 -04:00
NuclearW
3032572f18 New factories means more jobs for a better economy 2012-05-15 01:43:34 -04:00
NuclearW
bcee6abb65 Re-add call to updateInventory 2012-05-15 00:49:19 -04:00
nossr50
7e0b8ddf50 HudType will default to 'STANDARD' for MySQL DB - only good for new users 2012-05-14 15:13:55 -07:00
NuclearW
91dcb508b3 POOT DONATION HERE 2012-05-14 17:52:07 -04:00
GJ
d549e2722d Removed unused import. 2012-05-14 10:48:46 -04:00
nossr50
3bb29c8308 mcMMO's motd now links to the new website rather than the wiki 2012-05-13 19:00:49 -07:00
nossr50
0121228d88 Update README.creole 2012-05-13 15:30:09 -07:00
bm01
cbafa7110a Fixed minor Green Terra bugs on Stone Brick 2012-05-10 15:54:29 +02:00
bm01
06791beabd Fixed double Config instantiation causing NPE on PlayerProfile.save() 2012-05-09 15:58:11 +02:00
bm01
68b9857409 Fixed /<skill> command being processed twice when an alias was used 2012-05-09 13:06:40 +02:00
bm01
112a0df8c2 Minor locale fix 2012-05-09 12:10:59 +02:00
bm01
73717278ff Fixed /party not showing properly the member list 2012-05-09 11:38:22 +02:00
bm01
5fa79926db Fixed arrow boucing off entities on daze proc 2012-05-08 21:58:01 +02:00
bm01
06f97ac2f1 Fixed a bug where a player could gain Acrobatics exp while riding a cart 2012-05-08 20:20:23 +02:00
bm01
c2b4961b8d Removed exp gain when an arrow strikes its shooter 2012-05-08 20:12:41 +02:00
bm01
9b3838b912 Improved attacker and defender's party check 2012-05-08 19:42:26 +02:00
bm01
946ea19371 Fixed bad /party fix :( 2012-05-08 06:58:50 +02:00
NuclearW
419e011d0b Changelog for last commit 2012-05-07 22:50:24 -04:00
NuclearW
b0157c9bd2 Replace Bukkit Metadata for user placed blocks 2012-05-07 22:38:22 -04:00
nossr50
37d146e8fa Fixed various NPE errors when loading up mcMMO 2012-05-06 14:51:25 -07:00
bm01
063d982750 Fixed the fix! 2012-05-06 11:05:51 +02:00
bm01
fbfeaa0f95 Fixed /party not working properly with 2 arguments 2012-05-06 11:02:08 +02:00
bm01
9b11b02658 Minor locale fix 2012-05-06 09:55:15 +02:00
bm01
3e435c419a Refixed NPE due to GainXp task 2012-05-06 09:47:25 +02:00
GJ
1b37ba8daa Fixed a few issues from the merge, added the mod directory to the zip
backup.
2012-05-05 13:51:54 -04:00
nossr50
b529219a0e Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	src/main/java/com/gmail/nossr50/mcMMO.java
2012-05-05 10:20:26 -07:00
nossr50
d9b3eff18f Changed how a few variables were initialized 2012-05-05 10:16:41 -07:00
GJ
cb5ada6ec9 Fix for config files not being created at startup. 2012-05-05 13:02:55 -04:00
bm01
baf7ffd441 Fixed french locale string causing IAE on repair skillup 2012-05-04 20:17:17 +02:00
GJ
2b4ca80a95 Start of work on allowing custom tool/block mods. This version should
allow for XP gain from vanilla blocks with custom tools. Please report
any issues to facilitate further development.
2012-05-04 14:04:42 -04:00
bm01
b5963936fd Fixed /ability not checking the right permission 2012-05-04 19:42:00 +02:00
bm01
354ed9ede0 Fixed NPE on /party 2012-05-04 11:04:05 +02:00
bm01
7ad9b8ff3e Changed Arrow Retrieval to drop arrows individually 2012-05-04 10:27:49 +02:00
bm01
6dc522a044 Fixed Arrow Retrieval dropping only one arrow 2012-05-03 16:45:30 +02:00
GJ
3e91bc8c1e Can now enable/disable specific skills for PVP & PVE 2012-05-03 10:39:32 -04:00
nossr50
3218c544dc Added level curve modifier 2012-05-02 06:10:32 -07:00
GJ
1ae11da036 Start of work on allowing Combat skills to be enabled for just PVP or
PVE
2012-05-01 22:42:45 -04:00
bm01
84e36d758e Fixed /p and /a incompatibilities with bChatManager 2012-05-02 00:55:43 +02:00
bm01
06ede80435 Fixed Iron Grip working reversely 2012-05-01 23:51:49 +02:00
bm01
dbc57060ee Reduced bleeding ticks damage 2012-05-01 23:49:11 +02:00
GJ
798bd46d0a Command updates - Repair (Finally done!) 2012-05-01 16:29:52 -04:00
GJ
c95f388d8d Allow for checking if ALL double drops are disabled via config. 2012-05-01 15:56:09 -04:00
GJ
a9024ebc6b Fixed bug with getting NO logs from Tree Feller if double drops were
disabled in the config file.
2012-05-01 15:25:28 -04:00
GJ
33bc2d8a6b Command updates - Woodcutting & Unarmed 2012-05-01 15:15:30 -04:00
GJ
cc60f2f308 Command update - Swords 2012-05-01 14:28:20 -04:00
GJ
edaa51593b Skills refactoring 2012-05-01 13:58:47 -04:00
GJ
e2265dd6f7 Updates to repair command, minor permission node & config updates 2012-05-01 13:53:00 -04:00
nossr50
e1cf89c3bf Vamprirism updates. 2012-05-01 09:04:29 -07:00
nossr50
8cd1541893 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-05-01 08:48:10 -07:00
nossr50
9d510815b4 Vampirism for hardcore mode, needs testing. 2012-05-01 08:47:57 -07:00
GJ
44d22d93da Command update - Mining. Also fixed typo on new Herbalism permission. 2012-05-01 10:39:50 -04:00
nossr50
f7405a82e6 Fixed NPE when user clicks the HUD button for Spout 2012-05-01 06:30:57 -07:00
GJ
04f3e44c3a Command updates - Herbalism 2012-05-01 09:11:56 -04:00
GJ
6cc207a10c Fixed bug with Chimera Wing failing when used on half-blocks - Fixes
MCCORE-221

Also added treasures.yml to the zip backup.
2012-05-01 08:28:54 -04:00
GJ
6b5e615a23 Tabs are bad and we should feel bad for having them. 2012-05-01 07:54:37 -04:00
Grant
46268a7cf3 Merge pull request #202 from shatteredbeam/master
Zip automation running in SQL mode Fix
2012-05-01 04:41:09 -07:00
bm01
3682fbf531 Reverted last commit 2012-05-01 10:51:17 +02:00
bm01
0928b54d90 Actually fixed Hardcore 2012-05-01 10:49:36 +02:00
bm01
5a10339adc Fixed Hardcore mode always enabled 2012-05-01 10:43:04 +02:00
Shatteredbeam
7c412cbec8 Fix for zip backup running in SQL mode. 2012-05-01 00:07:17 -07:00
bm01
d235ca8ed8 Fixed SQLReconnect not working 2012-05-01 07:53:03 +02:00
GJ
97511be64a One more tweak. 2012-05-01 01:43:00 -04:00
GJ
3bd5aaa251 Importing by * is a bad idea. 2012-05-01 01:40:47 -04:00
GJ
ae2d9d8387 Locale update. 2012-05-01 01:33:42 -04:00
GJ
33c9694d26 Changelog update & the removal of a useless p 2012-05-01 01:25:13 -04:00
GJ
dbede7f81a Added config options for specific double drops. Implements MCCORE-226 2012-05-01 01:14:32 -04:00
bm01
c8ad2bb454 Added bm01 to authors :3 2012-05-01 01:34:21 +02:00
bm01
18c52a5e23 Cleanup 2012-05-01 01:32:50 +02:00
bm01
ca1954ff80 Merge pull request #201 from shatteredbeam/master
Zip Handling PR -
2012-04-30 16:08:13 -07:00
shatteredbeam
5a3574734c Added automatic backup of datafiles. 2012-04-30 15:48:59 -07:00
nossr50
5c6d10b2db Mining now completely ignore Silk Touch enchanted picks 2012-04-30 09:30:07 -07:00
nossr50
7e96ced4c4 Shortened the hardcore mode message 2012-04-30 07:19:13 -07:00
nossr50
8da259cabc Updated perm node behaviour and changelog 2012-04-30 07:17:10 -07:00
nossr50
f978d739bb Updates 2012-04-30 07:11:03 -07:00
nossr50
7b2d50e93e *Actually* fixing the Maths 2012-04-30 07:05:11 -07:00
nossr50
8bec50663f Fixing some Maths 2012-04-30 07:01:00 -07:00
nossr50
f4f5063efe Always forgot to update the changelog 2012-04-30 06:45:56 -07:00
nossr50
11782ac34d Bah, don't know why this got deleted. 2012-04-30 06:44:56 -07:00
nossr50
bfec3fff36 Forgot to register events for the new listener 2012-04-30 06:43:12 -07:00
nossr50
d8c0a56577 Added basic hardcore mode functionality, needs testing. 2012-04-30 06:41:58 -07:00
nossr50
ff1326a44f Revert "Added basic functionality of Hardcore Mode, needs testing..."
This reverts commit 1fa4fccbcc.
2012-04-30 06:41:09 -07:00
nossr50
1fa4fccbcc Added basic functionality of Hardcore Mode, needs testing... 2012-04-30 06:39:30 -07:00
nossr50
323b41fd58 Adding in config nodes for Hardcore Mode (WIP) 2012-04-30 06:21:14 -07:00
GJ
3d2b881b0e Command cleanup - Fishing. Added 2 new fishing permissions nodes. 2012-04-30 08:26:37 -04:00
GJ
def41af469 Command update - Excavation 2012-04-30 07:51:02 -04:00
GJ
4750aba763 Added permissions node for Greater Impact, cleanup of Axes command 2012-04-30 07:46:08 -04:00
GJ
5a9249dee1 Locale file update. 2012-04-29 23:05:57 -04:00
GJ
064fc0a8e2 Command format & permission changes, other minor cleanup. 2012-04-29 22:58:54 -04:00
bm01
67de70432c Fixed /party displaying twice the leader 2012-04-30 03:10:33 +02:00
bm01
facd71bd71 Minor locale things 2012-04-30 03:09:05 +02:00
nossr50
96e6270520 Changed MySQL to not save everything at once 2012-04-29 12:02:24 -07:00
nossr50
51c45e86ce Fixing formatting 2012-04-29 08:11:03 -07:00
nossr50
445214f0b5 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-04-28 20:22:37 -07:00
nossr50
859d4f5372 Fixed Green Thumb consuming 2 seeds instead of 1 2012-04-28 20:22:17 -07:00
bm01
0541280b20 Merge branch 'master' of git://github.com/mcMMO-Dev/mcMMO 2012-04-29 04:59:38 +02:00
bm01
ec7ced9fd3 Fixed Tree Feller changing damage value for any item 2012-04-29 04:59:03 +02:00
nossr50
4840b435f5 Updated wiki URL 2012-04-28 19:45:50 -07:00
nossr50
3acee3a686 Getting ready for promotion 2012-04-28 19:39:13 -07:00
nossr50
d849a249c2 Hows this look bm01? :D 2012-04-28 19:22:30 -07:00
bm01
38656eca72 Minor locale fixes 2012-04-29 02:12:40 +02:00
bm01
9b438d0caa Fixed Blast Mining not giving triple drop when it should 2012-04-29 01:59:56 +02:00
bm01
f30debd1b3 Updated changelog to better reflect last commit 2012-04-29 00:48:17 +02:00
bm01
d32b32842a Fixed double explosion for Blast Mining, added isSneaking requirement 2012-04-29 00:42:21 +02:00
bm01
2fad8f2ad7 Fixed undesirable FlatFileStuff access with MySQL enabled 2012-04-28 11:40:23 +02:00
bm01
7d17bd7dd1 Fixed Config NPE, made LoadTreasures singleton for consistency 2012-04-28 09:26:33 +02:00
nossr50
357eded2c3 Prevent HUDType from ever being null when loading config 2012-04-27 23:39:36 -07:00
nossr50
f7532cf5b4 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2012-04-27 23:38:34 -07:00
nossr50
bd7203dd9c Making HUD a bit more friendly 2012-04-27 23:38:16 -07:00
bm01
9e98351923 Capped bleeding ticks for monsters, moved players bleeding to BleedTimer 2012-04-28 07:33:57 +02:00
GJ
b46997bc1a Let's hope this fixes those NPEs... 2012-04-27 10:54:51 -04:00
GJ
477d698eac Little more whitespace stuff. 2012-04-27 10:39:08 -04:00
GJ
96ab3d1c7e Merge remote branch 'origin/master' 2012-04-27 10:07:04 -04:00
GJ
0dd41ab18a Little bit of whitespace cleanup. 2012-04-27 10:00:29 -04:00
nossr50
47b7780c96 Refactor ALL THE THINGS! 2012-04-27 02:47:11 -07:00
nossr50
ac35f002f1 *Actually* fixed exploit with PTP on yourself 2012-04-27 02:25:23 -07:00
nossr50
8dec24693c Possible fix for NPE on save 2012-04-27 02:21:43 -07:00
GJ
e3803702c5 Fixed exploit where you could teleport to yourself... 2012-04-27 02:21:31 -04:00
bm01
b9c8fed01f Made Party.isInParty safer 2012-04-27 08:17:02 +02:00
bm01
e97fec802c Fixed /party command not allowing party creation 2012-04-27 07:21:01 +02:00
bm01
0234b0f6ce Fixed Party class not being a real singleton 2012-04-27 07:12:49 +02:00
nossr50
4fa3708c2f Well this should fix the issues with config, but I hate it. 2012-04-26 20:58:21 -07:00
nossr50
bede658d94 Fixing file not found exception for FlatFile leaderboards 2012-04-26 19:36:28 -07:00
nossr50
6f85e4506b Updated changelog, maybe we promote this build? 2012-04-26 18:46:04 -07:00
nossr50
9d21aa36de Now using the latest version of Metrics to stop a NPE 2012-04-26 18:41:30 -07:00
nossr50
3c02286a08 Modifying pom.xml to prepare for release 2012-04-26 18:31:38 -07:00
nossr50
6f2a2fd9e6 Fix file not found exception and bm01 being spaced oddly in mcmmo command 2012-04-26 18:25:43 -07:00
nossr50
22169c64db NPE fix 2012-04-26 12:18:43 -07:00
nossr50
b8e128e0a9 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
Conflicts:
	src/main/java/com/gmail/nossr50/locale/mcLocale.java
2012-04-26 11:54:45 -07:00
nossr50
2729b37b76 Config overhaul is DONE! 2012-04-26 11:53:21 -07:00
bm01
0a5b0eb6d5 Minor locale fixes 2012-04-26 20:09:04 +02:00
nossr50
295b7a0701 Config overhaul part 7 2012-04-26 11:03:11 -07:00
nossr50
fea3bd6aa4 Refactor all the listeners! 2012-04-26 10:42:09 -07:00
nossr50
05724ae64f Config overhaul part 6 2012-04-26 10:34:02 -07:00
nossr50
8d7afe4f46 Removed the unfinished 'per-level tools' config information. 2012-04-26 10:24:11 -07:00
nossr50
77c716bd6c Config overhaul part 5 2012-04-26 10:18:25 -07:00
nossr50
f6c5aa9f84 Config overhaul part 4 2012-04-26 10:10:49 -07:00
nossr50
945e5ca11c Config overhaul part 3 2012-04-26 07:55:38 -07:00
nossr50
2f58e593e5 Config overhaul part 2 2012-04-26 07:41:00 -07:00
nossr50
32fad08ef5 Sigh, GIT why you so.. forgetful 2012-04-26 07:32:38 -07:00
nossr50
9606dd3501 Part 1 of refactoring/config overhaul 2012-04-26 07:27:57 -07:00
GJ
f09b055872 Last one for a while, I swear. 2012-04-25 22:45:02 -04:00
GJ
4433da1e4a Another minor locale fix. 2012-04-25 22:38:10 -04:00
GJ
e3f02d02a2 Few minor locale fixes. 2012-04-25 22:29:11 -04:00
GJ
a4ff2c7701 Added bypass nodes for offline inspecting & long-distance inspecting.
Also fixed some JavaDoc typos.
2012-04-25 22:07:08 -04:00
bm01
de510129bc Merge branch 'master' of git://github.com/mcMMO-Dev/mcMMO 2012-04-26 03:58:10 +02:00
bm01
ed171e5761 Fixed some locale stuff 2012-04-26 03:57:10 +02:00
GJ
747d8a6031 Moved our SQL Reconnect task into its own class. 2012-04-25 21:21:50 -04:00
bm01
36a5039c12 Fixed NPE at startup 2012-04-26 00:54:08 +02:00
GJ
ac075c5bae The last of the locale stuff. If your locale file no longer is
translated, please help us re-translate it at getlocalization.com/mcMMO
2012-04-25 16:14:44 -04:00
GJ
e650c2f534 Perm checks for abilities display - Acrobatics. 2012-04-25 11:40:37 -04:00
GJ
48b3998443 Even more locale & command updates. 2012-04-25 11:06:55 -04:00
GJ
ef17da48c7 More locale updates. 2012-04-24 09:21:21 -04:00
GJ
c97fff320b Merge branch 'master' into locale. 2012-04-23 22:29:24 -04:00
GJ
255954dd56 Almost done with command updates. 2012-04-23 18:05:30 -04:00
GJ
3c748bca39 More updates. ALMOST DONE. 2012-04-22 20:00:31 -04:00
GJ
c18b3e9114 Command & locale updates. 2012-04-22 19:34:34 -04:00
GJ
66b4388e64 More locale, command, and Party updates. 2012-04-22 15:36:48 -04:00
Grant
116adb1167 Merge pull request #198 from SeeD419/master
Added ability to repair fishing rods (fixed)
2012-04-22 10:24:52 -07:00
Blake Bartenbach
3db83db5d2 Added ability to repair Fishing Rods 2012-04-22 10:34:27 -05:00
GJ
efc63b5230 Cleanup, locale, & party improvements. 2012-04-22 02:55:58 -04:00
GJ
c45cd56c78 Making our file path strings more user friendly. 2012-04-21 14:05:39 -04:00
GJ
f94a617d94 Cleanup & refactoring, part 1. 2012-04-20 18:09:50 -04:00
GJ
153ecf4d13 Cleanup of /mctop, bug fixing, and locale. 2012-04-20 14:01:21 -04:00
nossr50
825bc87ca3 Merge pull request #196 from bm01/master
Added natural Iron Golems to exp table
2012-04-20 07:33:03 -07:00
bm01
d1b652b013 Added natural Iron Golems to exp table 2012-04-20 15:29:12 +02:00
GJ
46d7212d1b Even more locale. 2012-04-20 00:03:03 -04:00
GJ
ea350c30c8 Merge branch 'master' into locale 2012-04-19 23:32:32 -04:00
nossr50
45871aa1c8 Fixing a typo in mcremove 2012-04-19 18:54:20 -07:00
nossr50
d3dedca4a8 mcremove is smarter about dealing with MySQL now 2012-04-19 18:53:03 -07:00
GJ
1177263c8f Merge branch 'master' into locale. 2012-04-19 18:12:36 -04:00
GJ
a82b63e88b Changelog update. 2012-04-19 17:23:24 -04:00
GJ
2f66c93bfd Made /mcrefresh work for offline users & from console. 2012-04-19 17:21:55 -04:00
GJ
6991fa4907 Locale, part 3 2012-04-19 13:42:12 -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
fcdf538368 Locale, part 2 2012-04-11 16:34:54 -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
242 changed files with 28644 additions and 17723 deletions

View File

@@ -6,7 +6,182 @@ Key:
= Fix
! Change
- Removal
Version 1.3.09
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
+ Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP)
+ Added reduced cooldown permission nodes as special perks (1/4, 1/3, 1/2 cooldown)
+ Added increased activation time permissions nodes as special perks (+4, +8, and +12 seconds)
+ Added API for plugins to add custom tools directly via Spout - repair / abilities do not work ATM
+ Added offline party members to the list displayed by /party
+ Added possibility to kick offline members from parties
= Fixed bug that would cause a NPE for players that had no parties
= Fixed Vampirism not notifying the correct amount of stolen levels
= Fixed bug with Acrobatics not saving you from deadly falls
= Fixed /mcremove being applied only after a reload
= Fixed Archery PVE disablement not working properly
= Fixed possible NPE when a projectile is shot by a dispenser or doesn't have any shooter
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)
= Fixed tiny memory leak concerning Archery
= Fixed bug where you could receive Archery XP from Potions
= Fixed bug where Chunklets for the < 64 y coordinates would not be properly loaded
= Fixed exploit with block duplication via piston pushing
= Fixed bug with falling sand/gravel not being tracked
= Fixed bug with Tree Feller not working with custom axes
= Fixed bug with locale strings when trying to teleport to a non-existent player
= Fixed bug with Tree Feller changing durability before checking for axe splintering
= Fixed bug with Repair Mastery permission due to typo
= Fixed bug with repairing items that use metadata
= Fixed bug with Chunklets not being reloaded on /reload
= Fixed possible NPE when falling with no item in hand
! API methods can now only be used in a static way
! Arrows shot from a bow having the Infinity enchantment can no longer be retrieved
! Arrows that aren't shot by an entity are now able to be dodged (currently only from dispensers)
! Changed Spout settings to be in their own config file (spout.yml)
! Changed file format for parties (parties.yml), previous files are no longer used
! Changed mcMMO to inform on corrupt Chunklets and make new ones
Version 1.3.08
+ Added more notifications about Vampirism and Hardcore mode on player death
+ Added information about Hardcore mode when joining a server running Hardcore mode
+ Added new hidden.yml inside the jar for very sensitive config options for advanced users
+ Added option to disable Chunklets for servers which do not have doubledrops and do not care about xp farming
+ Added new "Max_Seconds" setting in config.yml to limit the max time of abilities
+ Added new repair configs to allow customization of the repair skill
+ Added message to inform users about hardcore mode on login
= Fixed exploit where you could gain tons of Acrobatics XP from spamming Ender Pearls
= Fixed normal pistons marking a block as user-placed on retract if it wasn't a sticky piston (thanks turt2live!)
= Fixed handling of the Unbreaking enchantment so that tools are actually damaged as they should now
= Fixed hurting pet cats with serrated strikes
! Changed Hardcore Vampirism to require the victim to have at least half the skill level of the killer in order for vampirism to proc (this is to avoid exploitation)
! Changed Hardcore Vampirism to steal a minimum of 1 skill level from a player no matter the percentage
! Changed Hardcore & Vampirism to not be executed if percentages were set to zero or below
! Changed Vampirism to actually remove stats from the victim
! Changed Vampirism to inform the victim of their stat loss
! Changed Mining to allow Silk Touch to work again since the dupe exploit has been fixed.
! Changed Metrics to also report if the server uses plugin profiling
- Removed level and item settings from Repair skill in config.yml
Version 1.3.07
+ Added ability to gain XP from custom blocks. Enable custom blocks in the config file, then enter the data in the blocks.yml file.
+ Added ability to gain XP with custom tools. Enable custom tools in the config file, then enter the data in the tools.yml file.
+ Added ability to repair custom tools. Enable custom tools in the config file, then enter the data in the tools.yml file.
+ Added ability to repair custom armor. Enable custom armor in the config file, then enter the data in the armor.yml file.
+ Added functionality which makes a new folder in all world files "mcmmo_data" to store player placed block information in
+ Added new configurable Hardcore mode functionality to mcMMO
+ Added new configurable Vampirism PVP stat leech for Hardcore mode
+ Added new bypass permission node for the negative penalties of Hardcore mode 'mcmmo.bypass.hardcoremode'
+ Added configurable level curve multiplier which allows for tweaking the steepness of the XP needed to level formula
+ Added a permission node for Archery bonus damage
+ Added a permission node for Greater Impact ability
+ Added permission nodes for Treasure & Magic Hunter for Fishing
+ Added a permission node for Farmer's Diet
+ Added config options for enabling/disabling specific double drops
+ Added automatic zip backup of flatfile database & config files
+ Added config options to enable/disable specific skills for PVP & PVE
= Fixed bug where Tree Feller was looking at the wrong blocks for determining how much to take down.
= Fixed bug where Green Terra consumed seeds even on Mossy Stone Brick
= Fixed bug where the client didn't reflect the Stone Brick to Mossy Stone Brick change
= Fixed bug where an arrow could bounce off entities on daze proc
= Fixed bug where a player could gain Acrobatics experience while riding a cart
= Fixed /party not working properly with 2 arguments
= Fixed /party not showing properly the member list
= Fixed /ability not checking the right permission
= Fixed rare NPE on /party command
= Fixed Arrow Retrieval dropping only one arrow
= Fixed /p and /a incompatibilities with bChatManager
= Fixed Iron Grip working reversely
= Fixed NPE when user clicked the HUD button with Spout
= Fixed bug where the permission node for Impact didn't work
= Fixed some bypass nodes defaulting true for Ops
= Fixed bug with trying to use Chimera Wing while standing on a half-block
= Fixed duplication bug when a placed block was mined after a server restart
= Fixed exploit where shooting yourself with an arrow gave Archery XP
! Changed the mcMMO motd to link to the new website rather than the wiki
! Changed bleeding ticks damage to 1 from 2
! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch
! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick
! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server
! Changed the permission node for Blast Mining detonation to mcmmo.ability.blastmining.detonate (was mcmmo.skills.blastmining) for the sake of consistency
! Changed skill commands to only display what you have permissions for
! Changed mcMMO to use a new storage system for player placed blocks
- Removed some unused permission nodes
- Removed a few config options in favor of permissions nodes (Hunger Bonus, Armor/Tool Repair, Instant Wheat Regrowth)
- Removed level requirement for repairing string tools from the config file
Version 1.3.06
+ Added Iron Golem XP for aggressive golems
+ 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.
+ Added some new languages to the locale files.
= Fixed Green Thumb consuming 2 seeds instead of 1
= Fixed exploit where you could teleport to yourself with PTP to prevent things like fall damage
= Fixed NPE error with Metrics on startup
= 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.
= Fixed bugs with the way /mctop displayed
= Fixed issues with custom characters & locale files.
= Fixed double explosion for Blast Mining
= Fixed Blast Mining not giving triple drops when it should
! Changed Bleeding to now stack to a finite number on Monsters and will wear off eventually
! Changed how we handled the config file to prevent any bugs when returning values
! Changed locale files to use a new naming scheme. This breaks ALL old locale files. If you want to assist with re-translating anything, go to getlocalization.com/mcMMO
! Changed /mcremove to check for users in the MySQL DB before sending queries to remove them
! 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 /mcrefresh to work from console
! Changed /mcrefresh to work for offline players
! Changed UpdateXPBar function to hopefully avoid errors
! Changed /party to show offline party members
! Changed Blast Mining requirements, now asks for the player to be crouching
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

View File

@@ -1,6 +1,9 @@
== mcMMO
**The RPG lovers mod**
=== Forums
http://forums.mcmmo.info Talk with developers and the community about mcMMO here
=== Brief Description
mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.

73
extras/repair.chain.yml Normal file
View File

@@ -0,0 +1,73 @@
#
# Any file named repair.*.yml in the mcmmmo folder will be loaded as a repair config
# All repair configs have a main section titled "Repairables"
# Afterwards, all sub-items are considered a Repairable to be loaded
# The bare minimum of a Repairable is that it have an ItemId, a RepairMaterialId, and a MaximumDurability
#
# ItemId: This is the id of the item to be repairable.
## This is required to be set.
#
# ItemType: This is the type of item to be repaired, this is only important to permissions.
## Valid values are ARMOR, TOOL, and OTHER.
## This defaults to OTHER.
#
# MaterialType: This is the type of the material of the item to be repaired, this is only important for permissions.
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
## This defaults to OTHER.
#
# RepairMaterialId: This is the id of the item used to repair this repairable.
## This is required to be set.
#
# RepairMaterialMetadata: This is the metadata of the item used to repair this repairable.
## A value of -1 means to ignore all metadata when repairing.
## This defaults to -1
#
# MaximumDurability: This is the maximum durability of the item.
## This is required to be set.
#
# MinimumLevel: This is the minimum repair level needed to repair this item.
## Valid values are > 0
## This defaults to 0
#
# MinimumQuantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses.
## This is typically the number of the repair material needed to create a new item, for example for a sword it is 2, for an axe it is 3
## This defaults to 2
#
# XpMultiplier: This is the amount to multiply the xp bonus by.
## This defaults to 1
#
#
# The following is an example of a repair.*.yml config which adds the ability to repair Chainmail armor using fire.
#
#
###
Repairables:
ChainHelmet:
ItemId: 302
ItemType: ARMOR
RepairMaterialId: 51
MaximumDurability: 165
MinimumQuantity: 5
XpMultiplier: 2
ChainChest:
ItemId: 303
ItemType: ARMOR
RepairMaterialId: 51
MaximumDurability: 240
MinimumQuantity: 8
XpMultiplier: 2
ChainLegs:
ItemId: 304
ItemType: ARMOR
RepairMaterialId: 51
MaximumDurability: 225
MinimumQuantity: 7
XpMultiplier: 2
ChainBoots:
ItemId: 305
ItemType: ARMOR
RepairMaterialId: 51
RepairMaterialMetadata: -1
MaximumDurability: 195
MinimumQuantity: 4
XpMultiplier: 2

View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.3.03</version>
<version>1.3.09</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement>

View File

@@ -1,119 +0,0 @@
package com.gmail.nossr50;
import org.bukkit.Material;
import com.gmail.nossr50.config.LoadProperties;
public class BlockChecks {
/**
* Checks to see if a block type awards XP.
*
* @param material The type of Block to check
* @return true if the block type awards XP, false otherwise
*/
public static boolean shouldBeWatched(Material material) {
switch (material) {
case BROWN_MUSHROOM:
case CACTUS:
case CLAY:
case COAL_ORE:
case DIAMOND_ORE:
case DIRT:
case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE:
case GOLD_ORE:
case GRASS:
case GRAVEL:
case IRON_ORE:
case JACK_O_LANTERN:
case LAPIS_ORE:
case LOG:
case MELON_BLOCK:
case MOSSY_COBBLESTONE:
case MYCEL:
case NETHERRACK:
case OBSIDIAN:
case PUMPKIN:
case RED_MUSHROOM:
case RED_ROSE:
case REDSTONE_ORE:
case SAND:
case SANDSTONE:
case SOUL_SAND:
case STONE:
case SUGAR_CANE_BLOCK:
case VINE:
case WATER_LILY:
case YELLOW_FLOWER:
return true;
default:
return false;
}
}
/**
* Check if a block should allow for the activation of abilities.
*
* @param material The type of Block to check
* @return true if the block should allow ability activation, false otherwise
*/
public static boolean abilityBlockCheck(Material material) {
switch (material) {
case BED_BLOCK:
case BREWING_STAND:
case BOOKSHELF:
case BURNING_FURNACE:
case CAKE_BLOCK:
case CHEST:
case DISPENSER:
case ENCHANTMENT_TABLE:
case FENCE_GATE:
case FURNACE:
case IRON_DOOR_BLOCK:
case JUKEBOX:
case LEVER:
case NOTE_BLOCK:
case STONE_BUTTON:
case TRAP_DOOR:
case WALL_SIGN:
case WOODEN_DOOR:
case WORKBENCH:
return false;
default:
break;
}
if (Material.getMaterial(LoadProperties.anvilID).equals(material)) {
return false;
}
else {
return true;
}
}
/**
* Check if a block type is an ore.
*
* @param material The type of Block to check
* @return true if the Block is an ore, false otherwise
*/
public static boolean isOre(Material material) {
switch (material) {
case COAL_ORE:
case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
return true;
default:
return false;
}
}
}

View File

@@ -1,468 +0,0 @@
package com.gmail.nossr50;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.FakeEntityDamageEvent;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.GainXp;
import com.gmail.nossr50.runnables.mcBleedTimer;
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 {
/**
* Apply combat modifiers and process and XP gain.
*
* @param event The event to run the combat checks on.
* @param plugin mcMMO plugin instance
*/
public static void combatChecks(EntityDamageByEntityEvent event, mcMMO plugin) {
if (event.getDamage() == 0 || event.getEntity().isDead()) {
return;
}
Entity damager = event.getDamager();
LivingEntity target = (LivingEntity) event.getEntity();
EntityType damagerType = damager.getType();
EntityType targetType = target.getType();
switch (damagerType) {
case PLAYER:
Player attacker = (Player) event.getDamager();
ItemStack itemInHand = attacker.getItemInHand();
PlayerProfile PPa = Users.getProfile(attacker);
combatAbilityChecks(attacker);
if (ItemChecks.isSword(itemInHand) && mcPermissions.getInstance().swords(attacker)) {
if (!mcBleedTimer.contains(target) && mcPermissions.getInstance().swordsBleed(attacker)) {
Swords.bleedCheck(attacker, target, plugin);
}
if (PPa.getSerratedStrikesMode()) {
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.SWORDS);
}
startGainXp(attacker, PPa, target, SkillType.SWORDS, plugin);
}
else if (ItemChecks.isAxe(itemInHand) && mcPermissions.getInstance().axes(attacker)) {
if (mcPermissions.getInstance().axeBonus(attacker)) {
Axes.axesBonus(attacker, event);
}
if (mcPermissions.getInstance().criticalHit(attacker)) {
Axes.axeCriticalCheck(attacker, event);
}
if (mcPermissions.getInstance().impact(attacker)) {
Axes.impact(attacker, target, event);
}
if (PPa.getSkullSplitterMode()) {
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.AXES);
}
startGainXp(attacker, PPa, target, SkillType.AXES, plugin);
}
else if (itemInHand.getType().equals(Material.AIR) && mcPermissions.getInstance().unarmed(attacker)) {
if (mcPermissions.getInstance().unarmedBonus(attacker)) {
Unarmed.unarmedBonus(PPa, event);
}
if (PPa.getBerserkMode() && mcPermissions.getInstance().berserk(attacker)) {
event.setDamage((int) (event.getDamage() * 1.5));
}
if (targetType.equals(EntityType.PLAYER) && mcPermissions.getInstance().disarm(attacker)) {
Unarmed.disarmProcCheck(PPa, (Player) target);
}
startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);
}
else if (itemInHand.getType().equals(Material.BONE) && mcPermissions.getInstance().beastLore(attacker)) {
Taming.beastLore(event, target, attacker);
}
break;
case WOLF:
Wolf wolf = (Wolf) damager;
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
Player master = (Player) wolf.getOwner();
PlayerProfile PPo = Users.getProfile(master);
if (mcPermissions.getInstance().taming(master)) {
if (mcPermissions.getInstance().fastFoodService(master)) {
Taming.fastFoodService(PPo, wolf, event);
}
if (mcPermissions.getInstance().sharpenedclaws(master)) {
Taming.sharpenedClaws(PPo, event);
}
if (mcPermissions.getInstance().gore(master)) {
Taming.gore(PPo, event, master, plugin);
}
startGainXp(master, PPo, target, SkillType.TAMING, plugin);
}
}
break;
case ARROW:
archeryCheck((EntityDamageByEntityEvent) event, plugin);
break;
default:
break;
}
if (targetType.equals(EntityType.PLAYER)) {
Swords.counterAttackChecks(event);
Acrobatics.dodgeChecks(event);
}
}
/**
* Process combat abilities based on weapon preparation modes.
*
* @param attacker The player attacking
*/
public static void combatAbilityChecks(Player attacker) {
PlayerProfile PPa = Users.getProfile(attacker);
if (PPa.getAxePreparationMode()) {
Skills.abilityCheck(attacker, SkillType.AXES);
}
else if (PPa.getSwordsPreparationMode()) {
Skills.abilityCheck(attacker, SkillType.SWORDS);
}
else if (PPa.getFistsPreparationMode()) {
Skills.abilityCheck(attacker, SkillType.UNARMED);
}
}
/**
* Process archery abilities.
*
* @param event The event to run the archery checks on.
* @param pluginx mcMMO plugin instance
*/
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx) {
Arrow arrow = (Arrow) event.getDamager();
LivingEntity shooter = arrow.getShooter();
LivingEntity target = (LivingEntity) event.getEntity();
if (target instanceof Player) {
Player defender = (Player) target;
if (mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getType().equals(Material.AIR)) {
Unarmed.deflectCheck(defender, event);
}
}
if (shooter instanceof Player) {
Player attacker = (Player) shooter;
PlayerProfile PPa = Users.getProfile(attacker);
int damage = event.getDamage();
if (mcPermissions.getInstance().archery(attacker) && damage > 0) {
if (mcPermissions.getInstance().trackArrows(attacker)) {
Archery.trackArrows(pluginx, target, PPa);
}
if (mcPermissions.getInstance().ignition(attacker)) {
Archery.ignitionCheck(target, attacker);
}
startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx);
if (target instanceof Player) {
Player defender = (Player) target;
PlayerProfile PPd = Users.getProfile(defender);
if (PPa.inParty() && PPd.inParty() && Party.getInstance().inSameParty(defender, attacker)) {
event.setCancelled(true);
return;
}
Archery.dazeCheck(defender, attacker);
}
}
}
}
/**
* Attempt to damage target for value dmg with reason CUSTOM
*
* @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do
*/
public static void dealDamage(LivingEntity target, int dmg) {
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
}
/**
* Attempt to damage target for value dmg with reason cause
*
* @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do
* @param cause DamageCause to pass to damage event
*/
private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
if (LoadProperties.eventCallback) {
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
Bukkit.getPluginManager().callEvent(ede);
if (ede.isCancelled()) {
return;
}
target.damage(ede.getDamage());
}
else {
target.damage(dmg);
}
}
/**
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
*
* @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
private static void dealDamage(LivingEntity target, int dmg, Player attacker) {
if (LoadProperties.eventCallback) {
EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
Bukkit.getPluginManager().callEvent(ede);
if (ede.isCancelled()) {
return;
}
target.damage(ede.getDamage());
}
else {
target.damage(dmg);
}
}
/**
* Apply Area-of-Effect ability actions.
*
* @param attacker The attacking player
* @param target The defending entity
* @param damage The initial damage amount
* @param plugin mcMMO plugin instance
* @param type The type of skill being used
*/
private static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, mcMMO plugin, SkillType type) {
int numberOfTargets = m.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
int damageAmount = 0;
if (type.equals(SkillType.AXES)) {
damageAmount = damage / 2;
}
else if (type.equals(SkillType.SWORDS)) {
damageAmount = damage / 4;
}
if (damageAmount < 1) {
damageAmount = 1;
}
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
EntityType entityType = entity.getType();
if (entityType.equals(EntityType.WOLF)) {
Wolf wolf = (Wolf) entity;
AnimalTamer tamer = wolf.getOwner();
if (tamer instanceof Player) {
Player owner = (Player) tamer;
if (owner.equals(attacker) || Party.getInstance().inSameParty(attacker, owner)) {
continue;
}
}
}
if (entity instanceof LivingEntity && numberOfTargets >= 1) {
if (entityType.equals(EntityType.PLAYER)) {
Player defender = (Player) entity;
PlayerProfile PP = Users.getProfile(defender);
//Reasons why the target shouldn't be hit
if (PP.getGodMode()) {
continue;
}
if (defender.getName().equals(attacker.getName())) { //Is this even possible?
continue;
}
if (Party.getInstance().inSameParty(attacker, defender)) {
continue;
}
if (defender.isDead()) {
continue;
}
//Apply effect to players only if PVP is enabled
if (target.getWorld().getPVP()) {
String message = "";
if (type.equals(SkillType.AXES)) {
message = mcLocale.getString("Axes.HitByCleave");
}
else if (type.equals(SkillType.SWORDS)) {
message = mcLocale.getString("Swords.HitBySerratedStrikes");
}
dealDamage(defender, damageAmount, attacker);
defender.sendMessage(message);
if (type.equals(SkillType.SWORDS)) {
PP.addBleedTicks(5);
}
numberOfTargets--;
}
}
else {
LivingEntity livingEntity = (LivingEntity) entity;
if (type.equals(SkillType.SWORDS)) {
mcBleedTimer.add(livingEntity);
}
dealDamage(livingEntity, damageAmount, attacker);
numberOfTargets--;
}
}
}
}
/**
* Start the task that gives combat XP.
*
* @param attacker The attacking player
* @param PP The player's PlayerProfile
* @param target The defending entity
* @param skillType The skill being used
* @param plugin mcMMO plugin instance
*/
public static void startGainXp(Player attacker, PlayerProfile PP, LivingEntity target, SkillType skillType, mcMMO pluginx) {
double baseXP = 0;
if (target instanceof Player) {
if (!LoadProperties.pvpxp) {
return;
}
Player defender = (Player) target;
PlayerProfile PPd = Users.getProfile(defender);
if (System.currentTimeMillis() >= (PPd.getRespawnATS() * 1000) + 5000 && ((PPd.getLastLogin() + 5) * 1000) < System.currentTimeMillis() && defender.getHealth() >= 1) {
baseXP = 20 * LoadProperties.pvpxprewardmodifier;
}
}
else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) {
baseXP = LoadProperties.animalXP;
}
else {
EntityType type = target.getType();
switch (type) {
case BLAZE:
baseXP = LoadProperties.blazeXP;
break;
case CAVE_SPIDER:
baseXP = LoadProperties.cavespiderXP;
break;
case CREEPER:
baseXP = LoadProperties.creeperXP;
break;
case ENDER_DRAGON:
baseXP = LoadProperties.enderdragonXP;
break;
case ENDERMAN:
baseXP = LoadProperties.endermanXP;
break;
case GHAST:
baseXP = LoadProperties.ghastXP;
break;
case MAGMA_CUBE:
baseXP = LoadProperties.magmacubeXP;
break;
case PIG_ZOMBIE:
baseXP = LoadProperties.pigzombieXP;
break;
case SILVERFISH:
baseXP = LoadProperties.silverfishXP;
break;
case SKELETON:
baseXP = LoadProperties.skeletonXP;
break;
case SLIME:
baseXP = LoadProperties.slimeXP;
break;
case SPIDER:
baseXP = LoadProperties.spiderXP;
break;
case ZOMBIE:
baseXP = LoadProperties.zombieXP;
break;
default:
break;
}
}
baseXP *= 10;
}
if (baseXP != 0) {
Bukkit.getScheduler().scheduleSyncDelayedTask(pluginx, new GainXp(attacker, PP, skillType, baseXP, target), 0);
}
}
}

View File

@@ -1,64 +0,0 @@
package com.gmail.nossr50;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class Item {
/**
* Check for item usage.
*
* @param player Player whose item usage to check
*/
public static void itemchecks(Player player) {
ItemStack inhand = player.getItemInHand();
if (LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId) {
chimaerawing(player);
}
}
private static void chimaerawing(Player player) {
PlayerProfile PP = Users.getProfile(player);
ItemStack is = player.getItemInHand();
Block block = player.getLocation().getBlock();
int amount = is.getAmount();
if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == LoadProperties.chimaeraId) {
if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= LoadProperties.feathersConsumedByChimaeraWing) {
player.setItemInHand(new ItemStack(LoadProperties.chimaeraId, amount - LoadProperties.feathersConsumedByChimaeraWing));
for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail"));
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
return;
}
}
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK)) {
player.teleport(player.getBedSpawnLocation());
}
else {
player.teleport(player.getWorld().getSpawnLocation());
}
player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass"));
}
else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing) {
player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)}));
}
else if (is.getAmount() <= LoadProperties.feathersConsumedByChimaeraWing) {
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.chimaeraId));
}
}
}
}

View File

@@ -1,541 +0,0 @@
package com.gmail.nossr50;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
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.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class Metrics {
/**
* The current revision number
*/
private final static int REVISION = 5;
/**
* 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";
/**
* The separator to use for custom data. This MUST NOT change unless you are hosting your own
* version of metrics and want to change it.
*/
private static final String CUSTOM_DATA_SEPARATOR = "~~";
/**
* Interval of time to ping (in minutes)
*/
private final static int PING_INTERVAL = 10;
/**
* A map of all of the graphs for each plugin
*/
private Map<Plugin, Set<Graph>> graphs = Collections.synchronizedMap(new HashMap<Plugin, Set<Graph>>());
/**
* A convenient map of the default Graph objects (used by addCustomData mainly)
*/
private Map<Plugin, Graph> defaultGraphs = Collections.synchronizedMap(new HashMap<Plugin, Graph>());
/**
* 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");
}
/**
* Construct and create a Graph that can be used to separate specific plotters to their own graphs
* on the metrics website. Plotters can be added to the graph object returned.
*
* @param plugin
* @param type
* @param name
* @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
*/
public Graph createGraph(Plugin plugin, Graph.Type type, String name) {
if (plugin == null || type == null || name == null) {
throw new IllegalArgumentException("All arguments must not be null");
}
// Construct the graph object
Graph graph = new Graph(type, name);
// Get the graphs for the plugin
Set<Graph> graphs = getOrCreateGraphs(plugin);
// Now we can add our graph
graphs.add(graph);
// and return back
return graph;
}
/**
* Adds a custom data plotter for a given plugin
*
* @param plugin
* @param plotter
*/
public void addCustomData(Plugin plugin, Plotter plotter) {
// The default graph for the plugin
Graph graph = getOrCreateDefaultGraph(plugin);
// Add the plotter to the graph o/
graph.addPlotter(plotter);
// Ensure the default graph is included in the submitted graphs
getOrCreateGraphs(plugin).add(graph);
}
/**
* Begin measuring a plugin
*
* @param plugin
*/
public void beginMeasuringPlugin(final Plugin plugin) {
// Did we opt out?
if (configuration.getBoolean("opt-out", false)) {
return;
}
// Begin hitting the server with glorious data
plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
private boolean firstPost = true;
public void run() {
try {
// We use the inverse of firstPost because if it is the first time we are posting,
// it is not a interval ping, so it evaluates to FALSE
// Each time thereafter it will evaluate to TRUE, i.e PING!
postPlugin(plugin, !firstPost);
// After the first post we set firstPost to false
// Each post thereafter will be a ping
firstPost = false;
} catch (IOException e) {
System.out.println("[Metrics] " + e.getMessage());
}
}
}, 0, PING_INTERVAL * 1200);
}
/**
* Generic method that posts a plugin to the metrics website
*
* @param plugin
*/
private void postPlugin(Plugin plugin, boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
PluginDescriptionFile description = plugin.getDescription();
// The author string, created with description.getAuthors()
// Authors are separated by a comma
String authors = "";
// Add each author to the string
for (String author : description.getAuthors()) {
authors += author + ", ";
}
// If there were any authors at all, we need to remove the last 2 characters
// the last 2 characters are the last comma and space
if (!authors.isEmpty()) {
authors = authors.substring(0, authors.length() - 2);
}
// Construct the post data
String data = encode("guid") + '=' + encode(guid)
+ encodeDataPair("authors", authors)
+ encodeDataPair("version", description.getVersion())
+ encodeDataPair("server", Bukkit.getVersion())
+ encodeDataPair("players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length))
+ encodeDataPair("revision", String.valueOf(REVISION));
// If we're pinging, append it
if (isPing) {
data += encodeDataPair("ping", "true");
}
// Add any custom data available for the plugin
Set<Graph> graphs = getOrCreateGraphs(plugin);
// Acquire a lock on the graphs, which lets us make the assumption we also lock everything
// inside of the graph (e.g plotters)
synchronized(graphs) {
Iterator<Graph> iter = graphs.iterator();
while (iter.hasNext()) {
Graph graph = iter.next();
// Because we have a lock on the graphs set already, it is reasonable to assume
// that our lock transcends down to the individual plotters in the graphs also.
// Because our methods are private, no one but us can reasonably access this list
// without reflection so this is a safe assumption without adding more code.
for (Plotter plotter : graph.getPlotters()) {
// The key name to send to the metrics server
// The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top
// Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME
String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName());
// The value to send, which for the foreseeable future is just the string
// value of plotter.getValue()
String value = Integer.toString(plotter.getValue());
// Add it to the http post data :)
data += encodeDataPair(key, value);
}
}
}
// 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
// It does not reroute POST requests so we need to go around 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()));
String 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")) {
synchronized (graphs) {
Iterator<Graph> iter = graphs.iterator();
while (iter.hasNext()) {
Graph graph = iter.next();
for (Plotter plotter : graph.getPlotters()) {
plotter.reset();
}
}
}
}
}
//if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right
}
/**
* Get or create the Set of graphs for a specific plugin
*
* @param plugin
* @return
*/
private Set<Graph> getOrCreateGraphs(Plugin plugin) {
Set<Graph> theGraphs = graphs.get(plugin);
// Create the Set if it does not already exist
if (theGraphs == null) {
theGraphs = Collections.synchronizedSet(new HashSet<Graph>());
graphs.put(plugin, theGraphs);
}
return theGraphs;
}
/**
* Get the default graph for a plugin and if it does not exist, create one
*
* @param plugin
* @return
*/
private Graph getOrCreateDefaultGraph(Plugin plugin) {
Graph graph = defaultGraphs.get(plugin);
// Not yet created :(
if (graph == null) {
graph = new Graph(Graph.Type.Line, "Default");
defaultGraphs.put(plugin, graph);
}
return graph;
}
/**
* 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 a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first
* key/value pair MUST be included manually, e.g:
* <p>
* String httpData = encode("guid") + "=" + encode("1234") + encodeDataPair("authors") + "..";
* </p>
*
* @param key
* @param value
* @return
*/
private static String encodeDataPair(String key, String value) throws UnsupportedEncodingException {
return "&" + encode(key) + "=" + encode(value);
}
/**
* Encode text as UTF-8
*
* @param text
* @return
*/
private static String encode(String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8");
}
/**
* Represents a custom graph on the website
*/
public static class Graph {
/**
* The graph's type that will be visible on the website
*/
public static enum Type {
/**
* A simple line graph which also includes a scrollable timeline viewer to view
* as little or as much of the data as possible.
*/
Line,
/**
* An area graph. This is the same as a line graph except the area under the curve is shaded
*/
Area,
/**
* A column graph, which is a graph where the data is represented by columns on the vertical axis,
* i.e they go up and down.
*/
Column,
/**
* A pie graph. The graph is generated by taking the data for the last hour and summing it
* together. Then the percentage for each plotter is calculated via round( (plot / total) * 100, 2 )
*/
Pie
}
/**
* What the graph should be plotted as
*/
private final Type type;
/**
* The graph's name, alphanumeric and spaces only :)
* If it does not comply to the above when submitted, it is rejected
*/
private final String name;
/**
* The set of plotters that are contained within this graph
*/
private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
private Graph(Type type, String name) {
this.type = type;
this.name = name;
}
/**
* Gets the graph's name
*
* @return
*/
public String getName() {
return name;
}
/**
* Add a plotter to the graph, which will be used to plot entries
*
* @param plotter
*/
public void addPlotter(Plotter plotter) {
plotters.add(plotter);
}
/**
* Remove a plotter from the graph
*
* @param plotter
*/
public void removePlotter(Plotter plotter) {
plotters.remove(plotter);
}
/**
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
* @return
*/
public Set<Plotter> getPlotters() {
return Collections.unmodifiableSet(plotters);
}
@Override
public int hashCode() {
return (type.hashCode() * 17) ^ name.hashCode();
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Graph)) {
return false;
}
Graph graph = (Graph) object;
return graph.type == type && graph.name.equals(name);
}
}
/**
* Interface used to collect custom data for a plugin
*/
public static abstract class Plotter {
/**
* The plot's name
*/
private final String name;
/**
* Construct a plotter with the default plot name
*/
public Plotter() {
this("Default");
}
/**
* Construct a plotter with a specific plot name
*
* @param name
*/
public Plotter(String name) {
this.name = name;
}
/**
* Get the current value for the plotted point
*
* @return
*/
public abstract int getValue();
/**
* Get the column name for the plotted point
*
* @return the plotted point's column name
*/
public String getColumnName() {
return name;
}
/**
* 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.name.equals(name) && plotter.getValue() == getValue();
}
}
}

View File

@@ -1,142 +0,0 @@
package com.gmail.nossr50;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class Users {
private static volatile Users instance;
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
String directory = "plugins/mcMMO/FlatFileStuff/";
String directoryb = "plugins/mcMMO/FlatFileStuff/Leaderboards/";
public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>();
/**
* Load users.
*/
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) {
e.printStackTrace();
}
}
}
/**
* Add a new user.
*
* @param player The player to create a user record for
*/
public static void addUser(Player player) {
if (!players.containsKey(player.getName().toLowerCase())) {
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
}
}
/**
* Clear all users.
*/
public static void clearUsers() {
players.clear();
}
/**
* Get all PlayerProfiles.
*
* @return a HashMap containing the PlayerProfile of everyone in the database
*/
public static HashMap<String, PlayerProfile> getProfiles() {
return players;
}
/**
* Remove a user from the database.
*
* @param player The player to remove
*/
public static void removeUser(Player player) {
//Only remove PlayerProfile if user is offline and we have it in memory
if (!player.isOnline() && players.containsKey(player.getName().toLowerCase())) {
players.get(player.getName().toLowerCase()).save();
players.remove(player.getName().toLowerCase());
}
}
/**
* Remove a user from the DB by name.
*
* @param playerName The name of the player to remove
*/
public static void removeUserByName(String playerName) {
players.remove(playerName.toLowerCase());
}
/**
* Get the profile of an online player.
*
* @param player The player whose profile to retrieve
* @return the player's profile
*/
public static PlayerProfile getProfile(Player player) {
if(players.get(player.getName().toLowerCase()) != null) {
return players.get(player.getName().toLowerCase());
}
else {
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
return players.get(player.getName().toLowerCase());
}
}
/**
* Get the profile of an online player.
*
* @param player The player whose profile to retrieve
* @return the player's profile
*/
public static PlayerProfile getProfile(String playerName) {
if(players.get(playerName.toLowerCase()) != null) {
return players.get(playerName.toLowerCase());
}
else {
players.put(playerName.toLowerCase(), new PlayerProfile(playerName));
return players.get(playerName.toLowerCase());
}
}
/**
* Get the profile of an offline player.
*
* @param playerName Name of the player whose profile to retrieve
* @return the player's profile
*/
public static PlayerProfile getOfflineProfile(String playerName) {
return new PlayerProfile(playerName, false);
}
/**
* Get an instance of this class.
*
* @return an instance of this class
*/
public static Users getInstance() {
if (instance == null) {
instance = new Users();
}
return instance;
}
}

View File

@@ -0,0 +1,71 @@
package com.gmail.nossr50.api;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public final class ChatAPI {
private 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 static void sendPartyChat(String sender, String party, String message) {
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return;
}
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") ";
mcMMO.p.getLogger().info("[P](" + chatEvent.getParty() + ")" + "<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
if (Users.getProfile(player).inParty()) {
if (Users.getProfile(player).getParty().getName().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 static void sendAdminChat(String sender, String message) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return;
}
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} ";
mcMMO.p.getLogger().info("[A]<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp())
player.sendMessage(aPrefix + chatEvent.getMessage());
}
}
}

View File

@@ -0,0 +1,138 @@
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 final class ExperienceAPI {
private 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 static void checkXP(Player player, SkillType skillType) {
if (skillType.equals(SkillType.ALL)) {
Skills.xpCheckAll(player, Users.getProfile(player));
}
else {
Skills.xpCheckSkill(skillType, player, Users.getProfile(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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static int getPowerLevel(Player player) {
return Users.getProfile(player).getPowerLevel();
}
}

View File

@@ -0,0 +1,145 @@
package com.gmail.nossr50.api;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public final class PartyAPI {
private 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 static String getPartyName(Player player) {
return Users.getProfile(player).getParty().getName();
}
/**
* 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 static 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 static boolean inSameParty(Player playera, Player playerb) {
return PartyManager.getInstance().inSameParty(playera, playerb);
}
/**
* Get a list of all current parties.
* </br>
* This function is designed for API usage.
*
* @return the list of parties.
*/
public static List<Party> getParties() {
return PartyManager.getInstance().getParties();
}
/**
* 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 static void addToParty(Player player, String partyName) {
PartyManager.getInstance().addToParty(player.getName(), Users.getProfile(player), PartyManager.getInstance().getParty(partyName)); //TODO this will throw a NPE if the party doesn't exist
}
/**
* Remove a player from a party.
* </br>
* This function is designed for API usage.
*
* @param player The player to remove
*/
public static void removeFromParty(Player player) {
PartyManager.getInstance().removeFromParty(player.getName(), Users.getProfile(player).getParty());
}
/**
* Get the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party name
* @return the leader of the party
*/
public static String getPartyLeader(String partyName) {
return PartyManager.getInstance().getPartyLeader(partyName);
}
/**
* Set the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The name of the party to set the leader of
* @param player The player to set as leader
*/
public static void setPartyLeader(String partyName, String player) {
PartyManager.getInstance().setPartyLeader(player, PartyManager.getInstance().getParty(partyName));
}
/**
* 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 static List<String> getAllMembers(Player player) {
return PartyManager.getInstance().getAllMembers(player);
}
/**
* Get a list of all online players in this party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party to check
* @return all online players in this party
*/
public static List<Player> getOnlineMembers(String partyName) {
return PartyManager.getInstance().getOnlineMembers(partyName);
}
/**
* Get a list of all online players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all online players in the player's party
*/
public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getInstance().getOnlineMembers(player);
}
}

View File

@@ -0,0 +1,54 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.ToolType;
public final class SpoutToolsAPI {
private SpoutToolsAPI() {}
public static List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
public static List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
public static List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
public static List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
public static List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
/**
* Add a custom Spout tool to mcMMO for XP gain & ability use.
* </br>
* This function is designed for API usage.
*
* @param spoutTool The tool to add
* @param type The type of tool to add
*/
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
switch (type) {
case AXE:
spoutAxes.add(spoutTool);
break;
case HOE:
spoutHoes.add(spoutTool);
break;
case PICKAXE:
spoutPickaxes.add(spoutTool);
break;
case SHOVEL:
spoutShovels.add(spoutTool);
break;
case SWORD:
spoutSwords.add(spoutTool);
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,144 @@
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.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
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 && !Permissions.getInstance().permission(player, permission)) {
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return true;
}
}
return false;
}
public static boolean noConsoleUsage(CommandSender sender) {
if (!(sender instanceof Player)) {
sender.sendMessage(LocaleLoader.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
*/
public static void printGatheringSkills(Player inspect, CommandSender display) {
if (Skills.hasGatheringSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
if (Permissions.getInstance().excavation(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
}
if (Permissions.getInstance().fishing(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
}
if (Permissions.getInstance().herbalism(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
}
if (Permissions.getInstance().mining(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
}
if (Permissions.getInstance().woodcutting(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), 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
*/
public static void printCombatSkills(Player inspect, CommandSender display) {
if (Skills.hasCombatSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
if (Permissions.getInstance().axes(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
}
if (Permissions.getInstance().archery(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
}
if (Permissions.getInstance().swords(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
}
if (Permissions.getInstance().taming(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
}
if (Permissions.getInstance().unarmed(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), 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
*/
public static void printMiscSkills(Player inspect, CommandSender display) {
if (Skills.hasMiscSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
if (Permissions.getInstance().acrobatics(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
}
if (Permissions.getInstance().repair(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), 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,85 @@
package com.gmail.nossr50.commands;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
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.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public abstract class SkillCommand implements CommandExecutor {
private SkillType skill;
private String skillString;
private String permission;
protected Player player;
protected PlayerProfile profile;
protected float skillValue;
protected DecimalFormat percent = new DecimalFormat("##0.00%");
protected Permissions permInstance = Permissions.getInstance();
public SkillCommand(SkillType skill) {
this.skill = skill;
this.skillString = Misc.getCapitalized(skill.toString());
this.permission = "mcmmo.skills." + skillString.toLowerCase();
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, permission)) {
return true;
}
player = (Player) sender;
profile = Users.getProfile(player);
skillValue = profile.getSkillLevel(skill);
dataCalculations();
permissionsCheck();
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString(skillString + ".SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain." + skillString) }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill) }));
if (effectsHeaderPermissions()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
effectsDisplay();
if (statsHeaderPermissions()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
statsDisplay();
Page.grabGuidePageForSkill(skill, player, args);
return true;
}
protected abstract void dataCalculations();
protected abstract void permissionsCheck();
protected abstract boolean effectsHeaderPermissions();
protected abstract void effectsDisplay();
protected abstract boolean statsHeaderPermissions();
protected abstract void statsDisplay();
}

View File

@@ -1,81 +1,118 @@
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.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
public class AddlevelsCommand implements CommandExecutor{
private final mcMMO plugin;
private final mcMMO plugin;
public AddlevelsCommand(mcMMO instance) {
this.plugin = instance;
}
public AddlevelsCommand (mcMMO plugin) {
this.plugin = plugin;
}
@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 levels;
SkillType skill;
String skillName;
String usage = ChatColor.RED + "Proper usage is /addlevels [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 (!(sender instanceof Player)) {
if (args.length < 2) {
System.out.println("Usage is /addlevels playername skillname levels");
return true;
} else if (args.length == 3) {
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
int levels = Integer.valueOf(args[2]);
Users.getProfile(plugin.getServer().getPlayer(args[0])).addLevels(Skills.getSkillType(args[1]), levels);
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
}
} else {
System.out.println("Usage is /addlevels playername skillname levels");
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
return true;
}
if (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender;
levels = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
PP = Users.getProfile(modifiedPlayer);
PlayerProfile PP = Users.getProfile(player);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = Misc.getCapitalized(skill.toString());
}
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 /addlevels playername skillname levels");
return true;
}
if (args.length == 3) {
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
int levels = Integer.valueOf(args[2]);
Users.getProfile(plugin.getServer().getPlayer(args[0])).addLevels(Skills.getSkillType(args[1]), levels);
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
}
} else if (args.length == 2) {
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
int levels = Integer.valueOf(args[1]);
PP.addLevels(Skills.getSkillType(args[0]), levels);
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
}
} else {
player.sendMessage(ChatColor.RED + "Usage is /addlevels playername skillname newvalue");
}
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;
}
return true;
case 3:
modifiedPlayer = plugin.getServer().getOfflinePlayer(args[0]);
String playerName = modifiedPlayer.getName();
PP = Users.getProfile(modifiedPlayer);
if (!PP.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!Skills.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[2])) {
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 = Misc.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,78 +6,127 @@ 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.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
//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 plugin) {
this.plugin = plugin;
}
@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 [playername] <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 (!(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;
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (!Skills.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
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 /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 (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender;
xp = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
return true;
}
PlayerProfile profile = Users.getProfile(modifiedPlayer);
profile.addXPOverride(skill, xp);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = Misc.getCapitalized(skill.toString());
}
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
if (skill.equals(SkillType.ALL)) {
Skills.xpCheckAll(modifiedPlayer, profile);
}
else {
Skills.xpCheckSkill(skill, modifiedPlayer, profile);
}
}
else {
sender.sendMessage(usage);
}
}
else {
sender.sendMessage(usage);
}
return true;
case 3:
modifiedPlayer = plugin.getServer().getPlayer(args[0]);
String playerName = modifiedPlayer.getName();
PlayerProfile profile = Users.getProfile(modifiedPlayer);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!Skills.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[2])) {
xp = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]);
String message;
profile.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 = Misc.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, profile);
}
else {
Skills.xpCheckSkill(skill, modifiedPlayer, profile);
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,126 +1,95 @@
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.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.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class InspectCommand implements CommandExecutor {
private final mcMMO plugin;
public InspectCommand(mcMMO instance) {
this.plugin = instance;
public InspectCommand (mcMMO plugin) {
this.plugin = plugin;
}
@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.
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (sender instanceof Player && !mcPermissions.getInstance().inspect(player)) {
sender.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
return true;
}
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Proper usage is /inspect <playername>");
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() && !Misc.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0) && !Permissions.getInstance().inspectDistanceBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", new Object[] { target.getName() }));
CommandHelper.printGatheringSkills(player, sender);
CommandHelper.printCombatSkills(player, sender);
CommandHelper.printMiscSkills(player, sender);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { PP.getPowerLevel() }));
return true;
}
else {
if (sender instanceof Player && !sender.isOp() && !Permissions.getInstance().inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
if (!PP.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
return true;
}
default:
sender.sendMessage(usage);
return true;
}
// if split[1] is an online player
if (plugin.getServer().getPlayer(args[0]) != null)
{
Player target = plugin.getServer().getPlayer(args[0]);
PlayerProfile PPt = Users.getProfile(target);
//If they are not an Op they have to be close
if(sender instanceof Player && !player.isOp() && !m.isNear(player.getLocation(), target.getLocation(), 5))
{
sender.sendMessage("You are too far away to inspect that player!");
}
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for " + ChatColor.YELLOW + target.getName());
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-");
if (mcPermissions.getInstance().excavation(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION)));
if (mcPermissions.getInstance().fishing(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING)));
if (mcPermissions.getInstance().herbalism(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM)));
if (mcPermissions.getInstance().mining(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING)));
if (mcPermissions.getInstance().woodcutting(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING)));
sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-");
if (mcPermissions.getInstance().axes(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES)));
if (mcPermissions.getInstance().archery(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY)));
if (mcPermissions.getInstance().swords(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS)));
if (mcPermissions.getInstance().taming(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING)));
if (mcPermissions.getInstance().unarmed(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED)));
sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-");
if (mcPermissions.getInstance().acrobatics(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS)));
if (mcPermissions.getInstance().repair(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(target, PPt)));
} else {
if(sender instanceof Player && !player.isOp())
{
sender.sendMessage("That player is offline, inspecting offline players is limited to Ops!");
return true;
}
PlayerProfile PPt = Users.getOfflineProfile(args[0]);
if(!PPt.isLoaded())
{
sender.sendMessage("Player does not exist in the database!");
return true;
}
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for Offline Player " + ChatColor.YELLOW + args[0]);
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-");
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING)));
sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-");
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED)));
sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-");
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS)));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
}
return true;
}
}

View File

@@ -1,78 +1,35 @@
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.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.Skills;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McstatsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
PlayerProfile PP = Users.getProfile(player);
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
CommandHelper.printGatheringSkills(player);
CommandHelper.printCombatSkills(player);
CommandHelper.printMiscSkills(player);
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { String.valueOf(PP.getPowerLevel()) }));
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().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().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, PP)));
return true;
}
return true;
}
}

View File

@@ -1,118 +1,115 @@
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.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
public class MmoeditCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer modifiedPlayer;
PlayerProfile playerProfile;
int newValue;
SkillType skill;
String skillName;
String usage = ChatColor.RED + "Proper usage is /mmoedit [player] <skill> <level>"; //TODO: Needs more locale.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player)
{
player = (Player) sender;
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 (!(sender instanceof Player))
{
if (args.length < 2)
{
System.out.println("Usage is /mmoedit playername skillname newvalue");
return true;
} else if (args.length == 3)
{
PlayerProfile PPt = null;
if(Users.players.containsKey(args[0].toLowerCase())) {
PPt = Users.players.get(args[0].toLowerCase());
}
if(PPt == null)
Users.getOfflineProfile(args[0]); //Only grab offline profile if the above failed
if(!PPt.isLoaded())
{
sender.sendMessage("Player does not exist in the database!");
return true;
}
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
{
int newvalue = Integer.valueOf(args[2]);
Users.getOfflineProfile(args[0]).modifyskill(Skills.getSkillType(args[1]), newvalue);
System.out.println(args[1] + " has been modified for " + args[0] + ".");
}
} else
{
System.out.println("Usage is /mmoedit playername skillname newvalue");
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
return true;
}
if (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender;
newValue = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
playerProfile = Users.getProfile(modifiedPlayer);
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)
{
PlayerProfile PPt = null;
if(Users.players.containsKey(args[0].toLowerCase())) {
PPt = Users.players.get(args[0].toLowerCase());
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = Misc.getCapitalized(skill.toString());
}
playerProfile.modifySkill(skill, newValue);
sender.sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
}
else {
sender.sendMessage(usage);
}
}
else {
sender.sendMessage(usage);
}
if(PPt == null)
Users.getOfflineProfile(args[0]); //Only grab offline profile if the above failed
if(!PPt.isLoaded())
{
sender.sendMessage("Player does not exist in the database!");
return true;
}
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
{
int newvalue = Integer.valueOf(args[2]);
PPt.modifyskill(Skills.getSkillType(args[1]), newvalue);
player.sendMessage(ChatColor.RED + args[1] + " has been modified for "+args[0]);
}
} else if (args.length == 2)
{
if (m.isInt(args[1]) && Skills.isSkill(args[0]))
{
PlayerProfile PP = Users.getProfile(player);
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");
}
return true;
}
return true;
case 3:
if (!Misc.isInt(args[2])) {
sender.sendMessage(usage);
return true;
}
skill = Skills.getSkillType(args[1]);
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = Misc.getCapitalized(skill.toString());
}
newValue = Integer.valueOf(args[2]);
playerProfile = Users.getProfile(args[0]);
if (playerProfile != null) {
Player player = playerProfile.getPlayer();
if (player.isOnline()) {
player.sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
}
}
else {
playerProfile = new PlayerProfile(null, args[0], false);
if (!playerProfile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
}
sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + args[0] + "."); //TODO: Use locale
playerProfile.modifySkill(skill, newValue);
playerProfile.save();
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,51 +1,51 @@
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.locale.mcLocale;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
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;
}
private final mcMMO plugin;
Player player = (Player) sender;
public MmoupdateCommand (mcMMO plugin) {
this.plugin = plugin;
}
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();
convertToMySQL();
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
player.sendMessage(ChatColor.GREEN + "Conversion finished!");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
return true;
}
/**
sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
Users.clearUsers();
convertToMySQL();
for (Player x : plugin.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) {
if (!Config.getInstance().getUseMySQL()) {
return;
}
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new SQLConversionTask(plugin), 1);
}
}
}

View File

@@ -1,124 +1,93 @@
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.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
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) {
private final mcMMO plugin;
private static int oldrate = Config.getInstance().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;
}
public XprateCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage1 = LocaleLoader.getString("Commands.xprate.proper.0");
String usage2 = LocaleLoader.getString("Commands.xprate.proper.1");
String usage3 = LocaleLoader.getString("Commands.xprate.proper.2");
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("reset")) {
if (xpevent) {
for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(LocaleLoader.getString("Commands.xprate.over"));
}
xpevent = !xpevent;
Config.getInstance().xpGainMultiplier = oldrate;
}
else {
Config.getInstance().xpGainMultiplier = oldrate;
}
}
else if (Misc.isInt(args[0])) {
sender.sendMessage(usage3);
}
else {
sender.sendMessage(usage2);
}
return true;
case 2:
if (Misc.isInt(args[0])) {
oldrate = Config.getInstance().xpGainMultiplier;
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
xpevent = Boolean.valueOf(args[1]);
}
else {
sender.sendMessage(usage3);
}
Config.getInstance().xpGainMultiplier = Misc.getInt(args[0]);
if (xpevent) {
for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.0"));
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.1", new Object[] {Config.getInstance().xpGainMultiplier}));
}
}
else {
sender.sendMessage("The XP RATE was modified to " + Config.getInstance().xpGainMultiplier); //TODO: Locale
}
}
else {
sender.sendMessage(usage1);
sender.sendMessage(usage2);
}
return true;
default:
sender.sendMessage(usage1);
sender.sendMessage(usage2);
return true;
}
}
}

View File

@@ -1,44 +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.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.locale.LocaleLoader;
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 && !mcPermissions.getInstance().mcAbility(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ability")) {
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
PlayerProfile PP = Users.getProfile((Player) sender);
PlayerProfile PP = Users.getProfile(player);
if (PP.getAbilityUse()) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
}
if (PP.getAbilityUse()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
PP.toggleAbilityUse();
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
PP.toggleAbilityUse();
}
PP.toggleAbilityUse();
return true;
}
return true;
}
}

View File

@@ -6,58 +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.locale.mcLocale;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
//TODO: Rework this whole thing. It's ugly. Also is missing all the admin & spout commands.
public class MccCommand 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;
}
@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 (Permissions.getInstance().party(player)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
player.sendMessage("/party " + LocaleLoader.getString("Commands.Party"));
player.sendMessage("/party q " + LocaleLoader.getString("Commands.Party.Quit"));
if (mcPermissions.getInstance().partyChat(player))
player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle"));
if (Permissions.getInstance().partyChat(player)) {
player.sendMessage("/p " + LocaleLoader.getString("Commands.Party.Toggle"));
}
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyInvite"));
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyAccept"));
player.sendMessage("/invite " + LocaleLoader.getString("Commands.Party.Invite"));
player.sendMessage("/accept " + LocaleLoader.getString("Commands.Party.Accept"));
if (mcPermissions.getInstance().partyTeleport(player))
player.sendMessage("/ptp " + mcLocale.getString("m.mccPartyTeleport"));
}
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 (Permissions.getInstance().partyTeleport(player)) {
player.sendMessage("/ptp " + LocaleLoader.getString("Commands.Party.Teleport"));
}
}
if (mcPermissions.getInstance().mcAbility(player))
player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility"));
player.sendMessage(LocaleLoader.getString("Commands.Other"));
player.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
player.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
if (mcPermissions.getInstance().adminChat(player))
player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle"));
if (Permissions.getInstance().mcAbility(player)) {
player.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
}
if (mcPermissions.getInstance().inspect(player))
player.sendMessage("/inspect " + mcLocale.getString("m.mccInspect"));
if (Permissions.getInstance().adminChat(player)) {
player.sendMessage("/a " + LocaleLoader.getString("Commands.AdminToggle"));
}
if (mcPermissions.getInstance().mmoedit(player))
player.sendMessage("/mmoedit" + mcLocale.getString("m.mccMmoedit"));
if (Permissions.getInstance().inspect(player)) {
player.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
}
if (mcPermissions.getInstance().mcgod(player))
player.sendMessage("/mcgod" + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod"));
if (Permissions.getInstance().mmoedit(player)) {
player.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
}
player.sendMessage(mcLocale.getString("m.mccSkillInfo"));
player.sendMessage("/mcmmo " + mcLocale.getString("m.mccModDescription"));
if (Permissions.getInstance().mcgod(player)) {
player.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
}
return true;
}
player.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
player.sendMessage("/mcmmo " + LocaleLoader.getString("Commands.ModDescription"));
return true;
}
}

View File

@@ -1,43 +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.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McgodCommand 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;
}
@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(LocaleLoader.getString("Commands.GodMode.Disabled"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
}
return true;
}
PP.toggleGodMode();
return true;
}
}

View File

@@ -1,43 +1,34 @@
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;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String description = LocaleLoader.getString("mcMMO.Description");
String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (Config.getInstance().getDonateMessageEnabled()) {
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) sender;
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "mcmmodev@gmail.com", Material.DIAMOND);
}
Player player = (Player) sender;
sender.sendMessage(ChatColor.DARK_AQUA + "Donation Info:");
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "mcmmodev@gmail.com" + ChatColor.GOLD + " Paypal");
}
String description = mcLocale.getString("mcMMO.Description", new Object[] { "mcc" });
String[] mcSplit = description.split(",");
for (String x : mcSplit) {
player.sendMessage(x);
}
if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) player;
if (LoadProperties.donateMessage)
sPlayer.sendMessage(ChatColor.YELLOW + "[mcMMO]"+ChatColor.GOLD+" Donate! Paypal "+ChatColor.GREEN+"theno1yeti@gmail.com");
} else {
if (LoadProperties.donateMessage)
player.sendMessage(ChatColor.YELLOW + "[mcMMO]"+ChatColor.GOLD+" Donate! Paypal "+ChatColor.GREEN+"theno1yeti@gmail.com");
}
return true;
}
return true;
}
}

View File

@@ -1,67 +1,75 @@
package com.gmail.nossr50.commands.mc;
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.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McrefreshCommand implements CommandExecutor {
private final mcMMO plugin;
private final mcMMO plugin;
public McrefreshCommand(mcMMO instance) {
this.plugin = instance;
}
public McrefreshCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer player;
PlayerProfile PP;
String usage = ChatColor.RED + "Proper usage is /mcrefresh [player]"; //TODO: Needs more locale
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcrefresh")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
switch (args.length) {
case 0:
if (sender instanceof Player) {
player = (Player) sender;
PP = Users.getProfile(player);
}
else {
sender.sendMessage(usage);
return true;
}
break;
if (!mcPermissions.getInstance().mcrefresh(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
player.sendMessage("You have refreshed " + args[0] + "'s cooldowns!");
player = plugin.getServer().getPlayer(args[0]);
}
case 1:
player = plugin.getServer().getOfflinePlayer(args[0]);
PP = Users.getProfile(player);
String playerName = player.getName();
/*
* PREP MODES
*/
PP = Users.getProfile(player);
PP.setRecentlyHurt((long) 0);
PP.setHoePreparationMode(false);
PP.setAxePreparationMode(false);
PP.setFistsPreparationMode(false);
PP.setSwordsPreparationMode(false);
PP.setPickaxePreparationMode(false);
if (!PP.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage("You have refreshed " + playerName + "'s cooldowns!"); //TODO: Use locale
//RESET COOLDOWNS
PP.resetCooldowns();
PP.setGreenTerraMode(false);
PP.setGigaDrillBreakerMode(false);
PP.setSerratedStrikesMode(false);
PP.setSuperBreakerMode(false);
PP.setTreeFellerMode(false);
PP.setBerserkMode(false);
break;
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));
default:
sender.sendMessage(usage);
return true;
}
return true;
}
PP.setRecentlyHurt(0);
PP.resetCooldowns();
PP.resetToolPrepMode();
PP.resetAbilityMode();
if (player.isOnline()) {
((Player) player).sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
}
return true;
}
}

View File

@@ -1,109 +1,149 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.Bukkit;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
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.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McremoveCommand implements CommandExecutor {
private final String location;
private final mcMMO plugin;
public McremoveCommand (mcMMO plugin) {
this.plugin = plugin;
this.location = mcMMO.usersFile;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
String playerName;
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
String databaseName = Config.getInstance().getMySQLDatabaseName();
String usage = ChatColor.RED + "Proper usage is /mcremove <player>"; //TODO: Needs more locale.
String success;
if (player != null && !mcPermissions.getInstance().mcremove(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcremove")) {
return true;
}
if(args.length == 0)
{
sender.sendMessage("Correct usage is /mcremove [Player Name]");
switch (args.length) {
case 1:
playerName = args[0];
success = ChatColor.GREEN + playerName + " was successfully removed from the database!"; //TODO: Locale
break;
default:
sender.sendMessage(usage);
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!");
} else {
//FlatFile removal
//TODO: Properly remove users from FlatFile, it's going to be a huge bitch with how our FlatFile system works. Let's adopt SQLite support.
if(Bukkit.getServer().getPlayer(playerName) != null)
{
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
if(targetPlayer.isOnline())
{
Users.getProfile(targetPlayer).resetAllData();
sender.sendMessage("User "+playerName+" removed from FlatFile DB!");
} else {
sender.sendMessage("[mcMMO] This command is not fully functional for FlatFile yet, the player needs to be online.");
return true;
}
} else {
sender.sendMessage("[mcMMO] This command is not fully functional for FlatFile yet, the player needs to be online.");
return true;
/* MySQL */
if (Config.getInstance().getUseMySQL()) {
int userId = 0;
userId = mcMMO.database.getInt("SELECT id FROM " + tablePrefix + "users WHERE user = '" + playerName + "'");
if (userId > 0) {
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "users WHERE "
+ tablePrefix + "users.id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "cooldowns WHERE "
+ tablePrefix + "cooldowns.user_id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "huds WHERE "
+ tablePrefix + "huds.user_id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "skills WHERE "
+ tablePrefix + "skills.user_id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "experience WHERE "
+ tablePrefix + "experience.user_id=" + userId);
sender.sendMessage(success);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
}
}
else {
if (removeFlatFileUser(playerName)) {
sender.sendMessage(success);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
}
}
//Force PlayerProfile stuff to update
if(Bukkit.getServer().getPlayer(playerName) != null)
{
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
if(targetPlayer.isOnline())
{
targetPlayer.kickPlayer("[mcMMO] Stats have been reset! Rejoin!");
Users.removeUserByName(playerName);
} else {
Users.removeUser(targetPlayer);
OfflinePlayer player = plugin.getServer().getOfflinePlayer(playerName);
PlayerProfile playerProfile = Users.getProfile(player);
if (playerProfile != null) {
Users.getProfiles().remove(playerProfile);
if (player.isOnline()) {
Users.addUser((Player) player);
}
} else {
Users.removeUserByName(playerName);
}
sender.sendMessage("[mcMMO] mcremove operation completed.");
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) {
plugin.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
return worked;
}
}
}

View File

@@ -7,180 +7,149 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
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.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
public class MctopCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (LoadProperties.useMySQL == false) {
/*
* POWER LEVEL INFO RETRIEVAL
*/
if (args.length == 0) {
int p = 1;
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
int n = 1 * p; // Position
for (String x : info) {
if (x != null) {
String digit = String.valueOf(n);
if (n < 10)
digit = "0" + String.valueOf(n);
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
}
if (args.length >= 1 && m.isInt(args[0])) {
int p = 1;
// Grab page value if specified
if (args.length >= 1) {
if (m.isInt(args[0])) {
p = Integer.valueOf(args[0]);
}
}
int pt = p;
if (p > 1) {
pt -= 1;
pt += (pt * 10);
pt = 10;
}
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
int n = 1 * pt; // Position
for (String x : info) {
if (x != null) {
String digit = String.valueOf(n);
if (n < 10)
digit = "0" + String.valueOf(n);
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
}
/*
* SKILL SPECIFIED INFO RETRIEVAL
*/
if (args.length >= 1 && Skills.isSkill(args[0])) {
int p = 1;
// Grab page value if specified
if (args.length >= 2) {
if (m.isInt(args[1])) {
p = Integer.valueOf(args[1]);
}
}
int pt = p;
if (p > 1) {
pt -= 1;
pt += (pt * 10);
pt = 10;
}
String firstLetter = args[0].substring(0, 1); // Get first letter
String remainder = args[0].substring(1); // Get remainder of word.
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /mctop [skill] [page]"; //TODO: Needs more locale.
String[] info = Leaderboard.retrieveInfo(args[0].toUpperCase(), p);
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
int n = 1 * pt; // Position
for (String x : info) {
if (x != null) {
String digit = String.valueOf(n);
if (n < 10)
digit = "0" + String.valueOf(n);
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
}
} else {
/*
* MYSQL LEADERBOARDS
*/
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
if (args.length >= 1 && Skills.isSkill(args[0])) {
/*
* Create a nice consistent capitalized leaderboard name
*/
String lowercase = args[0].toLowerCase(); // For the query
String firstLetter = args[0].substring(0, 1); // Get first letter
String remainder = args[0].substring(1); // Get remainder of word.
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
if (!Config.getInstance().getUseMySQL()) {
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]);
if (n2 > 1) {
// Figure out the 'page' here
n = 10;
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 ");
switch (args.length) {
case 0:
flatfileDisplay(1, "ALL", sender);
return true;
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)
break;
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 ");
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)
break;
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) {
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]);
if (n2 > 1) {
// Figure out the 'page' here
n = 10;
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 ");
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)
break;
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 ");
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)
break;
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));
}
}
}
case 1:
if (Misc.isInt(args[0])) {
flatfileDisplay(Integer.valueOf(args[0]), "ALL", sender);
}
else if (Skills.isSkill(args[0])) {
flatfileDisplay(1, args[0].toUpperCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
}
return true;
case 2:
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) {
flatfileDisplay(Integer.valueOf(args[1]), args[0].toUpperCase(), sender);
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
else {
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
switch (args.length) {
case 0:
sqlDisplay(1, powerlevel, sender);
return true;
case 1:
if (Misc.isInt(args[0])) {
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender);
}
else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
case 2:
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) {
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}
private void flatfileDisplay(int page, String skill, CommandSender sender) {
String[] info = Leaderboard.retrieveInfo(skill, page);
if (skill == "ALL") {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(skill) }));
}
int n = (page * 10) - 9; // Position
for (String x : info) {
if (x != null) {
String digit = String.valueOf(n);
if (n < 10) {
digit = "0" + digit;
}
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
}
private void sqlDisplay(int page, String query, CommandSender sender) {
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + query + ", user_id FROM " + tablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC ");
if (query == "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing") {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(query) }));
}
for (int i = (page * 10) - 9; i <= (page * 10); i++) {
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) {
break;
}
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + tablePrefix + "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));
}
}
}

View File

@@ -1,86 +1,108 @@
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ACommand implements CommandExecutor {
private final mcMMO plugin;
public ACommand() {}
public ACommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile PP;
String usage = ChatColor.RED + "Proper usage is /a <message>"; //TODO: Needs more locale.
// Console message?
if (!(sender instanceof Player) && args.length >= 1) {
String aMessage = args[0];
for (int i = 1; i <= args.length - 1; i++) {
aMessage = aMessage + " " + args[i];
}
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
Bukkit.getLogger().info("[A]<*Console*> " + aMessage);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
herp.sendMessage(aPrefix + aMessage);
}
return true;
}
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
return true;
}
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
switch (args.length) {
case 0:
if (sender instanceof Player) {
PP = Users.getProfile((Player) sender);
// Not a toggle, a message
if (PP.getPartyChatMode()) {
PP.togglePartyChat();
}
if (args.length >= 1) {
String aMessage = args[0];
for (int i = 1; i <= args.length - 1; i++) {
aMessage = aMessage + " " + args[i];
}
PP.toggleAdminChat();
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
Bukkit.getLogger().info("[A]<" + name + "> " + aMessage);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
herp.sendMessage(aPrefix + aMessage);
}
return true;
}
if (PP.getAdminChatMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
}
}
else {
sender.sendMessage(usage);
}
if(player != null)
{
PlayerProfile PP = Users.getProfile(player);
if (PP.getPartyChatMode())
PP.togglePartyChat();
PP.toggleAdminChat();
if (PP.getAdminChatMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
}
}
return true;
}
return true;
default:
String message = args[0];
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
}
if (sender instanceof Player) {
Player player = (Player) sender;
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
message = chatEvent.getMessage();
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
plugin.getLogger().info("[A]<" + player.getName() + "> " + message);
for (Player p : plugin.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp()) {
p.sendMessage(prefix + message);
}
}
}
else {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
message = chatEvent.getMessage();
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
plugin.getLogger().info("[A]<*Console*> " + message);
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp()) {
player.sendMessage(prefix + message);
}
}
}
return true;
}
}
}

View File

@@ -1,47 +1,70 @@
package com.gmail.nossr50.commands.party;
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class AcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
private final mcMMO plugin;
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
public AcceptCommand (mcMMO plugin) {
this.plugin = plugin;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!mcPermissions.getInstance().party(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
if (PP.hasPartyInvite()) {
Party Pinstance = Party.getInstance();
Player player = (Player) sender;
PlayerProfile playerProfile = Users.getProfile(player);
if (PP.inParty()) {
Pinstance.removeFromParty(player, PP);
}
PP.acceptInvite();
Pinstance.addToParty(player, PP, PP.getParty(), true);
if (playerProfile.hasPartyInvite()) {
PartyManager partyManagerInstance = PartyManager.getInstance();
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites"));
}
if (playerProfile.inParty()) {
Party party = playerProfile.getParty();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), playerProfile.getInvite().getName(), EventReason.CHANGED_PARTIES);
return true;
}
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyManagerInstance.removeFromParty(player.getName(), party);
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, playerProfile.getInvite().getName(), EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
}
partyManagerInstance.joinInvitedParty(player, playerProfile);
}
else {
player.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
}
return true;
}
}

View File

@@ -6,63 +6,69 @@ 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.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
//TODO: Make this work from console.
public class InviteCommand implements CommandExecutor {
private final mcMMO plugin;
private final mcMMO plugin;
public InviteCommand(mcMMO instance) {
this.plugin = instance;
}
public InviteCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /invite <player>"; //TODO: Needs more locale.
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
if (!mcPermissions.getInstance().party(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
switch (args.length) {
case 1:
Player player = (Player) sender;
PlayerProfile playerProfile = Users.getProfile(player);
Party Pinstance = Party.getInstance();
if (!playerProfile.inParty()) {
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true;
}
if (!PP.inParty()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.NotInParty"));
return true;
}
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Usage is /invite <playername>");
return true;
}
if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
if (Pinstance.canInvite(player, PP)) {
Player target = plugin.getServer().getPlayer(args[0]);
PlayerProfile PPt = Users.getProfile(target);
PPt.modifyInvite(PP.getParty());
Player target = plugin.getServer().getPlayer(args[0]);
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" }));
} else {
player.sendMessage(mcLocale.getString("Party.Locked"));
return true;
}
}
if (target != null) {
if (PartyManager.getInstance().canInvite(player, playerProfile)) {
Party party = playerProfile.getParty();
Users.getProfile(target).setInvite(party);
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", new Object[] {party.getName(), player.getName()}));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true;
}
else {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
}
return true;
}
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,94 +1,127 @@
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class PCommand implements CommandExecutor {
public PCommand() {}
private final mcMMO plugin;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public PCommand (mcMMO plugin) {
this.plugin = plugin;
}
// Console message?
if (!(sender instanceof Player)) {
if (args.length < 2)
return true;
String pMessage = args[1];
for (int i = 2; i <= args.length - 1; i++) {
pMessage = pMessage + " " + args[i];
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile PP;
String usage = ChatColor.RED + "Proper usage is /p <party-name> <message>"; //TODO: Needs more locale.
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
Bukkit.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + pMessage);
switch (args.length) {
case 0:
if (sender instanceof Player) {
PP = Users.getProfile((Player) sender);
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (Users.getProfile(herp).inParty()) {
if (Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) {
herp.sendMessage(pPrefix + pMessage);
}
}
}
return true;
}
if (PP.getAdminChatMode()) {
PP.toggleAdminChat();
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
PP.togglePartyChat();
if (!mcPermissions.getInstance().party(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (PP.getPartyChatMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
}
}
else {
sender.sendMessage(usage);
}
// Not a toggle, a message
return true;
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];
}
default:
if (sender instanceof Player) {
Player player = (Player) sender;
Party party = Users.getProfile(player).getParty();
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") ";
Bukkit.getLogger().info("[P](" + PP.getParty() + ")<" + name + "> " + pMessage);
if (party == null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true;
}
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (Users.getProfile(herp).inParty()) {
if (Party.getInstance().inSameParty(herp, player))
herp.sendMessage(pPrefix + pMessage);
}
}
String message = args[0];
return true;
}
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
}
if (PP.getAdminChatMode())
PP.toggleAdminChat();
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(player.getName(), party.getName(), message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
PP.togglePartyChat();
if (chatEvent.isCancelled()) {
return true;
}
if (PP.getPartyChatMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOn"));
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOff"));
}
message = chatEvent.getMessage();
String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
return true;
}
plugin.getLogger().info("[P](" + party.getName() + ")" + "<" + player.getName() + "> " + message);
for (Player member : party.getOnlineMembers()) {
member.sendMessage(prefix + message);
}
}
else {
if (args.length < 2) {
sender.sendMessage(usage);
return true;
}
if (!PartyManager.getInstance().isParty(args[0])) {
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return true;
}
String message = args[1];
for (int i = 2; i < args.length; i++) {
message = message + " " + args [i];
}
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
message = chatEvent.getMessage();
String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
plugin.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + message);
for (Player member : PartyManager.getInstance().getOnlineMembers(args[0])) {
member.sendMessage(prefix + message);
}
}
return true;
}
}
}

View File

@@ -1,225 +1,242 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Server;
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class PartyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
private final mcMMO plugin;
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
public PartyCommand (mcMMO plugin) {
this.plugin = plugin;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!mcPermissions.getInstance().party(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
Party Pinstance = Party.getInstance();
Player player = (Player) sender;
String playerName = player.getName();
PlayerProfile playerProfile = Users.getProfile(player);
if (PP.inParty() && (!Pinstance.isParty(PP.getParty()) || !Pinstance.isInParty(player, PP))) {
Pinstance.addToParty(player, PP, PP.getParty(), false);
}
PartyManager partyManagerInstance = PartyManager.getInstance();
Party party = playerProfile.getParty();
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 " }));
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 (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
tempList += ChatColor.GOLD + p.getName();
x++;
} else {
tempList += ChatColor.WHITE + p.getName();
x++;
}
}
if (p != null && x < Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) {
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
tempList += ChatColor.GOLD + p.getName() + ", ";
x++;
} else {
tempList += ChatColor.WHITE + p.getName() + ", ";
x++;
}
}
}
}
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);
switch (args.length) {
case 0:
if (party == null) {
player.sendMessage(LocaleLoader.getString("Party.Help.0"));
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(LocaleLoader.getString("Party.Help.2"));
}
else {
Server server = plugin.getServer();
String leader = party.getLeader();
StringBuffer tempList = new StringBuffer();
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 " }));
} else if (args[0].equalsIgnoreCase("lock")) {
if (PP.inParty()) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
Pinstance.lockParty(PP.getParty());
player.sendMessage(mcLocale.getString("Party.Locked"));
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else {
player.sendMessage(mcLocale.getString("Party.InvalidName"));
}
} else if (args[0].equalsIgnoreCase("unlock")) {
if (PP.inParty()) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
Pinstance.unlockParty(PP.getParty());
player.sendMessage(mcLocale.getString("Party.Unlocked"));
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else {
player.sendMessage(mcLocale.getString("Party.InvalidName"));
}
// Party debugging command.
// } else if (args[0].equalsIgnoreCase("dump")) {
// Pinstance.dump(player);
} else {
if (PP.inParty()) {
Pinstance.removeFromParty(player, PP);
}
Pinstance.addToParty(player, PP, args[0], false);
return true;
}
} else if (args.length == 2 && PP.inParty()) {
if (args[0].equalsIgnoreCase("password")) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
if (Pinstance.isPartyLocked(PP.getParty())) {
Pinstance.setPartyPassword(PP.getParty(), args[1]);
player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] { args[1] }));
} else {
player.sendMessage(mcLocale.getString("Party.IsntLocked"));
}
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else if (args[0].equalsIgnoreCase("kick")) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
if (Pinstance.isPartyLocked(PP.getParty())) {
Player tPlayer = null;
if (Bukkit.getServer().getPlayer(args[1]) != null)
tPlayer = Bukkit.getServer().getPlayer(args[1]);
if (tPlayer == null) {
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
}
if (!Pinstance.inSameParty(player, tPlayer)) {
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { tPlayer.getName() }));
} else {
// Not an admin
if (!mcPermissions.getInstance().admin(player)) {
// Can't kick an admin
if (mcPermissions.getInstance().admin(tPlayer)) {
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { tPlayer.getName() }));
}
}
PlayerProfile tPP = Users.getProfile(tPlayer);
for (String otherPlayerName : party.getMembers()) {
if (leader.equals(otherPlayerName)) {
tempList.append(ChatColor.GOLD);
}
else if (server.getPlayer(otherPlayerName) != null) {
tempList.append(ChatColor.WHITE);
}
else {
tempList.append(ChatColor.GRAY);
}
Pinstance.removeFromParty(tPlayer, tPP);
tempList.append(otherPlayerName + " ");
}
tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
}
} else {
player.sendMessage(mcLocale.getString("Party.IsntLocked"));
}
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else if (args[0].equalsIgnoreCase("owner")) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
Player tPlayer = null;
if (Bukkit.getServer().getPlayer(args[1]) != null)
tPlayer = Bukkit.getServer().getPlayer(args[1]);
if (tPlayer == null) {
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] }));
}
if (!Pinstance.inSameParty(player, tPlayer)) {
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { tPlayer.getName() }));
} else {
Pinstance.setPartyLeader(PP.getParty(), tPlayer.getName());
}
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else {
Pinstance.removeFromParty(player, PP);
Pinstance.addToParty(player, PP, args[0], false, args[1]);
}
} else if (args.length == 2 && !PP.inParty()) {
Pinstance.addToParty(player, PP, args[0], false, args[1]);
}
player.sendMessage(LocaleLoader.getString("Commands.Party.InParty", new Object[] {party.getName()}));
player.sendMessage(LocaleLoader.getString("Commands.Party.Members", new Object[] {tempList}));
}
return true;
}
return true;
case 1:
if (args[0].equalsIgnoreCase("q")) {
if (party != null) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), null, EventReason.LEFT_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyManagerInstance.removeFromParty(playerName, party);
player.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
}
else {
player.sendMessage("Commands.Party.None");
}
}
else if (args[0].equals("?")) {
player.sendMessage(LocaleLoader.getString("Party.Help.3"));
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(LocaleLoader.getString("Party.Help.4"));
player.sendMessage(LocaleLoader.getString("Party.Help.5"));
player.sendMessage(LocaleLoader.getString("Party.Help.6"));
player.sendMessage(LocaleLoader.getString("Party.Help.7"));
}
else if (args[0].equalsIgnoreCase("lock")) {
if (party != null) {
if (party.getLeader().equals(playerName)) {
if (party.isLocked()) {
player.sendMessage(LocaleLoader.getString("Party.IsLocked"));
}
else {
party.setLocked(true);
player.sendMessage(LocaleLoader.getString("Party.Locked"));
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else {
player.sendMessage("Commands.Party.None");
}
}
else if (args[0].equalsIgnoreCase("unlock")) {
if (party != null) {
if (party.getLeader().equals(playerName)) {
if (!party.isLocked()) {
player.sendMessage(LocaleLoader.getString("Party.IsntLocked"));
}
else {
party.setLocked(false);
player.sendMessage(LocaleLoader.getString("Party.Unlocked"));
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else {
player.sendMessage("Commands.Party.None");
}
}
else {
if (party != null) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyManagerInstance.removeFromParty(playerName, party);
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
}
partyManagerInstance.joinParty(player, playerProfile, args[0], null);
}
return true;
case 2:
if (playerProfile.inParty()) {
if (args[0].equalsIgnoreCase("password")) {
if (party.getLeader().equals(playerName)) {
party.setLocked(true);
party.setPassword(args[1]);
player.sendMessage(LocaleLoader.getString("Party.PasswordSet", new Object[] {args[1]}));
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else if (args[0].equalsIgnoreCase("kick")) {
if (party.getLeader().equals(playerName)) {
if (!party.getMembers().contains(args[1])) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true;
}
else {
String partyName = party.getName();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyManagerInstance.removeFromParty(args[1], party);
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else if (args[0].equalsIgnoreCase("owner")) {
if (party.getLeader().equals(playerName)) {
if (!party.getMembers().contains(args[1])) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true;
}
else {
partyManagerInstance.setPartyLeader(args[1], party);
}
}
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyManagerInstance.removeFromParty(playerName, party);
partyManagerInstance.joinParty(player, playerProfile, args[0], args[1]);
}
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyManagerInstance.joinParty(player, playerProfile, args[0], args[1]);
}
return true;
default:
player.sendMessage(LocaleLoader.getString("Party.Help.0"));
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(LocaleLoader.getString("Party.Help.2"));
return true;
}
}
}

View File

@@ -6,70 +6,83 @@ 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.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class PtpCommand implements CommandExecutor {
private final mcMMO plugin;
private final mcMMO plugin;
public PtpCommand(mcMMO instance) {
this.plugin = instance;
}
public PtpCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /ptp <player>"; //TODO: Needs more locale.
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ptp")) {
return true;
}
if (!mcPermissions.getInstance().partyTeleport(player)) {
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!");
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.");
return true;
}
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>");
return true;
}
if (plugin.getServer().getPlayer(args[0]) == null) {
player.sendMessage("That is not a valid player");
}
switch (args.length) {
case 1:
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (plugin.getServer().getPlayer(args[0]) != null) {
Player target = plugin.getServer().getPlayer(args[0]);
PlayerProfile PPt = Users.getProfile(target);
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.");
} else {
player.sendMessage(ChatColor.RED + "That player is in a different party than you.");
}
}
if (PP.getRecentlyHurt() + (Config.getInstance().getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", new Object[] { Config.getInstance().getPTPCommandCooldown() }));
return true;
}
return true;
}
}
Player target = plugin.getServer().getPlayer(args[0]);
if (player.equals(target)) {
player.sendMessage("You can't teleport to yourself!"); //TODO: Use locale
return true;
}
if (target == null) {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
}
if (target.isDead()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead"));
return true;
}
if (PartyManager.getInstance().inSameParty(player, target)) {
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, PP.getParty().getName());
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
player.teleport(target);
player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", new Object[] { target.getName() }));
target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", new Object[] { player.getName() }));
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { target.getName() }));
return true;
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,56 +1,90 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class AcrobaticsCommand extends SkillCommand {
private String dodgeChance;
private String rollChance;
private String gracefulRollChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canDodge;
private boolean canRoll;
private boolean canGracefulRoll;
String dodgepercentage;
float skillvalue = (float) PP.getSkillLevel(SkillType.ACROBATICS);
String percentage = String.valueOf((skillvalue / 1000) * 100);
String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2);
public AcrobaticsCommand() {
super(SkillType.ACROBATICS);
}
if (PP.getSkillLevel(SkillType.ACROBATICS) <= 800)
dodgepercentage = String.valueOf((skillvalue / 4000 * 100));
else
dodgepercentage = "20";
@Override
protected void dataCalculations() {
if (skillValue >= 1000) {
dodgeChance = "20.00%";
rollChance = "100.00%";
gracefulRollChance = "100.00%";
}
else if (skillValue >= 800) {
dodgeChance = "20.00%";
rollChance = percent.format(skillValue / 1000);
gracefulRollChance = "100.00%";
}
else if (skillValue >= 500) {
dodgeChance = percent.format(skillValue / 4000);
rollChance = percent.format(skillValue / 1000);
gracefulRollChance = "100.00%";
}
else {
dodgeChance = percent.format(skillValue / 4000);
rollChance = percent.format(skillValue / 1000);
gracefulRollChance = percent.format(skillValue / 500);
}
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAcrobatics") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAcrobatics") }));
@Override
protected void permissionsCheck() {
canDodge = permInstance.dodge(player);
canRoll = permInstance.roll(player);
canGracefulRoll = permInstance.gracefulRoll(player);
}
if (mcPermissions.getInstance().acrobatics(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
@Override
protected boolean effectsHeaderPermissions() {
return canDodge || canGracefulRoll || canRoll;
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics1_0"), mcLocale.getString("m.EffectsAcrobatics1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics2_0"), mcLocale.getString("m.EffectsAcrobatics2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics3_0"), mcLocale.getString("m.EffectsAcrobatics3_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
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;
}
@Override
protected void effectsDisplay() {
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1") }));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3") }));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canDodge || canGracefulRoll || canRoll;
}
@Override
protected void statsDisplay() {
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
}
}
}

View File

@@ -1,66 +1,80 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class ArcheryCommand extends SkillCommand {
private String skillShotBonus;
private String dazeChance;
private String retrieveChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canSkillShot;
private boolean canDaze;
private boolean canRetrieve;
float skillvalue = (float) PP.getSkillLevel(SkillType.ARCHERY);
String percentage = String.valueOf((skillvalue / 1000) * 100);
public ArcheryCommand() {
super(SkillType.ARCHERY);
}
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;
@Override
protected void dataCalculations() {
if (skillValue >= 1000) {
skillShotBonus = "200.00%";
dazeChance = "50.00%";
retrieveChance = "100.00%";
}
else {
skillShotBonus = percent.format(((int) skillValue / 50) * 0.1D); //TODO: Not sure if this is the best way to calculate this or not...
dazeChance = percent.format(skillValue / 2000);
retrieveChance = percent.format(skillValue / 1000);
}
}
String percentagedaze;
if (PP.getSkillLevel(SkillType.ARCHERY) < 1000)
percentagedaze = String.valueOf((skillvalue / 2000) * 100);
else
percentagedaze = "50";
@Override
protected void permissionsCheck() {
canSkillShot = permInstance.archeryBonus(player);
canDaze = permInstance.daze(player);
canRetrieve = permInstance.trackArrows(player);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillArchery") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainArchery") }));
@Override
protected boolean effectsHeaderPermissions() {
return canSkillShot || canDaze || canRetrieve;
}
if (mcPermissions.getInstance().archery(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
@Override
protected void effectsDisplay() {
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") }));
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1") }));
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.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);
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") }));
}
return true;
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canSkillShot || canDaze || canRetrieve;
}
@Override
protected void statsDisplay() {
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
}
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
}
}
}

View File

@@ -1,68 +1,108 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class AxesCommand extends SkillCommand {
private String critChance;
private String bonusDamage;
private String impactDamage;
private String greaterImpactDamage;
private String skullSplitterLength;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canSkullSplitter;
private boolean canCritical;
private boolean canBonusDamage;
private boolean canImpact;
private boolean canGreaterImpact;
String percentage;
public AxesCommand() {
super(SkillType.AXES);
}
float skillvalue = (float) PP.getSkillLevel(SkillType.AXES);
if (PP.getSkillLevel(SkillType.AXES) < 750)
percentage = String.valueOf((skillvalue / 2000) * 100);
else
percentage = "37.5";
int bonusDmg = Users.getProfile(player).getSkillLevel(SkillType.AXES)/50;
if(bonusDmg > 4)
bonusDmg = 4;
@Override
protected void dataCalculations() {
impactDamage = String.valueOf(5 + ((int) skillValue / 30));
skullSplitterLength = String.valueOf(2 + ((int) skillValue / 50));
greaterImpactDamage = "2";
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;
ticks++;
}
if (skillValue >= 750) {
critChance = "37.50";
bonusDamage = "4";
}
else if (skillValue >= 200) {
critChance = percent.format(skillValue / 2000);
bonusDamage = "4";
}
else {
critChance = percent.format(skillValue / 2000);
bonusDamage = String.valueOf((int) skillValue / 50);
}
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAxes") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAxes") }));
@Override
protected void permissionsCheck() {
canSkullSplitter = permInstance.skullSplitter(player);
canCritical = permInstance.criticalHit(player);
canBonusDamage = permInstance.axeBonus(player);
canImpact = permInstance.impact(player);
canGreaterImpact = permInstance.greaterImpact(player);
}
if (mcPermissions.getInstance().axes(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
@Override
protected boolean effectsHeaderPermissions() {
return canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact;
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
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 }));
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 }));
@Override
protected void effectsDisplay() {
if (canSkullSplitter) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1") }));
}
return true;
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3") }));
}
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5") }));
}
if (canImpact) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7") }));
}
if (canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact;
}
@Override
protected void statsDisplay() {
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", new Object[] {bonusDamage}) }));
}
if (canImpact) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", new Object[] {impactDamage}) }));
}
if (canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }));
}
if (canSkullSplitter) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.SS.Length", new Object[] { skullSplitterLength }));
}
}
}

View File

@@ -1,50 +1,55 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class ExcavationCommand extends SkillCommand {
private String gigaDrillBreakerLength;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canGigaDrill;
private boolean canTreasureHunt;
int ticks = 2;
int x = PP.getSkillLevel(SkillType.EXCAVATION);
while (x >= 50) {
x -= 50;
ticks++;
}
public ExcavationCommand() {
super(SkillType.EXCAVATION);
}
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") }));
@Override
protected void dataCalculations() {
gigaDrillBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
}
if (mcPermissions.getInstance().excavation(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
@Override
protected void permissionsCheck() {
canGigaDrill = permInstance.gigaDrillBreaker(player);
canTreasureHunt = permInstance.excavationTreasures(player);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
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.ExcavationGigaDrillBreakerLength", new Object[] { ticks }));
@Override
protected boolean effectsHeaderPermissions() {
return canGigaDrill || canTreasureHunt;
}
Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args);
return true;
}
@Override
protected void effectsDisplay() {
if (canGigaDrill) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.0"), LocaleLoader.getString("Excavation.Effect.1") }));
}
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.2"), LocaleLoader.getString("Excavation.Effect.3") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canGigaDrill;
}
@Override
protected void statsDisplay() {
if (canGigaDrill) {
player.sendMessage(LocaleLoader.getString("Excavation.Effect.Length", new Object[] { gigaDrillBreakerLength }));
}
}
}

View File

@@ -1,50 +1,78 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Fishing;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.gathering.Fishing;
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.");
return true;
}
public class FishingCommand extends SkillCommand {
private int lootTier;
private String magicChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canTreasureHunt;
private boolean canMagicHunt;
private boolean canShake;
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillFishing") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainFishing") }));
public FishingCommand() {
super(SkillType.FISHING);
}
if (mcPermissions.getInstance().fishing(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
@Override
protected void dataCalculations() {
lootTier = Fishing.getFishingLootTier(profile);
magicChance = percent.format((float) lootTier / 15);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing1_0"), mcLocale.getString("m.EffectsFishing1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing2_0"), mcLocale.getString("m.EffectsFishing2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing3_0"), mcLocale.getString("m.EffectsFishing3_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
player.sendMessage(mcLocale.getString("m.FishingRank", new Object[] { Fishing.getFishingLootTier(PP) }));
player.sendMessage(mcLocale.getString("m.FishingMagicInfo"));
@Override
protected void permissionsCheck() {
canTreasureHunt = permInstance.fishingTreasures(player);
canMagicHunt = permInstance.fishingMagic(player);
canShake = permInstance.shakeMob(player);
}
if (PP.getSkillLevel(SkillType.FISHING) < 150)
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);
@Override
protected boolean effectsHeaderPermissions() {
return canTreasureHunt || canMagicHunt || canShake;
}
return true;
}
@Override
protected void effectsDisplay() {
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1") }));
}
if (canMagicHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3") }));
}
if (canShake) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canTreasureHunt || canMagicHunt || canShake;
}
@Override
protected void statsDisplay() {
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", new Object[] { lootTier }));
}
if (canMagicHunt) {
player.sendMessage(LocaleLoader.getString("Fishing.Enchant.Chance", new Object[] { magicChance }));
}
if (canShake) {
//TODO: Do we really need to display this twice? Not like there are any associated stats.
if (skillValue < 150) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake"));
}
}
}
}

View File

@@ -1,72 +1,141 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class HerbalismCommand extends SkillCommand {
private String greenTerraLength;
private String greenThumbChance;
private String greenThumbStage;
private String farmersDietRank;
private String doubleDropChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canGreenTerra;
private boolean canGreenThumbWheat;
private boolean canGreenThumbBlocks;
private boolean canFarmersDiet;
private boolean canDoubleDrop;
private boolean doubleDropsDisabled;
int bonus = 0;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 200)
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 400)
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600)
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 800)
bonus++;
if (PP.getSkillLevel(SkillType.HERBALISM) >= 1000)
bonus++;
public HerbalismCommand() {
super(SkillType.HERBALISM);
}
int ticks = 2;
int x = PP.getSkillLevel(SkillType.HERBALISM);
while (x >= 50) {
x -= 50;
ticks++;
}
@Override
protected void dataCalculations() {
greenTerraLength = String.valueOf(2 + ((int) skillValue / 50));
float skillvalue = (float) PP.getSkillLevel(SkillType.HERBALISM);
if (skillValue >= 1500) {
greenThumbChance = "100.00%";
greenThumbStage = "4";
farmersDietRank = "5";
doubleDropChance = "100.00%";
}
else if (skillValue >= 1000) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "4";
farmersDietRank = "5";
doubleDropChance = "100.00%";
}
else if (skillValue >= 800) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "4";
farmersDietRank = "4";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 600) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "4";
farmersDietRank = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 400) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "3";
farmersDietRank = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 200) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "2";
farmersDietRank = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "1";
farmersDietRank = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
}
String percentage = String.valueOf((skillvalue / 1000) * 100);
String gpercentage = String.valueOf((skillvalue / 1500) * 100);
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillHerbalism") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainHerbalism") }));
@Override
protected void permissionsCheck() {
Config configInstance = Config.getInstance();
if (mcPermissions.getInstance().herbalism(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
canGreenTerra = permInstance.greenTerra(player);
canGreenThumbWheat = permInstance.greenThumbWheat(player);
canGreenThumbBlocks = permInstance.greenThumbBlocks(player);
canFarmersDiet = permInstance.farmersDiet(player);
canDoubleDrop = permInstance.herbalismDoubleDrops(player);
doubleDropsDisabled = configInstance.herbalismDoubleDropsDisabled();
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
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);
@Override
protected boolean effectsHeaderPermissions() {
return canGreenTerra || (canDoubleDrop && !doubleDropsDisabled) || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat;
}
return true;
}
@Override
protected void effectsDisplay() {
if (canGreenTerra) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
}
if (canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3") }));
}
if (canGreenThumbBlocks) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5") }));
}
if (canFarmersDiet) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canGreenTerra || (canDoubleDrop && !doubleDropsDisabled) || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat;
}
@Override
protected void statsDisplay() {
if (canGreenTerra) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
}
if (canGreenThumbBlocks || canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
}
if (canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
}
if (canFarmersDiet) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } ));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
}
}
}

View File

@@ -1,132 +1,169 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
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.");
return true;
}
public class MiningCommand extends SkillCommand {
private String doubleDropChance;
private String superBreakerLength;
private String blastMiningRank;
private String blastRadiusIncrease;
private String blastDamageDecrease;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canSuperBreaker;
private boolean canDoubleDrop;
private boolean canBlast;
private boolean canBiggerBombs;
private boolean canDemoExpert;
private boolean doubleDropsDisabled;
float skillvalue = (float) PP.getSkillLevel(SkillType.MINING);
String percentage = String.valueOf((skillvalue / 1000) * 100);
int ticks = 2;
int x = PP.getSkillLevel(SkillType.MINING);
while (x >= 50) {
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") }));
public MiningCommand() {
super(SkillType.MINING);
}
if (mcPermissions.getInstance().mining(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
@Override
protected void dataCalculations() {
superBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
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;
}
if (skillValue >= 1000) {
blastMiningRank = "8";
blastDamageDecrease = "100.00%";
blastRadiusIncrease = "4";
doubleDropChance = "100.00%";
}
else if (skillValue >= 875) {
blastMiningRank = "7";
blastDamageDecrease = "50.00%";
blastRadiusIncrease = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 750) {
blastMiningRank = "6";
blastDamageDecrease = "50.00%";
blastRadiusIncrease = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 625) {
blastMiningRank = "5";
blastDamageDecrease = "25.00%";
blastRadiusIncrease = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 500) {
blastMiningRank = "4";
blastDamageDecrease = "25.00%";
blastRadiusIncrease = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 375) {
blastMiningRank = "3";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 250) {
blastMiningRank = "2";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 125) {
blastMiningRank = "1";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "0";
doubleDropChance = percent.format(skillValue / 1000);
}
else {
blastMiningRank = "0";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "0";
doubleDropChance = percent.format(skillValue / 1000);
}
}
@Override
protected void permissionsCheck() {
Config configInstance = Config.getInstance();
canBiggerBombs = permInstance.biggerBombs(player);
canBlast = permInstance.blastMining(player);
canDemoExpert = permInstance.demolitionsExpertise(player);
canDoubleDrop = permInstance.miningDoubleDrops(player);
canSuperBreaker = permInstance.superBreaker(player);
doubleDropsDisabled = configInstance.miningDoubleDropsDisabled();
}
@Override
protected boolean effectsHeaderPermissions() {
return canBiggerBombs || canBlast || canDemoExpert || (canDoubleDrop && !doubleDropsDisabled) || canSuperBreaker;
}
@Override
protected void effectsDisplay() {
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3") }));
}
if (canBlast) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5") }));
}
if (canBiggerBombs) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7") }));
}
if (canDemoExpert) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canBiggerBombs || canBlast || canDemoExpert || (canDoubleDrop && !doubleDropsDisabled) || canSuperBreaker;
}
@Override
protected void statsDisplay() {
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
}
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
}
if (canBlast) {
if (skillValue < 125) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (Misc.getInt(blastMiningRank) - 1)) }));
}
}
if (canBiggerBombs) {
if (skillValue < 250) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", new Object[] { blastRadiusIncrease }));
}
}
if (canDemoExpert) {
if (skillValue < 500) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", new Object[] { blastDamageDecrease }));
}
}
}
}

View File

@@ -1,54 +1,142 @@
package com.gmail.nossr50.commands.skills;
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.mcMMO;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Repair;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.Repairable;
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.");
return true;
}
public class RepairCommand extends SkillCommand {
private int arcaneForgingRank;
private String repairMasteryBonus;
private String superRepairChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canSuperRepair;
private boolean canMasterRepair;
private boolean canArcaneForge;
private boolean canRepairStone;
private boolean canRepairIron;
private boolean canRepairGold;
private boolean canRepairDiamond;
private boolean canRepairString;
private boolean canRepairLeather;
private boolean canRepairWood;
float skillvalue = (float) PP.getSkillLevel(SkillType.REPAIR);
String percentage = String.valueOf((skillvalue / 1000) * 100);
String repairmastery = String.valueOf((skillvalue / 500) * 100);
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillRepair") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainRepair") }));
private int diamondLevel;
private int goldLevel;
private int ironLevel;
private int stoneLevel;
if (mcPermissions.getInstance().repair(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
public RepairCommand() {
super(SkillType.REPAIR);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair1_0"), mcLocale.getString("m.EffectsRepair1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair2_0"), mcLocale.getString("m.EffectsRepair2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair3_0"), mcLocale.getString("m.EffectsRepair3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair4_0", new Object[] { LoadProperties.repairdiamondlevel }), mcLocale.getString("m.EffectsRepair4_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair5_0"), mcLocale.getString("m.EffectsRepair5_1") }));
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.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;
}
@Override
protected void dataCalculations() {
// We're using pickaxes here, not the best but it works
Repairable diamondRepairable = mcMMO.repairManager.getRepairable(278);
Repairable goldRepairable = mcMMO.repairManager.getRepairable(285);
Repairable ironRepairable = mcMMO.repairManager.getRepairable(257);
Repairable stoneRepairable = mcMMO.repairManager.getRepairable(274);
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel();
ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel();
stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel();
repairMasteryBonus = percent.format(skillValue / 500);
if (skillValue >= 1000) {
superRepairChance = "100.00%";
}
else {
superRepairChance = percent.format(skillValue / 1000);
}
arcaneForgingRank = Repair.getArcaneForgingRank(profile);
}
@Override
protected void permissionsCheck() {
canSuperRepair = permInstance.repairBonus(player);
canMasterRepair = permInstance.repairMastery(player);
canArcaneForge = permInstance.arcaneForging(player);
canRepairDiamond = permInstance.diamondRepair(player);
canRepairGold = permInstance.goldRepair(player);
canRepairIron = permInstance.ironRepair(player);
canRepairStone = permInstance.stoneRepair(player);
canRepairString = permInstance.stringRepair(player);
canRepairLeather = permInstance.leatherRepair(player);
canRepairWood = permInstance.woodRepair(player);
}
@Override
protected boolean effectsHeaderPermissions() {
return canArcaneForge || canRepairDiamond || canRepairGold || canRepairIron || canMasterRepair || canRepairStone || canSuperRepair || canRepairString || canRepairWood || canRepairLeather;
}
@Override
protected void effectsDisplay() {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.0"), LocaleLoader.getString("Repair.Effect.1") }));
if (canMasterRepair) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.2"), LocaleLoader.getString("Repair.Effect.3") }));
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.4"), LocaleLoader.getString("Repair.Effect.5") }));
}
/* Repair Level Requirements */
if (canRepairStone && stoneLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.14", new Object[] { stoneLevel }), LocaleLoader.getString("Repair.Effect.15") }));
}
if (canRepairIron && ironLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.12", new Object[] { ironLevel }), LocaleLoader.getString("Repair.Effect.13") }));
}
if (canRepairGold && goldLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.10", new Object[] { goldLevel }), LocaleLoader.getString("Repair.Effect.11") }));
}
if (canRepairDiamond && diamondLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.6", new Object[] { diamondLevel }), LocaleLoader.getString("Repair.Effect.7") }));
}
if (canArcaneForge) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canArcaneForge || canMasterRepair || canSuperRepair;
}
@Override
protected void statsDisplay() {
if (canMasterRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Mastery", new Object[] { repairMasteryBonus }));
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }));
}
if (canArcaneForge) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank }));
if (Config.getInstance().getArcaneForgingEnchantLossEnabled()) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", new Object[] { Repair.getEnchantChance(arcaneForgingRank) }));
}
if (Config.getInstance().getArcaneForgingDowngradeEnabled()) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", new Object[] { Repair.getDowngradeChance(arcaneForgingRank) }));
}
}
}
}

View File

@@ -1,72 +1,91 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class SwordsCommand extends SkillCommand {
private String counterAttackChance;
private String bleedLength;
private String bleedChance;
private String serratedStrikesLength;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canCounter;
private boolean canSerratedStrike;
private boolean canBleed;
int bleedrank = 2;
String percentage, counterattackpercentage;
public SwordsCommand() {
super(SkillType.SWORDS);
}
float skillvalue = (float) PP.getSkillLevel(SkillType.SWORDS);
if (PP.getSkillLevel(SkillType.SWORDS) < 750)
percentage = String.valueOf((skillvalue / 1000) * 100);
else
percentage = "75";
@Override
protected void dataCalculations() {
serratedStrikesLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillvalue >= 750)
bleedrank += 1;
if (skillValue >= 750) {
bleedLength = "3";
bleedChance = "75.00%";
counterAttackChance = "30.00%";
}
else if (skillValue >= 600) {
bleedLength = "2";
bleedChance = percent.format(skillValue / 1000);
counterAttackChance = "30.00%";
}
else {
bleedLength = "2";
bleedChance = percent.format(skillValue / 1000);
counterAttackChance = percent.format(skillValue / 2000);
}
}
if (PP.getSkillLevel(SkillType.SWORDS) <= 600)
counterattackpercentage = String.valueOf((skillvalue / 2000) * 100);
else
counterattackpercentage = "30";
@Override
protected void permissionsCheck() {
canBleed = permInstance.swordsBleed(player);
canCounter = permInstance.counterAttack(player);
canSerratedStrike = permInstance.serratedStrikes(player);
}
int ticks = 2;
int x = PP.getSkillLevel(SkillType.SWORDS);
while (x >= 50) {
x -= 50;
ticks++;
}
@Override
protected boolean effectsHeaderPermissions() {
return canBleed || canCounter || canSerratedStrike;
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillSwords") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainSwords") }));
if (mcPermissions.getInstance().swords(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords3_0"), mcLocale.getString("m.EffectsSwords3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords5_0"), mcLocale.getString("m.EffectsSwords5_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
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.SwordsBleedChance", new Object[] { percentage }));
player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] { ticks }));
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);
@Override
protected void effectsDisplay() {
if (canCounter) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1") }));
}
return true;
}
if (canSerratedStrike) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5") }));
}
if (canBleed) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canBleed || canCounter || canSerratedStrike;
}
@Override
protected void statsDisplay() {
if (canCounter) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
}
if (canBleed) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
}
if (canSerratedStrike) {
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", new Object[] { serratedStrikesLength }));
}
}
}

View File

@@ -1,78 +1,145 @@
package com.gmail.nossr50.commands.skills;
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.commands.SkillCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class TamingCommand extends SkillCommand {
private String goreChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canBeastLore;
private boolean canGore;
private boolean canSharpenedClaws;
private boolean canEnvironmentallyAware;
private boolean canThickFur;
private boolean canShockProof;
private boolean canCallWild;
private boolean canFastFood;
float skillvalue = (float) PP.getSkillLevel(SkillType.TAMING);
String percentage = String.valueOf((skillvalue / 1000) * 100);
public TamingCommand() {
super(SkillType.TAMING);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillTaming") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainTaming") }));
@Override
protected void dataCalculations() {
if (skillValue >= 1000) {
goreChance = "100.00%";
}
else {
goreChance = percent.format(skillValue / 1000);
} }
if (mcPermissions.getInstance().taming(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
@Override
protected void permissionsCheck() {
canBeastLore = permInstance.beastLore(player);
canCallWild = permInstance.callOfTheWild(player);
canEnvironmentallyAware = permInstance.environmentallyAware(player);
canFastFood = permInstance.fastFoodService(player);
canGore = permInstance.gore(player);
canSharpenedClaws = permInstance.sharpenedClaws(player);
canShockProof = permInstance.shockProof(player);
canThickFur = permInstance.thickFur(player);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming1_0"), mcLocale.getString("m.EffectsTaming1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming2_0"), mcLocale.getString("m.EffectsTaming2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming3_0"), mcLocale.getString("m.EffectsTaming3_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming4_0"), mcLocale.getString("m.EffectsTaming4_1") }));
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") }));
@Override
protected boolean effectsHeaderPermissions() {
return canBeastLore || canCallWild || canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur;
}
if (PP.getSkillLevel(SkillType.TAMING) < 100)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming1") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming1_0"), mcLocale.getString("m.AbilBonusTaming1_1") }));
@Override
protected void effectsDisplay() {
Config configInstance = Config.getInstance();
if (PP.getSkillLevel(SkillType.TAMING) < 250)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming2") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming2_0"), mcLocale.getString("m.AbilBonusTaming2_1") }));
if (canBeastLore) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1") }));
}
if (PP.getSkillLevel(SkillType.TAMING) < 500)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming3") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming3_0"), mcLocale.getString("m.AbilBonusTaming3_1") }));
if (canGore) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3") }));
}
if (PP.getSkillLevel(SkillType.TAMING) < 750)
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);
if (canSharpenedClaws) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5") }));
}
return true;
}
if (canEnvironmentallyAware) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7") }));
}
if (canThickFur) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9") }));
}
if (canShockProof) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11") }));
}
if (canFastFood) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17") }));
}
if (canCallWild) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13") }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.14", new Object[] { configInstance.getTamingCOTWOcelotCost() }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.15", new Object[] { configInstance.getTamingCOTWWolfCost() }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur;
}
@Override
protected void statsDisplay() {
if (canFastFood) {
if (skillValue < 50) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.4") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9") }));
}
}
if (canEnvironmentallyAware) {
if (skillValue < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1") }));
}
}
if (canThickFur) {
if (skillValue < 250) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3") }));
}
}
if (canShockProof) {
if (skillValue < 500) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.2") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5") }));
}
}
if (canSharpenedClaws) {
if (skillValue < 750) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.3") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7") }));
}
}
if (canGore) {
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
}
}
}

View File

@@ -1,75 +1,97 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class UnarmedCommand extends SkillCommand {
private String berserkLength;
private String deflectChance;
private String disarmChance;
private String ironArmBonus;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
private boolean canBerserk;
private boolean canDisarm;
private boolean canBonusDamage;
private boolean canDeflect;
String percentage, arrowpercentage;
float skillvalue = (float) PP.getSkillLevel(SkillType.UNARMED);
public UnarmedCommand() {
super(SkillType.UNARMED);
}
if (PP.getSkillLevel(SkillType.UNARMED) < 1000)
percentage = String.valueOf((skillvalue / 3000) * 100);
else
percentage = "33.3";
@Override
protected void dataCalculations() {
berserkLength = String.valueOf(2 + ((int) skillValue / 50));
if (PP.getSkillLevel(SkillType.UNARMED) < 1000)
arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
else
arrowpercentage = "50";
if (skillValue >= 1000) {
disarmChance = "33.33%";
deflectChance = "50.00%";
ironArmBonus = "8";
}
else if (skillValue >= 250) {
disarmChance = percent.format(skillValue / 3000);
deflectChance = percent.format(skillValue / 2000);
ironArmBonus = "8";
}
else {
disarmChance = percent.format(skillValue / 3000);
deflectChance = percent.format(skillValue / 2000);
ironArmBonus = String.valueOf(3 + ((int) skillValue / 50));
} }
int ticks = 2;
int x = PP.getSkillLevel(SkillType.UNARMED);
while (x >= 50) {
x -= 50;
ticks++;
}
int bonus = 3 + (PP.getSkillLevel(SkillType.UNARMED)/50);
if(bonus > 8)
bonus = 8;
@Override
protected void permissionsCheck() {
canBerserk = permInstance.berserk(player);
canBonusDamage = permInstance.unarmedBonus(player);
canDeflect = permInstance.deflect(player);
canDisarm = permInstance.disarm(player);
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillUnarmed") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainUnarmed") }));
@Override
protected boolean effectsHeaderPermissions() {
return canBerserk || canBonusDamage || canDeflect || canDisarm;
}
if (mcPermissions.getInstance().unarmed(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
@Override
protected void effectsDisplay() {
if (canBerserk) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.0"), LocaleLoader.getString("Unarmed.Effect.1") }));
}
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
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 (canDisarm) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.2"), LocaleLoader.getString("Unarmed.Effect.3") }));
}
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1", new Object[] {bonus}) }));
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.4"), LocaleLoader.getString("Unarmed.Effect.5") }));
}
player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] { ticks }));
Page.grabGuidePageForSkill(SkillType.UNARMED, player, args);
if (canDeflect) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.6"), LocaleLoader.getString("Unarmed.Effect.7") }));
}
}
return true;
}
@Override
protected boolean statsHeaderPermissions() {
return canBerserk || canBonusDamage || canDeflect || canDisarm;
}
@Override
protected void statsDisplay() {
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", new Object[] {ironArmBonus}) }));
}
if (canDeflect) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }));
}
if (canDisarm) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }));
}
if (canBerserk) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Berserk.Length", new Object[] { berserkLength }));
}
}
}

View File

@@ -1,59 +1,88 @@
package com.gmail.nossr50.commands.skills;
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.datatypes.PlayerProfile;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
public class WoodcuttingCommand extends SkillCommand {
private String treeFellerLength;
private String doubleDropChance;
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
float skillvalue = (float) PP.getSkillLevel(SkillType.WOODCUTTING);
int ticks = 2;
int x = PP.getSkillLevel(SkillType.WOODCUTTING);
while (x >= 50) {
x -= 50;
ticks++;
}
String percentage = String.valueOf((skillvalue / 1000) * 100);
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillWoodCutting") }));
player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainWoodCutting") }));
if (mcPermissions.getInstance().woodcutting(player))
player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting1_0"), mcLocale.getString("m.EffectsWoodCutting1_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting2_0"), mcLocale.getString("m.EffectsWoodCutting2_1") }));
player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting3_0"), mcLocale.getString("m.EffectsWoodCutting3_1") }));
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
if (PP.getSkillLevel(SkillType.WOODCUTTING) < 100)
player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockWoodCutting1") }));
else
player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusWoodCutting1_0"), mcLocale.getString("m.AbilBonusWoodCutting1_1") }));
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;
}
private boolean canTreeFell;
private boolean canLeafBlow;
private boolean canDoubleDrop;
private boolean doubleDropsDisabled;
public WoodcuttingCommand() {
super(SkillType.WOODCUTTING);
}
@Override
protected void dataCalculations() {
treeFellerLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 1000) {
doubleDropChance = "100.00%";
}
else {
doubleDropChance = percent.format(skillValue / 1000);
}
}
@Override
protected void permissionsCheck() {
Config configInstance = Config.getInstance();
canTreeFell = permInstance.treeFeller(player);
canDoubleDrop = permInstance.woodcuttingDoubleDrops(player);
canLeafBlow = permInstance.leafBlower(player);
doubleDropsDisabled = configInstance.woodcuttingDoubleDropsDisabled();
}
@Override
protected boolean effectsHeaderPermissions() {
return (canDoubleDrop && !doubleDropsDisabled) || canLeafBlow || canTreeFell;
}
@Override
protected void effectsDisplay() {
if (canTreeFell) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.0"), LocaleLoader.getString("Woodcutting.Effect.1") }));
}
if (canLeafBlow) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.2"), LocaleLoader.getString("Woodcutting.Effect.3") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.4"), LocaleLoader.getString("Woodcutting.Effect.5") }));
}
}
@Override
protected boolean statsHeaderPermissions() {
return (canDoubleDrop && !doubleDropsDisabled) || canLeafBlow || canTreeFell;
}
@Override
protected void statsDisplay() {
//TODO: Remove? Basically duplicates the above.
if (canLeafBlow) {
if (skillValue < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Woodcutting.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1") }));
}
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }));
}
if (canTreeFell) {
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Length", new Object[] { treeFellerLength }));
}
}
}

View File

@@ -1,50 +1,77 @@
package com.gmail.nossr50.commands.spout;
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.config.LoadProperties;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
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.");
return true;
}
private final mcMMO plugin;
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
public MchudCommand (mcMMO plugin) {
this.plugin = plugin;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if(args.length >= 1)
{
for(HUDType x : HUDType.values())
{
if(x.toString().toLowerCase().equals(args[0].toLowerCase()))
{
if(SpoutStuff.playerHUDs.containsKey(player))
{
SpoutStuff.playerHUDs.get(player).resetHUD();
SpoutStuff.playerHUDs.remove(player);
PP.setHUDType(x);
SpoutStuff.playerHUDs.put(player, new HUDmmo(player));
}
}
}
}
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /mchud <hud-type>"; //TODO: Locale
String invalid = ChatColor.RED + "That is not a valid HUD type."; //TODO: Locale
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
switch (args.length) {
case 1:
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
HUDType hud;
if (args[0].equalsIgnoreCase("disabled")) {
hud = HUDType.DISABLED;
}
else if (args[0].equalsIgnoreCase("standard")) {
hud = HUDType.STANDARD;
}
else if (args[0].equalsIgnoreCase("small")) {
hud = HUDType.SMALL;
}
else if (args[0].equalsIgnoreCase("retro")) {
hud = HUDType.RETRO;
}
else {
player.sendMessage(invalid);
return true;
}
if (SpoutStuff.playerHUDs.containsKey(player)) {
SpoutStuff.playerHUDs.get(player).resetHUD();
SpoutStuff.playerHUDs.remove(player);
PP.setHUDType(hud);
SpoutStuff.playerHUDs.put(player, new HUDmmo(player, plugin));
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -6,57 +6,76 @@ 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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
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.");
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /xplock [skill]";
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
if (PP.getXpBarLocked()) {
PP.setSkillLock(Skills.getSkillType(args[0]));
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
} else {
PP.setSkillLock(Skills.getSkillType(args[0]));
PP.toggleXpBarLocked();
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
}
SpoutStuff.updateXpBar(player);
} else if (args.length < 1) {
if (PP.getXpBarLocked()) {
PP.toggleXpBarLocked();
player.sendMessage(mcLocale.getString("Commands.xplock.unlocked"));
} else if (PP.getLastGained() != null) {
PP.toggleXpBarLocked();
PP.setSkillLock(PP.getLastGained());
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
}
} else if (args.length >= 1 && !Skills.isSkill(args[0])) {
player.sendMessage("Commands.xplock.invalid");
} else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
return true;
}
switch (args.length) {
case 0:
if (PP.getXpBarLocked()) {
PP.toggleXpBarLocked();
player.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
return true;
}
SkillType lastGained = PP.getLastGained();
if (lastGained != null) {
PP.toggleXpBarLocked();
PP.setSkillLock(lastGained);
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(lastGained.toString()) }));
return true;
}
case 1:
if (Skills.isSkill(args[0])) {
if (Permissions.getInstance().permission(player, "mcmmo.skills." + args[0].toLowerCase())) {
PP.setXpBarLocked(true);
PP.setSkillLock(Skills.getSkillType(args[0]));
SpoutStuff.updateXpBar(player);
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(args[0]) }));
return true;
}
else {
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return true;
}
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
default:
player.sendMessage(usage);
return true;
}
}
}

View File

@@ -0,0 +1,388 @@
package com.gmail.nossr50.config;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.gmail.nossr50.mcMMO;
public class Config extends ConfigLoader {
public int xpGainMultiplier = 1;
private static Config instance;
public static Config getInstance() {
if (instance == null) {
instance = new Config(mcMMO.p);
instance.load();
}
return instance;
}
/*
* GENERAL SETTINGS
*/
/* General Settings */
public String getLocale() { return config.getString("General.Locale", "en_us"); }
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
/* mySQL */
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
public String getMySQLDatabaseName() { return config.getString("MySQL.Database.Name", "DatabaseName"); }
public String getMySQLUserName() { return config.getString("MySQL.Database.User_Name", "UserName"); } //Really should be labeled under MySQL.User_Name instead...
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
public String getMySQLUserPassword() {
if (config.getString("MySQL.Database.User_Password", null) != null) {
return config.getString("MySQL.Database.User_Password", null);
}
else {
return "";
}
}
/* Hardcore Mode */
public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); }
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75); }
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism_Stat_Leech_Percentage", 5); }
public boolean getHardcoreVampirismEnabled() { return config.getBoolean("Hardcore.Vampirism", false); }
/* SMP Mods */
public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
/* Commands */
public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
public boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); }
public boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); }
public boolean getCommandAddLevelsEnabled() { return config.getBoolean("Commands.addlevels.Enabled", true); }
public boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); }
public boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); }
public boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); }
public boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); }
public boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); }
public boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); }
public boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); }
public boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); }
public boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); }
public boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); }
public boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); }
public boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); }
public boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); }
public boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); }
public boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); }
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); }
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
/* Items */
public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
/*
* ABILITY SETTINGS
*/
/* General Settings */
public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); }
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
/* Durability Settings */
public boolean getAbilitiesDamageTools() { return config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true); }
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 2); }
/* Cooldowns */
public int getAbilityCooldownGreenTerra() { return config.getInt("Abilities.Cooldowns.Green_Terra", 240); }
public int getAbilityCooldownSuperBreaker() { return config.getInt("Abilities.Cooldowns.Super_Breaker", 240); }
public int getAbilityCooldownGigaDrillBreaker() { return config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240); }
public int getAbilityCooldownTreeFeller() { return config.getInt("Abilities.Cooldowns.Tree_Feller", 240); }
public int getAbilityCooldownBerserk() { return config.getInt("Abilities.Cooldowns.Berserk", 240); }
public int getAbilityCooldownSerratedStrikes() { return config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240); }
public int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); }
public int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); }
/* Max ticks */
public int getAbilityMaxTicksGreenTerra() { return config.getInt("Abilities.Max_Seconds.Green_Terra", 0); }
public int getAbilityMaxTicksSuperBreaker() { return config.getInt("Abilities.Max_Seconds.Super_Breaker", 0); }
public int getAbilityMaxTicksGigaDrillBreaker() { return config.getInt("Abilities.Max_Seconds.Giga_Drill_Breaker", 0); }
public int getAbilityMaxTicksTreeFeller() { return config.getInt("Abilities.Max_Seconds.Tree_Feller", 0); }
public int getAbilityMaxTicksBerserk() { return config.getInt("Abilities.Max_Seconds.Berserk", 0); }
public int getAbilityMaxTicksSerratedStrikes() { return config.getInt("Abilities.Max_Seconds.Serrated_Strikes", 0); }
public int getAbilityMaxTicksSkullSplitter() { return config.getInt("Abilities.Max_Seconds.Skull_Splitter", 0); }
public int getAbilityMaxTicksBlastMining() { return config.getInt("Abilities.Max_Seconds.Blast_Mining", 0); }
/* Thresholds */
public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }
/*
* SKILL SETTINGS
*/
/* Tool Requirements */
public boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); }
public boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); }
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
/* Excavation */
public int getExcavationBaseXP() { return config.getInt("Experience.Excavation.Base", 40); }
/* Fishing */
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
public boolean getFishingDropsEnabled() { return config.getBoolean("Fishing.Drops_Enabled", true); }
public int getFishingTierLevelsTier1() { return config.getInt("Fishing.Tier_Levels.Tier1", 0); }
public int getFishingTierLevelsTier2() { return config.getInt("Fishing.Tier_Levels.Tier2", 200); }
public int getFishingTierLevelsTier3() { return config.getInt("Fishing.Tier_Levels.Tier3", 400); }
public int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); }
public int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); }
/* Herbalism */
public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); }
public int getHerbalismXPWheat() { return config.getInt("Experience.Herbalism.Wheat", 50); }
public int getHerbalismXPCactus() { return config.getInt("Experience.Herbalism.Cactus", 30); }
public int getHerbalismXPPumpkin() { return config.getInt("Experience.Herbalism.Pumpkin", 20); }
public int getHerbalismXPFlowers() { return config.getInt("Experience.Herbalism.Flowers", 100); }
public int getHerbalismXPMushrooms() { return config.getInt("Experience.Herbalism.Mushrooms", 150); }
public int getHerbalismXPMelon() { return config.getInt("Experience.Herbalism.Melon", 20); }
public int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); }
public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); }
public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); }
public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); }
public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); }
public boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); }
public boolean getBrownMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Brown_Mushrooms", true); }
public boolean getCactiDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cacti", true); }
public boolean getWheatDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Wheat", true); }
public boolean getMelonsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Melons", true); }
public boolean getNetherWartsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Nether_Warts", true); }
public boolean getPumpkinsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Pumpkins", true); }
public boolean getRedMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Mushrooms", true); }
public boolean getRedRosesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Roses", true); }
public boolean getSugarCaneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Sugar_Cane", true); }
public boolean getVinesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Vines", true); }
public boolean getWaterLiliesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Water_Lilies", true); }
public boolean getYellowFlowersDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Yellow_Flowers", true); }
public boolean herbalismDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Herbalism");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Herbalism." + key)) {
disabled = false;
break;
}
}
return disabled;
}
/* Mining */
public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); }
public int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); }
public int getMiningXPIronOre() { return config.getInt("Experience.Mining.Iron", 250); }
public int getMiningXPRedstoneOre() { return config.getInt("Experience.Mining.Redstone", 150); }
public int getMiningXPLapisOre() { return config.getInt("Experience.Mining.Lapis", 400); }
public int getMiningXPObsidian() { return config.getInt("Experience.Mining.Obsidian", 150); }
public int getMiningXPNetherrack() { return config.getInt("Experience.Mining.Netherrack", 30); }
public int getMiningXPGlowstone() { return config.getInt("Experience.Mining.Glowstone", 30); }
public int getMiningXPCoalOre() { return config.getInt("Experience.Mining.Coal", 100); }
public int getMiningXPStone() { return config.getInt("Experience.Mining.Stone", 30); }
public int getMiningXPSandstone() { return config.getInt("Experience.Mining.Sandstone", 30); }
public int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); }
public int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); }
public boolean getCoalDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Coal", true); }
public boolean getDiamondDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Diamond", true); }
public boolean getEndStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.End_Stone", true); }
public boolean getGlowstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Glowstone", true); }
public boolean getGoldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Gold", true); }
public boolean getIronDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Iron", true); }
public boolean getLapisDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Lapis", true); }
public boolean getMossyCobblestoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Moss_Stone", true); }
public boolean getNetherrackDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Netherrack", true); }
public boolean getObsidianDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Obsidian", true); }
public boolean getRedstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Redstone", true); }
public boolean getSandstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Sandstone", true); }
public boolean getStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Stone", true); }
public boolean miningDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Mining");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Mining." + key)) {
disabled = false;
break;
}
}
return disabled;
}
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
/* Repair */
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
/* Taming */
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
/* Woodcutting */
public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
public boolean woodcuttingDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Woodcutting");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Woodcutting." + key)) {
disabled = false;
break;
}
}
return disabled;
}
/* Arcane Forging */
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); }
public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); }
public int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); }
public int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); }
public int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); }
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); }
public int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); }
public int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); }
public int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); }
public int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); }
public int getArcaneForgingRankLevels1() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); }
public int getArcaneForgingRankLevels2() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); }
public int getArcaneForgingRankLevels3() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); }
public int getArcaneForgingRankLevels4() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); }
/* Level Caps */
public int getLevelCapAcrobatics() { return config.getInt("Skills.Acrobatics.Level_Cap", 0); }
public int getLevelCapArchery() { return config.getInt("Skills.Archery.Level_Cap", 0); }
public int getLevelCapAxes() { return config.getInt("Skills.Axes.Level_Cap", 0); }
public int getLevelCapExcavation() { return config.getInt("Skills.Excavation.Level_Cap", 0); }
public int getLevelCapFishing() { return config.getInt("Skills.Fishing.Level_Cap", 0); }
public int getLevelCapHerbalism() { return config.getInt("Skills.Herbalism.Level_Cap", 0); }
public int getLevelCapMining() { return config.getInt("Skills.Mining.Level_Cap", 0); }
public int getLevelCapRepair() { return config.getInt("Skills.Repair.Level_Cap", 0); }
public int getLevelCapSwords() { return config.getInt("Skills.Swords.Level_Cap", 0); }
public int getLevelCapTaming() { return config.getInt("Skills.Taming.Level_Cap", 0); }
public int getLevelCapUnarmed() { return config.getInt("Skills.Unarmed.Level_Cap", 0); }
public int getLevelCapWoodcutting() { return config.getInt("Skills.Woodcutting.Level_Cap", 0); }
public int getPowerLevelCap() { return config.getInt("General.Power_Level_Cap", 0); }
/* PVP & PVE Settings */
public boolean getAcrobaticsPVP() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVP", true); }
public boolean getAcrobaticsPVE() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVE", true); }
public boolean getArcheryPVP() { return config.getBoolean("Skills.Archery.Enabled_For_PVP", true); }
public boolean getArcheryPVE() { return config.getBoolean("Skills.Archery.Enabled_For_PVE", true); }
public boolean getAxesPVP() { return config.getBoolean("Skills.Axes.Enabled_For_PVP", true); }
public boolean getAxesPVE() { return config.getBoolean("Skills.Axes.Enabled_For_PVE", true); }
public boolean getSwordsPVP() { return config.getBoolean("Skills.Swords.Enabled_For_PVP", true); }
public boolean getSwordsPVE() { return config.getBoolean("Skills.Swords.Enabled_For_PVE", true); }
public boolean getTamingPVP() { return config.getBoolean("Skills.Taming.Enabled_For_PVP", true); }
public boolean getTamingPVE() { return config.getBoolean("Skills.Taming.Enabled_For_PVE", true); }
public boolean getUnarmedPVP() { return config.getBoolean("Skills.Unarmed.Enabled_For_PVP", true); }
public boolean getUnarmedPVE() { return config.getBoolean("Skills.Unarmed.Enabled_For_PVE", true); }
/*
* XP SETTINGS
*/
/* General Settings */
public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); }
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
public int getExperienceGainsGlobalMultiplier() { return config.getInt("Experience.Gains.Multiplier.Global", 1); }
/* Combat XP Multipliers */
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); }
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
public double getCreeperXP() { return config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); }
public double getSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); }
public double getSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Spider", 3.0); }
public double getGhastXP() { return config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0); }
public double getSlimeXP() { return config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); }
public double getZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); }
public double getPigZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); }
public double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0); }
public double getCaveSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); }
public double getSilverfishXP() { return config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); }
public double getBlazeXP() { return config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); }
public double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); }
public double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); }
public double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); }
/* XP Formula Multiplier */
public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); }
public double getFormulaMultiplierTaming() { return config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); }
public double getFormulaMultiplierMining() { return config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); }
public double getFormulaMultiplierRepair() { return config.getDouble("Experience.Formula.Multiplier.Repair", 1.0); }
public double getFormulaMultiplierWoodcutting() { return config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); }
public double getFormulaMultiplierUnarmed() { return config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0); }
public double getFormulaMultiplierHerbalism() { return config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0); }
public double getFormulaMultiplierExcavation() { return config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0); }
public double getFormulaMultiplierArchery() { return config.getDouble("Experience.Formula.Multiplier.Archery", 1.0); }
public double getFormulaMultiplierSwords() { return config.getDouble("Experience.Formula.Multiplier.Swords", 1.0); }
public double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); }
public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); }
public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); }
/*
* CONFIG LOADING
*/
private Config(mcMMO plugin) {
super(plugin, "config.yml");
saveIfNotExist();
xpGainMultiplier = getExperienceGainsGlobalMultiplier();
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO config.yml File...");
}
}

View File

@@ -4,45 +4,67 @@ import java.io.File;
import java.io.IOException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
public abstract class ConfigLoader {
protected static File configFile;
protected static File dataFolder;
protected String fileName;
protected File configFile;
protected File dataFolder;
protected final mcMMO plugin;
protected static FileConfiguration config;
protected FileConfiguration config;
public ConfigLoader(mcMMO plugin, String fileName){
this.plugin = plugin;
this.fileName = fileName;
dataFolder = plugin.getDataFolder();
configFile = new File(dataFolder, File.separator + fileName);
config = YamlConfiguration.loadConfiguration(configFile);
}
/**
* Load this config file.
*/
protected abstract void load();
public void load() {
if (!configFile.exists()) {
dataFolder.mkdir();
saveConfig();
}
addDefaults();
loadKeys();
}
/**
* Save this config file.
*/
private static void saveConfig() {
private void saveConfig() {
try {
config.save(configFile);
}
catch (IOException e) {
e.printStackTrace();
catch (IOException ex) {
plugin.getLogger().severe("Could not save config to " + configFile + ex);
}
}
protected void saveIfNotExist() {
if (!configFile.exists()) {
if (plugin.getResource(fileName) != null) {
plugin.saveResource(fileName, false);
}
}
rereadFromDisk();
}
protected void rereadFromDisk() {
config = YamlConfiguration.loadConfiguration(configFile);
}
/**
* Add the defaults to this config file.
*/
protected void addDefaults() {
// Load from included config.yml
config.options().copyDefaults(true);
saveConfig();
}

View File

@@ -0,0 +1,46 @@
package com.gmail.nossr50.config;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
public class HiddenConfig extends ConfigLoader {
private static String fileName;
private static HiddenConfig instance;
private static YamlConfiguration config;
private static boolean chunkletsEnabled;
public HiddenConfig(mcMMO plugin, String fileName) {
super(plugin, fileName);
HiddenConfig.fileName = fileName;
}
public static HiddenConfig getInstance() {
if (instance == null) {
instance = new HiddenConfig(mcMMO.p, "hidden.yml");
instance.load();
}
return instance;
}
@Override
public void load() {
if (plugin.getResource(fileName) != null) {
loadKeys();
}
}
@Override
protected void loadKeys() {
config = YamlConfiguration.loadConfiguration(plugin.getResource(fileName));
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
}
public boolean getChunkletsEnabled() {
return chunkletsEnabled;
}
}

View File

@@ -1,479 +0,0 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType;
public class LoadProperties extends ConfigLoader{
/*
* GENERAL SETTINGS
*/
/* General Settings */
public static String locale;
public static Boolean enableMotd, statsTracking, eventCallback;
public static int saveInterval;
/* mySQL */
public static Boolean useMySQL;
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass;
public static int MySQLport;
/* 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 Boolean aDisplayNames, pDisplayNames;
public static int ptpCommandCooldown;
public static Boolean donateMessage;
/* 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;
/* Items */
public static Boolean chimaeraWingEnable;
public static int chimaeraId, feathersConsumedByChimaeraWing;
/*
* ABILITY SETTINGS
*/
/* General Settings */
public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities;
/* Durability Settings */
public static Boolean toolsLoseDurabilityFromAbilities;
public static int abilityDurabilityLoss;
/* Cooldowns */
public static int superBreakerCooldown, blastMiningCooldown, greenTerraCooldown,
gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown,
serratedStrikeCooldown, skullSplitterCooldown;
/* Thresholds */
public static int treeFellerThreshold;
/*
* SKILL SETTINGS
*/
/* Tool Requirements */
public static Boolean miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe;
/* Excavation */
public static int mbase;
/* Fishing */
public static Boolean fishingDrops;
public static int fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5;
public static int mfishing;
/* 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;
/* Mining */
public static int msandstone, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, mendstone, mmossstone;
public static int detonatorID;
/* 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;
/* Taming */
public static int mtameWolf, mtameOcelot;
public static int bonesConsumedByCOTW, fishConsumedByCOTW;
/* Woodcutting */
public static int moak, mbirch, mspruce, mjungle;
/* 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;
/* Level Caps */
public static int levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting;
/*
* XP SETTINGS
*/
/* General Settings */
public static Boolean xpGainsMobSpawners, pvpxp;
public static int xpGainMultiplier;
/* Combat XP Multipliers */
public static double pvpxprewardmodifier;
public static double animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP,
zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP,
blazeXP, magmacubeXP, enderdragonXP;
/* XP Formula Multiplier */
public static double tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
/*
* SPOUT SETTINGS
*/
public static Boolean spoutEnabled;
/* Spout Party HUD */
public static Boolean showDisplayName, showFaces, partybar;
/* Spout XP Bar */
public static Boolean xpbar, xpicon;
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y;
/* 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;
/*
* CONFIG LOADING
*/
public static HUDType defaulthud;
public LoadProperties(mcMMO plugin) {
super(plugin, "config.yml");
config = plugin.getConfig();
}
@Override
public void load() {
// If it doesn't exist, copy it from the .jar
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveDefaultConfig();
}
addDefaults();
loadKeys();
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO config.yml File...");
// Setup default HUD
String temp = config.getString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().equalsIgnoreCase(temp)) {
defaulthud = x;
}
}
enableAbilityMessages = config.getBoolean("Abilities.Messages", true);
enableAbilities = config.getBoolean("Abilities.Enabled", true);
donateMessage = config.getBoolean("Commands.mcmmo.Donate_Message", true);
xpGainsMobSpawners = config.getBoolean("Experience.Gains.Mobspawners.Enabled", false);
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);
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);
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);
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);
aDisplayNames = config.getBoolean("Commands.a.Display_Names", true);
pDisplayNames = config.getBoolean("Commands.p.Display_Names", 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,115 @@
package com.gmail.nossr50.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.RepairItemType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableFactory;
public class RepairConfig extends ConfigLoader {
private List<Repairable> repairables;
public RepairConfig(mcMMO plugin, String fileName) {
super(plugin, fileName);
this.config = YamlConfiguration.loadConfiguration(this.configFile);
}
@Override
public void load() {
loadKeys();
}
@Override
protected void loadKeys() {
repairables = new ArrayList<Repairable>();
ConfigurationSection section = config.getConfigurationSection("Repairables");
Set<String> keys = section.getKeys(false);
for (String key : keys) {
// Validate all the things!
List<String> reason = new ArrayList<String>();
if (!config.contains("Repairables." + key + ".ItemId")) {
reason.add(key + " is missing ItemId");
}
if (!config.contains("Repairables." + key + ".RepairMaterialId")) {
reason.add(key + " is missing RepairMaterialId");
}
if (!config.contains("Repairables." + key + ".MaximumDurability")) {
reason.add(key + " is missing MaximumDurability");
}
int itemId = config.getInt("Repairables." + key + ".ItemId", 0);
int repairMaterialId = config.getInt("Repairables." + key + ".RepairMaterialId", 0);
int maximumDurability = config.getInt("Repairables." + key + ".MaximumDurability", 0);
int repairMetadata = config.getInt("Repairables." + key + ".RepairMaterialMetadata", -1);
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel", 0);
int minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
RepairItemType repairItemType = RepairItemType.OTHER;
RepairMaterialType repairMaterialType = RepairMaterialType.OTHER;
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
if (minimumLevel < 0) {
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
}
if (minimumQuantity < 0) {
reason.add(key + " has an invalid MinimumQuantity of " + minimumQuantity);
}
try {
repairItemType = RepairItemType.valueOf(repairItemTypeString);
}
catch (IllegalArgumentException ex) {
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
}
try {
repairMaterialType = RepairMaterialType.valueOf(repairMaterialTypeString);
}
catch (IllegalArgumentException ex) {
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
}
if (noErrorsInRepairable(reason)) {
Repairable repairable = RepairableFactory.getRepairable(itemId, repairMaterialId, (byte) repairMetadata, minimumLevel, minimumQuantity, (short) maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
repairables.add(repairable);
}
}
}
protected List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
private boolean noErrorsInRepairable(List<String> issues) {
if (issues.isEmpty()) {
return true;
}
else {
for (String issue : issues) {
plugin.getLogger().warning(issue);
}
return false;
}
}
}

View File

@@ -0,0 +1,56 @@
package com.gmail.nossr50.config;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.Repairable;
public class RepairConfigManager {
private List<Repairable> repairables;
public RepairConfigManager(mcMMO plugin) {
repairables = new ArrayList<Repairable>();
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
File dataFolder = plugin.getDataFolder();
File vanilla = new File(dataFolder, "repair.vanilla.yml");
if (!vanilla.exists()) {
plugin.saveResource("repair.vanilla.yml", false);
}
for (String location : dataFolder.list()) {
if (!pattern.matcher(location).matches()) {
continue;
}
plugin.getLogger().info("Loading " + location + " repair config file...");
File file = new File(dataFolder, location);
if (file.isDirectory()) {
continue;
}
RepairConfig rConfig = new RepairConfig(plugin, location);
rConfig.load();
List<Repairable> rConfigRepairables = rConfig.getLoadedRepairables();
if (rConfigRepairables != null) {
repairables.addAll(rConfigRepairables);
}
}
}
public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
}

View File

@@ -0,0 +1,98 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType;
public class SpoutConfig extends ConfigLoader {
private static SpoutConfig instance;
public static SpoutConfig getInstance() {
if (instance == null) {
instance = new SpoutConfig(mcMMO.p);
instance.load();
}
return instance;
}
public HUDType defaulthud;
private SpoutConfig(mcMMO plugin) {
super(plugin, "spout.yml");
saveIfNotExist();
}
public boolean getShowPowerLevel() { return config.getBoolean("HUD.Show_Power_Level", true); }
public String getMenuKey() { return config.getString("Menu.Key", "KEY_M"); }
/* XP Bar */
public boolean getXPBarEnabled() { return config.getBoolean("XP.Bar.Enabled", true); }
public boolean getXPBarIconEnabled() { return config.getBoolean("XP.Icon.Enabled", true); }
public int getXPBarXPosition() { return config.getInt("XP.Bar.X_POS", 95); }
public int getXPBarYPosition() { return config.getInt("XP.Bar.Y_POS", 6); }
public int getXPIconXPosition() { return config.getInt("XP.Icon.X_POS", 78); }
public int getXPIconYPosition() { return config.getInt("XP.Icon.Y_POS", 2); }
/* HUD Colors */
public double getRetroHUDXPBorderRed() { return config.getDouble("HUD.Retro.Colors.Border.RED", 0.0); }
public double getRetroHUDXPBorderGreen() { return config.getDouble("HUD.Retro.Colors.Border.GREEN", 0.0); }
public double getRetroHUDXPBorderBlue() { return config.getDouble("HUD.Retro.Colors.Border.BLUE", 0.0); }
public double getRetroHUDXPBackgroundRed() { return config.getDouble("HUD.Retro.Colors.Background.RED", 0.75); }
public double getRetroHUDXPBackgroundGreen() { return config.getDouble("HUD.Retro.Colors.Background.GREEN", 0.75); }
public double getRetroHUDXPBackgroundBlue() { return config.getDouble("HUD.Retro.Colors.Background.BLUE", 0.75); }
public double getRetroHUDAcrobaticsRed() { return config.getDouble("HUD.Retro.Colors.Acrobatics.RED", 0.3); }
public double getRetroHUDAcrobaticsGreen() { return config.getDouble("HUD.Retro.Colors.Acrobatics.GREEN", 0.3); }
public double getRetroHUDAcrobaticsBlue() { return config.getDouble("HUD.Retro.Colors.Acrobatics.BLUE", 0.75); }
public double getRetroHUDArcheryRed() { return config.getDouble("HUD.Retro.Colors.Archery.RED", 0.3); }
public double getRetroHUDArcheryGreen() { return config.getDouble("HUD.Retro.Colors.Archery.GREEN", 0.3); }
public double getRetroHUDArcheryBlue() { return config.getDouble("HUD.Retro.Colors.Archery.BLUE", 0.75); }
public double getRetroHUDAxesRed() { return config.getDouble("HUD.Retro.Colors.Axes.RED", 0.3); }
public double getRetroHUDAxesGreen() { return config.getDouble("HUD.Retro.Colors.Axes.GREEN", 0.3); }
public double getRetroHUDAxesBlue() { return config.getDouble("HUD.Retro.Colors.Axes.BLUE", 0.75); }
public double getRetroHUDExcavationRed() { return config.getDouble("HUD.Retro.Colors.Excavation.RED", 0.3); }
public double getRetroHUDExcavationGreen() { return config.getDouble("HUD.Retro.Colors.Excavation.GREEN", 0.3); }
public double getRetroHUDExcavationBlue() { return config.getDouble("HUD.Retro.Colors.Excavation.BLUE", 0.75); }
public double getRetroHUDHerbalismRed() { return config.getDouble("HUD.Retro.Colors.Herbalism.RED", 0.3); }
public double getRetroHUDHerbalismGreen() { return config.getDouble("HUD.Retro.Colors.Herbalism.GREEN", 0.3); }
public double getRetroHUDHerbalismBlue() { return config.getDouble("HUD.Retro.Colors.Herbalism.BLUE", 0.75); }
public double getRetroHUDMiningRed() { return config.getDouble("HUD.Retro.Colors.Mining.RED", 0.3); }
public double getRetroHUDMiningGreen() { return config.getDouble("HUD.Retro.Colors.Mining.GREEN", 0.3); }
public double getRetroHUDMiningBlue() { return config.getDouble("HUD.Retro.Colors.Mining.BLUE", 0.75); }
public double getRetroHUDRepairRed() { return config.getDouble("HUD.Retro.Colors.Repair.RED", 0.3); }
public double getRetroHUDRepairGreen() { return config.getDouble("HUD.Retro.Colors.Repair.GREEN", 0.3); }
public double getRetroHUDRepairBlue() { return config.getDouble("HUD.Retro.Colors.Repair.BLUE", 0.75); }
public double getRetroHUDSwordsRed() { return config.getDouble("HUD.Retro.Colors.Swords.RED", 0.3); }
public double getRetroHUDSwordsGreen() { return config.getDouble("HUD.Retro.Colors.Swords.GREEN", 0.3); }
public double getRetroHUDSwordsBlue() { return config.getDouble("HUD.Retro.Colors.Swords.BLUE", 0.75); }
public double getRetroHUDTamingRed() { return config.getDouble("HUD.Retro.Colors.Taming.RED", 0.3); }
public double getRetroHUDTamingGreen() { return config.getDouble("HUD.Retro.Colors.Taming.GREEN", 0.3); }
public double getRetroHUDTamingBlue() { return config.getDouble("HUD.Retro.Colors.Taming.BLUE", 0.75); }
public double getRetroHUDUnarmedRed() { return config.getDouble("HUD.Retro.Colors.Unarmed.RED", 0.3); }
public double getRetroHUDUnarmedGreen() { return config.getDouble("HUD.Retro.Colors.Unarmed.GREEN", 0.3); }
public double getRetroHUDUnarmedBlue() { return config.getDouble("HUD.Retro.Colors.Unarmed.BLUE", 0.75); }
public double getRetroHUDWoodcuttingRed() { return config.getDouble("HUD.Retro.Colors.Woodcutting.RED", 0.3); }
public double getRetroHUDWoodcuttingGreen() { return config.getDouble("HUD.Retro.Colors.Woodcutting.GREEN", 0.3); }
public double getRetroHUDWoodcuttingBlue() { return config.getDouble("HUD.Retro.Colors.Woodcutting.BLUE", 0.75); }
public double getRetroHUDFishingRed() { return config.getDouble("HUD.Retro.Colors.Fishing.RED", 0.3); }
public double getRetroHUDFishingGreen() { return config.getDouble("HUD.Retro.Colors.Fishing.GREEN", 0.3); }
public double getRetroHUDFishingBlue() { return config.getDouble("HUD.Retro.Colors.Fishing.BLUE", 0.75); }
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO spout.yml File...");
// Setup default HUD
String temp = config.getString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().equalsIgnoreCase(temp.toString())) {
defaulthud = x;
}
}
if (defaulthud == null) {
defaulthud = HUDType.STANDARD;
}
}
}

View File

@@ -7,7 +7,6 @@ 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;
@@ -17,37 +16,34 @@ 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 class TreasuresConfig extends ConfigLoader{
private static TreasuresConfig instance;
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();
public static TreasuresConfig getInstance() {
if (instance == null) {
instance = new TreasuresConfig(mcMMO.p);
instance.load();
}
addDefaults();
loadKeys();
return instance;
}
public List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
public List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier5 = new ArrayList<FishingTreasure>();
private TreasuresConfig(mcMMO plugin) {
super(plugin, "treasures.yml");
saveIfNotExist();
}
@Override
@@ -86,7 +82,7 @@ public class LoadTreasures extends ConfigLoader{
int data = config.getInt("Treasures." + treasureName + ".Data");
if (Material.getMaterial(id) == null) {
reason.add("Invlid id: " + id);
reason.add("Invalid id: " + id);
}
if (amount < 1) {
@@ -213,23 +209,23 @@ public class LoadTreasures extends ConfigLoader{
int dropLevel = fTreasure.getDropLevel();
int maxLevel = fTreasure.getMaxLevel();
if(dropLevel <= LoadProperties.fishingTier1 && maxLevel >= LoadProperties.fishingTier1) {
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) {
fishingRewardsTier1.add(fTreasure);
}
if(dropLevel <= LoadProperties.fishingTier2 && maxLevel >= LoadProperties.fishingTier2) {
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
fishingRewardsTier2.add(fTreasure);
}
if (dropLevel <= LoadProperties.fishingTier3 && maxLevel >= LoadProperties.fishingTier3) {
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier3() && maxLevel >= Config.getInstance().getFishingTierLevelsTier3()) {
fishingRewardsTier3.add(fTreasure);
}
if (dropLevel <= LoadProperties.fishingTier4 && maxLevel >= LoadProperties.fishingTier4) {
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier4() && maxLevel >= Config.getInstance().getFishingTierLevelsTier4()) {
fishingRewardsTier4.add(fTreasure);
}
if (dropLevel <= LoadProperties.fishingTier5 && maxLevel >= LoadProperties.fishingTier5) {
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier5() && maxLevel >= Config.getInstance().getFishingTierLevelsTier5()) {
fishingRewardsTier5.add(fTreasure);
}
@@ -278,7 +274,7 @@ public class LoadTreasures extends ConfigLoader{
}
else {
for (String issue : issues) {
Bukkit.getLogger().warning(issue);
plugin.getLogger().warning(issue);
}
return false;
}

View File

@@ -0,0 +1,97 @@
package com.gmail.nossr50.config.mods;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.mods.CustomItem;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableFactory;
public class CustomArmorConfig extends ModConfigLoader{
private static CustomArmorConfig instance;
public static CustomArmorConfig getInstance() {
if (instance == null) {
instance = new CustomArmorConfig(mcMMO.p);
}
return instance;
}
private List<Repairable> repairables;
public List<Integer> customBootIDs = new ArrayList<Integer>();
public List<Integer> customChestplateIDs = new ArrayList<Integer>();
public List<Integer> customHelmetIDs = new ArrayList<Integer>();
public List<Integer> customLeggingIDs = new ArrayList<Integer>();
public List<Integer> customIDs = new ArrayList<Integer>();
public List<CustomItem> customArmorList = new ArrayList<CustomItem>();
public HashMap<Integer, CustomItem> customArmor = new HashMap<Integer, CustomItem>();
public CustomArmorConfig(mcMMO plugin) {
super(plugin, "armor.yml");
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO armor.yml File...");
repairables = new ArrayList<Repairable>();
loadArmor("Boots", customBootIDs);
loadArmor("Chestplates", customChestplateIDs);
loadArmor("Helmets", customHelmetIDs);
loadArmor("Leggings", customLeggingIDs);
}
private void loadArmor(String armorType, List<Integer> idList) {
ConfigurationSection armorSection = config.getConfigurationSection(armorType);
Set<String> armorConfigSet = armorSection.getKeys(false);
Iterator<String> iterator = armorConfigSet.iterator();
while (iterator.hasNext()) {
String armorName = iterator.next();
int id = config.getInt(armorType + "." + armorName + ".ID", 0);
boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
int repairID = config.getInt(armorType + "." + armorName + ".Repair_Material_ID", 0);
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", 0);
int repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Quantity", 0);
short durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 0);
if (id == 0) {
plugin.getLogger().warning("Missing ID. This item will be skipped.");
continue;
}
if (repairable && (repairID == 0 || repairQuantity == 0 || durability == 0)) {
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable.");
repairable = false;
}
CustomItem armor;
if (repairable) {
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
}
armor = new CustomItem(id, durability);
idList.add(id);
customIDs.add(id);
customArmorList.add(armor);
customArmor.put(id, armor);
}
}
public List<Repairable> getLoadedRepairables() {
if(repairables == null) return new ArrayList<Repairable>();
return repairables;
}
}

View File

@@ -0,0 +1,110 @@
package com.gmail.nossr50.config.mods;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
public class CustomBlocksConfig extends ModConfigLoader{
private static CustomBlocksConfig instance;
public static CustomBlocksConfig getInstance() {
if (instance == null) {
instance = new CustomBlocksConfig(mcMMO.p);
}
return instance;
}
public List<ItemStack> customExcavationBlocks = new ArrayList<ItemStack>();
public List<ItemStack> customHerbalismBlocks = new ArrayList<ItemStack>();
public List<ItemStack> customMiningBlocks = new ArrayList<ItemStack>();
public List<ItemStack> customWoodcuttingBlocks = new ArrayList<ItemStack>();
public List<ItemStack> customOres = new ArrayList<ItemStack>();
public List<ItemStack> customLogs = new ArrayList<ItemStack>();
public List<ItemStack> customLeaves = new ArrayList<ItemStack>();
public List<ItemStack> customItems = new ArrayList<ItemStack>();
public List<CustomBlock> customBlocks = new ArrayList<CustomBlock>();
public CustomBlocksConfig(mcMMO plugin) {
super(plugin, "blocks.yml");
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO blocks.yml File...");
loadBlocks("Excavation", customExcavationBlocks);
loadBlocks("Herbalism", customHerbalismBlocks);
loadBlocks("Mining", customMiningBlocks);
loadBlocks("Woodcutting", customWoodcuttingBlocks);
}
private void loadBlocks(String skillType, List<ItemStack> blockList) {
ConfigurationSection skillSection = config.getConfigurationSection(skillType);
Set<String> skillConfigSet = skillSection.getKeys(false);
Iterator<String> iterator = skillConfigSet.iterator();
while (iterator.hasNext()) {
String blockName = iterator.next();
int id = config.getInt(skillType + "." + blockName + ".ID", 0);
byte data = (byte) config.getInt(skillType + "." + blockName + ".Data_Value", 0);
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain", 0);
int tier = config.getInt(skillType + "." + blockName + ".Tier", 1);
boolean dropItem = config.getBoolean(skillType + "." + blockName + ".Drop_Item", false);
int dropID = config.getInt(skillType + "." + blockName + ".Drop_Item_ID", 0);
byte dropData = (byte) config.getInt(skillType + "." + blockName + ".Drop_Item_Data_Value", 0);
int dropAmount = config.getInt(skillType + "." + blockName + ".Drop_Item_Amount", 1);
if (id == 0) {
plugin.getLogger().warning("Missing ID. This block will be skipped.");
continue;
}
if (dropItem && dropID == 0) {
plugin.getLogger().warning("Incomplete item drop information. This block will drop itself.");
dropItem = false;
}
CustomBlock block;
ItemStack itemDrop;
ItemStack blockItem;
if (dropItem) {
itemDrop = new ItemStack(dropID, dropAmount, (short) 0, dropData);
}
else {
itemDrop = new ItemStack(id, dropAmount, (short) 0, data);
}
block = new CustomBlock(itemDrop, tier, xp, data, id);
blockItem = new ItemStack(id, 1, (short) 0, data);
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
customOres.add(blockItem);
}
else if (skillType.equals("Woodcutting")) {
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
customLogs.add(blockItem);
}
else {
customLeaves.add(blockItem);
block.setXpGain(0); //Leaves don't grant XP
}
}
blockList.add(blockItem);
customItems.add(blockItem);
customBlocks.add(block);
}
}
}

View File

@@ -0,0 +1,104 @@
package com.gmail.nossr50.config.mods;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.mods.CustomTool;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.RepairableFactory;
public class CustomToolsConfig extends ModConfigLoader {
private static CustomToolsConfig instance;
public static CustomToolsConfig getInstance() {
if (instance == null) {
instance = new CustomToolsConfig(mcMMO.p);
}
return instance;
}
private List<Repairable> repairables;
public List<Integer> customAxeIDs = new ArrayList<Integer>();
public List<Integer> customBowIDs = new ArrayList<Integer>();
public List<Integer> customHoeIDs = new ArrayList<Integer>();
public List<Integer> customPickaxeIDs = new ArrayList<Integer>();
public List<Integer> customShovelIDs = new ArrayList<Integer>();
public List<Integer> customSwordIDs = new ArrayList<Integer>();
public List<Integer> customIDs = new ArrayList<Integer>();
public List<CustomTool> customToolList = new ArrayList<CustomTool>();
public HashMap<Integer, CustomTool> customTools = new HashMap<Integer, CustomTool>();
private CustomToolsConfig(mcMMO plugin) {
super(plugin, "tools.yml");
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO tools.yml File...");
repairables = new ArrayList<Repairable>();
loadTool("Axes", customAxeIDs);
loadTool("Bows", customBowIDs);
loadTool("Hoes", customHoeIDs);
loadTool("Pickaxes", customPickaxeIDs);
loadTool("Shovels", customShovelIDs);
loadTool("Swords", customSwordIDs);
}
private void loadTool(String toolType, List<Integer> idList) {
ConfigurationSection toolSection = config.getConfigurationSection(toolType);
Set<String> toolConfigSet = toolSection.getKeys(false);
Iterator<String> iterator = toolConfigSet.iterator();
while (iterator.hasNext()) {
String toolName = iterator.next();
int id = config.getInt(toolType + "." + toolName + ".ID", 0);
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
boolean abilityEnabled = config.getBoolean(toolType + "." + toolName + ".Ability_Enabled", true);
int tier = config.getInt(toolType + "." + toolName + ".Tier", 1);
boolean repairable = config.getBoolean(toolType + "." + toolName + ".Repairable");
int repairID = config.getInt(toolType + "." + toolName + ".Repair_Material_ID", 0);
byte repairData = (byte) config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Value", 0);
int repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Quantity", 0);
short durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 0);
if (id == 0) {
plugin.getLogger().warning("Missing ID. This item will be skipped.");
continue;
}
if (repairable && (repairID == 0 || repairQuantity == 0 || durability == 0)) {
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable.");
repairable = false;
}
CustomTool tool;
if (repairable) {
repairables.add(RepairableFactory.getRepairable(id, repairID, repairData, repairQuantity, durability));
}
tool = new CustomTool(tier, abilityEnabled, multiplier, durability, id);
idList.add(id);
customIDs.add(id);
customToolList.add(tool);
customTools.put(id, tool);
}
}
public List<Repairable> getLoadedRepairables() {
if(repairables == null) return new ArrayList<Repairable>();
return repairables;
}
}

View File

@@ -0,0 +1,13 @@
package com.gmail.nossr50.config.mods;
import java.io.File;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.ConfigLoader;
public abstract class ModConfigLoader extends ConfigLoader{
public ModConfigLoader(mcMMO plugin, String fileName) {
super(plugin, "ModConfigs" + File.separator + fileName);
}
}

View File

@@ -1,291 +1,212 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Excavation;
import com.gmail.nossr50.skills.Herbalism;
import com.gmail.nossr50.skills.Mining;
public enum AbilityType {
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 mode of this ability.
*
* @param PP PlayerProfile of the player using the ability
* @return true if the ability is enabled, false otherwise
*/
public boolean getMode(PlayerProfile PP) {
switch (this) {
case BERSERK:
return PP.getBerserkMode();
case SUPER_BREAKER:
return PP.getSuperBreakerMode();
case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerMode();
case GREEN_TERRA:
return PP.getGreenTerraMode();
case SKULL_SPLIITER:
return PP.getSkullSplitterMode();
case TREE_FELLER:
return PP.getTreeFellerMode();
case SERRATED_STRIKES:
return PP.getSerratedStrikesMode();
default:
return false;
}
}
/**
* Set the mode of this ability.
*
* @param PP PlayerProfile of the player using the ability
* @param bool Mode to set the ability to
*/
public void setMode(PlayerProfile PP, boolean bool) {
switch (this) {
case BERSERK:
PP.setBerserkMode(bool);
break;
case SUPER_BREAKER:
PP.setSuperBreakerMode(bool);
break;
case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerMode(bool);
break;
case GREEN_TERRA:
PP.setGreenTerraMode(bool);
break;
case SKULL_SPLIITER:
PP.setSkullSplitterMode(bool);
break;
case TREE_FELLER:
PP.setTreeFellerMode(bool);
break;
case SERRATED_STRIKES:
PP.setSerratedStrikesMode(bool);
break;
default:
break;
}
}
/**
* Get the informed state of this ability
*
* @param PP PlayerProfile of the player using the ability
* @return true if the ability is informed, false otherwise
*/
public boolean getInformed(PlayerProfile PP) {
switch (this) {
case BERSERK:
return PP.getBerserkInformed();
case BLAST_MINING:
return PP.getBlastMiningInformed();
case SUPER_BREAKER:
return PP.getSuperBreakerInformed();
case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerInformed();
case GREEN_TERRA:
return PP.getGreenTerraInformed();
case SKULL_SPLIITER:
return PP.getSkullSplitterInformed();
case TREE_FELLER:
return PP.getTreeFellerInformed();
case SERRATED_STRIKES:
return PP.getSerratedStrikesInformed();
default:
return false;
}
}
/**
* Set the informed state of this ability.
*
* @param PP PlayerProfile of the player using the ability
* @param bool Informed state to set the ability to
*/
public void setInformed(PlayerProfile PP, boolean bool) {
switch (this) {
case BERSERK:
PP.setBerserkInformed(bool);
break;
case BLAST_MINING:
PP.setBlastMiningInformed(bool);
break;
case SUPER_BREAKER:
PP.setSuperBreakerInformed(bool);
break;
case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerInformed(bool);
break;
case GREEN_TERRA:
PP.setGreenTerraInformed(bool);
break;
case SKULL_SPLIITER:
PP.setSkullSplitterInformed(bool);
break;
case TREE_FELLER:
PP.setTreeFellerInformed(bool);
break;
case SERRATED_STRIKES:
PP.setSerratedStrikesInformed(bool);
break;
default:
break;
}
}
/**
* 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;
}
}
}
package com.gmail.nossr50.datatypes;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Permissions;
public enum AbilityType {
BERSERK(
Config.getInstance().getAbilityCooldownBerserk(),
Config.getInstance().getAbilityMaxTicksBerserk(),
"Unarmed.Skills.Berserk.On",
"Unarmed.Skills.Berserk.Off",
"Unarmed.Skills.Berserk.Other.On",
"Unarmed.Skills.Berserk.Refresh",
"Unarmed.Skills.Berserk.Other.Off"),
SUPER_BREAKER(
Config.getInstance().getAbilityCooldownSuperBreaker(),
Config.getInstance().getAbilityMaxTicksSuperBreaker(),
"Mining.Skills.SuperBreaker.On",
"Mining.Skills.SuperBreaker.Off",
"Mining.Skills.SuperBreaker.Other.On",
"Mining.Skills.SuperBreaker.Refresh",
"Mining.Skills.SuperBreaker.Other.Off"),
GIGA_DRILL_BREAKER(
Config.getInstance().getAbilityCooldownGigaDrillBreaker(),
Config.getInstance().getAbilityMaxTicksGigaDrillBreaker(),
"Excavation.Skills.GigaDrillBreaker.On",
"Excavation.Skills.GigaDrillBreaker.Off",
"Excavation.Skills.GigaDrillBreaker.Other.On",
"Excavation.Skills.GigaDrillBreaker.Refresh",
"Excavation.Skills.GigaDrillBreaker.Other.Off"),
GREEN_TERRA(
Config.getInstance().getAbilityCooldownGreenTerra(),
Config.getInstance().getAbilityMaxTicksGreenTerra(),
"Herbalism.Skills.GTe.On",
"Herbalism.Skills.GTe.Off",
"Herbalism.Skills.GTe.Other.On",
"Herbalism.Skills.GTe.Refresh",
"Herbalism.Skills.GTe.Other.Off"),
SKULL_SPLIITER(
Config.getInstance().getAbilityCooldownSkullSplitter(),
Config.getInstance().getAbilityMaxTicksSkullSplitter(),
"Axes.Skills.SS.On",
"Axes.Skills.SS.Off",
"Axes.Skills.SS.Other.On",
"Axes.Skills.SS.Refresh",
"Axes.Skills.SS.Other.Off"),
TREE_FELLER(
Config.getInstance().getAbilityCooldownTreeFeller(),
Config.getInstance().getAbilityMaxTicksTreeFeller(),
"Woodcutting.Skills.TreeFeller.On",
"Woodcutting.Skills.TreeFeller.Off",
"Woodcutting.Skills.TreeFeller.Other.On",
"Woodcutting.Skills.TreeFeller.Refresh",
"Woodcutting.Skills.TreeFeller.Other.Off"),
SERRATED_STRIKES(
Config.getInstance().getAbilityCooldownSerratedStrikes(),
Config.getInstance().getAbilityMaxTicksSerratedStrikes(),
"Swords.Skills.SS.On",
"Swords.Skills.SS.Off",
"Swords.Skills.SS.Other.On",
"Swords.Skills.SS.Refresh",
"Swords.Skills.SS.Other.Off"),
BLAST_MINING(
Config.getInstance().getAbilityCooldownBlastMining(),
Config.getInstance().getAbilityMaxTicksBlastMining(),
null,
null,
"Mining.Blast.Other.On",
"Mining.Blast.Refresh",
null),
LEAF_BLOWER(
0,
0,
null,
null,
null,
null,
null);
private int cooldown;
private int maxTicks;
private String abilityOn;
private String abilityOff;
private String abilityPlayer;
private String abilityRefresh;
private String abilityPlayerOff;
private AbilityType(int cooldown, int maxTicks, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
this.cooldown = cooldown;
this.maxTicks = maxTicks;
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 LocaleLoader.getString(this.abilityOn);
}
public String getAbilityOff() {
return LocaleLoader.getString(this.abilityOff);
}
public String getAbilityPlayer(Player player) {
return LocaleLoader.getString(this.abilityPlayer, new Object[] {player.getName()});
}
public String getAbilityPlayerOff(Player player) {
return LocaleLoader.getString(this.abilityPlayerOff, new Object[] {player.getName()});
}
public String getAbilityRefresh() {
return LocaleLoader.getString(this.abilityRefresh);
}
public int getMaxTicks() {
return this.maxTicks;
}
/**
* 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) {
Permissions permInstance = Permissions.getInstance();
switch (this) {
case BERSERK:
return permInstance.berserk(player);
case BLAST_MINING:
return permInstance.blastMining(player);
case GIGA_DRILL_BREAKER:
return permInstance.gigaDrillBreaker(player);
case GREEN_TERRA:
return permInstance.greenTerra(player);
case LEAF_BLOWER:
return permInstance.leafBlower(player);
case SERRATED_STRIKES:
return permInstance.serratedStrikes(player);
case SKULL_SPLIITER:
return permInstance.skullSplitter(player);
case SUPER_BREAKER:
return permInstance.superBreaker(player);
case TREE_FELLER:
return permInstance.treeFeller(player);
default:
return false;
}
}
/**
* Check if a block is affected by this ability.
*
* @param Block the block to check
* @return true if the block is affected by this ability, false otherwise
*/
public boolean blockCheck(Block block) {
switch (this) {
case BERSERK:
return (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW);
case GIGA_DRILL_BREAKER:
return BlockChecks.canBeGigaDrillBroken(block);
case GREEN_TERRA:
return BlockChecks.makeMossy(block);
case LEAF_BLOWER:
return block.getType() == Material.LEAVES;
case SUPER_BREAKER:
return BlockChecks.canBeSuperBroken(block);
case TREE_FELLER:
return block.getType() == Material.LOG;
default:
return false;
}
}
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.Color;
@@ -10,291 +9,363 @@ 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.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
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;
private String playerName;
private final mcMMO plugin;
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;
public HUDmmo(Player player, mcMMO plugin) {
this.playerName = player.getName();
this.plugin = plugin;
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) SpoutConfig.getInstance().getRetroHUDXPBorderRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderBlue(), 1f);
Color green = new Color(0f, 1f, 0f, 1f);
Color background = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBackgroundRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundBlue(), 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 (SpoutConfig.getInstance().getXPBarEnabled()) {
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpfill);
sPlayer.getMainScreen().attachWidget(plugin, xpbg);
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
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 (SpoutConfig.getInstance().getXPBarEnabled()) {
xpbar = new GenericTexture();
((GenericTexture) xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(SpoutConfig.getInstance().getXPBarXPosition());
xpbar.setY(SpoutConfig.getInstance().getXPBarYPosition());
xpbar.setHeight(8);
xpbar.setWidth(256);
xpbar.setPriority(RenderPriority.Lowest);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(16);
xpicon.setWidth(32);
xpicon.setX(SpoutConfig.getInstance().getXPIconXPosition());
xpicon.setY(SpoutConfig.getInstance().getXPIconYPosition());
xpicon.setPriority(RenderPriority.High);
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 (SpoutConfig.getInstance().getXPBarEnabled()) {
xpbar = new GenericTexture();
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(center_x - 64);
xpbar.setY(SpoutConfig.getInstance().getXPBarYPosition());
xpbar.setHeight(4);
xpbar.setWidth(128);
xpbar.setPriority(RenderPriority.Lowest);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(8);
xpicon.setWidth(16);
xpicon.setX(center_x - (8 + 64));
xpicon.setY(SpoutConfig.getInstance().getXPIconYPosition() + 2);
xpicon.setPriority(RenderPriority.High);
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 (!SpoutConfig.getInstance().getXPBarEnabled()) {
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;
}
xpicon.setUrl(Misc.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 (!SpoutConfig.getInstance().getXPBarEnabled()) {
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(Misc.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);
}
((GenericTexture) xpbar).setUrl(getUrlBar(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 = getRetroColor(theType);
if(xpicon != null && theType != null)
xpicon.setUrl(m.getCapitalized(theType.toString())+"_r.png");
if(theType != null)
xpfill.setBottomColor(color).setTopColor(color).setWidth(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 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);
return new Color((float) SpoutConfig.getInstance().getRetroHUDAcrobaticsRed(), (float) SpoutConfig.getInstance().getRetroHUDAcrobaticsGreen(), (float) SpoutConfig.getInstance().getRetroHUDAcrobaticsBlue(), 1f);
case ARCHERY:
return new Color((float) LoadProperties.archery_r, (float)LoadProperties.archery_g, (float)LoadProperties.archery_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDArcheryRed(), (float) SpoutConfig.getInstance().getRetroHUDArcheryGreen(), (float) SpoutConfig.getInstance().getRetroHUDArcheryBlue(), 1f);
case AXES:
return new Color((float) LoadProperties.axes_r, (float)LoadProperties.axes_g, (float)LoadProperties.axes_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDAxesRed(), (float) SpoutConfig.getInstance().getRetroHUDAxesGreen(), (float) SpoutConfig.getInstance().getRetroHUDAxesBlue(), 1f);
case EXCAVATION:
return new Color((float)LoadProperties.excavation_r, (float)LoadProperties.excavation_g, (float)LoadProperties.excavation_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDExcavationRed(), (float) SpoutConfig.getInstance().getRetroHUDExcavationGreen(), (float) SpoutConfig.getInstance().getRetroHUDExcavationBlue(), 1f);
case HERBALISM:
return new Color((float)LoadProperties.herbalism_r, (float)LoadProperties.herbalism_g, (float)LoadProperties.herbalism_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDHerbalismRed(), (float) SpoutConfig.getInstance().getRetroHUDHerbalismGreen(), (float) SpoutConfig.getInstance().getRetroHUDHerbalismBlue(), 1f);
case MINING:
return new Color((float)LoadProperties.mining_r, (float)LoadProperties.mining_g, (float)LoadProperties.mining_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDMiningRed(), (float) SpoutConfig.getInstance().getRetroHUDMiningGreen(), (float) SpoutConfig.getInstance().getRetroHUDMiningBlue(), 1f);
case REPAIR:
return new Color((float)LoadProperties.repair_r, (float)LoadProperties.repair_g, (float)LoadProperties.repair_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDRepairRed(), (float) SpoutConfig.getInstance().getRetroHUDRepairGreen(), (float) SpoutConfig.getInstance().getRetroHUDRepairBlue(), 1f);
case SWORDS:
return new Color((float)LoadProperties.swords_r, (float)LoadProperties.swords_g, (float)LoadProperties.swords_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDSwordsRed(), (float) SpoutConfig.getInstance().getRetroHUDSwordsGreen(), (float) SpoutConfig.getInstance().getRetroHUDSwordsBlue(), 1f);
case TAMING:
return new Color((float)LoadProperties.taming_r, (float)LoadProperties.taming_g, (float)LoadProperties.taming_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDTamingRed(), (float) SpoutConfig.getInstance().getRetroHUDTamingGreen(), (float) SpoutConfig.getInstance().getRetroHUDTamingBlue(), 1f);
case UNARMED:
return new Color((float)LoadProperties.unarmed_r, (float)LoadProperties.unarmed_g, (float)LoadProperties.unarmed_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDUnarmedRed(), (float) SpoutConfig.getInstance().getRetroHUDUnarmedGreen(), (float) SpoutConfig.getInstance().getRetroHUDUnarmedBlue(), 1f);
case WOODCUTTING:
return new Color((float)LoadProperties.woodcutting_r, (float)LoadProperties.woodcutting_g, (float)LoadProperties.woodcutting_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDWoodcuttingRed(), (float) SpoutConfig.getInstance().getRetroHUDWoodcuttingGreen(), (float) SpoutConfig.getInstance().getRetroHUDWoodcuttingBlue(), 1f);
case FISHING:
return new Color((float)LoadProperties.fishing_r, (float)LoadProperties.fishing_g, (float)LoadProperties.fishing_b, 1f);
return new Color((float) SpoutConfig.getInstance().getRetroHUDFishingRed(), (float) SpoutConfig.getInstance().getRetroHUDFishingGreen(), (float) SpoutConfig.getInstance().getRetroHUDFishingBlue(), 1f);
default:
return new Color(0.3f, 0.3f, 0.75f, 1f);
}
@@ -305,13 +376,13 @@ public class HUDmmo
switch (num.length) {
case 1:
return "xpbar_inc00"+number+".png";
return "xpbar_inc00" + number + ".png";
case 2:
return "xpbar_inc0"+number+".png";
return "xpbar_inc0" + number + ".png";
default:
return "xpbar_inc"+number+".png";
return "xpbar_inc" + number + ".png";
}
}
@@ -334,4 +405,13 @@ public class HUDmmo
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

@@ -2,95 +2,130 @@ package com.gmail.nossr50.datatypes;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public enum SkillType
{
ACROBATICS(LoadProperties.levelCapAcrobatics),
ALL, //This one is just for convenience
ARCHERY(LoadProperties.levelCapArchery),
AXES(AbilityType.SKULL_SPLIITER, LoadProperties.levelCapAxes, ToolType.AXE),
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, LoadProperties.levelCapExcavation, ToolType.SHOVEL),
FISHING(LoadProperties.levelCapFishing),
HERBALISM(AbilityType.GREEN_TERRA, LoadProperties.levelCapHerbalism, ToolType.HOE),
MINING(AbilityType.SUPER_BREAKER, LoadProperties.levelCapMining, ToolType.PICKAXE),
REPAIR(LoadProperties.levelCapRepair),
SWORDS(AbilityType.SERRATED_STRIKES, LoadProperties.levelCapSwords, ToolType.SWORD),
TAMING(LoadProperties.levelCapTaming),
UNARMED(AbilityType.BERSERK, LoadProperties.levelCapUnarmed, ToolType.FISTS),
WOODCUTTING(AbilityType.TREE_FELLER, LoadProperties.levelCapWoodcutting, ToolType.AXE);
private AbilityType ability;
private int maxLevel;
private ToolType tool;
private SkillType()
{
this.ability = null;
this.maxLevel = 0;
this.tool = null;
}
private SkillType(AbilityType ability, int maxLevel, ToolType tool)
{
this.ability = ability;
this.maxLevel = maxLevel;
this.tool = tool;
}
private SkillType(int maxLevel)
{
this(null, maxLevel, null);
}
public AbilityType getAbility()
{
return this.ability;
}
public int getMaxLevel()
{
if(maxLevel > 0)
return maxLevel;
else
return Integer.MAX_VALUE;
}
public ToolType getTool()
{
return this.tool;
}
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);
}
return false;
}
public enum SkillType {
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
ALL, //This one is just for convenience
ARCHERY(Config.getInstance().getLevelCapArchery(), Config.getInstance().getFormulaMultiplierArchery()),
AXES(AbilityType.SKULL_SPLIITER, Config.getInstance().getLevelCapAxes(), ToolType.AXE, Config.getInstance().getFormulaMultiplierAxes()),
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getInstance().getLevelCapExcavation(), ToolType.SHOVEL, Config.getInstance().getFormulaMultiplierExcavation()),
FISHING(Config.getInstance().getLevelCapFishing(), Config.getInstance().getFormulaMultiplierFishing()),
HERBALISM(AbilityType.GREEN_TERRA, Config.getInstance().getLevelCapHerbalism(), ToolType.HOE, Config.getInstance().getFormulaMultiplierHerbalism()),
MINING(AbilityType.SUPER_BREAKER, Config.getInstance().getLevelCapMining(), ToolType.PICKAXE, Config.getInstance().getFormulaMultiplierMining()),
REPAIR(Config.getInstance().getLevelCapRepair(), Config.getInstance().getFormulaMultiplierRepair()),
SWORDS(AbilityType.SERRATED_STRIKES, Config.getInstance().getLevelCapSwords(), ToolType.SWORD, Config.getInstance().getFormulaMultiplierSwords()),
TAMING(Config.getInstance().getLevelCapTaming(), Config.getInstance().getFormulaMultiplierTaming()),
UNARMED(AbilityType.BERSERK, Config.getInstance().getLevelCapUnarmed(), ToolType.FISTS, Config.getInstance().getFormulaMultiplierUnarmed()),
WOODCUTTING(AbilityType.TREE_FELLER, Config.getInstance().getLevelCapWoodcutting(), ToolType.AXE, Config.getInstance().getFormulaMultiplierWoodcutting());
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 Permissions.getInstance().acrobatics(player);
case ARCHERY:
return Permissions.getInstance().archery(player);
case AXES:
return Permissions.getInstance().axes(player);
case EXCAVATION:
return Permissions.getInstance().excavation(player);
case FISHING:
return Permissions.getInstance().fishing(player);
case HERBALISM:
return Permissions.getInstance().herbalism(player);
case MINING:
return Permissions.getInstance().mining(player);
case REPAIR:
return Permissions.getInstance().repair(player);
case SWORDS:
return Permissions.getInstance().swords(player);
case TAMING:
return Permissions.getInstance().taming(player);
case UNARMED:
return Permissions.getInstance().unarmed(player);
case WOODCUTTING:
return Permissions.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

@@ -3,145 +3,61 @@ package com.gmail.nossr50.datatypes;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.ItemChecks;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.locale.LocaleLoader;
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 this.lowerTool;
}
public String getRaiseTool()
{
return this.raiseTool;
}
public boolean getToolMode(PlayerProfile PP)
{
switch(this)
{
case AXE:
return PP.getAxePreparationMode();
case FISTS:
return PP.getFistsPreparationMode();
case HOE:
return PP.getHoePreparationMode();
case PICKAXE:
return PP.getPickaxePreparationMode();
case SHOVEL:
return PP.getShovelPreparationMode();
case SWORD:
return PP.getSwordsPreparationMode();
}
return false;
}
public void setToolMode(PlayerProfile PP, boolean bool)
{
switch(this)
{
case AXE:
PP.setAxePreparationMode(bool);
break;
case FISTS:
PP.setFistsPreparationMode(bool);
break;
case HOE:
PP.setHoePreparationMode(bool);
break;
case PICKAXE:
PP.setPickaxePreparationMode(bool);
break;
case SHOVEL:
PP.setShovelPreparationMode(bool);
break;
case SWORD:
PP.setSwordsPreparationMode(bool);
break;
}
}
public long getToolATS(PlayerProfile PP)
{
switch(this)
{
case AXE:
return PP.getAxePreparationATS();
case FISTS:
return PP.getFistsPreparationATS();
case HOE:
return PP.getHoePreparationATS();
case PICKAXE:
return PP.getPickaxePreparationATS();
case SHOVEL:
return PP.getShovelPreparationATS();
case SWORD:
return PP.getSwordsPreparationATS();
}
return 0;
}
public void setToolATS(PlayerProfile PP, long ats)
{
switch(this)
{
case AXE:
PP.setAxePreparationATS(ats);
break;
case FISTS:
PP.setFistsPreparationATS(ats);
break;
case HOE:
PP.setHoePreparationATS(ats);
break;
case PICKAXE:
PP.setPickaxePreparationATS(ats);
break;
case SHOVEL:
PP.setShovelPreparationATS(ats);
break;
case SWORD:
PP.setSwordsPreparationATS(ats);
break;
}
}
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);
}
return false;
}
public enum ToolType {
AXE(LocaleLoader.getString("Axes.Ability.Lower"), LocaleLoader.getString("Axes.Ability.Ready")),
FISTS(LocaleLoader.getString("Unarmed.Ability.Lower"), LocaleLoader.getString("Unarmed.Ability.Ready")),
HOE(LocaleLoader.getString("Herbalism.Ability.Lower"), LocaleLoader.getString("Herbalism.Ability.Ready")),
PICKAXE(LocaleLoader.getString("Mining.Ability.Lower"), LocaleLoader.getString("Mining.Ability.Ready")),
SHOVEL(LocaleLoader.getString("Excavation.Ability.Lower"), LocaleLoader.getString("Excavation.Ability.Ready")),
SWORD(LocaleLoader.getString("Swords.Ability.Lower"), LocaleLoader.getString("Swords.Ability.Ready"));
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.isPickaxe(is);
case SHOVEL:
return ItemChecks.isShovel(is);
case SWORD:
return ItemChecks.isSword(is);
default:
return false;
}
}
}

View File

@@ -2,14 +2,10 @@ package com.gmail.nossr50.datatypes;
import java.util.ArrayList;
import com.gmail.nossr50.datatypes.PlayerStat;
public class Tree {
private TreeNode root = null;
public Tree(){}
/**
* Add a node to this tree.
*
@@ -33,12 +29,12 @@ public class Tree {
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.
/*
* 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>();

View File

@@ -2,48 +2,49 @@ package com.gmail.nossr50.datatypes;
import java.util.ArrayList;
import com.gmail.nossr50.datatypes.PlayerStat;
public class TreeNode {
TreeNode left = null;
TreeNode right = null;
PlayerStat ps = new PlayerStat();
public class TreeNode
{
TreeNode left = null
, 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 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 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

@@ -2,12 +2,12 @@ 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,21 +1,14 @@
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,21 +1,14 @@
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

@@ -0,0 +1,59 @@
package com.gmail.nossr50.datatypes.mods;
import org.bukkit.inventory.ItemStack;
public class CustomBlock {
private int itemID;
private byte dataValue;
private int xpGain;
private int tier;
private ItemStack itemDrop;
public CustomBlock(ItemStack itemDrop, int tier, int xpGain, byte dataValue, int itemID) {
this.itemID = itemID;
this.dataValue = dataValue;
this.xpGain = xpGain;
this.tier = tier;
this.itemDrop = itemDrop;
}
public int getItemID() {
return itemID;
}
public void setItemID(int itemID) {
this.itemID = itemID;
}
public byte getDataValue() {
return dataValue;
}
public void setDataValue(byte dataValue) {
this.dataValue = dataValue;
}
public int getXpGain() {
return xpGain;
}
public void setXpGain(int xpGain) {
this.xpGain = xpGain;
}
public int getTier() {
return tier;
}
public void setTier(int tier) {
this.tier = tier;
}
public ItemStack getItemDrop() {
return itemDrop;
}
public void setItemDrop(ItemStack itemDrop) {
this.itemDrop = itemDrop;
}
}

View File

@@ -0,0 +1,27 @@
package com.gmail.nossr50.datatypes.mods;
public class CustomItem {
protected int itemID;
protected short durability;
public CustomItem(int itemID, short durability) {
this.itemID = itemID;
this.durability = durability;
}
public int getItemID() {
return itemID;
}
public void setItemID(int itemID) {
this.itemID = itemID;
}
public short getDurability() {
return durability;
}
public void setDurability(short durability) {
this.durability = durability;
}
}

View File

@@ -0,0 +1,38 @@
package com.gmail.nossr50.datatypes.mods;
public class CustomTool extends CustomItem {
private double xpMultiplier;
private boolean abilityEnabled;
private int tier;
public CustomTool(int tier, boolean abilityEnabled, double xpMultiplier, short durability, int itemID) {
super(itemID, durability);
this.xpMultiplier = xpMultiplier;
this.abilityEnabled = abilityEnabled;
this.tier = tier;
}
public double getXpMultiplier() {
return xpMultiplier;
}
public void setXpMultiplier(Double xpMultiplier) {
this.xpMultiplier = xpMultiplier;
}
public boolean isAbilityEnabled() {
return abilityEnabled;
}
public void setAbilityEnabled(boolean abilityEnabled) {
this.abilityEnabled = abilityEnabled;
}
public int getTier() {
return tier;
}
public void setTier(int tier) {
this.tier = tier;
}
}

View File

@@ -4,56 +4,55 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.gui.GenericLabel;
import org.getspout.spoutapi.gui.GenericPopup;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
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;
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 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);
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

@@ -3,125 +3,126 @@ 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);
}
// 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;
// Raw getters and setters
public byte getDropsFrom() {
return dropsFrom;
}
public ExcavationTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
super(drop, xp, dropChance, dropLevel);
}
public void setDropsFrom(byte dropsFrom) {
this.dropsFrom = dropsFrom;
}
// Raw getters and setters
public byte getDropsFrom() {
return dropsFrom;
}
// Getters
public boolean getDropsFromDirt() {
return getDropFromMask(1);
}
public void setDropsFrom(byte dropsFrom) {
this.dropsFrom = dropsFrom;
}
public boolean getDropsFromGrass() {
return getDropFromMask(2);
}
// Getters
public boolean getDropsFromDirt() {
return getDropFromMask(1);
}
public boolean getDropsFromSand() {
return getDropFromMask(4);
}
public boolean getDropsFromGrass() {
return getDropFromMask(2);
}
public boolean getDropsFromGravel() {
return getDropFromMask(8);
}
public boolean getDropsFromSand() {
return getDropFromMask(4);
}
public boolean getDropsFromClay() {
return getDropFromMask(16);
}
public boolean getDropsFromGravel() {
return getDropFromMask(8);
}
public boolean getDropsFromMycel() {
return getDropFromMask(32);
}
public boolean getDropsFromClay() {
return getDropFromMask(16);
}
public boolean getDropsFromSoulSand() {
return getDropFromMask(64);
}
public boolean getDropsFromMycel() {
return getDropFromMask(32);
}
private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false;
}
public boolean getDropsFromSoulSand() {
return getDropFromMask(64);
}
// Setters
public void setDropsFromDirt() {
setDropFromMask(1);
}
private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false;
}
public void setDropsFromGrass() {
setDropFromMask(2);
}
// Setters
public void setDropsFromDirt() {
setDropFromMask(1);
}
public void setDropsFromSand() {
setDropFromMask(4);
}
public void setDropsFromGrass() {
setDropFromMask(2);
}
public void setDropsFromGravel() {
setDropFromMask(8);
}
public void setDropsFromSand() {
setDropFromMask(4);
}
public void setDropsFromClay() {
setDropFromMask(16);
}
public void setDropsFromGravel() {
setDropFromMask(8);
}
public void setDropsFromMycel() {
setDropFromMask(32);
}
public void setDropsFromClay() {
setDropFromMask(16);
}
public void setDropsFromSoulSand() {
setDropFromMask(64);
}
public void setDropsFromMycel() {
setDropFromMask(32);
}
private void setDropFromMask(int mask) {
dropsFrom |= mask;
}
public void setDropsFromSoulSand() {
setDropFromMask(64);
}
// Un-setters
public void unsetDropsFromDirt() {
unsetDropFromMask(1);
}
private void setDropFromMask(int mask) {
dropsFrom |= mask;
}
public void unsetDropsFromGrass() {
unsetDropFromMask(2);
}
// Un-setters
public void unsetDropsFromDirt() {
unsetDropFromMask(1);
}
public void unsetDropsFromSand() {
unsetDropFromMask(4);
}
public void unsetDropsFromGrass() {
unsetDropFromMask(2);
}
public void unsetDropsFromGravel() {
unsetDropFromMask(8);
}
public void unsetDropsFromSand() {
unsetDropFromMask(4);
}
public void unsetDropsFromClay() {
unsetDropFromMask(16);
}
public void unsetDropsFromGravel() {
unsetDropFromMask(8);
}
public void unsetDropsFromMycel() {
unsetDropFromMask(32);
}
public void unsetDropsFromClay() {
unsetDropFromMask(16);
}
public void unsetDropsFromSoulSand() {
unsetDropFromMask(64);
}
public void unsetDropsFromMycel() {
unsetDropFromMask(32);
}
private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask;
}
public void unsetDropsFromSoulSand() {
unsetDropFromMask(64);
}
private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask;
}
}

View File

@@ -3,18 +3,18 @@ package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class FishingTreasure extends Treasure {
private int maxLevel;
private int maxLevel;
public FishingTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel, int maxLevel) {
super(drop, xp, dropChance, dropLevel);
this.setMaxLevel(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 int getMaxLevel() {
return maxLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
}

View File

@@ -3,48 +3,47 @@ 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 int xp;
private double dropChance;
private int dropLevel;
private ItemStack drop;
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 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 ItemStack getDrop() {
return drop;
}
public void setDrop(ItemStack drop) {
this.drop = drop;
}
public void setDrop(ItemStack drop) {
this.drop = drop;
}
public int getXp() {
return xp;
}
public int getXp() {
return xp;
}
public void setXp(int xp) {
this.xp = xp;
}
public void setXp(int xp) {
this.xp = xp;
}
public double getDropChance() {
return dropChance;
}
public Double getDropChance() {
return dropChance;
}
public void setDropChance(Double dropChance) {
this.dropChance = dropChance;
}
public void setDropChance(Double dropChance) {
this.dropChance = dropChance;
}
public int getDropLevel() {
return dropLevel;
}
public int getDropLevel() {
return dropLevel;
}
public void setDropLevel(int dropLevel) {
this.dropLevel = dropLevel;
}
public void setDropLevel(int dropLevel) {
this.dropLevel = dropLevel;
}
}

View File

@@ -1,15 +0,0 @@
package com.gmail.nossr50.events;
import java.util.ArrayList;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
public class FakeBlockBreakEvent extends BlockBreakEvent {
public FakeBlockBreakEvent(Block theBlock, Player player) {
super(theBlock, player, new ArrayList<ItemStack>(theBlock.getDrops()));
}
}

View File

@@ -1,10 +0,0 @@
package com.gmail.nossr50.events;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage) {
super(damager, damagee, cause, damage);
}
}

View File

@@ -1,72 +0,0 @@
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
*/
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,54 +0,0 @@
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
*/
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,51 +0,0 @@
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;
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,16 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.inventory.ItemStack;
/**
* Called when mcMMO damages a block due to a special ability.
*/
public class FakeBlockDamageEvent extends BlockDamageEvent {
public FakeBlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) {
super(player, block, itemInHand, instaBreak);
}
}

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

@@ -1,10 +1,14 @@
package com.gmail.nossr50.events;
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageEvent;
public class FakeEntityDamageEvent extends 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,73 @@
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();
@Override
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;
}
}

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