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

Compare commits

...

567 Commits

Author SHA1 Message Date
t00thpick1
13e7788b14 Fix off-by-one chunk coords calculation for ChunkStore. 2014-02-03 08:56:22 -05:00
TfT_02
62b13a9a84 Fixed bug where Snow would never drop treasures
Fixes #1820
2014-02-01 00:30:42 +01:00
TfT_02
c48ccae484 Compile with RELEASE to remain 1.6 compatibility for now 2014-02-01 00:30:37 +01:00
TfT_02
6264bfa15f Don't store Block objects, use BlockState
Fixes #1811, Closes #1822
2014-01-30 20:45:21 +01:00
TfT_02
b50ba9c02e Fix wrong data value of Potion of Hunger II
Fixes #1817
2014-01-26 15:13:35 +01:00
GJ
b3474c04c7 Increment SQL query numbers due to addition of Alchemy. Fixes #1803
Thanks to @roastnewt for the help!
2014-01-21 11:16:39 -08:00
TfT_02
a1c1271d21 Fix issues pointed out by the FindBugs plugin 2014-01-20 23:20:51 +01:00
md-5
79155887b0 You can only ever deploy one release.
Use -SNAPSHOT to indicate this is a dev build and not a release.
2014-01-20 23:06:37 +01:00
TfT_02
4178604833 Update pom.xml with md_5 Maven repo settings 2014-01-20 22:48:27 +01:00
TfT_02
d1fcd6958f Check if brewingStand == null
Fixes #1804
2014-01-20 22:38:20 +01:00
TfT_02
f39623c279 Bit of Alchemy cleanup 2014-01-20 22:38:04 +01:00
GJ
520f5cb116 Fix the broken build. Shame on me. 2014-01-20 14:53:31 -08:00
GJ
43e2c813d1 Clean up some of our messes. 2014-01-20 13:58:40 -08:00
TfT_02
c6ea32f0b0 Added Ender Dragon, Wither, and Witch to combat experience multipliers
They do not give any XP by default.

Fixes #1763
2014-01-19 19:40:33 +01:00
TfT_02
976c3b8494 Fix bug which prevented Hoppers from inserting new bottles
Fixes #1801
2014-01-19 15:35:27 +01:00
TfT_02
f3db90b6a9 Fix a couple of typos in plugin.yml
Mulitplies => Multiplies
2014-01-19 01:08:38 +01:00
TfT_02
82509fb476 Added custom XP boost perk 2014-01-19 01:08:38 +01:00
TfT_02
c27d79cf25 Added new XP perk - 10% boost
Adds #1698
2014-01-19 01:08:37 +01:00
TfT_02
de912c1e07 Make sure the player is valid as well 2014-01-19 01:08:37 +01:00
TfT_02
2159aa91ff Add missing alchemy ingredient tiers to ingredient check 2014-01-18 20:28:28 +01:00
TfT_02
748dba41dc Randomize the treasure drop amounts instead of always dropping everything
For example, the guaranteed 5 diamonds will now be a 1-5 diamond drop.
2014-01-18 19:15:38 +01:00
TfT_02
9349416326 Check if brewing stand still exists before processing AlchemyBrewTask 2014-01-18 19:11:15 +01:00
TfT_02
3b794c897d Make sure the party leader is online before attempting to notify 2014-01-18 19:06:20 +01:00
TfT_02
b460f7a564 Add more debug messages in onDisable()
So that we can track down why the disable proces slows down
2014-01-18 16:59:16 +01:00
TfT_02
383b048fef Changed config validation for Rank_Levels, successive Ranks can now be less than or equal to each other
Closes #1790
2014-01-18 12:02:05 +01:00
TfT_02
243a3bfbf6 Remove trailing whitespaces 2014-01-18 12:02:05 +01:00
TfT_02
c108a475e3 Fix a typo in the Alchemy skill guide
Concotions => Concoctions
2014-01-17 19:25:48 +01:00
TfT_02
6b653fa606 Changed appearance of party member list 2014-01-17 18:58:07 +01:00
TfT_02
818962e668 Added party levels
Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members
2014-01-17 18:56:27 +01:00
TfT_02
c729297615 Added party alliances
Adds the following commands:
`/party alliance`
`/party alliance invite <target>`
`/party alliance accept`

Allies will share party chat and will not be able to harm eachother.
Item and XP sharing is limitied to a single party. Allowing two parties
to team up without sharing resources and XP.

Closes #1009
2014-01-17 18:55:58 +01:00
TfT_02
e6e90954a9 Changed config validation for UnlockLevels, they can now also be 0
Closes #1790
2014-01-17 15:51:28 +01:00
TfT_02
4e86f60fd2 Replace ingredient strings correctly
Fixes #1789
2014-01-17 14:00:22 +01:00
TfT_02
27ff545d46 Add Alchemy hardcore settings to default config.yml file
These setting were already working, just forgot to add them to the
default file as well.
2014-01-17 00:17:10 +01:00
TfT_02
7c891e9ba8 Optimize imports 2014-01-16 22:32:40 +01:00
TfT_02
6143003516 Update PR to changes in master
- Special thanks, instead of in dev team
- Fix formatting issues
  * Remove trailing whitespaces
  * Rename method names of event listeners
  * Check for negative instead of positive
- Added Alchemy skill guide
2014-01-16 22:32:40 +01:00
Eric Hildebrand
8f83e328b0 Introduction of new Alchemy skill! 2014-01-16 22:32:40 +01:00
TfT_02
9afa8efd7d No need to hardcode the max tier here 2014-01-15 12:20:05 +01:00
TfT_02
393d9ca74e Fixed bug where Hylian Luck was broken
Fixes #1771
2014-01-13 14:18:16 +01:00
nossr50
97c95c1c49 This doesn't belong in the main branch 2014-01-12 14:49:05 -08:00
TfT_02
491df2cc82 Changed the appearance of /mcmmo commands
Closes #978
2014-01-12 13:51:12 +01:00
TfT_02
b4a6ecc58c Abstract HolidayManager a little more
Now we don’t have to manually edit this each year.
2014-01-12 12:08:47 +01:00
TfT_02
103bf593f3 Check null here as well
Fixes #1664
2014-01-12 10:30:04 +01:00
TfT_02
0332c0f5e0 Move this comment up
#1538
2014-01-11 15:14:39 +01:00
TfT_02
a004d6976d We already had a key called Confirm_Required
Another attempt to fix #1583
2014-01-11 14:54:01 +01:00
TfT_02
730f786d5b Fix issue with /ptp command
Fixes #1773
2014-01-11 10:30:12 +01:00
Foxtail
8993c71577 Update extrabiomesxl.blocks.yml
Config file was missing a section of 2x2 trees, called Quarter logs.
Missing logs were added to appropriate divided sections.
2014-01-10 10:56:04 -05:00
Sean Porter
cc524bb2ab Map.remove() can return Null. 2014-01-09 22:52:25 -08:00
TfT_02
2e94eecda0 Fix a small error with the config validation of advanced.yml
Fixes #1769
2014-01-08 13:19:51 +01:00
TfT_02
2466270b22 Removed /stats alias for /mcstats
Closes #1667
2014-01-08 01:10:12 +01:00
TfT_02
54a514edfa Added a LOTR mod config files, made by Dragyn 2014-01-07 23:28:16 +01:00
TfT_02
1336aeaef0 Remove/move more comments on identical keys
#1583
2014-01-07 22:05:18 +01:00
TfT_02
3c078100e8 Another attempt to fix the broken config updater
An attempt to solve #1583
2014-01-07 20:50:48 +01:00
GJ
13a623ea1f Misc was getting crowded again. 2014-01-03 11:07:13 -05:00
GJ
05b21eae5f Clean up our inventory event handling. 2014-01-03 10:41:38 -05:00
GJ
e0358d42d6 Ensure we're not dealing with a fake player. Fixes #1749 2014-01-03 09:19:07 -05:00
GJ
26174d88f4 Remove unused import 2014-01-03 08:30:59 -05:00
Sean Porter
c12d4319ac Don't cancel death message fixes for NPCs. 2013-12-27 15:21:25 -08:00
Sean Porter
a87bd14342 The attack target can still be an NPC without being an instance of Player. 2013-12-27 14:50:01 -08:00
TfT_02
d5990eee71 Added a ton of mod config files, made by Dragyn 2013-12-17 19:36:41 +01:00
TfT_02
f94343f13b Only grant taming XP once when taming a horse
Fixes #1651
2013-12-15 23:36:43 +01:00
TfT_02
ea4c424e0f Added level thresholds to hardcore modes
Players will not lose stats when their level is below the
Level_Threshold.
2013-12-15 23:27:37 +01:00
riking
f99e5e015d Add checks to rectify the potential for negative XP
Fixes #1573
2013-12-15 23:26:57 +01:00
riking
56b57da077 Only call one Death Penalty Event 2013-12-15 23:26:57 +01:00
TfT_02
4b402d9837 Fixed validation feedback message for Chimaera Wing recipe cost
Fixes #1703
2013-12-15 22:25:15 +01:00
TfT_02
6c2b1f555f Improve CleanBackupsTask a bit
* Print proper file names to the console when the date could not be
determined
* Skip all directories
* Skip every file that doesn’t have .zip in the file name
2013-12-13 00:17:56 +01:00
TfT_02
cdcda03e92 Moved repair config classes to the config package 2013-12-12 19:53:27 +01:00
TfT_02
65aa05a660 Fix /addlevels all and /skillreset all commands
Fixes #1675
2013-12-12 16:50:36 +01:00
TfT_02
7c7aa994a5 Added pre-made metallurgy.tools.yml by Skuli 2013-12-11 15:02:25 +01:00
riking
2aec4a69ea Database conversion bug: Integral division in output format 2013-12-10 14:56:07 -08:00
Glitchfinder
06c9ea7068 Minecraft handles block drop chances internally.
Fixes #1678
2013-12-08 12:49:43 -08:00
TfT_02
c88583c1c0 Use Matcher.quoteReplacement here!
Fixes #1676 - for real this time
2013-12-08 17:07:45 +01:00
TfT_02
d2b6838453 Fix config.yml formatting 2013-12-08 11:40:09 +01:00
TfT_02
c9f1f8f662 Fixed bug where party chat broke if the display name contained special characters
Fixes #1676
2013-12-08 11:35:02 +01:00
TfT_02
7a08343304 Actually keep all weeks, not just from the past year
Week numbers are obviously the same every year, we need to check the
year as well as the week number to determine if we should keep the
backup file or not.
2013-12-07 13:18:14 +01:00
riking
3b1bb3e08a Minor changes to Tree Feller - use a HashSet, move comment
LinkedHashSet doesn't actually do anything for us - we were never using the consistent ordering it promises, and openjdk-7 doesn't even provide that consistent ordering. Better to just not use it.
2013-12-06 23:55:26 -08:00
TfT_02
07cafd4866 Fixed bug where disabling hardcore mode for specific skills didn't work
Fixes #1661
2013-12-03 22:15:23 +01:00
GJ
48821a710f Fixed bug with cooldown donor perks 2013-12-02 08:30:45 -05:00
GJ
30a1b333b9 Need a space here. 2013-12-02 08:18:28 -05:00
GJ
696bf71962 Remove unused import 2013-12-02 08:13:53 -05:00
t00thpick1
2d577e92f1 AntiTheft option for Disarm Ability 2013-12-01 19:08:22 -05:00
Luuk Jacobs
86b92b5b30 add alias to mcscoreboard 2013-11-27 00:35:58 +01:00
GJ
24c1dec046 Fix missing import & broken build.
That's what I get for editing through Github's web UI...
2013-11-25 09:32:16 -05:00
GJ
6c478a26c4 Fix issue with custom axes not working with Tree Feller.
Most custom materials don't properly report their max durability, so we need to use our repairable manager to handle them instead.
2013-11-25 09:29:41 -05:00
t00thpick1
2d3da6daf8 Space not underscore 2013-11-24 18:01:05 -05:00
t00thpick1
de3b2b8024 Damage should probably actually be fatal I would think. 2013-11-23 12:34:14 -05:00
t00thpick1
02a064ffc6 These need spaces to be called pretty 2013-11-23 00:45:12 -05:00
t00thpick1
cb5303ce4d These strings return with Spaces, not underscores 2013-11-23 00:42:43 -05:00
t00thpick1
c0dee19cb0 Missed a refactor :P Also, javadoc event 2013-11-22 12:48:53 -05:00
t00thpick1
870987bba7 SecondaryAbility's API additions 2013-11-22 12:32:23 -05:00
riking
5d63a4b910 Run PlayerProfileSaveTask async, as intended 2013-11-21 12:41:26 -08:00
riking
3236ee5ec9 Harden save() method by making a defensive copy 2013-11-21 11:17:24 -08:00
riking
12ed2ac07b Have ExperienceCommand and SkillresetCommand explicitly handle 'all' 2013-11-19 18:56:47 -08:00
t00thpick1
729f3b1df9 There is no usage of this method in which "all" will not cause NPE's 2013-11-19 21:00:29 -05:00
TfT_02
ee1be3599c .length doesn't start at 0 2013-11-18 21:01:41 +01:00
TfT_02
12a6aca8cd Assume that block data = 0 if there isn't one in the config 2013-11-18 20:48:37 +01:00
TfT_02
2b81b8daeb Fix Commands.Scoreboard.Timer locale string
Closes #1626
2013-11-18 19:56:29 +01:00
GJ
5edbdec151 Actually fix broken locale string. 2013-11-15 07:25:50 -05:00
GJ
eaa38c11b8 Fix broken locale string.
Fixes #1615
2013-11-13 09:47:13 -05:00
GJ
e904e34556 Update Korean translation
Closes PR #1613 from @wolfdate25
2013-11-12 08:15:58 -05:00
TfT_02
445f805bb8 Set the treasure drop after using .clone()
Fixes #1603
2013-11-12 12:49:16 +01:00
t00thpick1
df77b9d0ed Parenthesis 2013-11-10 13:56:15 -05:00
t00thpick1
29f2525b58 Tend toward the smaller values, and configurable maximum for horse jump strength 2013-11-10 13:54:45 -05:00
TfT_02
5a68c7a335 Fixed bug which prevented gaining Acrobatics XP 2013-11-10 00:52:30 +01:00
GJ
69ef7f40d8 Command cleanup. 2013-11-08 23:14:11 +01:00
GJ
d1d6b80676 Allow repair of items without a recipe. 2013-11-08 10:52:43 -05:00
GJ
dfe83ff497 Fix divide by zero bug
Minimum Level & Minimum Quantity were accidentally flipped.
2013-11-07 09:13:56 -05:00
riking
e5acf6d936 Also clone fishing treasures, use alternate Wool method
The alternate wool method is testing, the treasure clone is there to stay ;)
2013-11-06 21:34:16 -08:00
riking
bca0ca6766 Fix Shake poisoning the treasure cache with Wither skeletons
The returned ItemStack is modified for both Sheep and Skeletons, so a copy should be returned.
2013-11-06 21:03:13 -08:00
GJ
f17b5faaf6 Parenthesis are good. 2013-11-06 14:52:19 -05:00
GJ
f20fa571f1 Update changelog. 2013-11-06 11:56:50 -05:00
GJ
b90d1c31c7 Updated localization files
Includes new Portuguese (Brazil) translation provided by @FabioZumbi12
in #1585

Includes new Korean translation provided by @wolfwork in #1258
2013-11-06 09:48:05 -05:00
GJ
cf56ca35eb Tweaked durability handling slightly.
Now routes everything through one function to handle enchants and max
durability. Use max durability from RepairableManager by default to
account for mod tools.
2013-11-06 08:45:20 -05:00
TfT_02
c31f5b5782 Account for Unbreaking enchantment when using abilities 2013-11-05 14:51:54 +01:00
GJ
af98c8eb59 Best way to handle minimum quantities.
Check repair function first, assuming the item isn't null, otherwise
check the config. If not found, check config.
2013-11-04 11:01:14 -05:00
TfT_02
3a10b2d83c Make sure we're not setting a bite chance > 1.0
Fixes #1592
2013-11-04 10:32:05 +01:00
TfT_02
32e7c48fd8 Change this message to something that makes sense
The old message was confusing see #1593
2013-11-03 22:49:39 +01:00
Glitchfinder
af578870c7 Defaulted quantities should be defaulted everywhere.
Fixes #1581
2013-11-03 09:40:04 -08:00
TfT_02
cd470d5497 Fix a NPE which occured when there was no backups folder 2013-11-03 14:09:41 +01:00
TfT_02
a9c5e2a04f Don't send a message to the console if no backups were deleted 2013-11-02 21:50:49 +01:00
TfT_02
0196fd8447 Fix the update checker 2013-11-02 21:49:20 +01:00
TfT_02
b1458840e7 Permissions should be lowercase 2013-11-02 19:29:36 +01:00
TfT_02
1fea786669 Added bypass permission for finding Fishing traps 2013-11-02 19:25:02 +01:00
TfT_02
6f9a57751e We can't schedule tasks in onDisable() 2013-11-01 17:39:03 +01:00
GJ
2e1c585005 Fix issue with updating players that are offline. 2013-11-01 12:38:40 -04:00
GJ
811626e67b Cleanup. 2013-11-01 11:54:51 -04:00
TfT_02
cdfd81a67a Cleanup ZipLibrary class 2013-11-01 16:44:03 +01:00
TfT_02
408b8b2107 Added automatic cleanup of backups folder
By default mcMMO keeps the following files:
 * All files from the last 24 hours
 * Daily backups of the past week
 * Weekly backups of the past months

Adds #1574
2013-11-01 16:43:56 +01:00
GJ
6d5f3a52f4 Don't process chat if the mcMMOPlayer is null.
The player should ALWAYS be online when chatting, but depending on
external plugins and applications, this is not always properly
implemented. Fixes #1578
2013-11-01 09:30:10 -04:00
GJ
2cdf08de9f Allow offline players for chat events.
This fixes issues with plugins or applications that rely on JSONAPI to
chat. Fixes #1578
2013-11-01 09:12:06 -04:00
GJ
71141a0f8d Minimum quantity should default to 2.
Fixes #1581
2013-11-01 08:22:14 -04:00
TfT_02
bded936af5 Cleanup our imports 2013-10-31 22:30:05 +01:00
GJ
caaac232d7 Cleanup CombatUtils.
Opting to stick with the if-else rather than the switch statement,
because I think it's slightly easier to read.
2013-10-31 15:03:06 -04:00
GJ
a9d51dad34 Clean up Smelting checks.
Now uses recipes to check if an item is the result of smelting.
2013-10-31 14:29:06 -04:00
GJ
88296da0af Removed MCPC+ workaround.
This has been fixed by MCPC+ starting with build 112.

Addresses #1549
2013-10-31 13:28:54 -04:00
GJ
de3c4f8fd7 Smelting now works with custom ores.
Also fixed exploit where smelting XP could be awarded for some
non-smeltable materials.
2013-10-31 13:25:06 -04:00
GJ
1785bab504 Fix bug with Salvage config value.
After our renames and updates, Salvage was not reading the config value
for the anvil material properly.
2013-10-31 09:09:52 -04:00
GJ
41da32cd1b Added options to disable various sound effects.
Fixes #1577
2013-10-31 09:03:29 -04:00
GJ
93d586592e Move these checks up.
These checks need to happen sooner because they may impact config
loading, specifically the MCPC+ check.

Fixes #1549
2013-10-31 08:15:30 -04:00
Glitchfinder
d6c6c75157 Experience is occasionally zero or cast to zero.
Fixes #1575 and fixes #1576
2013-10-30 15:49:47 -07:00
GJ
4889769522 Workaround MCPC+ shortcomings for now.
Fixes #1549
2013-10-30 15:33:37 -04:00
TfT_02
6c70de6a58 Also backup experience.yml 2013-10-30 12:33:34 +01:00
GJ
fd9154e009 Fixed bug with toggle commands not properly displaying the success message. 2013-10-29 11:45:27 -04:00
GJ
97b9214d6e Wrap these inside McMMOPlayer for easier access. 2013-10-29 11:02:57 -04:00
GJ
a8d1376533 More minor cleanup. 2013-10-29 10:01:30 -04:00
GJ
3be443c63c Cleanup some XP functions, remove unused scoreboard values, minor refactoring. 2013-10-29 09:49:41 -04:00
GJ
cc2c9eb21d Move this to the skill itself. 2013-10-28 16:32:40 -04:00
GJ
9b3ae5c729 These belong in their managers, not in McMMOPlayer 2013-10-28 16:14:52 -04:00
GJ
ccb7fc5886 Remove, don't just comment out. 2013-10-28 16:04:55 -04:00
GJ
60d69e3cc4 Create wrapper to handle all PTP data. 2013-10-28 15:49:48 -04:00
riking
f64f62492f Reinstate static color list, clarify intent 2013-10-28 12:47:25 -07:00
GJ
3fe936306b Oops. 2013-10-28 15:19:47 -04:00
GJ
c79f8043ad Use proper functions where they exist, and move functions to better locations. 2013-10-28 15:12:24 -04:00
GJ
8369ae4616 Don't use a class variable here. 2013-10-28 14:14:20 -04:00
GJ
4715688fe8 Update changelog. 2013-10-28 14:07:41 -04:00
GJ
62e03a4ef5 Black is hard to read. 2013-10-28 13:58:34 -04:00
GJ
9ef3c721df Formatting cleanup from the scoreboard update. Also handle skill permissions differently. 2013-10-28 13:04:46 -04:00
TfT_02
f55039ac6b Earn XP when using Shake
Adds #1564
2013-10-28 17:38:03 +01:00
TfT_02
be792a1052 Fix exploitPrevention() and add Javadocs 2013-10-28 15:39:47 +01:00
GJ
c612036db3 Don't try to find a treasure if there aren't any.
Fixes #1572
2013-10-28 08:52:55 -04:00
GJ
ad4ee6f402 Cleanup exploit prevention method. 2013-10-28 08:17:06 -04:00
TfT_02
49a5bd2ba6 We can move this check to exploitPrevention() 2013-10-26 00:50:31 +02:00
GJ
8aac6a992b Back to active development. 2013-10-25 17:11:54 -04:00
GJ
5da66f05d4 Update pom.xml for 1.4.07 release 2013-10-25 17:11:04 -04:00
GJ
134e0db2e9 Cleanup more of Riking's mess. 2013-10-25 17:07:56 -04:00
GJ
b3415ee2f4 Cleanup some of Riking's mess. 2013-10-25 17:05:36 -04:00
TfT_02
14175a6dfd Don't complain about missing Guide strings 2013-10-25 22:16:18 +02:00
TfT_02
7b3fb46a9a Improved AFK Acrobatics prevention mechanism 2013-10-25 22:02:39 +02:00
Kane York
0aea165a8f Add note about temporary dev build setup to README 2013-10-25 11:46:29 -07:00
riking
17b7a9bf10 Add message to /mcscoreboard time [n] 2013-10-25 11:41:21 -07:00
riking
bd611ee11c Add message to /mcscoreboard keep when a board is not shown 2013-10-25 11:39:24 -07:00
riking
c6ca65f5c9 Create a utility method in SkillUtils to easily check ability cooldowns 2013-10-25 09:49:02 -07:00
riking
95f15e68fe New and Improved Scoreboard System
- Scoreboards now AUTO-UPDATE
 - Scoreboards now COME IN COLOR
 - If you want, they can come in EVERY COLOR (Config setting)
 - Scoreboards can be displayed alongside chat output!
 - Prevention of denial of service to SQL via spamming /mctop using a cooldown
 - Added /mccooldown command to show cooldowns for all available skills
2013-10-25 09:49:02 -07:00
TfT_02
89dabaeb43 Hook location cleanup 2013-10-24 23:14:23 +02:00
TfT_02
c2e100b1e3 Use hook location in Master Angler 2013-10-24 21:19:24 +02:00
GJ
9f33c6cef1 Use addUnsafeEnchantment instead of addEnchantment
Since the enchantment was already present on the item, there's no need to check if it's valid. This also avoids any errors that may occur when trying to repair an item with non-standard enchants.

Fixes #1561
2013-10-22 09:57:13 -04:00
GJ
7e241e3993 Useless else statement. 2013-10-21 13:15:41 -04:00
GJ
bc51505150 More cleanup. 2013-10-21 08:31:35 -04:00
TfT_02
e0599a0dea Subtract XP with Hardcore mode
Adds #1529
2013-10-20 20:02:16 +02:00
TfT_02
d410251595 Changed kraken default behavior
It will no longer broadcast chat messages globally by default, as well as strike lightning on it's target. Instead it will spawn explosion effects.
2013-10-20 17:04:50 +02:00
TfT_02
810c74dc2a Fixed bug which prevented players from leveling up
Any affected players will get their levels back when they gain some
more XP in that particular skill.
2013-10-19 14:08:04 +02:00
TfT_02
100f2c7e56 Added a warning message if the server is running NoCheatPlus without CompatNoCheatPlus 2013-10-19 00:27:07 +02:00
TfT_02
e13e5295e8 Notify about updates if user is running dev1 and beta1 is available 2013-10-18 17:25:21 +02:00
TfT_02
b100b7bcc7 Gravity's Updater version 2.0 2013-10-18 16:58:12 +02:00
TfT_02
f4ff8518c2 Cleanup progress feedback 2013-10-18 16:43:37 +02:00
riking
dbd27b641e Give periodic status messages to the console in conversion 2013-10-18 16:40:44 +02:00
TfT_02
4a428a47af Fix bug with HolidayManager and some cleanup 2013-10-18 16:24:01 +02:00
GJ
3252137ed7 Update locale files. 2013-10-18 10:20:38 -04:00
GJ
68c4b99d1b Oops. 2013-10-18 10:16:51 -04:00
GJ
f282891d0a More info for armor errors. 2013-10-18 10:15:23 -04:00
GJ
7f4e3fedb3 Need different methods for mod files and regular files. 2013-10-18 10:12:55 -04:00
GJ
2042e0cdbd How did I not realize this would loop forever... 2013-10-18 10:02:11 -04:00
GJ
2662fee9fb ACTUALLY use the proper path. 2013-10-18 10:02:10 -04:00
TfT_02
e8e2dcff46 -levelsChanged instead of - levelsChanged 2013-10-18 15:26:15 +02:00
TfT_02
3b09012b35 Also use getServer() here as well 2013-10-18 15:26:14 +02:00
GJ
a774733af4 Use proper path 2013-10-18 09:23:10 -04:00
GJ
4a7e1e2b94 Update pom.xml to fix resource issues. 2013-10-18 08:54:07 -04:00
GJ
b8c1f868f5 Event updates 2013-10-18 08:54:06 -04:00
GJ
3f56a8fbcf Importing Bukkit.java is bad, always use getServer() instead 2013-10-18 08:54:05 -04:00
Bestle
d8e86d0fc7 Fix logic error in fireworkParticleShower
If a player is inside a vehicle, the y position of the spawned firework should be modified, not the x
2013-10-18 12:59:21 +01:00
TfT_02
e125700b43 Fixed Fishing ability "Shake" 2013-10-18 12:25:49 +02:00
t00thpick1
819a1c62ed Merge pull request #1550 from Bestle/master
Add missing ignoreCancelled checks - MERGE COMMIT HAHAHAHA
2013-10-17 16:38:38 -07:00
Bestle
4bc446e306 Add missing ignoreCancelled checks
If a plugin cancels a piston retract or extend event, mcMMO still considers that block or blocks to have moved.

This allow players to gain xp and double drops from blocks that they shouldn't. Checking for cancelled events fixes this.
2013-10-17 21:05:29 +01:00
TfT_02
7f2f15d88e Revert "Don't forget to include the mod files!"
This reverts commit be4736fffd.
2013-10-16 01:41:31 +02:00
TfT_02
be4736fffd Don't forget to include the mod files!
Fixes #1546
2013-10-16 01:38:09 +02:00
riking
b4f4de4628 Get all logs in Tree Feller, and optimize performance
Tree Feller has been shown, both anecdotally and with timings, to put a strain on the server, and therefore is worthy of the effort of optimization.
Prior to this change, on jungle trees, Tree Feller would take around 20-40 milliseconds to process a Jungle Tree after the JIT kicked in, and around 15-25 milliseconds for a normal tree.

Additionally, logs would be left up in the air for jungle trees.

After this change, Tree Feller takes 2-5 milliseconds on normal trees, and 10-15 milliseconds on jungle trees, and no logs are left up in the air.
2013-10-16 00:59:11 +02:00
TfT_02
b9c652ef2b This check shouldn't be inverted
Fixes #1545
2013-10-16 00:57:56 +02:00
GJ
bf4e8d43ea Because the entity that exploded might be null (or might not be TNT) 2013-10-15 13:10:29 -04:00
GJ
468fbdab56 SkillUtils cleanup, EventUtils creation
Move some functions in SkillUtils to more relevant locations.

Begin work on utility class to handle all event calls.
2013-10-15 13:03:33 -04:00
GJ
309dfd50cd Revert change to smoke particle handling
Have to do it this way, because not all block directions are valid for
smoke
2013-10-15 08:38:59 -04:00
riking
44e3e4d1e1 Localize several command results
Also don't nullcheck the null-guarded mcMMOPlayer in PartyManager
2013-10-14 20:48:36 +02:00
riking
476f426590 Remove RepairableManagerFactory until we actually need it
Let's hold off on the factory pattern until we actually offer choices.
2013-10-14 20:48:35 +02:00
riking
766f1f4127 Oh! So that's why it's never used here 2013-10-14 20:48:35 +02:00
riking
b3cf9bf839 When an error occurs updating the leaderboards, print out the current player name if possible 2013-10-14 09:53:42 -07:00
GJ
056f7cc93b Nicer handling of some particle effect code. 2013-10-14 11:29:25 -04:00
TfT_02
741f629ab8 Don't spawn fireworks under a boat (for real this time)
Fixes #1534
2013-10-14 17:07:15 +02:00
TfT_02
dd64c4008b Account for Master Angler config values in /fishing
Fixes #1537
2013-10-14 16:28:48 +02:00
TfT_02
3a5de8e2ce This should be on LOWEST 2013-10-14 09:28:16 +02:00
TfT_02
2d78c0738d Color party leader names only once 2013-10-12 20:50:42 +02:00
TfT_02
77617ebee2 Add bow to fishing treasures 2013-10-12 20:29:52 +02:00
TfT_02
67e9d9c535 Fishing TNT traps should not destroy blocks 2013-10-12 03:30:10 +02:00
TfT_02
800786111c Fix apostrophe issues
Fixes #1523
2013-10-12 02:41:13 +02:00
TfT_02
ed8197bd50 Remove level based bonus from Master Angler
Let's try this another way, instead of removing this passive ability all togheter I think it would be nice to keep the boat/biome catch rate boost. The level based boost was out of hand and counter-intuitive as it made leveling easier on high skill levels.
2013-10-12 02:41:13 +02:00
TfT_02
82f8c4ce36 Fishing Treasure Hunter overhaul 2013-10-12 02:41:13 +02:00
TfT_02
b1cf7d0348 Fire FakeBlockBreakEvent when using Hylian Luck
Fixes #1528
2013-10-11 23:47:42 +02:00
GJ
ae77313007 We forgot one...
Fixes #1527
2013-10-11 15:46:34 -04:00
TfT_02
49cbaad47f Clean up advanced.yml comments and keys 2013-10-11 16:22:30 +02:00
TfT_02
1d96ed72dc Move Acrobatics XP settings to experience.yml 2013-10-11 15:18:57 +02:00
TfT_02
ec378d046f Reformat advanced.yml making the keys consistent 2013-10-11 15:18:56 +02:00
GJ
a25dc24c6c No reason to have this many functions... 2013-10-11 15:18:56 +02:00
TfT_02
68eb51a3d0 Removed Shake_UnlockLevel config option
because it is no longer needed.
2013-10-11 15:18:56 +02:00
TfT_02
2eda3a9c83 Add extra tiers! Every ability now has 8 tiers 2013-10-11 15:18:55 +02:00
GJ
ad8e200a84 Make sure we update the blocks config after this too. 2013-10-09 11:45:49 -04:00
GJ
0c83bf2a80 Improve our drop handling. 2013-10-09 11:44:45 -04:00
GJ
6eaec5ffab We don't need this anymore. 2013-10-09 10:27:06 -04:00
GJ
8a2c5fb051 Check 0 first. 2013-10-09 10:26:51 -04:00
GJ
9485869014 Move these functions to SkillType. 2013-10-09 09:20:32 -04:00
GJ
e1bf55b077 Backup old mod configs & replace with new. 2013-10-08 13:10:09 -04:00
GJ
81140824e4 Backup and replace updated treasures.yml file. 2013-10-07 13:09:46 -04:00
GJ
d5545de81f Backup & replace the repair config files that have been updated. 2013-10-07 13:04:36 -04:00
GJ
8632baed27 No reason to handle this ourselves, Bukkit does it for us. 2013-10-07 11:54:23 -04:00
GJ
9aaea7e44f Fix old files if they exist. 2013-10-07 10:43:22 -04:00
GJ
c2f8f4d016 User data is now saved in flatfile, not FlatFileStuff 2013-10-07 10:33:14 -04:00
GJ
5131e74349 Save mod config files to "mods" rather than "ModConfigs", mirror directory structure inside the jar file. 2013-10-07 10:32:40 -04:00
GJ
3927427b5b Refactor all our repairable stuff into a special package. 2013-10-07 10:23:04 -04:00
TfT_02
4aef4c63fc Split the locale skill guides into seperate sections
This will make it easier for translators to keep up with translating our skill guides. Closes #560
2013-10-07 16:05:11 +02:00
GJ
fb4777e7f0 Added XP boost to Acrobatics when wearing Boots of Feather Falling.
Adds #1098
2013-10-07 09:53:32 -04:00
GJ
d8f3a54f9b Compiler throws warnings all over the place about our close methods, this one is no different. 2013-10-07 07:56:13 -04:00
GJ
de964a3a60 This naming bothers me. 2013-10-07 07:53:42 -04:00
t00thpick1
ce3bc07aa8 Reasonably sure this needs to be this way 2013-10-06 17:46:45 -04:00
TfT_02
5a6bb363cf Don't spawn fireworks under the player if they're in a vehicle 2013-10-06 12:08:22 +02:00
TfT_02
3f9c98d72e Update changelog & minor formatting fixes 2013-10-06 10:25:28 +02:00
riking
96b54387fe SQL database - split loadProfile to have retry flag
Instead of assuming that newUser() worked as intended, we cycle back around into the method.
This also removes the possibility of infinite loops from the writeMissingRows() code path.
2013-10-06 10:09:09 +02:00
riking
70eb67dd6a Flatfile loadProfile - place newUser() inside of try block
This fixes incorrect behavior in the edge-case where an IOException occurs when reading (but not writing) the flatfile database.
2013-10-06 10:09:09 +02:00
riking
77f9f40065 Do not save an un-loaded PlayerProfile 2013-10-06 10:09:09 +02:00
riking
14ae1a69c4 Attempt clean recovery from an unloaded PlayerProfile
This change should cause McMMOPlayer to create a graceful recovery when the database is temporarily unavailable.
When a McMMOPlayer is constructed and recieves an unloaded PlayerProfile, it schedules a task to re-attempt profile retrieval. This task can run for a maximum of 5 seconds, after which a second warning is printed indicating that it has given up (and a message given to the user).
2013-10-06 10:09:09 +02:00
riking
c9858dfd49 Do not mark a PlayerProfile as clean if it failed to save
DatabaseManager.saveUser() now returns a success value, which is used by PlayerProfile to determine whether or not it should be considered clean.
2013-10-06 10:09:09 +02:00
riking
f75fe3cc89 Potential fix for loss of data due to SQL connection dropping
The idea behind this change is to send a ping every hour, which is shorter than the driver's 'dead connection' threshold of 8 hours.

As a side effect, this also will fix a subset of the situations where the MySQL server is restarted.
2013-10-06 10:09:08 +02:00
TfT_02
c19ccbccac Use only 1 extra durability by default, instead of 2 2013-10-06 10:08:06 +02:00
TfT_02
2f90e533a5 Improve validation messages of treasures.yml 2013-10-06 09:51:33 +02:00
Kane York
0cd0919447 /mcconvert: Fix mismatched type in list.remove() call
The databaseTypes collection is a List<String>, so attempting to remove a DatabaseType object will have no effect.
2013-10-05 14:07:06 -07:00
TfT_02
e8b886fcc6 This check somehow got removed 2013-10-05 01:18:51 +02:00
GJ
b8e937a234 ALWAYS remove pots broken by swords. 2013-10-04 13:16:41 -04:00
GJ
eb2e0d3abf Fixed Hylian Luck not working at all.
Fixes #1508
2013-10-04 10:27:18 -04:00
GJ
3365da7f8d MCPC+ checks, notify server owners that they're missing out. 2013-10-04 09:50:49 -04:00
TfT_02
a0e37a4a09 I forgot to invert this check 2013-10-03 22:04:39 +02:00
GJ
5541c15753 Try/catch was stupid. 2013-10-02 09:07:30 -04:00
GJ
f87110749e ACTUALLY fix the NPE here. 2013-10-02 09:03:09 -04:00
GJ
a0ef0d5708 Check vanilla's maxDurability here as well, just to be safe.
Fixes #1504
2013-10-02 08:56:48 -04:00
TfT_02
2e2abcd645 Handle this nicer 2013-10-02 10:42:06 +02:00
TfT_02
6baf820afa Cleanup and formatting 2013-10-01 22:14:29 +02:00
Kane York
288287badf Add holiday celebration for the console 2013-10-01 22:06:51 +02:00
TfT_02
ca4feca073 Cleanup changelog.txt a bit 2013-10-01 15:09:45 +02:00
GJ
7c9356955e ACTUALLY handle SQL passwords (or other fields) with '#' in them properly. 2013-09-30 16:17:44 -04:00
GJ
57541ec233 This can never be null, and there's no reason to pass that as a variable. 2013-09-30 14:19:07 -04:00
TfT_02
9c6d1ce020 Fixing these infinite recursing methods
Oops, that was silly. Thanks @t00thpick1
2013-09-30 19:38:22 +02:00
TfT_02
c72ead9d0a Prevent breaking other plugins who use this API 2013-09-30 19:03:44 +02:00
TfT_02
4262a1b2a5 Added two more treasures to Excavation 2013-09-30 16:24:21 +02:00
TfT_02
eb589b6e78 Renamed some config options in the Commands section.
The following keys have been renamed:
* General => Generic
* p => partychat
* a => adminchat
2013-09-30 15:43:37 +02:00
GJ
98e5e53fda Ignore "#" in SQL passwords. 2013-09-30 08:36:32 -04:00
TfT_02
00918fbdc1 Change this back, getPlayerExact() is faster 2013-09-30 14:04:34 +02:00
TfT_02
5ad0f2c624 Do a little bit of localebending 2013-09-30 11:32:35 +02:00
TfT_02
babb9baa2b Handle joining disbanded parties properly 2013-09-30 11:22:15 +02:00
TfT_02
45143836e5 Fixed /party kick
Fixes #1499
2013-09-30 10:39:33 +02:00
TfT_02
ceacd7dc52 Fixed /party disband 2013-09-30 10:39:14 +02:00
TfT_02
6eb255632f Clean this up a little bit 2013-09-30 10:24:36 +02:00
TfT_02
3a37d0e092 Fixing an error due to confusingly named check
Refactored healthBarEnabled to healthBarPluginEnabled to avoid this
from happening again.
2013-09-29 23:57:13 +02:00
TfT_02
4c7fb1854d addRawXP should use float instead of int 2013-09-29 15:48:11 +02:00
TfT_02
763cff6898 Fixed a bug where Repair wasn't asking for confirmation 2013-09-28 19:46:47 +02:00
riking
fa34d06341 Clear child skill FamilyTree on reload 2013-09-27 15:46:19 -07:00
TfT_02
1ca53da0e2 Also try to count recipe ingredients regardless of repairMaterial
when the normal counting and the config value result in 0

Fixes #1484
2013-09-27 13:42:50 +02:00
TfT_02
57dfa00541 Fixed a NPE when an invalid repair material was entered
#1484
2013-09-27 10:46:54 +02:00
TfT_02
36ae84eada Update README.md 2013-09-26 23:06:07 +02:00
GJ
7f290504ad Set random jump strength for horses as well. 2013-09-26 10:43:45 -04:00
GJ
92b4be9a01 We don't use these parts of the updater. 2013-09-26 09:39:13 -04:00
GJ
8cb8dea642 Move Updater to independent package due to custom changes being overwritten by other plugins using the updater. 2013-09-26 09:37:31 -04:00
GJ
a63f745c73 Add custom mobs automatically as they're killed. 2013-09-26 15:06:36 +02:00
GJ
4a0fee5796 Use class names to better find custom entities. 2013-09-26 15:06:21 +02:00
GJ
cf90236e57 Redo blocks.yml
** YOU WILL NEED TO UPDATE THIS FILE **
2013-09-26 15:06:21 +02:00
GJ
fc6c7bb1de Rework custom tool config.
** YOU WILL NEED TO UPDATE YOUR CONFIG TO THE NEW FORMAT **
2013-09-26 15:06:21 +02:00
GJ
1b92131ce9 Added Carrot on a Stick, and Flint & Steel to repair.vanilla.yml 2013-09-26 14:58:31 +02:00
GJ
792ecd6aad Rework armor.yml to take item names instead of IDs in advance of 1.7 changes.
** YOU WILL NEED TO REDO YOUR armor.yml FILE **
2013-09-26 14:58:30 +02:00
TfT_02
933b6f278b Disable partial name matching for offline players by default
#1482
2013-09-25 14:26:24 +02:00
TfT_02
45dfc13ebd Match playernames using OfflinePlayers instead
Fixes #1482
2013-09-24 11:40:53 +02:00
dddeeefff
1254ab232a Add randomized Horse appearance to Call Of The Wild 2013-09-23 22:29:02 +02:00
dddeeefff
b49e56c857 Added missing COTW message when there are too many Horses nearby 2013-09-23 22:29:01 +02:00
TfT_02
d5bd9a1693 Fixed some small mistakes in CommandUtils 2013-09-23 20:22:41 +02:00
GJ
9b60cd96f9 Don't need these keys with the new format either. 2013-09-23 10:33:50 -04:00
TfT_02
0a05ed98d0 Updated to the new format! 2013-09-22 23:28:09 +02:00
TfT_02
6a3a564bd4 Use cooldownExpired here as well. 2013-09-22 23:28:09 +02:00
TfT_02
3828f78480 Fixed respawn cooldown checks
Thanks @Riking for pointing this out!
2013-09-22 23:28:08 +02:00
Travis Ralston
239d7e33cb Revert "Metrics be dead"
This reverts commit 0a9fd4a92e.
2013-09-22 12:33:01 -06:00
TfT_02
b8c479549c Disable our healthbars when the plugin "HealthBar" is found
Adds #1477
2013-09-22 16:55:02 +02:00
t00thpick1
0a9fd4a92e Metrics be dead 2013-09-20 22:23:38 -04:00
TfT_02
4c96161acb Don't throw errors about dropped columns 2013-09-20 21:39:20 +02:00
TfT_02
ce7a7a31a7 A bit of cleaning up 2013-09-20 00:15:22 +02:00
TfT_02
834e26b44e Minor improvements 2013-09-19 21:47:12 +02:00
GJ
f71b302f6f Don't need this anymore. 2013-09-19 15:19:16 -04:00
GJ
566a381e95 Remove debug message, use recipe method for salvage. 2013-09-19 15:17:19 -04:00
GJ
5d7d779a49 Changed format of repair.vanilla.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT** 2013-09-19 11:02:47 -04:00
GJ
59a35b170c Oh yeah, that's why. 2013-09-18 15:42:54 -04:00
GJ
14eb473355 Why we were making this so complicated, I'll never know. 2013-09-18 14:55:17 -04:00
GJ
a8e23e08ee Remove HudType from Flatfile records. 2013-09-18 11:54:23 -04:00
GJ
15f5dcf860 Removed HudType references from the database. 2013-09-18 09:57:28 -04:00
GJ
9be9908a22 Remove unused imports. 2013-09-18 09:39:54 -04:00
GJ
446b6c107b Remove empty lines from FlatFile - the plugin will not enable if these are present. 2013-09-18 08:34:47 -04:00
GJ
5a3f8ad15f Add COTW info for horses to the Taming command. 2013-09-17 14:13:11 -04:00
GJ
3a2c6a0827 We can have ' again! 2013-09-17 14:09:39 -04:00
GJ
e865acd871 Fix locale parsing issues.
Fixes #1463
2013-09-17 14:03:00 -04:00
TfT_02
4a0e1ba444 Fix a small boo boo 2013-09-16 23:26:06 +02:00
GJ
1a88b0b944 Better way to handle ink sacks, allows for dropping of multiple types. 2013-09-16 12:48:08 -04:00
GJ
e0592b3f62 Don't try to ever pull the mcMMOPlayer here.
Fixes #1466
2013-09-16 12:12:31 -04:00
GJ
1ec55c2d7e Remove the last bits of Spout from our code. 2013-09-16 12:05:39 -04:00
GJ
6427a7dcdf Fix issues with Skulls in treasures.yml 2013-09-16 11:45:57 -04:00
TfT_02
7bac0e2ca5 Dropped SpoutPlugin support
Because SpoutPlugin is not being updated to 1.6.x and mcMMO 1.4.07 does
not support any CB version below 1.6.x SpoutPlugin support is no longer
needed.
https://blog.spout.org/minecraft-1-6-and-the-legacy-finale/
2013-09-16 16:48:42 +02:00
GJ
e8bc2475c3 Add sound for level-up even when not using Spout. 2013-09-16 09:52:09 -04:00
GJ
816b08b14a Make sure the attacker is a valid player too.
Fixes #1464
2013-09-16 08:53:55 -04:00
GJ
64e1448782 Added ability to give items names & lore through treasures.yml.
Adds #1419
2013-09-15 21:09:32 -04:00
TfT_02
ae0a27991b Register when the config files were last updated 2013-09-15 23:10:35 +02:00
TfT_02
f1b82dcbe6 Fixed regex of version string parsing 2013-09-15 23:09:06 +02:00
TfT_02
bfbd50d8f4 Fix another wrong default Material name 2013-09-15 22:52:59 +02:00
GJ
de07316261 Just in case there's something broken in the file. 2013-09-15 16:49:41 -04:00
GJ
eae196c6a1 Fix wrong default material name. 2013-09-15 16:48:05 -04:00
GJ
8af41975ff Don't keep trying to load if they've got an old file. 2013-09-15 16:09:41 -04:00
GJ
957bbbc9b2 Warn if treasures.yml is outdated. 2013-09-15 15:59:29 -04:00
TfT_02
17faf1561f Refactor to getMaxLength 2013-09-15 21:45:16 +02:00
TfT_02
ec6419f0ff Fix formatting of the new Updater 2013-09-15 21:45:16 +02:00
GJ
f6e60bebcc Fix dropping sideways logs and leaf blocks.
Fixes #1460
2013-09-15 15:09:48 -04:00
GJ
797ac20567 Added Horses to the "Shake" ability.
Witches no longer drop water bottles from Shake, since they no longer drop them in Vanilla.
Changed format of treasures.yml.

**YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
2013-09-15 01:07:04 -04:00
GJ
3bc029a0de Make Updater work with our versioning setup. 2013-09-13 11:46:55 -04:00
GJ
4eba33a1c6 Use doubles in config.yml where appropriate. Change item IDs to item names
in light of upcoming Minecraft changes that will remove access to item
IDs.
2013-09-13 09:52:52 -04:00
GJ
800a452d62 Remove use of deprecated function. 2013-09-13 09:11:34 -04:00
GJ
177604e94a Condense this into one function. 2013-09-13 08:11:32 -04:00
GJ
088015dd4d Switch to H31ix's updater for security reasons. 2013-09-13 00:59:07 -04:00
t00thpick1
0f2d0aee5f Fix NPE on /addxp 2013-09-12 21:21:00 -04:00
t00thpick1
1004e2a32b These duplicate checks are handled in config validation. 2013-09-12 20:52:26 -04:00
t00thpick1
5c2b523f7a Allow less than one percentages for hardcore losses 2013-09-12 20:52:26 -04:00
GJ
de42063171 Fixed a bug where Kraken messages couldn't be disabled.
Fixes #1174
2013-09-12 15:53:43 -04:00
GJ
a49d373af0 Back to active development. 2013-09-12 14:28:51 -04:00
GJ
0095f7f9c7 Update pom.xml for 1.4.07 beta release (finally!) 2013-09-12 14:20:18 -04:00
GJ
f53820e4de Update changelog. 2013-09-12 14:18:52 -04:00
GJ
25e4700ef9 Changed various values to double in advanced.yml for the sake of consistency. 2013-09-12 14:18:13 -04:00
GJ
58c7dcb705 Fix issues with double damage, double death messages, and other damage oddities.
Fixes #1450
2013-09-12 11:52:34 -04:00
GJ
44626c36a9 Nerfed Archery damage to eliminate constant one-hit kills 2013-09-11 11:43:06 -04:00
TfT_02
cfd5bfe2c4 Deal skillShot bonus damage properly 2013-09-11 17:08:59 +02:00
t00thpick1
f7928787dc Skill shot should be after deflect check 2013-09-11 10:17:24 -04:00
GJ
d6630a0eb5 Prevent multiple events from being fired. 2013-09-11 08:51:51 -04:00
GJ
af39e84aef Actually remove /mmoupdate, fix usage strings for /mcconvert, fix tab completion
Fixes #1451
2013-09-10 15:47:47 -04:00
TfT_02
93fe2ff504 Cleanup our imports 2013-09-10 15:28:11 +02:00
GJ
b42f2d4073 Refactor, plus store these values rather than checking them twice. 2013-09-10 08:38:06 -04:00
TfT_02
c5c231920d Cleaning up the changelog and comments 2013-09-09 23:19:59 +02:00
GJ
89ddf8c4fa Fixed issues with dealing damage to Entities 2013-09-09 20:41:06 +02:00
GJ
71ab678945 Fix bug where mcMMO damage wasn't awarding XP.
Fixes #1400
2013-09-09 12:00:37 -04:00
GJ
14daee3b1b Fixed a bug where squid were not awarding XP. 2013-09-09 10:46:26 -04:00
GJ
d2bbbb0fe7 More deprecation fixes. 2013-09-05 16:36:02 -04:00
GJ
fd8d9b02a9 Begin trying to remove newly-deprecated "magic numbers" 2013-09-05 14:55:08 -04:00
GJ
a639a37637 Add per-skill XP boost perks.
Fixes #1412
2013-09-03 09:24:58 -04:00
GJ
7eec53d621 Added Horses to Taming. 2013-08-30 14:25:46 -04:00
GJ
7523afffb5 Updated permissions for more control over Call of the Wild. 2013-08-30 13:50:34 -04:00
GJ
2c8b9334b6 THis should stay false. 2013-08-28 13:13:34 -04:00
GJ
d41ccf9072 Don't loop forever if not connected. 2013-08-28 13:12:24 -04:00
GJ
c98d298cf1 Actually make use of the checkConnected calls. 2013-08-28 11:44:58 -04:00
GJ
73d0b377ae Reduce code duplication. Also verify that our target is alive before trying to damage them.
Fixes #1403
2013-08-28 11:29:30 -04:00
TfT_02
df29306a1f Cleanup Javadocs and fix StackOverflowError 2013-08-26 22:09:29 +02:00
GJ
435522415d This is better too. 2013-08-26 12:20:56 -04:00
GJ
a17d1d3a2f More cleanup to PartyManager. 2013-08-26 11:55:35 -04:00
GJ
94a5bef62c Cleaning up PartyManager 2013-08-26 08:39:24 -04:00
GJ
2cd9a5658e Remove unused import 2013-08-26 08:39:24 -04:00
TfT_02
3c5bd3cedd Fix a NPE in MobHealthDisplayUpdateTask
Band aid for broken isValid() function.
Fixes #1396
2013-08-25 17:35:41 +02:00
GJ
8e02b57369 Align these. 2013-08-23 14:52:21 -04:00
GJ
935b8b7bc4 Update localization files. Adds Estonian translations for some strings. 2013-08-23 14:29:01 -04:00
TfT_02
9c54f8fd11 Fix Javadocs issues 2013-08-23 20:14:13 +02:00
GJ
6bfc1b84de Let's do this the right way. 2013-08-23 20:14:13 +02:00
TfT_02
59f545d5ce Fixed FakeEntityDamageByEntityEvent not getting fired 2013-08-23 20:14:13 +02:00
GJ
23983422e0 Cleanup & remove code duplication. 2013-08-23 14:08:16 -04:00
TfT_02
956bf2d763 Added McMMOPlayerLevelDownEvent and McMMOPlayerLevelChangeEvent 2013-08-23 19:54:30 +02:00
TfT_02
964b2636fb Move experience related settings from config.yml to experience.yml 2013-08-23 19:37:44 +02:00
GJ
490bc195d8 We don't care about teleports to the same spot. 2013-08-23 08:58:23 -04:00
TfT_02
0ce41150c6 Vampirism can now be enabled without having Skill Death Penalty enabled 2013-08-22 22:54:05 +02:00
TfT_02
0455416dec Reorganized Hardcore locale strings 2013-08-22 22:54:05 +02:00
TfT_02
a6e7febf77 Hardcore mode can now be toggled for each skill individually 2013-08-22 22:54:05 +02:00
GJ
ede0757d83 Remove /mmoupdate and replace with /mcconvert database 2013-08-22 22:33:06 +02:00
GJ
8282d84b16 Validate, and nicer loading. 2013-08-22 22:22:19 +02:00
GJ
223649ec28 Formatting and localizing. 2013-08-22 22:22:19 +02:00
TfT_02
68e433b3b7 Added new ExperienceFormula config and /mcconvert command 2013-08-22 22:22:19 +02:00
GJ
1a51b93ec9 Another quick check to avoid issues with NPCs. 2013-08-22 14:45:30 -04:00
GJ
c31ffa5ab4 Remove unused import. 2013-08-22 13:51:01 -04:00
TfT_02
ca6bee07ea Fix formatting 2013-08-22 00:37:48 +02:00
TfT_02
9acaa7b126 We're expecting a null object here as well. 2013-08-21 16:48:08 +02:00
gmcferrin
2bae937b28 Don't throw a warning if we're expecting a null object. 2013-08-21 14:20:12 +00:00
TfT_02
51bf989418 Counter Attack now only activates when the player is blocking
Closes #1018
2013-08-20 23:23:49 +02:00
GJ
07dd460d78 Validate in a seperate function. 2013-08-20 15:51:12 -04:00
GJ
045d74fb9d These were basically the same function. 2013-08-20 15:15:42 -04:00
GJ
c8c76f4174 Put this function in a better place. 2013-08-20 15:12:38 -04:00
GJ
83c4d09093 Fix formatting 2013-08-20 15:08:10 -04:00
GJ
50ef8d9610 Improvements to mcMMOPlayer lookup. 2013-08-20 14:10:49 -04:00
GJ
98c6abad36 No reason to cast here. 2013-08-19 15:14:33 -04:00
GJ
62146480db Hardcoding this is a bad idea. 2013-08-19 15:12:08 -04:00
TfT_02
6518d192ec Improved partial name matcher
Fixes #1164
2013-08-19 10:37:04 +02:00
TfT_02
3fe9cfee74 Slightly improved update checker feedback 2013-08-18 18:04:20 +02:00
T00thpick1
d495054eb5 Config Validation 2013-08-18 02:42:13 -04:00
T00thpick1
ce80636141 Min value for IronArm configurable 2013-08-18 02:38:57 -04:00
TfT_02
fe93be66ad Changed the color of party leader names in Party chat 2013-08-17 13:53:46 +02:00
TfT_02
1f712063bf Admin and Party chat prefixes are now customizable
Closes #578
2013-08-17 12:18:29 +02:00
TfT_02
560c3860b4 Fixed bug which allowed players to bypass fishing's exploit prevention
Fixes #1319
2013-08-17 10:11:46 +02:00
TfT_02
36f1a2d78a Changed the way Repair hands out XP
Closes #373
2013-08-15 20:50:19 +02:00
TfT_02
3ddd8d2056 Added API to get a players rank on the leaderboards 2013-08-13 09:37:45 +02:00
TfT_02
5441fcc374 Fix broken Dodge_DamageModifier config node
Also fix a derp with the validation of
Arcane_Forging.Keep_Enchants.Chance
2013-08-11 15:55:25 +02:00
TfT_02
1d83784820 Arcane Forging downgrade chance can also be 0
Fixes #1367
2013-08-11 09:26:02 +02:00
TfT_02
fb5bab6e92 String values are compared using '.equals()' not '==' 2013-08-10 22:24:13 +02:00
TfT_02
90fcf35c34 Javadocs cleanup 2013-08-10 20:10:45 +02:00
TfT_02
4ff6b5fbc7 Don't try to register listeners when mcMMO was disabled 2013-08-10 19:33:21 +02:00
TfT_02
ead1398132 Super Breaker & Giga Driller now use more durability
A configurable amount is added to the vanilla durability loss.

Use `Abilities.Tools.Durability_Loss` to disable (set to 0) or set it
to -1 for no durability loss while using abilities. Closes #1363
2013-08-09 22:21:45 +02:00
TfT_02
6330c4a69e Move the noErrorsInConfig check to Misc 2013-08-09 19:10:03 +02:00
TfT_02
dcc18049a1 Removed Abilities.Tools.Durability_Loss_Enabled
Set Abilities.Tools.Durability_Loss to 0 to disable instead.
Addresses #1357
2013-08-09 18:13:22 +02:00
TfT_02
fcb8909a54 Kick interval can be disabled with '-1'
Fixes #1356
2013-08-09 13:36:04 +02:00
TfT_02
37e3bfe7d9 Fixed formatting 2013-08-07 19:58:49 +02:00
riking
d61b837dcf Implement checkStructure() 2013-08-07 19:49:00 +02:00
riking
f079e22789 Use provided last-saved information for purge.
The new method, OfflinePlayer.getLastPlayed(), is used as a backup for when the data is unparsable.
TODO check if StringUtils is available here
2013-08-07 19:45:27 +02:00
TfT_02
1f53c62ced Added McMMOPlayerDeathPenaltyEvent
Called when a player dies and mcMMO tries to invoke Hardcore mode or
Vampirism
2013-08-07 01:21:52 +02:00
TfT_02
9fb4e0988b Save / load party itemshare category states.
Closes #1336
2013-08-07 00:38:17 +02:00
TfT_02
d8bbe459b9 Fix minor Javadoc errors 2013-08-07 00:15:51 +02:00
TfT_02
8bd7526b43 String values are compared using '.equals()' not '==' 2013-08-06 21:48:09 +02:00
TfT_02
24b1485555 Validate advanced.yml settings 2013-08-06 21:37:19 +02:00
TfT_02
7683dfc436 Move validation to proper location 2013-08-06 21:27:16 +02:00
TfT_02
ccbffca278 Validate config.yml settings 2013-08-06 21:17:14 +02:00
Glitchfinder
aeaab43f44 Fixing a multitude of reported NPEs. 2013-08-04 12:15:01 -07:00
Glitchfinder
a2450d2d07 If a variable can be null, check it before using it. 2013-08-04 11:48:44 -07:00
T00thpick1
c85bd8ab70 One more last try 2013-08-04 11:56:37 -04:00
T00thpick1
3f6bce0fc6 One last try 2013-08-04 11:51:34 -04:00
T00thpick1
e566b20e2b This might be important 2013-08-04 11:38:52 -04:00
T00thpick1
f37a7d759a Hack around nms bug 2013-08-04 11:34:04 -04:00
T00thpick1
d1341b0be0 Would help if I actualized the value... Fix dupe bug for realz 2013-08-04 11:05:53 -04:00
T00thpick1
4ea3d690db Fix Dupe bug...... why was this overlooked? 2013-08-03 11:37:29 -04:00
TfT_02
d5dc9895e4 Move Blast Mining activation check to MONITOR priority
Fixes #1331
2013-08-02 21:11:58 +02:00
Glitchfinder
b1fc72e8a9 When a variable can be null, check it before using it. Fixes #1308. 2013-08-01 08:47:14 -07:00
GJ
7479a02220 Update changelog. 2013-07-30 15:23:32 -04:00
GJ
d1bf48ad79 Fix bug where teleport location was never reset if warmup was set to 0
for Chimera Wing.

Fixes #1323
2013-07-30 15:20:18 -04:00
GJ
a345737b8b Add more detailed error messages on SQL connection failure.
Fixes #1322
2013-07-30 15:09:22 -04:00
GJ
c501ebb357 Clean up after our experience commands. Fixes #1324 2013-07-30 14:47:11 -04:00
GJ
15e0570a8c Else if > if 2013-07-29 08:45:30 -04:00
GJ
09e77c8c94 Move break event to the initial check. 2013-07-29 08:29:10 -04:00
TfT_02
f5c58f3679 Added config option for Acrobatics teleport cooldown,
also updated the changelog.
2013-07-29 00:57:43 +02:00
GJ
ddcbe64db6 Fix some possible issues with handler priority, more javadoc work. 2013-07-28 13:55:48 -04:00
GJ
c5137eb884 Begin work on cleaning up our listeners and their Javadocs. 2013-07-25 14:52:21 -04:00
GJ
e073eca458 Validation is important. 2013-07-24 20:29:32 -04:00
GJ
78f2e0a064 Check the range in a seperate function 2013-07-24 14:13:58 -04:00
TfT_02
df2defe969 Added extra settings for Call of the Wild
* Requested in issue #910
* Adds a setting to configure the range check
* Adds a setting to summon multiple pets with one summon
2013-07-24 20:01:26 +02:00
TfT_02
6d4a2feaae Slighty changed a Green Thumb string
Make this fit on one line in the chat window
2013-07-24 20:01:26 +02:00
GJ
8939fc09b3 Patch potential exploit relating to teleportation and acrobatics. 2013-07-24 13:57:53 -04:00
GJ
e0e574c19e Fix a potential issue with PTP and Chimera Wing teleportation cooldowns. 2013-07-24 13:50:33 -04:00
GJ
02126c93b9 This function is never used. 2013-07-24 12:35:28 -04:00
GJ
37671bad9a We already have the mcMMOPlayer here. 2013-07-24 12:30:02 -04:00
TfT_02
0e8ce005d7 This is also a change 2013-07-24 16:10:26 +02:00
GJ
584a225d6e Only get the mcMMOPlayer once. 2013-07-24 09:37:45 -04:00
riking
736359056f Add checkConnected() calls to re-establish dead SQL connections 2013-07-23 15:03:19 -07:00
TfT_02
bf2e527e72 Fixed NPE with Beast Lore
Fixes #1289
2013-07-22 11:35:48 +02:00
TfT_02
be7992d541 Disable all abilities when a player quits
Fixes #1295
2013-07-22 11:25:56 +02:00
TfT_02
435eb7f8b9 Added new experience curve option 2013-07-21 23:14:42 +02:00
GJ
001f1dbd3c Fix issue with truncating things that don't need truncating. 2013-07-17 13:45:31 -04:00
GJ
7b5372a985 Temporary fix for MCPC+ entity issues. This change will be reverted
after the fix is made in MCPC+.

Fixes #1197
2013-07-17 10:29:42 -04:00
GJ
1647ef4fae Fixed issue where locale strings could cause the scoreboard header to be
longer than 16 characters.

Fixes #1278
2013-07-17 08:18:54 -04:00
GJ
ee86f8244f Put ShareMode in its own class. 2013-07-15 09:56:45 -04:00
GJ
e518b58b23 Better way to do locale strings there. 2013-07-15 09:48:14 -04:00
GJ
5af1164b5c Tweak ShareHandler a bit. 2013-07-15 09:40:07 -04:00
GJ
c9aba059e2 Don't provide direct access to the players map. 2013-07-15 09:14:23 -04:00
GJ
dc9469c0cc Refactor to match standards set for where datatypes should be located. 2013-07-15 08:44:13 -04:00
TfT_02
696e82e622 Add missing Axes locale string
* Somehow, the message notifying a player that he was struck by Skull
Splitter wasn't in the locale files anymore.
 * Re-added this string and renamed it.
 * Fixes #1271
2013-07-15 13:18:13 +02:00
TfT_02
18a5ec73d7 Fixed Level up announcement
Fixes #1270
2013-07-14 10:58:51 +02:00
TfT_02
83ee8dd3f8 Update README.md
* Updated the about section so its similar with BukkitDev
 * Updated required libraries list, we're using EMetrics instead of Metrics
2013-07-11 20:53:35 +02:00
GJ
04224b309a Add snow to excavation. No treasures will drop from snow by default,
but they can be added to the treasures.yml file by specifying

"Drops_From:
	Snow: true"

Adds #1229
2013-07-11 14:41:23 -04:00
GJ
01a1cf5765 Update changelog. 2013-07-11 13:22:44 -04:00
GJ
8fdf4042bb Tweaked for readability. 2013-07-11 13:22:14 -04:00
GJ
621969459a Use profile instead of mcMMOPlayer 2013-07-11 13:19:04 -04:00
T00thpick1
6fe1c85592 Save on logout 2013-07-11 13:16:51 -04:00
T00thpick1
79346d92d7 Only save on changes 2013-07-11 13:16:42 -04:00
GJ
24ceeb626b Updated localization files 2013-07-11 13:03:38 -04:00
GJ
68727496ad Useless casting and elses. 2013-07-11 12:49:01 -04:00
GJ
d07b67b5bf Health and damage are now doubles, not ints. 2013-07-11 12:43:36 -04:00
GJ
4dc9c97978 Build from LATEST again. 2013-07-11 12:26:31 -04:00
GJ
99916f99fd Back to new development 2013-07-11 12:25:21 -04:00
GJ
4a5307f47b New 1.4.06 release before work starts on adding new features from 1.6 2013-07-11 12:09:24 -04:00
GJ
69aead58a7 Using getPlayerExact is faster. 2013-07-08 19:15:44 -04:00
T00thpick1
f0dcfb0346 Temporary for building for old peoples 2013-07-02 12:48:35 -04:00
T00thpick1
c85d52e594 Make Riking's stuff work 2013-07-02 12:42:09 -04:00
Travis Ralston
4342abca3d Update EMetrics version to use 0.0.5-SNAPSHOT (MCStats R7) 2013-07-01 17:11:58 +02:00
T00thpick1
11e4ff34d6 Flatfile repair 2013-07-01 02:36:21 -04:00
Kane York
f118ac14ca Specify returning of generated keys before using them
This is a herp derp fix
2013-07-01 00:35:07 -04:00
T00thpick1
f5eb7a10de Only set custom class when valid class 2013-07-01 00:34:54 -04:00
T00thpick1
36b09421e8 These should all be 0 too, for consistancy 2013-06-29 23:42:28 -04:00
T00thpick1
d6b39a11e7 0 is nonexistant, not -1 2013-06-29 23:41:08 -04:00
riking
23729f45ee Pull changes from dev-dbman (commit f63c5e3) 2013-06-28 15:02:58 -07:00
T00thpick1
27d7b73e57 Pretty sure this should be Fake 2013-06-28 16:22:55 -04:00
TfT_02
af60f08a8b Localize the ScoreboardManager
Closes #1232
2013-06-28 19:17:39 +02:00
TfT_02
c19d3fd068 Fixed bug with Ice Fishing which allowed players to break protected blocks
Fixes #2074
2013-06-28 14:06:54 +02:00
TfT_02
0f8312dd5e Minor cleanup 2013-06-28 14:06:13 +02:00
TfT_02
1edb11cedf Disable mob healthbars for boss mobs!
Fixes #1210
2013-06-28 13:36:48 +02:00
TfT_02
6fea7c8d74 Update the changelog: Fixed update check 2013-06-27 22:23:09 +02:00
riking
a4a1ba4331 Make UpdateChecker run asynchronously and not block startup
Closes #1049
2013-06-27 09:48:39 -07:00
TfT_02
de46277bea Realized that it wasn't only happening in the Nether 2013-06-24 17:10:39 +02:00
TfT_02
6d7d811814 Fixed bug with Ice Fishing in the Nether
Fixes  #1218
2013-06-24 16:25:49 +02:00
GJ
98b98256b7 Make our oldUserRemover actually work... 2013-06-13 12:23:58 -04:00
GJ
abd389f4de Try to speed up our PartyKickTask a bit. 2013-06-13 12:18:18 -04:00
GJ
602956a555 Fix duplicate prefix sending with party chat & logging. 2013-06-13 11:10:46 -04:00
GJ
8d0601babc Fix bug where all ranks less than 10 show as 0 with /mctop. 2013-06-13 10:56:46 -04:00
GJ
050be563bf Less magic numbers. 2013-06-12 19:26:09 -04:00
GJ
965dbda101 Clean up some stuff with our DATS. 2013-06-12 19:20:05 -04:00
GJ
f2b2cd9cc0 Oops. 2013-06-12 15:59:51 -04:00
GJ
3a78e1b487 More code duplication removal. 2013-06-12 15:56:42 -04:00
GJ
db637f0bc9 Remove more code duplication. 2013-06-12 15:41:26 -04:00
GJ
b15f1dde28 We don't need that potato. 2013-06-12 15:15:56 -04:00
GJ
28a78d820a Tidy up our InventoryListener. 2013-06-12 15:10:43 -04:00
GJ
a1792fe125 We were calling deflect twice. Also made individual functions for each
type of combat.
2013-06-07 15:47:00 -04:00
T00thpick1
3f7b17961f Reset mob healthbars on death to avoid conflicting with loot plugins 2013-06-07 15:46:59 -04:00
GJ
0ea07d4bc7 Fixed bug where spawned arrows could throw
ArrayIndexOutOfBoundsException. Fixes #1171
2013-06-07 15:46:59 -04:00
GJ
190b7ee1f5 ChatManagers... 2013-06-07 15:46:58 -04:00
GJ
4ff4271da2 These should be protected. 2013-06-07 15:46:57 -04:00
T00thpick1
8705974e08 Use a single manager to handle our databases. 2013-06-07 15:46:57 -04:00
TfT_02
de0487d16f This should make it work properly 2013-06-07 15:46:56 -04:00
TfT_02
fc0c386ecb Fixing this as pointed out by Riking 2013-06-07 15:46:55 -04:00
TfT_02
86db4251a2 Check visibility before range 2013-06-07 15:46:55 -04:00
TfT_02
effe5ec305 We were deprecating these kind of permission nodes 2013-06-07 15:46:54 -04:00
TfT_02
8fb92292bd Move adding users to UserManager from onLogin to onJoin 2013-06-07 15:46:54 -04:00
TfT_02
375fa4f75c Added permission node to prevent inspecting hidden players 2013-06-07 15:46:53 -04:00
TfT_02
da25b02e0a Only set the item in hand null if it's actually a fishing rod 2013-06-07 15:46:53 -04:00
GJ
d43ae17bd2 Tweak a few things on the UpdateChecker. 2013-06-07 15:46:52 -04:00
Kane York
f81a763d6c Use finally to close the update checker stream 2013-06-07 15:46:52 -04:00
Kane York
385f8ca0b3 Reduce code duplication in ExperienceAPI 2013-06-07 15:46:46 -04:00
GJ
0ba4bc25c7 Use player objects instead of names - should be more efficient and less
buggy.
2013-05-28 13:33:20 -04:00
GJ
b0eb4b93a8 Cleaner way to avoid salvaging chainmail. 2013-05-28 12:59:10 -04:00
GJ
54f135aebd We're checking this twice and shouldn't be. 2013-05-28 12:53:12 -04:00
GJ
10e369f9c5 Increased auto-fishing detection. 2013-05-28 12:42:39 -04:00
TfT_02
1ae9b0f4d2 Animals can also have the "Spawned Entity" tag 2013-05-26 17:55:24 +02:00
T00thpick1
198ee6a7ed I think this is case sensitive 2013-05-26 11:51:42 -04:00
TfT_02
2414ddf485 Fix broken Tree Feller
Fixes #1139
2013-05-25 14:45:24 +02:00
GJ
2cd52db8c9 The ; is important. 2013-05-22 22:30:40 -04:00
GJ
5e00636761 And a little more... 2013-05-22 22:30:09 -04:00
GJ
a82cc9609b Cleaning up a bit. 2013-05-22 22:13:40 -04:00
T00thpick1
45c6c20ccd Null parties! Hurray! 2013-05-22 21:20:35 -04:00
GJ
7a61f55e49 Remove some code duplication in our ShareHandler. 2013-05-22 17:22:06 -04:00
GJ
aa0b77a64c Updates to our parties. 2013-05-22 13:02:26 -04:00
GJ
030c8e59d7 The other way leaks memory like a sieve. 2013-05-22 00:01:19 -04:00
GJ
f21fbe2d40 Make repair & salvage respect the sneaking settings. Fixes #1108 2013-05-21 22:34:06 -04:00
GJ
9a5f4b638f Little more cleaning. 2013-05-21 14:15:28 -04:00
GJ
9aa49a09da Little more cleanup. 2013-05-21 14:03:00 -04:00
GJ
bf8945ac59 Try to clean CombatUtils a bit... 2013-05-21 13:36:44 -04:00
GJ
d9926bab4e Try to clean up our poor EntityListener... 2013-05-21 13:27:52 -04:00
GJ
38ba2c21e5 Back to normal development. 2013-05-21 12:22:11 -04:00
624 changed files with 28523 additions and 14466 deletions

View File

@@ -7,7 +7,124 @@ Key:
! Change
- Removal
Version 1.4.06-dev
Version 1.4.08-dev
+ Added a new skill; Alchemy. Special thanks to EasyMFnE for creating this!
+ Added SecondaryAbilityType enum, and new SecondaryAbilityWeightedActivationCheckEvent, fired when a secondary ability checkes its activation chances
+ Added the possibility to gain experience when using Fishing "Shake"
+ Added config options to disable various sound effects
+ Smelting now works with custom ores - add smelting XP value to blocks.yml, or it will default to 1/10th of normal XP.
+ Added automatic cleanup of backups folder.
+ Added bypass permission for finding Fishing traps
+ Added level threshold settings to hardcore modes. When a players skill level is below this threshold, they will not lose any stats
+ Added party alliances, two parties can now team up. Allies share party chat and cannot harm each other.
+ Added new experience bonus perk 'mcmmo.perks.xp.10percentboost.<skillname>' multiplies incoming XP by 1.1
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
= Fixed bug where LeafBlower permissions were ignored
= Fixed bug with toggle commands not properly displaying the success message.
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
= Fixed bug with Salvage not reading the config value for the anvil material.
= Fixed exploit where you could receive smelting XP for improper items
= Fixed bug where the Unbreaking enchantment was ignored when using "Super Breaker" or "Giga Drill Breaker"
= Fixed bug which prevented players from gaining Acrobatics XP when the setting 'Prevent_XP_After_Teleport' was set to false
= Fixed bug where cooldown donor perks were reducing more than expected
= Fixed bug where disabling hardcore mode for specific skills didn't work
= Fixed bug which caused the backup cleanup to delete old backups while it should have kept those
= Fixed bug where party chat broke if the display name contained special characters
= Fixed bug where `/addlevels all` and `/skillreset all` didn't work
= Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse
= Fixed bug where the /ptp request expiration time was checked wrongly - preventing players from using the command
= Fixed bug where Hylian Luck was broken
= Fixed bug where Snow would never drop treasures
! Changed party system. Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members
! Changed appearance of party member list. Gold = party leader, White = online, Gray = offline, Italic = not nearby
! Updated localization files
! Changed the appearance of /mcmmo commands
! Changed AxesCritical to CriticalHit in config file
! Changed several secondary ability permissions(deprecated versions still exist)
! Changed /ptp config setting, Commands.ptp.Confirm_Required is now Commands.ptp.Accept.Required
! Changed config validation for UnlockLevels, they can now also be 0
! Changed config validation for Rank_Levels, successive Ranks can now be less than or equal to each other
- Removed /stats alias for /mcstats
Version 1.4.07
+ Added XP boost to Acrobatics when wearing Boots of Feather Falling
+ Added SQL Database can now recover from a dropped connection without losing data. (Thanks Riking!)
+ Added more tiers to Fishing, Repair and Smelting!
+ Added Carrot on a Stick and Flint & Steel to repair.vanilla.yml
+ Added horses to the "Shake" ability
+ Added ability to summon horses via "Call of the Wild" using apples
+ Added XP gain to Taming for horses
+ Added new permission nodes to allow more control over Taming and "Call of the Wild"
+ Added new experience.yml config file! Moved all experience related settings from config.yml to experience.yml
+ Added support for EXPONENTIAL formula curves to experience.yml
+ Added new /mcconvert command to convert players levels and experience from one formula curve to another.
+ Added snow to Excavation blocks
+ Added new experience curve option. Cumulative curve, calculates experience needed for next level using power level.
+ Added extra settings to config.yml for "Call of the Wild" (Taming)
+ Added a 5 second cooldown after teleporting before Acrobatics XP can be earned. Plus a config option to disable
+ Added new API methods to ExperienceAPI to get a players rank on the leaderboards
+ Added new McMMOPlayerDeathPenaltyEvent, fired when a player dies and would lose levels
+ Added new McMMOPlayerLevelChangeEvent, fired when a players level changes
+ Added new McMMOPlayerLevelDownEvent, fired when a player loses levels
+ Added ability to give custom names to items in treasures.yml - use the key "Custom_Name" to set, expects a string.
+ Added ability to give lore to items in treasures.yml - use the key "Lore" to set, expects a list of strings.
+ Added Quartz and Name Tags to the default Excavation treasures
+ Added a warning message if the server is running NoCheatPlus without CompatNoCheatPlus
+ Added cooldown to commands with heavy database access to prevent denial of service
+ Added /mcscoreboard keep, to keep the scoreboard up forever
+ Added Rainbow Mode to scoreboards
+ Added new /mccooldowns command to show all ability cooldowns
+ Commands may now both print text and display a scoreboard
+ Killing a custom entity will automatically add it to the custom entity config file with default values.
= Fixed bug which allowed players to bypass fishing's exploit prevention
= Fixed bug where FakeEntityDamageByEntityEvent wasn't being fired
= Fixed bug with "Skull Splitter" not finding the locale string
= Fixed issue where locale strings could cause the scoreboard header to be longer than 16 characters.
= Fixed a bug with "Beast Lore" when the entity had no owner but was tamed.
= Fixed a bug where AbilityDeactivateEvent would throw an error if the player logged out before his ability ran out.
= Fixed a bug where LevelUpEvent would be called for an offline player.
= Fixed a bug where teleport location was never reset if warmup was set to 0 for "Chimaera Wing".
= Fixed a bug where the "Dodge" DamageModifier wasn't being read from advanced.yml
= Fixed a bug where squid were not awarding XP.
= Fixed a bug where Combat XP was granted within 5 seconds for respawned players
= Fixed a bug where wrong feedback messages were being send when using a command on an offline player
= Fixed a bug where players were able to gain Herbalism XP in mine carts, even though Prevent_AFK_Leveling was enabled
= Fixed a bug where players would get hit by fireworks if they leveled up while in a boat
! Changed Fishing "Treasure Hunter" and "Magic Hunter" drop percentages
! Changed format of mod config files. (blocks.yml, tools.yml, armor.yml and entities.yml) **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
! Changed format of treasures.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
! Changed format of repair.vanilla.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
! Changed default XP multiplier for repairing shears
! Changed "Shake" drops for Witches. They no longer drop water bottles, since they no longer drop them in Vanilla.
! Changed fishing exploit prevention, by default it will no longer send global sounds, effects and messages.
! Changed Hardcore modes, they will also subtract experience
! Changed various values to double in advanced.yml for the sake of consistency.
! Nerfed Fishing "Master Angler" (removed skill level based bonus) and also made the modifiers configurable
! Nerfed Archery damage to eliminate constant one-hit kills.
! Changed the way Repair hands out XP, also added config options to control Repair XP
! Changed Swords "Counter Attack" ability from passive to active. Blocking is required to activate.
! Hardcore modes can now be toggled for each skill individually
! Vampirism can now be enabled without having Skill Death Penalty enabled
! Admin and Party chat prefixes are now customizable
! Changed the color of party leader names in Party chat
! Improved "Tree Feller" algorithm (Thanks Riking!)
! Improved AFK Acrobatics prevention mechanism
! Improved profile saving
! Improved partial name matcher
! Improved update checker
! Updated localization files
! Party item share category states are now saved when the server shuts down.
! When using "Super Breaker" or "Giga Driller" abilities extra tool durability is used (again)
! Mob healthbars are automatically disabled when the plugin "HealthBar" is found
! Massively improved scoreboard handling
! Reworked scoreboard configuration (config.yml) - **you will need to update**
- The /mmoupdate command has been removed. It is replaced by /mcconvert database
- Removed Abilities.Tools.Durability_Loss_Enabled, set Abilities.Tools.Durability_Loss to 0 to disable instead.
- Removed Skills.Fishing.Shake_UnlockLevel from advanced.yml, now using Skills.Fishing.Rank_Levels.Rank_1 instead.
- Removed SpoutPlugin support
Version 1.4.06
+ Added "Ice Fishing" ability to Fishing
+ Added global scoreboards to track skill rankings (display using /mctop)
+ Added per-player scoreboard displays for the /inspect, /mcrank, /mcstats, and /<skillname> commands
@@ -28,6 +145,11 @@ Version 1.4.06-dev
+ Added multiplier to Archery XP based on bow force
+ Added information about /party itemshare and /party expshare to the party help page
+ Added option to use scoreboards for power level display instead of Spout.
+ Added permission node to prevent inspecting hidden players
+ Added SQL to Flatfile database conversion
+ Added ability to use custom database managers and convert to/from them
= Fixed bug which could cause the server to hang for a minute when checking for updates. (Thanks to Riking)
= Fixed bug where spawned arrows could throw ArrayIndexOutOfBoundsException
= Fixed bug where custom Spout titles were overwritten by mcMMO.
= Fixed bug where Nether Quartz wasn't included in Smelting or item sharing
= Fixed bug where players were able to join the same party multiple times
@@ -48,6 +170,10 @@ Version 1.4.06-dev
= Fixed bug where Blast Mining would drop wrong items
= Fixed bug with Blast Mining where the Ability refreshed message was being send too early
= Fixed bug where the chance of a successful Gracefull Roll was twice as high as displayed
= Fixed bug where lucky perks where not working
= Fixed bug with Ice Fishing on a single block of ice
= Fixed bug with Ice Fishing which allowed players to break ice in protected areas
= Fixed a small bug with mob healthbars and bosses, such as EnderDragons and Withers
! Changed Spout notification tiers to be stored in SpoutConfig instead of AdvancedConfig
! Changed Berserk to add items to inventory rather than denying pickup
! Changed Call of the Wild, newly summoned pet's will have a custom name. (added permission node to disable this)

View File

@@ -2,12 +2,10 @@
## The RPG lovers mod
### Dev builds
Our latest development builds are available [here](http://ci.mcmmo.info).
Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/).
### 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.
If you want an original RPG experience like no other mod out there, mcMMO is for you.
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
## About the Team
@@ -31,17 +29,23 @@ mcMMO is currently developed by a team of individuals from all over the world.
(https://github.com/TfT-02)
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)]
(https://github.com/t00thpick1)
[![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)]
(https://github.com/riking)
### Special thanks
[![EasyMFnE](https://www.gravatar.com/avatar/99c9a1fa3bbf957791ceac7b45daadb0.png)]
(https://github.com/EasyMFnE)
Added the Alchemy skill
## Compiling
mcMMO uses Maven 3 to manage dependancies, packaging, and shading of necessary classes; Maven 3 is required to compile mcMMO.
mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary classes; Maven 3 is required to compile mcMMO.
The typical command used to build mcMMO is: mvn clean package install
The typical command used to build mcMMO is: `mvn clean package install`
Required Libraries:
* Spout API
* JUnit
* Metrics
* EMetrics
* Bukkit
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.

439
extras/mods/LOTR.armor.yml Executable file
View File

@@ -0,0 +1,439 @@
# Lord of the Rings mod config by Dragyn
# Built against version [1.6.4] The Lord of the Rings Mod Public Beta 11.1
#
#
# Settings for Boots
###
Boots:
# Bronze
X12015:
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Orc
X12035:
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Gondorian
X12060:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Mithril
X12064:
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Elven
X12088:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Warg
X12098:
Repairable: true
Repair_Material: X12094
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dwarven
X12129:
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Galven
X12134:
Repairable: true
Repair_Material: X12130
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Uruk
X12161:
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Wood Elf
X12176:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Ancient
X12180:
Repairable: true
Repair_Material: X12179
Repair_Material_Data_Value: 3
Repair_Material_Quantity: 2
Durability: 500
# Rohirric
X12187:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Rangers
X12206:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dunlending
X12210:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Morgul
X12222:
Repairable: true
Repair_Material: X12217
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Chestplates
###
Chestplates:
# Bronze
X12013:
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Orc
X12033:
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Gondorian
X12058:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Mithril
X12062:
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Elven
X12086:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Warg
X12096:
Repairable: true
Repair_Material: X12094
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dwarven
X12127:
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Galven
X12132:
Repairable: true
Repair_Material: X12130
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Uruk
X12159:
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Wood Elf
X12174:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Ancient
X12178:
Repairable: true
Repair_Material: X12179
Repair_Material_Data_Value: 3
Repair_Material_Quantity: 2
Durability: 500
# Rohirric
X12185:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Rangers
X12204:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dunlending
X12208:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Morgul
X12220:
Repairable: true
Repair_Material: X12217
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Helmets
###
Helmets:
# Bronze
X12012:
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Orc
X12032:
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Gondorian
X12057:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Mithril
X12061:
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Elven
X12085:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Warg
X12095:
Repairable: true
Repair_Material: X12094
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dwarven
X12126:
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Galven
X12131:
Repairable: true
Repair_Material: X12130
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Uruk
X12158:
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Wood Elf
X12173:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Ancient
X12177:
Repairable: true
Repair_Material: X12179
Repair_Material_Data_Value: 3
Repair_Material_Quantity: 2
Durability: 500
# Rohirric
X12184:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Rangers
X12203:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dunlending
X12207:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Morgul
X12219:
Repairable: true
Repair_Material: X12217
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Leggings
###
Leggings:
# Bronze
X12014:
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Orc
X12034:
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Gondorian
X12059:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Mithril
X12063:
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Elven
X12087:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Warg
X12097:
Repairable: true
Repair_Material: X12094
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dwarven
X12128:
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Galven
X12133:
Repairable: true
Repair_Material: X12130
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Uruk
X12160:
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Wood Elf
X12175:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Ancient
X12179:
Repairable: true
Repair_Material: X12179
Repair_Material_Data_Value: 3
Repair_Material_Quantity: 2
Durability: 500
# Rohirric
X12186:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Rangers
X12205:
Repairable: true
Repair_Material: LEATHER
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Dunlending
X12209:
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Morgul
X12221:
Repairable: true
Repair_Material: X12217
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

211
extras/mods/LOTR.blocks.yml Executable file
View File

@@ -0,0 +1,211 @@
# Lord of the Rings mod config by Skuli (Updated by Dragyn)
# Built against version [1.6.4] The Lord of the Rings Mod Public Beta 11.1
#
# Settings for Custom Excavation Blocks
###
Excavation:
Block_1|0:
XP_Gain: 99
Double_Drops_Enabled: true
Block_2|0:
XP_Gain: 99
Double_Drops_Enabled: true
#
# Settings for Custom Herbalism Blocks
###
Herbalism:
# Shireheather
X1813:
XP_Gain: 100
Double_Drops_Enabled: true
# Simbelmyne
X1805:
XP_Gain: 100
Double_Drops_Enabled: true
# Asphodel
X1895:
XP_Gain: 100
Double_Drops_Enabled: true
# Bluebell
X1867:
XP_Gain: 100
Double_Drops_Enabled: true
# Clover
X1873:
XP_Gain: 10
Double_Drops_Enabled: false
# Dead Marsh Plant
X1886:
XP_Gain: 10
Double_Drops_Enabled: false
# DwarfWort
X1902:
XP_Gain: 100
Double_Drops_Enabled: true
# Elanor
X1833:
XP_Gain: 100
Double_Drops_Enabled: true
# Lettuce Crop
X1830:
XP_Gain: 100
Double_Drops_Enabled: true
# Morgul Shroom
X1870:
XP_Gain: 100
Double_Drops_Enabled: true
# Niphredil
X1834:
XP_Gain: 100
Double_Drops_Enabled: true
# Pipeweed Crop
X1823:
XP_Gain: 100
Double_Drops_Enabled: true
# Pipeweed Plant
X1822:
XP_Gain: 100
Double_Drops_Enabled: true
#
# Settings for Custom Mining Blocks
###
Mining:
# Mithril
X1803:
XP_Gain: 2000
Double_Drops_Enabled: false
Is_Ore: true
# Naurite
X1818:
XP_Gain: 150
Double_Drops_Enabled: false
Is_Ore: false
#Glowstone Ore
X1859:
XP_Gain: 30
Double_Drops_Enabled: false
Is_Ore: false
# Remains
X1885:
XP_Gain: 1800
Double_Drops_Enabled: false
Is_Ore: false
# Gulduril
X1887:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Ore: false
# Quendite
X1846:
XP_Gain: 150
Double_Drops_Enabled: false
Is_Ore: false
# MorgulIron
X1819:
XP_Gain: 25
Double_Drops_Enabled: true
Is_Ore: false
# Rohan Rock
X180|2:
XP_Gain: 30
Double_Drops_Enabled: false
Is_Ore: false
#Gondor Stone
X180|1:
XP_Gain: 30
Double_Drops_Enabled: false
Is_Ore: false
# Mordor Stone
X180|0:
XP_Gain: 30
Double_Drops_Enabled: false
Is_Ore: false
#
# Settings for Custom Woodcutting Blocks
###
Woodcutting:
# Shire Pine
X1806|0:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Mallorn
X1806|1:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Apple
X1860|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Pear
X1860|1:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Cherry
X1860|2:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Mirkwood
X1806|2:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Charred
X1806|3:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Lebethron
X1896|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Beech
X1896|1:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
#
# Settings for Custom Ability Blocks
# (These blocks don't trigger abilities)
###
Ability_Blocks:
Block_1|0:
Block_2|0:

700
extras/mods/LOTR.tools.yml Executable file
View File

@@ -0,0 +1,700 @@
# Lord of the Rings mod config by Skuli (Updated by Dragyn)
# Built against version [1.6.4] The Lord of the Rings Mod Public Beta 11.1
Axes:
#DwarvenThrowingAxe
X12146:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 451
#UrukWarhammer
X12156:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 391
#Gondorian Warhammer
X12140:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 281
#UrukBattleaxe
X12155:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 391
#MithrilBattleaxe
X12138:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 2479
#MithrilWarhamer
X12139:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 2479
#OrcWarhammer
X12125:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 261
#Dwarven Warhammer
X12120:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 451
#DwarvenZbattleaxe
X12119:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 451
#BronzeAxe
X12009:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 197
#MithrilAxe
X12050:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 2479
#MallornAxe
X12075:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X1801
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 121
#Elven Axe
X12080:
XP_Modifer: 2
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 313
#DwarvenAxe
X12115:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 450
#OrcAxe
X12123:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 261
#UrukAxe
X12150:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 391
Bows:
#ElvenBow
X12093:
XP_Modifer: 2
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Durability: 485
#mallornbow
X12084:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X1801
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 417
#orcBow
X12099:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 441
#UrukCrossbow
X12163:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 471
#MithrilCrossbow
X12171:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 1761
#IronCrossbow
X12170:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Durability: 357
#BowofMirkwood
X12177:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X1806
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 3
Durability: 417
Hoes:
#BronzeHoe
X12011:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 197
#MithrilHoe
X12052:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 2479
#MallornHoe
X12077:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X1801
Repair_Material_Data_Value: 1
Repair_Material_Quantity: 2
Durability: 121
#CopperHoe
X26511:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X26507
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 180
#ElvenHoe
X12082:
XP_Modifer: 2
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12082
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 313
#DwarvenHoe
X12117:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X26507
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 180
Pickaxes:
#MEBronzePickaxe
X12008:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 197
#MithrilPixkaxe
X12049:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 2479
#MallornPickaxe
X12074:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X1801
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 121
#ElvenPickaxe
X12079:
XP_Modifer: 2
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 313
#DwarvenPickaxe
X12114:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 451
#UrukPickaxe
X12149:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 391
#OrcPickaxe
X12122:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 3
Durability: 261
Shovels:
#BronzeShovel
X12007:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 197
#MithrilShovel
X12048:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 2479
#MallornShovel
X12073:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X1801
Repair_Material_Data_Value: 1
Repair_Material_Quantity: 1
Durability: 121
#ElvenShovel
X12078:
XP_Modifer: 2
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12082
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 313
#DwarvenShovel
X12113:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 451
#UrukShovel
X12148:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 391
#OrcShovel
X12121:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 261
Swords:
#Uruk Dagger
X12153:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 313
#Poisoned urukd agger
X12154:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 313
#Uruk Spear
X12157:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 391
#Rohirric Sword
X12181:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 251
#Rohirric Dagger
X12182:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 201
#Rohirric Spear
X12183:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 251
#Dunlending Spear
X12212:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 251
#Uruk Scimitar
X12151:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12147
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 391
#Mithril Dagger
X12137:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 1983
#Iron Dagger
X12136:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 201
#Dwarven Dagger
X12118:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 361
#Dwarven Sword
X12116:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12112
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 451
#Elven Sword
X12081:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 313
#Elven Spear
X12083:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 313
#Anduril
X12070:
XP_Modifer: 1
Ability_Enabled: true
Tier: 4
Repairable: false
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 313
#Mallorn Sword
X12076:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X1801
Repair_Material_Data_Value: 1
Repair_Material_Quantity: 2
Durability: 121
#Mithril Spear
X12069:
XP_Modifer: 1
Ability_Enabled: true
Tier: 4
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 2479
#Iron Spear
X12068:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: IRON_INGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 251
#Orc Spear
X12066:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 261
#Bronze Spear
X12067:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 197
#Gondor Spear
X12065:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 281
#Gondor Sword
X12056:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: false
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 281
#Orc Scimitar
X12031:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12036
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 261
#Steel Sword
X26862:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X26857
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 751
#Bronze Sword
X12010:
XP_Modifer: 1
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X12004
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 1
Durability: 197
#Mithril Sword
X12051:
XP_Modifer: 1
Ability_Enabled: true
Tier: 4
Repairable: true
Repair_Material: X12006
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 2479

View File

@@ -0,0 +1,182 @@
# Config created by Dragyn
# Created For ExtrabiomesXL-universal-1.6.4-3.14.5
#
# Settings for Custom Excavation Blocks
###
Excavation:
# Quicksand
X2214|0:
XP_Gain: 40
Double_Drops_Enabled: true
#
# Settings for Custom Herbalism Blocks
###
Herbalism:
# Cattails
X2201|0:
XP_Gain: 30
Double_Drops_Enabled: true
# Hydrangea
X2202|1:
XP_Gain: 100
Double_Drops_Enabled: true
# Buttercups
X2202|2:
XP_Gain: 100
Double_Drops_Enabled: true
# Lavender
X2202|3:
XP_Gain: 100
Double_Drops_Enabled: true
# Tiny Cactus
X2202|4:
XP_Gain: 30
Double_Drops_Enabled: true
# Toadstool
X2202|6:
XP_Gain: 150
Double_Drops_Enabled: true
# Calla Lillies
X2202|7:
XP_Gain: 100
Double_Drops_Enabled: true
#
# Settings for Custom Mining Blocks
###
Mining:
X254|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X254|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
#
# Settings for Custom Woodcutting Blocks
###
Woodcutting:
# Fir
X2208|0:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Acacia
X2208|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Cypress
X2208|2:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Japanese Maple
X2208|3:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Redwood Quarter
X2209|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2211|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2212|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2213|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Fir Quarters
X2209|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X2211|1:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2212|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X2213|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Oak Quarters
X2209|2:
XP_Gain: 70
Double_Drops_Enabled: true
Is_Log: true
X2211|2:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2212|2:
XP_Gain: 70
Double_Drops_Enabled: true
Is_Log: true
X2213|2:
XP_Gain: 70
Double_Drops_Enabled: true
Is_Log: true
# Acacia
X2209|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Cypress
X2209|2:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Bald Cypress Quarter
X2225|0:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Bald Cypress Elbow
X2227|0:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Bald Cypress Log
X2231|2:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Rainbow Eucalyptus
X2228|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2229|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
X2231|0:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Autumn Log
X2231|1:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Sakura Log
X2238|0:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true

View File

@@ -0,0 +1,71 @@
# Config created by Dragyn
# Created For Galacticraft-1.6.4-2.0.7.904 and Galacticraft-Planets-1.6.4-2.0.7.904
#
# Settings for Boots
###
Boots:
# Heavy Duty
X10149:
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
X10171:
Repairable: true
Repair_Material: X10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 999
#
# Settings for Chestplates
###
Chestplates:
# Heavy Duty
X10147:
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
X10169:
Repairable: true
Repair_Material: X10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 999
#
# Settings for Helmets
###
Helmets:
# Heavy Duty
X10146:
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
X10168:
Repairable: true
Repair_Material: X10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 999
#
# Settings for Leggings
###
Leggings:
# Heavy Duty
X10148:
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
X10170:
Repairable: true
Repair_Material: X10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 999

View File

@@ -0,0 +1,98 @@
# Config created by Dragyn
# Created For Galacticraft-1.6.4-2.0.7.904 and Galacticraft-Planets-1.6.4-2.0.7.904
#
# Settings for Custom Excavation Blocks
###
Excavation:
# Dirt
X3347|3:
XP_Gain: 40
Double_Drops_Enabled: true
Block_2|0:
XP_Gain: 99
Double_Drops_Enabled: true
#
# Settings for Custom Mining Blocks
###
Mining:
# Copper Ore
X3347|0:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
X3372|5:
XP_Gain: 450
Double_Drops_Enabled: true
Is_Ore: true
X3390|0:
XP_Gain: 550
Double_Drops_Enabled: true
Is_Ore: true
# Tin Ore
X3347|1:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
X3372|6:
XP_Gain: 450
Double_Drops_Enabled: true
Is_Ore: true
X3390|1:
XP_Gain: 550
Double_Drops_Enabled: true
Is_Ore: true
# Aluminum Ore
X3372|7:
XP_Gain: 450
Double_Drops_Enabled: true
Is_Ore: true
# Silicon Ore
X3372|8:
XP_Gain: 450
Double_Drops_Enabled: true
Is_Ore: true
# Cheese Ore
X3347|2:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Iron Ore
X3390|3:
XP_Gain: 550
Double_Drops_Enabled: true
Is_Ore: true
# Desh Ore
X3390|2:
XP_Gain: 600
Double_Drops_Enabled: true
Is_Ore: true
# Moon Stone
X3347|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Moon Turf
X3347|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Mars Cobblestone
X3390|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Mars Rock/Stone
X3390|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X3390|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X3390|9:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false

View File

@@ -0,0 +1,123 @@
# Config created by Dragyn
# Created For Galacticraft-1.6.4-2.0.7.904 and Galacticraft-Planets-1.6.4-2.0.7.904
#
# Settings for Axes
###
Axes:
# Heavy Duty
X10145:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
# Desh
X10167:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: 10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 1000
#
# Settings for Hoes
###
Hoes:
# Heavy Duty
X10144:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
# Desh
X10166:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: 10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 1000
#
# Settings for Pickaxes
###
Pickaxes:
# Heavy Duty
X10142:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
# Desh
X10164:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: 10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 1000
#
# Settings for Shovels
###
Shovels:
# Heavy Duty
X10143:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
# Desh
X10165:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: 10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 1000
#
# Settings for Swords
###
Swords:
# Heavy Duty
X10141:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 4
Repairable: true
Repair_Material: X10150
Repair_Material_Data_Value: 9
Repair_Material_Quantity: 2
Durability: 500
# Desh
X10163:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: 10161
Repair_Material_Data_Value: 2
Repair_Material_Quantity: 2
Durability: 1000

1018
extras/mods/metallurgy3.armor.yml Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,185 @@
# Config created by Dragyn
# Created For Metallurgy-1.6.4-3.3.1
#
#
# Settings for Custom Mining Blocks
###
Mining:
# Copper
X900|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Tin
X900|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Zinc
X902|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Silver
X902|1:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Platinum
X902|3:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# NETHER ORES
# Ignatius
X903|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Shadow Iron
X903|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Lemurite
X903|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Midasium
X903|3:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Vyroxeres
X903|4:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Ceruclase
X903|5:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Alduorite
X903|6:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Kalendrite
X903|7:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Vulcanite
X903|8:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Sanguinite
X903|9:
XP_Gain: 450
Double_Drops_Enabled: true
Is_Ore: true
# Manganese
X900|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: true
# Eximite
X900|5:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Meutoite
X900|6:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Sulfur
X905|7:
XP_Gain: 150
Double_Drops_Enabled: true
Is_Ore: false
# Phosphorite
X905|8:
XP_Gain: 150
Double_Drops_Enabled: true
Is_Ore: false
# Saltpeter
X905|9:
XP_Gain: 150
Double_Drops_Enabled: true
Is_Ore: false
# Magnesium
X905|10:
XP_Gain: 150
Double_Drops_Enabled: true
Is_Ore: false
# Bitumen
X905|11:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Ore: false
# Potash
X905|12:
XP_Gain: 150
Double_Drops_Enabled: true
Is_Ore: false
# Prometheum
X906|0:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Deep Iron
X906|1:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Infuscolium
X906|2:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Oureclase
X906|4:
XP_Gain: 650
Double_Drops_Enabled: true
Is_Ore: true
# Astral Silver
X906|5:
XP_Gain: 650
Double_Drops_Enabled: true
Is_Ore: true
# Carmot
X906|6:
XP_Gain: 350
Double_Drops_Enabled: true
Is_Ore: true
# Mithril
X906|7:
XP_Gain: 750
Double_Drops_Enabled: true
Is_Ore: true
# Rubracium
X906|8:
XP_Gain: 800
Double_Drops_Enabled: true
Is_Ore: true
# Orichalcum
X906|11:
XP_Gain: 900
Double_Drops_Enabled: true
Is_Ore: true
# Adamantine
X906|13:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Ore: true
# Atlarus
X906|14:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Ore: true

File diff suppressed because it is too large Load Diff

44
extras/mods/railcraft.armor.yml Executable file
View File

@@ -0,0 +1,44 @@
# Config created by Dragyn
# Created For Railcraft_1.6.2-8.1.0.0
#
#
# Settings for Boots
###
Boots:
X7758:
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Chestplates
###
Chestplates:
X7761:
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Helmets
###
Helmets:
X7759:
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Leggings
###
Leggings:
X7760:
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

103
extras/mods/railcraft.blocks.yml Executable file
View File

@@ -0,0 +1,103 @@
# Config created by Dragyn
# Created For Railcraft_1.6.2-8.1.0.0
#
#
# Settings for Custom Mining Blocks
###
Mining:
# Abyssal Stone
X457|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Quarried Stone
X457|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Sulfur
X458|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
# Saltpeter
X458|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
# Dark Diamond
X458|2:
XP_Gain: 750
Double_Drops_Enabled: true
Is_Ore: false
# Dark Emerald
X458|3:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Ore: false
# Dark Lapis
X458|4:
XP_Gain: 400
Double_Drops_Enabled: true
Is_Ore: false
# Firestone
X458|5:
XP_Gain: 450
Double_Drops_Enabled: true
Is_Ore: false
# Infernal Stone
X467|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X467|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Blood Stained Stone
X468|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X468|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Sandy Stone
X469|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X469|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Quarried Stone
X471|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X471|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Frost Bound Stone
X472|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X472|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
# Nether Stone
X475|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X475|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false

76
extras/mods/railcraft.tools.yml Executable file
View File

@@ -0,0 +1,76 @@
# Config created by Dragyn
# Created For Railcraft_1.6.2-8.1.0.0
#
#
# Settings for Axes
###
Axes:
# Steel
X7819:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Hoes
###
Hoes:
# Steel
X7820:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Pickaxes
###
Pickaxes:
# Steel
X7821:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Shovels
###
Shovels:
# Steel
X7823:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Swords
###
Swords:
# Steel
X7824:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X7796
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

543
extras/mods/simcraft.blocks.yml Executable file
View File

@@ -0,0 +1,543 @@
# Config created by Dragyn
# Created For SimCraft 1.6.4
#
#
# Settings for Custom Herbalism Blocks
###
Herbalism:
X705|0:
XP_Gain: 50
Double_Drops_Enabled: true
X705|1:
XP_Gain: 50
Double_Drops_Enabled: true
X705|2:
XP_Gain: 50
Double_Drops_Enabled: true
X705|3:
XP_Gain: 50
Double_Drops_Enabled: true
X705|4:
XP_Gain: 50
Double_Drops_Enabled: true
X705|5:
XP_Gain: 50
Double_Drops_Enabled: true
X705|6:
XP_Gain: 50
Double_Drops_Enabled: true
X705|7:
XP_Gain: 50
Double_Drops_Enabled: true
X705|8:
XP_Gain: 50
Double_Drops_Enabled: true
X705|9:
XP_Gain: 50
Double_Drops_Enabled: true
X705|10:
XP_Gain: 50
Double_Drops_Enabled: true
X705|11:
XP_Gain: 50
Double_Drops_Enabled: true
X705|12:
XP_Gain: 50
Double_Drops_Enabled: true
X705|13:
XP_Gain: 50
Double_Drops_Enabled: true
X705|14:
XP_Gain: 50
Double_Drops_Enabled: true
X705|15:
XP_Gain: 50
Double_Drops_Enabled: true
X706|0:
XP_Gain: 50
Double_Drops_Enabled: true
X706|1:
XP_Gain: 50
Double_Drops_Enabled: true
X706|2:
XP_Gain: 50
Double_Drops_Enabled: true
X706|3:
XP_Gain: 50
Double_Drops_Enabled: true
X706|4:
XP_Gain: 50
Double_Drops_Enabled: true
X706|5:
XP_Gain: 50
Double_Drops_Enabled: true
X706|6:
XP_Gain: 50
Double_Drops_Enabled: true
X706|7:
XP_Gain: 50
Double_Drops_Enabled: true
X706|8:
XP_Gain: 50
Double_Drops_Enabled: true
X706|9:
XP_Gain: 50
Double_Drops_Enabled: true
X706|10:
XP_Gain: 50
Double_Drops_Enabled: true
X706|11:
XP_Gain: 50
Double_Drops_Enabled: true
X706|12:
XP_Gain: 50
Double_Drops_Enabled: true
X706|13:
XP_Gain: 50
Double_Drops_Enabled: true
X706|14:
XP_Gain: 50
Double_Drops_Enabled: true
X706|15:
XP_Gain: 50
Double_Drops_Enabled: true
X707|0:
XP_Gain: 50
Double_Drops_Enabled: true
X707|1:
XP_Gain: 50
Double_Drops_Enabled: true
X707|2:
XP_Gain: 50
Double_Drops_Enabled: true
X707|3:
XP_Gain: 50
Double_Drops_Enabled: true
X707|4:
XP_Gain: 50
Double_Drops_Enabled: true
X707|5:
XP_Gain: 50
Double_Drops_Enabled: true
X707|6:
XP_Gain: 50
Double_Drops_Enabled: true
X707|7:
XP_Gain: 50
Double_Drops_Enabled: true
X707|8:
XP_Gain: 50
Double_Drops_Enabled: true
X707|9:
XP_Gain: 50
Double_Drops_Enabled: true
X707|10:
XP_Gain: 50
Double_Drops_Enabled: true
X707|11:
XP_Gain: 50
Double_Drops_Enabled: true
X707|12:
XP_Gain: 50
Double_Drops_Enabled: true
X707|13:
XP_Gain: 50
Double_Drops_Enabled: true
X707|14:
XP_Gain: 50
Double_Drops_Enabled: true
X707|15:
XP_Gain: 50
Double_Drops_Enabled: true
#
# Settings for Custom Mining Blocks
###
Mining:
X700|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|3:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|8:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|9:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|10:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|11:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|12:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|13:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|14:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X700|15:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X701|0:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|1:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|2:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|3:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|4:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|5:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|6:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|7:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|8:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|9:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|10:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|11:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|12:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|13:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|14:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X701|15:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X702|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|3:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|4:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|5:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|6:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|7:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|8:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|9:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|10:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|11:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|12:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|13:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|14:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X702|15:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|3:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|4:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|5:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|6:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|7:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|8:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|9:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|10:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|11:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|12:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|13:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|14:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X703|15:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|3:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|4:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|5:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|6:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|7:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|8:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|9:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|10:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|11:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|12:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|13:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|14:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X704|15:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
#
# Settings for Custom Woodcutting Blocks
###
Woodcutting:
X708|0:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|2:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|3:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|4:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|5:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|6:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|7:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|8:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|9:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|10:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X708|11:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X1095|0:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X1095|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X1095|2:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X1095|3:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true

61
extras/mods/simcraft.tools.yml Executable file
View File

@@ -0,0 +1,61 @@
# Config created by Dragyn
# Created For Railcraft_1.6.2-8.1.0.0
#
#
# Settings for Axes
###
Axes:
# Steel
X15787:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X15260
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Pickaxes
###
Pickaxes:
# Steel
X15788:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X15260
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Shovels
###
Shovels:
# Steel
X15789:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X15260
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Swords
###
Swords:
# Steel
X15786:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X15260
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

View File

@@ -0,0 +1,134 @@
# Config created by Dragyn
# Created For twilightforest-1.20.3
#
#
# Settings for Boots
###
Boots:
# Ironwood
X27978:
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
X27995:
Repairable: true
Repair_Material: X27991
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
X28002:
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28037:
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Chestplates
###
Chestplates:
# Ironwood
X27976:
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
X27993:
Repairable: true
Repair_Material: X27991
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
X28000:
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28035:
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Helmets
###
Helmets:
# Ironwood
X27975:
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
X27992:
Repairable: true
Repair_Material: X27991
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
X27999:
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28034:
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Leggings
###
Leggings:
# Ironwood
X27977:
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
X27994:
Repairable: true
Repair_Material: X27991
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
X28001:
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28036:
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

View File

@@ -0,0 +1,117 @@
# Config created by Dragyn
# Created For twilightforest-1.20.3
#
#
# Settings for Custom Herbalism Blocks
###
Herbalism:
# Mushgloom
X2169|9:
XP_Gain: 150
Double_Drops_Enabled: true
# Torchberry Plant
X2169|13:
XP_Gain: 20
Double_Drops_Enabled: true
# Mayapple
X2169|4:
XP_Gain: 30
Double_Drops_Enabled: true
# Fiddlehead
X2169|8:
XP_Gain: 35
Double_Drops_Enabled: true
#
# Settings for Custom Mining Blocks
###
Mining:
# Mazestone
X2165|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|3:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|4:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|5:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|6:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
X2165|7:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
#
# Settings for Custom Woodcutting Blocks
###
Woodcutting:
# Twilight Oak
X2163|0:
XP_Gain: 70
Double_Drops_Enabled: true
Is_Log: true
# Canopy
X2163|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Mangrove
X2163|2:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Darkwood
X2163|3:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Roots
X2170|0:
XP_Gain: 10
Double_Drops_Enabled: true
Is_Log: false
X2170|1:
XP_Gain: 10
Double_Drops_Enabled: true
Is_Log: false
# Timewood
X2176|0:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true
# Transwood
X2176|1:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true
# Minewood
X2176|2:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true
# Sortingwood
X2176|3:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true

View File

@@ -0,0 +1,186 @@
# Config created by Dragyn
# Created For twilightforest-1.20.3
#
#
# Settings for Axes
###
Axes:
# Ironwood
X27982:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
X31989:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28040:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Minotaur
X31984:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X264
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Hoes
###
Hoes:
# Ironwood
X27983:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
X31988:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Pickaxes
###
Pickaxes:
# Ironwood
X27981:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
X27997:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27991
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
X28005:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28039:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Shovels
###
Shovels:
# Ironwood
X27980:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
X28004:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Swords
###
Swords:
# Ironwood
X27979:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27974
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
X27996:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27991
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
X28003:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X27998
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
X28038:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X28032
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

View File

@@ -0,0 +1,171 @@
# Config created by Dragyn
# Created For UndergroundBiomes 1.6.x - 0.4.2c
#
#
# Settings for Custom Mining Blocks
###
Mining:
X2000|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|3:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2000|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
#
X2001|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|3:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2001|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
#
X2009|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|3:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2009|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
#
X2010|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|3:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|4:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2010|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
#
X2011|0:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2011|1:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2011|2:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2011|3:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2011|4:
XP_Gain: 50
Double_Drops_Enabled: true
Is_Ore: false
X2011|5:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2011|6:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false
X2011|7:
XP_Gain: 30
Double_Drops_Enabled: true
Is_Ore: false

View File

@@ -1,11 +1,11 @@
#
# Repair configuration
# Last updated on ${project.version}-b${BUILD_NUMBER}
#
# 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.
# Afterwards, all sub-items are considered a Repairable to be loaded. The names of each subitem should be the exact material name.
# The bare minimum of a Repairable is that it have a RepairMaterial and a MaximumDurability
#
# ItemType: This is the type of item to be repaired, this is only important to permissions.
## Valid values are ARMOR, TOOL, and OTHER.
@@ -15,7 +15,7 @@
## 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.
# RepairMaterial: This is the material name 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.
@@ -26,7 +26,7 @@
## This is required to be set.
#
# MinimumLevel: This is the minimum repair level needed to repair this item.
## Valid values are > 0
## 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.
@@ -42,32 +42,19 @@
#
###
Repairables:
ChainHelmet:
ItemId: 302
ItemType: ARMOR
RepairMaterialId: 51
MaximumDurability: 165
MinimumQuantity: 5
#
# Chainmail repairables
###
# Armor
CHAINMAIL_HELMET:
RepairMaterial: FIRE
XpMultiplier: 2
ChainChest:
ItemId: 303
ItemType: ARMOR
RepairMaterialId: 51
MaximumDurability: 240
MinimumQuantity: 8
CHAINMAIL_CHESTPLATE:
RepairMaterial: FIRE
XpMultiplier: 2
ChainLegs:
ItemId: 304
ItemType: ARMOR
RepairMaterialId: 51
MaximumDurability: 225
MinimumQuantity: 7
CHAINMAIL_LEGGINGS:
RepairMaterial: FIRE
XpMultiplier: 2
ChainBoots:
ItemId: 305
ItemType: ARMOR
RepairMaterialId: 51
RepairMaterialMetadata: -1
MaximumDurability: 195
MinimumQuantity: 4
CHAINMAIL_BOOTS:
RepairMaterial: FIRE
XpMultiplier: 2

69
pom.xml
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.4.06-beta5</version>
<version>1.4.08-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement>
@@ -22,38 +22,6 @@
<include>.jenkins</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/xpbar/</directory>
<includes>
<include>xpbar*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/healthbar/</directory>
<includes>
<include>health*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/skillicon/</directory>
<includes>
<include>*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/sound/</directory>
<includes>
<include>*.wav</include>
</includes>
</resource>
<resource>
<targetPath>com/gmail/nossr50/locale</targetPath>
<filtering>true</filtering>
@@ -62,6 +30,14 @@
<include>locale*.properties</include>
</includes>
</resource>
<resource>
<targetPath>mods</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/mods</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
@@ -133,8 +109,8 @@
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<id>spout-repo</id>
<url>http://nexus.spout.org/content/groups/public/</url>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
</repository>
<repository>
<id>Plugin MetricsExtension</id>
@@ -145,14 +121,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>LATEST</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutplugin</artifactId>
<version>LATEST</version>
<version>RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
@@ -165,20 +134,24 @@
<dependency>
<groupId>com.turt2live.metrics</groupId>
<artifactId>MetricsExtension</artifactId>
<version>0.0.4-SNAPSHOT</version>
<version>0.0.5-SNAPSHOT</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>mcmmo-repo</id>
<url>file:///var/lib/jenkins/repo</url>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>md_5-snapshots</id>
<url>http://repo.md-5.net/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<ciManagement>
<system>Jenkins</system>
<url>ci.mcmmo.org</url>
<system>Jenkins</system>
<url>http://ci.ecocitycraft.com/job/mcMMO</url>
</ciManagement>
</project>

View File

@@ -50,34 +50,34 @@ public final class AbilityAPI {
}
public static void resetCooldowns(Player player) {
UserManager.getPlayer(player).getProfile().resetCooldowns();
UserManager.getPlayer(player).resetCooldowns();
}
public static void setBerserkCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.BERSERK, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.BERSERK, cooldown);
}
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.GIGA_DRILL_BREAKER, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.GIGA_DRILL_BREAKER, cooldown);
}
public static void setGreenTerraCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.GREEN_TERRA, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.GREEN_TERRA, cooldown);
}
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.SERRATED_STRIKES, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SERRATED_STRIKES, cooldown);
}
public static void setSkullSplitterCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.SKULL_SPLITTER, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SKULL_SPLITTER, cooldown);
}
public static void setSuperBreakerCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.SUPER_BREAKER, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SUPER_BREAKER, cooldown);
}
public static void setTreeFellerCooldown(Player player, long cooldown) {
UserManager.getPlayer(player).getProfile().setSkillDATS(AbilityType.TREE_FELLER, cooldown);
UserManager.getPlayer(player).setAbilityDATS(AbilityType.TREE_FELLER, cooldown);
}
}

View File

@@ -4,6 +4,9 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
@@ -22,7 +25,7 @@ public final class ChatAPI {
* @param message The message to send
*/
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
ChatManager.handlePartyChat(plugin, PartyManager.getParty(party), sender, displayName, message);
getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
}
/**
@@ -36,7 +39,7 @@ public final class ChatAPI {
* @param message The message to send
*/
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
ChatManager.handlePartyChat(plugin, PartyManager.getParty(party), sender, sender, message);
getPartyChatManager(plugin, party).handleChat(sender, message);
}
/**
@@ -50,7 +53,7 @@ public final class ChatAPI {
* @param message The message to send
*/
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
ChatManager.handleAdminChat(plugin, sender, displayName, message);
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message);
}
/**
@@ -63,7 +66,7 @@ public final class ChatAPI {
* @param message The message to send
*/
public static void sendAdminChat(Plugin plugin, String sender, String message) {
ChatManager.handleAdminChat(plugin, sender, sender, message);
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, message);
}
/**
@@ -73,7 +76,7 @@ public final class ChatAPI {
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(Player player) {
return isUsingPartyChat(player.getName());
return UserManager.getPlayer(player).isChatEnabled(ChatMode.PARTY);
}
/**
@@ -83,7 +86,7 @@ public final class ChatAPI {
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(String playerName) {
return UserManager.getPlayer(playerName).getPartyChatMode();
return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.PARTY);
}
/**
@@ -93,7 +96,7 @@ public final class ChatAPI {
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(Player player) {
return isUsingAdminChat(player.getName());
return UserManager.getPlayer(player).isChatEnabled(ChatMode.ADMIN);
}
/**
@@ -103,7 +106,7 @@ public final class ChatAPI {
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(String playerName) {
return UserManager.getPlayer(playerName).getAdminChatMode();
return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.ADMIN);
}
/**
@@ -112,7 +115,7 @@ public final class ChatAPI {
* @param player The player to toggle party chat on.
*/
public static void togglePartyChat(Player player) {
togglePartyChat(player.getName());
UserManager.getPlayer(player).toggleChat(ChatMode.PARTY);
}
/**
@@ -121,7 +124,7 @@ public final class ChatAPI {
* @param playerName The name of the player to toggle party chat on.
*/
public static void togglePartyChat(String playerName) {
UserManager.getPlayer(playerName).setPartyChat(!isUsingPartyChat(playerName));
UserManager.getPlayer(playerName).toggleChat(ChatMode.PARTY);
}
/**
@@ -130,7 +133,7 @@ public final class ChatAPI {
* @param player The player to toggle admin chat on.
*/
public static void toggleAdminChat(Player player) {
toggleAdminChat(player.getName());
UserManager.getPlayer(player).toggleChat(ChatMode.ADMIN);
}
/**
@@ -139,6 +142,13 @@ public final class ChatAPI {
* @param playerName The name of the player to toggle party chat on.
*/
public static void toggleAdminChat(String playerName) {
UserManager.getPlayer(playerName).setAdminChat(!isUsingAdminChat(playerName));
UserManager.getPlayer(playerName).toggleChat(ChatMode.ADMIN);
}
private static ChatManager getPartyChatManager(Plugin plugin, String party) {
ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY);
((PartyChatManager) chatManager).setParty(PartyManager.getParty(party));
return chatManager;
}
}

View File

@@ -4,9 +4,11 @@ import java.util.Set;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.exceptions.InvalidPlayerException;
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.child.FamilyTree;
@@ -15,6 +17,42 @@ import com.gmail.nossr50.util.player.UserManager;
public final class ExperienceAPI {
private ExperienceAPI() {}
/**
* Returns whether given string is a valid type of skill suitable for the
* other API calls in this class.
* </br>
* This function is designed for API usage.
*
* @param skillType A string that may or may not be a skill
* @return true if this is a valid mcMMO skill
*/
public static boolean isValidSkillType(String skillType) {
return SkillType.getSkill(skillType) != null;
}
/**
* Returns whether the given skill type string is both valid and not a
* child skill. (Child skills have no XP of their own, and their level is
* derived from the parent(s).)
* </br>
* This function is designed for API usage.
*
* @param skillType the skill to check
* @return true if this is a valid, non-child mcMMO skill
*/
public static boolean isNonChildSkill(String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) return false;
return !skill.isChildSkill();
}
@Deprecated
public static void addRawXP(Player player, String skillType, int XP) {
addRawXP(player, skillType, (float) XP);
}
/**
* Adds raw XP to the player.
* </br>
@@ -26,14 +64,13 @@ public final class ExperienceAPI {
*
* @throws InvalidSkillException if the given skill is not valid
*/
public static void addRawXP(Player player, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
public static void addRawXP(Player player, String skillType, float XP) {
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), XP);
}
if (skill == null) {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).applyXpGain(skill, XP);
@Deprecated
public static void addRawXPOffline(String playerName, String skillType, int XP) {
addRawXPOffline(playerName, skillType, (float) XP);
}
/**
@@ -48,14 +85,8 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void addRawXPOffline(String playerName, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
addOfflineXP(playerName, skill, XP);
public static void addRawXPOffline(String playerName, String skillType, float XP) {
addOfflineXP(playerName, getSkillType(skillType), (int) Math.floor(XP));
}
/**
@@ -70,13 +101,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static void addMultipliedXP(Player player, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@@ -92,13 +117,7 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void addMultipliedXPOffline(String playerName, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
addOfflineXP(playerName, skill, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
addOfflineXP(playerName, getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@@ -113,13 +132,9 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static void addModifiedXP(Player player, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
SkillType skill = getSkillType(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@@ -135,17 +150,14 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
SkillType skill = getSkillType(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills,
* and party sharing.
* </br>
* This function is designed for API usage.
*
@@ -156,13 +168,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static void addXP(Player player, String skillType, int XP) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).beginXpGain(skill, XP);
UserManager.getPlayer(player).beginXpGain(getSkillType(skillType), XP);
}
/**
@@ -178,17 +184,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getXP(Player player, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return UserManager.getPlayer(player).getProfile().getSkillXpLevel(skill);
return UserManager.getPlayer(player).getSkillXpLevel(getNonChildSkillType(skillType));
}
/**
@@ -205,17 +201,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXP(String playerName, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return getOfflineProfile(playerName).getSkillXpLevel(skill);
return getOfflineProfile(playerName).getSkillXpLevel(getNonChildSkillType(skillType));
}
/**
@@ -231,17 +217,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static float getXPRaw(Player player, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return UserManager.getPlayer(player).getProfile().getSkillXpLevelRaw(skill);
return UserManager.getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType));
}
/**
@@ -258,17 +234,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static float getOfflineXPRaw(String playerName, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return getOfflineProfile(playerName).getSkillXpLevelRaw(skill);
return getOfflineProfile(playerName).getSkillXpLevelRaw(getNonChildSkillType(skillType));
}
/**
@@ -284,17 +250,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getXPToNextLevel(Player player, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return UserManager.getPlayer(player).getProfile().getXpToLevel(skill);
return UserManager.getPlayer(player).getXpToLevel(getNonChildSkillType(skillType));
}
/**
@@ -311,17 +267,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXPToNextLevel(String playerName, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return getOfflineProfile(playerName).getXpToLevel(skill);
return getOfflineProfile(playerName).getXpToLevel(getNonChildSkillType(skillType));
}
/**
@@ -337,15 +283,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getXPRemaining(Player player, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
SkillType skill = getNonChildSkillType(skillType);
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
@@ -366,15 +304,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXPRemaining(String playerName, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
SkillType skill = getNonChildSkillType(skillType);
PlayerProfile profile = getOfflineProfile(playerName);
@@ -393,13 +323,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static void addLevel(Player player, String skillType, int levels) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).getProfile().addLevels(skill, levels);
UserManager.getPlayer(player).addLevels(getSkillType(skillType), levels);
}
/**
@@ -416,11 +340,7 @@ public final class ExperienceAPI {
*/
public static void addLevelOffline(String playerName, String skillType, int levels) {
PlayerProfile profile = getOfflineProfile(playerName);
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
SkillType skill = getSkillType(skillType);
if (skill.isChildSkill()) {
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
@@ -449,13 +369,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static int getLevel(Player player, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
return UserManager.getPlayer(player).getProfile().getSkillLevel(skill);
return UserManager.getPlayer(player).getSkillLevel(getSkillType(skillType));
}
/**
@@ -471,13 +385,7 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static int getLevelOffline(String playerName, String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
return getOfflineProfile(playerName).getSkillLevel(skill);
return getOfflineProfile(playerName).getSkillLevel(getSkillType(skillType));
}
/**
@@ -506,7 +414,7 @@ public final class ExperienceAPI {
int powerLevel = 0;
PlayerProfile profile = getOfflineProfile(playerName);
for (SkillType type : SkillType.nonChildSkills()) {
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
powerLevel += profile.getSkillLevel(type);
}
@@ -524,13 +432,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static int getLevelCap(String skillType) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
return Config.getInstance().getLevelCap(skill);
return Config.getInstance().getLevelCap(getSkillType(skillType));
}
/**
@@ -544,6 +446,40 @@ public final class ExperienceAPI {
return Config.getInstance().getPowerLevelCap();
}
/**
* Get the position on the leaderboard of a player.
* </br>
* This function is designed for API usage.
*
* @param playerName The name of the player to check
* @param skillType The skill to check
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*
* @return the position on the leaderboard
*/
public static int getPlayerRankSkill(String playerName, String skillType) {
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(playerName).getPlayerName()).get(getNonChildSkillType(skillType));
}
/**
* Get the position on the power level leaderboard of a player.
* </br>
* This function is designed for API usage.
*
* @param playerName The name of the player to check
*
* @throws InvalidPlayerException if the given player does not exist in the database
*
* @return the position on the power level leaderboard
*/
public static int getPlayerRankOverall(String playerName) {
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(playerName).getPlayerName()).get(null);
}
/**
* Sets the level of a player in a specific skill type.
* </br>
@@ -556,13 +492,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static void setLevel(Player player, String skillType, int skillLevel) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
UserManager.getPlayer(player).getProfile().modifySkill(skill, skillLevel);
UserManager.getPlayer(player).modifySkill(getSkillType(skillType), skillLevel);
}
/**
@@ -578,13 +508,7 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database
*/
public static void setLevelOffline(String playerName, String skillType, int skillLevel) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
getOfflineProfile(playerName).modifySkill(skill, skillLevel);
getOfflineProfile(playerName).modifySkill(getSkillType(skillType), skillLevel);
}
/**
@@ -600,17 +524,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void setXP(Player player, String skillType, int newValue) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
UserManager.getPlayer(player).getProfile().setSkillXpLevel(skill, newValue);
UserManager.getPlayer(player).setSkillXpLevel(getNonChildSkillType(skillType), newValue);
}
/**
@@ -627,17 +541,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void setXPOffline(String playerName, String skillType, int newValue) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
getOfflineProfile(playerName).setSkillXpLevel(skill, newValue);
getOfflineProfile(playerName).setSkillXpLevel(getNonChildSkillType(skillType), newValue);
}
/**
@@ -653,17 +557,7 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void removeXP(Player player, String skillType, int xp) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
UserManager.getPlayer(player).getProfile().removeXp(skill, xp);
UserManager.getPlayer(player).removeXp(getNonChildSkillType(skillType), xp);
}
/**
@@ -680,46 +574,20 @@ public final class ExperienceAPI {
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static void removeXPOffline(String playerName, String skillType, int xp) {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
getOfflineProfile(playerName).removeXp(skill, xp);
getOfflineProfile(playerName).removeXp(getNonChildSkillType(skillType), xp);
}
/**
* Add XP to an offline player.
*
* @param playerName The player to check
* @param skillType The skill to check
* @param XP The amount of XP to award.
*/
// Utility methods follow.
private static void addOfflineXP(String playerName, SkillType skill, int XP) {
PlayerProfile profile = getOfflineProfile(playerName);
if (skill.isChildSkill()) {
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
for (SkillType parentSkill : parentSkills) {
profile.setSkillXpLevel(parentSkill, profile.getSkillLevel(parentSkill) + (XP / parentSkills.size()));
}
profile.save();
return;
}
profile.setSkillXpLevel(skill, profile.getSkillXpLevel(skill) + XP);
profile.addXp(skill, XP);
profile.save();
}
private static PlayerProfile getOfflineProfile(String playerName) {
PlayerProfile profile = new PlayerProfile(playerName, false);
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
if (!profile.isLoaded()) {
throw new InvalidPlayerException();
@@ -727,4 +595,24 @@ public final class ExperienceAPI {
return profile;
}
private static SkillType getSkillType(String skillType) throws InvalidSkillException {
SkillType skill = SkillType.getSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
}
return skill;
}
private static SkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException {
SkillType skill = getSkillType(skillType);
if (skill.isChildSkill()) {
throw new UnsupportedOperationException("Child skills do not have XP");
}
return skill;
}
}

View File

@@ -79,12 +79,10 @@ public final class PartyAPI {
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party();
party.setName(partyName);
party.setLeader(player.getName());
party = new Party(player.getName(), partyName);
}
PartyManager.addToParty(player, UserManager.getPlayer(player), party);
PartyManager.addToParty(UserManager.getPlayer(player), party);
}
/**
@@ -95,7 +93,7 @@ public final class PartyAPI {
* @param player The player to remove
*/
public static void removeFromParty(Player player) {
PartyManager.removeFromParty(player, UserManager.getPlayer(player).getParty());
PartyManager.removeFromParty(UserManager.getPlayer(player));
}
/**
@@ -176,4 +174,17 @@ public final class PartyAPI {
public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getOnlineMembers(player);
}
public static boolean hasAlly(String partyName) {
return PartyManager.getParty(partyName).getAlly() != null;
}
public static String getAllyName(String partyName) {
Party ally = PartyManager.getParty(partyName).getAlly();
if (ally != null) {
return ally.getName();
}
return null;
}
}

View File

@@ -1,29 +0,0 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.util.player.UserManager;
public class SpoutHudAPI {
private SpoutHudAPI() {}
/**
* Disable the mcMMO XP bar for a player.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar(Player player) {
UserManager.getPlayer(player).getProfile().setHudType(HudType.DISABLED);
}
/**
* Disable the mcMMO XP bar for the server.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar() {
SpoutConfig.getInstance().setXPBarEnabled(false);
}
}

View File

@@ -1,53 +0,0 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.skills.ToolType;
public final class SpoutToolsAPI {
public static final List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
private SpoutToolsAPI() {}
/**
* 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,22 @@
package com.gmail.nossr50.chat;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
public class AdminChatManager extends ChatManager {
protected AdminChatManager(Plugin plugin) {
super(plugin, Config.getInstance().getAdminDisplayNames(), Config.getInstance().getAdminChatPrefix());
}
@Override
public void handleChat(String senderName, String displayName, String message, boolean isAsync) {
handleChat(new McMMOAdminChatEvent(plugin, senderName, displayName, message, isAsync));
}
@Override
protected void sendMessage() {
plugin.getServer().broadcast(message, "mcmmo.chat.adminchat");
}
}

View File

@@ -1,78 +1,53 @@
package com.gmail.nossr50.chat;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.events.chat.McMMOChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
public final class ChatManager {
public ChatManager() {}
public abstract class ChatManager {
protected Plugin plugin;
protected boolean useDisplayNames;
protected String chatPrefix;
public static void handleAdminChat(Plugin plugin, String playerName, String displayName, String message, boolean isAsync) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(plugin, playerName, displayName, message, isAsync);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
protected String senderName;
protected String displayName;
protected String message;
if (chatEvent.isCancelled()) {
protected ChatManager(Plugin plugin, boolean useDisplayNames, String chatPrefix) {
this.plugin = plugin;
this.useDisplayNames = useDisplayNames;
this.chatPrefix = chatPrefix;
}
protected void handleChat(McMMOChatEvent event) {
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
if (Config.getInstance().getAdminDisplayNames()) {
displayName = chatEvent.getDisplayName();
}
else {
displayName = chatEvent.getSender();
}
senderName = event.getSender();
displayName = useDisplayNames ? event.getDisplayName() : senderName;
message = LocaleLoader.formatString(chatPrefix, displayName) + " " + event.getMessage();
String adminMessage = chatEvent.getMessage();
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Commands.AdminChat.Prefix", displayName) + adminMessage, "mcmmo.chat.adminchat");
sendMessage();
}
public static void handleAdminChat(Plugin plugin, String senderName, String message) {
handleAdminChat(plugin, senderName, senderName, message);
public void handleChat(String senderName, String message) {
handleChat(senderName, senderName, message, false);
}
public static void handleAdminChat(Plugin plugin, String playerName, String displayName, String message) {
handleAdminChat(plugin, playerName, displayName, message, false);
public void handleChat(Player player, String message, boolean isAsync) {
handleChat(player.getName(), player.getDisplayName(), message, isAsync);
}
public static void handlePartyChat(Plugin plugin, Party party, String playerName, String displayName, String message, boolean isAsync) {
String partyName = party.getName();
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(plugin, playerName, displayName, partyName, message, isAsync);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return;
}
if (Config.getInstance().getPartyDisplayNames()) {
displayName = chatEvent.getDisplayName();
}
else {
displayName = chatEvent.getSender();
}
String partyMessage = chatEvent.getMessage();
for (Player member : party.getOnlineMembers()) {
member.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Prefix", displayName) + partyMessage);
}
mcMMO.p.getLogger().info("[P](" + partyName + ")" + "<" + ChatColor.stripColor(displayName) + "> " + partyMessage);
public void handleChat(String senderName, String displayName, String message) {
handleChat(senderName, displayName, message, false);
}
public static void handlePartyChat(Plugin plugin, Party party, String senderName, String message) {
handlePartyChat(plugin, party, senderName, senderName, message);
}
public abstract void handleChat(String senderName, String displayName, String message, boolean isAsync);
public static void handlePartyChat(Plugin plugin, Party party, String playerName, String displayName, String message) {
handlePartyChat(plugin, party, playerName, displayName, message, false);
}
protected abstract void sendMessage();
}

View File

@@ -0,0 +1,31 @@
package com.gmail.nossr50.chat;
import java.util.HashMap;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.datatypes.chat.ChatMode;
public class ChatManagerFactory {
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<Plugin, AdminChatManager>();
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<Plugin, PartyChatManager>();
public static ChatManager getChatManager(Plugin plugin, ChatMode mode) {
switch (mode) {
case ADMIN:
if (!adminChatManagers.containsKey(plugin)) {
adminChatManagers.put(plugin, new AdminChatManager(plugin));
}
return adminChatManagers.get(plugin);
case PARTY:
if (!partyChatManagers.containsKey(plugin)) {
partyChatManagers.put(plugin, new PartyChatManager(plugin));
}
return partyChatManagers.get(plugin);
default:
return null;
}
}
}

View File

@@ -1,70 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
public enum ChatMode {
ADMIN(LocaleLoader.getString("Commands.AdminChat.On"), LocaleLoader.getString("Commands.AdminChat.Off")),
PARTY(LocaleLoader.getString("Commands.Party.Chat.On"), LocaleLoader.getString("Commands.Party.Chat.Off"));
private String enabledMessage;
private String disabledMessage;
private ChatMode(String enabledMessage, String disabledMessage) {
this.enabledMessage = enabledMessage;
this.disabledMessage = disabledMessage;
}
public boolean isEnabled(McMMOPlayer mcMMOPlayer) {
switch (this) {
case ADMIN:
return mcMMOPlayer.getAdminChatMode();
case PARTY:
return mcMMOPlayer.getPartyChatMode();
default:
return false;
}
}
public void disable(McMMOPlayer mcMMOPlayer) {
switch (this) {
case ADMIN:
mcMMOPlayer.setAdminChat(false);
return;
case PARTY:
mcMMOPlayer.setPartyChat(false);
return;
default:
return;
}
}
public void enable(McMMOPlayer mcMMOPlayer) {
switch (this) {
case ADMIN:
mcMMOPlayer.setAdminChat(true);
mcMMOPlayer.setPartyChat(false);
return;
case PARTY:
mcMMOPlayer.setPartyChat(true);
mcMMOPlayer.setAdminChat(false);
return;
default:
return;
}
}
public String getEnabledMessage() {
return enabledMessage;
}
public String getDisabledMessage() {
return disabledMessage;
}
}

View File

@@ -0,0 +1,50 @@
package com.gmail.nossr50.chat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
public class PartyChatManager extends ChatManager {
private Party party;
protected PartyChatManager(Plugin plugin) {
super(plugin, Config.getInstance().getPartyDisplayNames(), Config.getInstance().getPartyChatPrefix());
}
public void setParty(Party party) {
this.party = party;
}
@Override
public void handleChat(String senderName, String displayName, String message, boolean isAsync) {
handleChat(new McMMOPartyChatEvent(plugin, senderName, displayName, party.getName(), message, isAsync));
}
@Override
protected void sendMessage() {
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
}
for (Player member : party.getOnlineMembers()) {
member.sendMessage(message);
}
if (party.getAlly() != null) {
for (Player member : party.getAlly().getOnlineMembers()) {
String allyPrefix = LocaleLoader.formatString(Config.getInstance().getPartyChatPrefixAlly());
member.sendMessage(allyPrefix + message);
}
}
plugin.getLogger().info("[P]<" + party.getName() + ">" + message);
}
}

View File

@@ -13,6 +13,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public class KrakenCommand implements TabExecutor {
@@ -38,9 +39,10 @@ public class KrakenCommand implements TabExecutor {
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
if (!CommandUtils.checkPlayerExistence(sender, args[0], mcMMOPlayer)) {
if (!CommandUtils.checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
return true;
}
@@ -56,7 +58,7 @@ public class KrakenCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();

View File

@@ -2,6 +2,7 @@ package com.gmail.nossr50.commands;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
@@ -17,13 +18,13 @@ public class McabilityCommand extends ToggleCommand {
}
@Override
protected void applyCommandAction() {
player.sendMessage(LocaleLoader.getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On")));
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On")));
mcMMOPlayer.toggleAbilityUse();
}
@Override
protected void sendSuccessMessage(CommandSender sender) {
sender.sendMessage("Ability use has been toggled for " + player.getName()); // TODO: Localize
protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle", playerName));
}
}

View File

@@ -0,0 +1,93 @@
package com.gmail.nossr50.commands;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.database.ConvertDatabaseCommand;
import com.gmail.nossr50.commands.experience.ConvertExperienceCommand;
import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.google.common.collect.ImmutableList;
public class McconvertCommand implements TabExecutor {
private static final List<String> FORMULA_TYPES;
private static final List<String> DATABASE_TYPES;
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
static {
ArrayList<String> formulaTypes = new ArrayList<String>();
ArrayList<String> databaseTypes = new ArrayList<String>();
for (FormulaType type : FormulaType.values()) {
formulaTypes.add(type.toString());
}
for (DatabaseType type : DatabaseType.values()) {
databaseTypes.add(type.toString());
}
// Custom stuff
databaseTypes.remove(DatabaseType.CUSTOM.toString());
if (mcMMO.getDatabaseManager().getDatabaseType() == DatabaseType.CUSTOM) {
databaseTypes.add(DatabaseManagerFactory.getCustomDatabaseManagerClass().getName());
}
Collections.sort(formulaTypes);
Collections.sort(databaseTypes);
FORMULA_TYPES = ImmutableList.copyOf(formulaTypes);
DATABASE_TYPES = ImmutableList.copyOf(databaseTypes);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return databaseConvertCommand.onCommand(sender, command, label, args);
}
else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
return experienceConvertCommand.onCommand(sender, command, label, args);
}
return false;
default:
return false;
}
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<String>(SUBCOMMANDS.size()));
case 2:
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<String>(DATABASE_TYPES.size()));
}
if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[0].equalsIgnoreCase("exp")) {
return StringUtil.copyPartialMatches(args[0], FORMULA_TYPES, new ArrayList<String>(FORMULA_TYPES.size()));
}
return ImmutableList.of();
default:
return ImmutableList.of();
}
}
}

View File

@@ -2,6 +2,7 @@ package com.gmail.nossr50.commands;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
@@ -17,13 +18,13 @@ public class McgodCommand extends ToggleCommand {
}
@Override
protected void applyCommandAction() {
player.sendMessage(LocaleLoader.getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
mcMMOPlayer.toggleGodMode();
}
@Override
protected void sendSuccessMessage(CommandSender sender) {
sender.sendMessage("God mode has been toggled for " + player.getName()); // TODO: Localize
protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Toggle", playerName));
}
}

View File

@@ -4,14 +4,12 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.party.PartySubcommandType;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.spout.SpoutUtils;
public class McmmoCommand implements CommandExecutor {
@Override
@@ -28,16 +26,12 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) {
if (mcMMO.isSpoutEnabled() && sender instanceof Player) {
SpoutUtils.sendDonationNotification((Player) sender);
}
else {
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
}
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
}
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
mcMMO.getHolidayManager().anniversaryCheck(sender);
return true;
case 1:
@@ -48,9 +42,9 @@ public class McmmoCommand implements CommandExecutor {
}
sender.sendMessage(LocaleLoader.getString("Commands.mcc.Header"));
displayPartyCommands(sender);
displayGeneralCommands(sender);
displayOtherCommands(sender);
displayPartyCommands(sender);
}
return true;
@@ -59,55 +53,57 @@ public class McmmoCommand implements CommandExecutor {
}
}
private void displayPartyCommands(CommandSender sender) {
if (Permissions.party(sender)) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
sender.sendMessage(" /party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
sender.sendMessage(" /party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
sender.sendMessage(" /party quit " + LocaleLoader.getString("Commands.Party.Quit"));
private void displayGeneralCommands(CommandSender sender) {
sender.sendMessage(ChatColor.DARK_AQUA + " /mcstats " + LocaleLoader.getString("Commands.Stats"));
sender.sendMessage(ChatColor.DARK_AQUA + " /<skill>" + LocaleLoader.getString("Commands.SkillInfo"));
sender.sendMessage(ChatColor.DARK_AQUA + " /mctop " + LocaleLoader.getString("Commands.Leaderboards"));
if (Permissions.partyChat(sender)) {
sender.sendMessage(" /party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
}
if (Permissions.inspect(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /inspect " + LocaleLoader.getString("Commands.Inspect"));
}
sender.sendMessage(" /party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
sender.sendMessage(" /party accept " + LocaleLoader.getString("Commands.Party.Accept"));
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
sender.sendMessage(" /party teleport " + LocaleLoader.getString("Commands.Party.Teleport"));
}
if (Permissions.mcability(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
}
}
private void displayOtherCommands(CommandSender sender) {
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
sender.sendMessage(" /mcstats " + LocaleLoader.getString("Commands.Stats"));
sender.sendMessage(" /mctop " + LocaleLoader.getString("Commands.Leaderboards"));
if (Permissions.skillreset(sender)) {
sender.sendMessage(" /skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
}
if (Permissions.mcability(sender)) {
sender.sendMessage(" /mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
}
if (Permissions.adminChat(sender)) {
sender.sendMessage(" /adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
}
if (Permissions.inspect(sender)) {
sender.sendMessage(" /inspect " + LocaleLoader.getString("Commands.Inspect"));
sender.sendMessage(ChatColor.DARK_AQUA + " /skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
}
if (Permissions.mmoedit(sender)) {
sender.sendMessage(" /mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
sender.sendMessage(ChatColor.DARK_AQUA + " /mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
}
if (Permissions.adminChat(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
}
if (Permissions.mcgod(sender)) {
sender.sendMessage(" /mcgod " + LocaleLoader.getString("Commands.mcgod"));
sender.sendMessage(ChatColor.DARK_AQUA + " /mcgod " + LocaleLoader.getString("Commands.mcgod"));
}
}
sender.sendMessage(" /<skill>" + LocaleLoader.getString("Commands.SkillInfo"));
private void displayPartyCommands(CommandSender sender) {
if (Permissions.party(sender)) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party quit " + LocaleLoader.getString("Commands.Party.Quit"));
if (Permissions.partyChat(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
}
sender.sendMessage(ChatColor.DARK_AQUA + " /party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party accept " + LocaleLoader.getString("Commands.Party.Accept"));
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /party teleport <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Teleport"));
}
}
}
}

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
@@ -17,7 +18,7 @@ public class McnotifyCommand implements TabExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
mcMMOPlayer.toggleChatNotifications();

View File

@@ -2,6 +2,7 @@ package com.gmail.nossr50.commands;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
@@ -17,17 +18,17 @@ public class McrefreshCommand extends ToggleCommand {
}
@Override
protected void applyCommandAction() {
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.setRecentlyHurt(0);
mcMMOPlayer.getProfile().resetCooldowns();
mcMMOPlayer.resetCooldowns();
mcMMOPlayer.resetToolPrepMode();
mcMMOPlayer.resetAbilityMode();
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
}
@Override
protected void sendSuccessMessage(CommandSender sender) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", player.getName()));
protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", playerName));
}
}

View File

@@ -6,20 +6,17 @@ import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList;
public class McscoreboardCommand implements TabExecutor {
private static final List<String> SCOREBOARD_TYPES = ImmutableList.of("clear", "rank", "stats", "top");
private static final List<String> FIRST_ARGS = ImmutableList.of("keep", "time", "clear");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@@ -27,94 +24,49 @@ public class McscoreboardCommand implements TabExecutor {
return true;
}
Player player = (Player) sender;
switch (args.length) {
case 0:
clearScoreboard(player);
return true;
case 1:
if (args[0].equalsIgnoreCase("clear")) {
clearScoreboard(player);
if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("reset")) {
ScoreboardManager.clearBoard(sender.getName());
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Clear"));
return true;
}
else if (args[0].equalsIgnoreCase("rank")) {
if (!Config.getInstance().getMcrankScoreboardEnabled()) {
sender.sendMessage("This scoreboard is not enabled."); //TODO: Localize
if (args[0].equalsIgnoreCase("keep")) {
if (!Config.getInstance().getAllowKeepBoard()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
ScoreboardManager.setupPlayerScoreboard(player.getName());
ScoreboardManager.enablePlayerRankScoreboard(player);
}
else if (args[0].equalsIgnoreCase("stats")) {
if (!Config.getInstance().getMcstatsScoreboardsEnabled()) {
sender.sendMessage("This scoreboard is not enabled."); //TODO: Localize
if (!ScoreboardManager.isBoardShown(sender.getName())) {
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.NoBoard"));
return true;
}
ScoreboardManager.setupPlayerScoreboard(player.getName());
ScoreboardManager.enablePlayerStatsScoreboard(UserManager.getPlayer(player));
}
else if (args[0].equalsIgnoreCase("top")) {
if (!Config.getInstance().getMctopScoreboardEnabled()) {
sender.sendMessage("This scoreboard is not enabled."); //TODO: Localize
return true;
}
ScoreboardManager.enableGlobalStatsScoreboard(player, "all", 1);
}
else {
return false;
ScoreboardManager.keepBoard(sender.getName());
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Keep"));
return true;
}
return true;
return help(sender);
case 2:
if (!args[0].equalsIgnoreCase("top")) {
return false;
}
if (args[0].equalsIgnoreCase("time") || args[0].equalsIgnoreCase("timer")) {
if (CommandUtils.isInvalidInteger(sender, args[1])) {
return true;
}
if (!Config.getInstance().getMctopScoreboardEnabled()) {
sender.sendMessage("This scoreboard is not enabled."); //TODO: Localize
int time = Math.abs(Integer.parseInt(args[1]));
ScoreboardManager.setRevertTimer(sender.getName(), time);
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", time));
return true;
}
if (StringUtils.isInt(args[1])) {
ScoreboardManager.enableGlobalStatsScoreboard(player, "all", Math.abs(Integer.parseInt(args[1])));
return true;
}
if (CommandUtils.isInvalidSkill(sender, args[1])) {
return true;
}
ScoreboardManager.enableGlobalStatsScoreboard(player, args[1], 1);
return true;
case 3:
if (!args[0].equalsIgnoreCase("top")) {
return false;
}
if (!Config.getInstance().getMctopScoreboardEnabled()) {
sender.sendMessage("This scoreboard is not enabled."); //TODO: Localize
return true;
}
if (CommandUtils.isInvalidSkill(sender, args[1])) {
return true;
}
if (CommandUtils.isInvalidInteger(sender, args[2])) {
return true;
}
ScoreboardManager.enableGlobalStatsScoreboard(player, args[1], Math.abs(Integer.parseInt(args[2])));
return true;
return help(sender);
default:
return false;
return help(sender);
}
}
@@ -122,20 +74,17 @@ public class McscoreboardCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], SCOREBOARD_TYPES, new ArrayList<String>(SCOREBOARD_TYPES.size()));
case 2:
if (args[0].equalsIgnoreCase("top")) {
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
}
// Fallthrough
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<String>(FIRST_ARGS.size()));
default:
return ImmutableList.of();
}
}
private void clearScoreboard(Player player) {
player.setScoreboard(mcMMO.p.getServer().getScoreboardManager().getMainScoreboard());
player.sendMessage("Your scoreboard has been cleared!"); //TODO: Locale
private boolean help(CommandSender sender) {
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.0"));
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.1"));
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.2"));
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.3"));
return true;
}
}

View File

@@ -7,10 +7,11 @@ import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
@@ -38,16 +39,14 @@ public class MobhealthCommand implements TabExecutor {
switch (args.length) {
case 1:
PlayerProfile playerProfile = UserManager.getPlayer(sender.getName()).getProfile();
try {
MobHealthbarType type = MobHealthbarType.valueOf(args[0].toUpperCase().trim());
playerProfile.setMobHealthbarType(type);
sender.sendMessage("Display type changed to: " + type); //TODO: Localize
UserManager.getPlayer((Player) sender).getProfile().setMobHealthbarType(type);
sender.sendMessage(LocaleLoader.getString("Commands.Healthbars.Changed." + type.name()));
return true;
}
catch (IllegalArgumentException ex) {
sender.sendMessage("Invalid type!"); //TODO: Localize
sender.sendMessage(LocaleLoader.getString("Commands.Healthbars.Invalid"));
return true;
}

View File

@@ -7,7 +7,6 @@ import java.util.Set;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@@ -17,9 +16,6 @@ import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public abstract class ToggleCommand implements TabExecutor {
protected McMMOPlayer mcMMOPlayer;
protected Player player;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
@@ -33,10 +29,7 @@ public abstract class ToggleCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
applyCommandAction();
applyCommandAction(UserManager.getPlayer(sender.getName()));
return true;
case 1:
@@ -45,20 +38,19 @@ public abstract class ToggleCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(args[0]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
if (!CommandUtils.checkPlayerExistence(sender, args[0], mcMMOPlayer)) {
if (!CommandUtils.checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
return true;
}
player = mcMMOPlayer.getPlayer();
if (CommandUtils.isOffline(sender, player)) {
if (CommandUtils.isOffline(sender, mcMMOPlayer.getPlayer())) {
return true;
}
applyCommandAction();
sendSuccessMessage(sender);
applyCommandAction(mcMMOPlayer);
sendSuccessMessage(sender, playerName);
return true;
default:
@@ -70,7 +62,7 @@ public abstract class ToggleCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();
@@ -79,6 +71,6 @@ public abstract class ToggleCommand implements TabExecutor {
protected abstract boolean hasOtherPermission(CommandSender sender);
protected abstract boolean hasSelfPermission(CommandSender sender);
protected abstract void applyCommandAction();
protected abstract void sendSuccessMessage(CommandSender sender);
protected abstract void applyCommandAction(McMMOPlayer mcMMOPlayer);
protected abstract void sendSuccessMessage(CommandSender sender, String playerName);
}

View File

@@ -9,7 +9,7 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
@@ -18,11 +18,7 @@ import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList;
public class XprateCommand implements TabExecutor {
private double originalRate;
public XprateCommand() {
originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
}
private final double ORIGINAL_XP_RATE = ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@@ -42,7 +38,7 @@ public class XprateCommand implements TabExecutor {
mcMMO.p.toggleXpEventEnabled();
}
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(ORIGINAL_XP_RATE);
return true;
case 2:
@@ -66,7 +62,7 @@ public class XprateCommand implements TabExecutor {
}
int newXpRate = Integer.parseInt(args[0]);
Config.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if (mcMMO.p.isXPEventEnabled()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.0"));

View File

@@ -1,12 +1,8 @@
package com.gmail.nossr50.commands.chat;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.datatypes.chat.ChatMode;
public class AdminChatCommand extends ChatCommand {
public AdminChatCommand() {
@@ -15,12 +11,6 @@ public class AdminChatCommand extends ChatCommand {
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
ChatManager.handleAdminChat(mcMMO.p, player.getName(), player.getDisplayName(), buildChatMessage(args, 0));
}
else {
ChatManager.handleAdminChat(mcMMO.p, LocaleLoader.getString("Commands.Chat.Console"), buildChatMessage(args, 0));
}
chatManager.handleChat(sender.getName(), getDisplayName(sender), buildChatMessage(args, 0));
}
}

View File

@@ -6,9 +6,15 @@ import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.chat.ChatMode;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
@@ -17,15 +23,18 @@ import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public abstract class ChatCommand implements TabExecutor {
protected ChatMode chatMode;
private McMMOPlayer mcMMOPlayer;
private ChatMode chatMode;
protected ChatManager chatManager;
public ChatCommand(ChatMode chatMode) {
this.chatMode = chatMode;
this.chatManager = ChatManagerFactory.getChatManager(mcMMO.p, chatMode);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
McMMOPlayer mcMMOPlayer;
switch (args.length) {
case 0:
if (CommandUtils.noConsoleUsage(sender)) {
@@ -34,11 +43,11 @@ public abstract class ChatCommand implements TabExecutor {
mcMMOPlayer = UserManager.getPlayer(sender.getName());
if (chatMode.isEnabled(mcMMOPlayer)) {
disableChatMode(sender);
if (mcMMOPlayer.isChatEnabled(chatMode)) {
disableChatMode(mcMMOPlayer, sender);
}
else {
enableChatMode(sender);
enableChatMode(mcMMOPlayer, sender);
}
return true;
@@ -49,9 +58,7 @@ public abstract class ChatCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
enableChatMode(sender);
enableChatMode(UserManager.getPlayer(sender.getName()), sender);
return true;
}
@@ -60,9 +67,7 @@ public abstract class ChatCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
disableChatMode(sender);
disableChatMode(UserManager.getPlayer(sender.getName()), sender);
return true;
}
@@ -96,25 +101,34 @@ public abstract class ChatCommand implements TabExecutor {
return builder.toString();
}
protected String getDisplayName(CommandSender sender) {
return (sender instanceof Player) ? ((Player) sender).getDisplayName() : LocaleLoader.getString("Commands.Chat.Console");
}
protected abstract void handleChatSending(CommandSender sender, String[] args);
private void enableChatMode(CommandSender sender) {
private void enableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
chatMode.enable(mcMMOPlayer);
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
return;
}
mcMMOPlayer.enableChat(chatMode);
sender.sendMessage(chatMode.getEnabledMessage());
}
private void disableChatMode(CommandSender sender) {
private void disableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
chatMode.disable(mcMMOPlayer);
mcMMOPlayer.disableChat(chatMode);
sender.sendMessage(chatMode.getDisabledMessage());
}
}

View File

@@ -3,9 +3,8 @@ package com.gmail.nossr50.commands.chat;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatMode;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
@@ -18,16 +17,18 @@ public class PartyChatCommand extends ChatCommand {
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
Party party;
String message;
if (sender instanceof Player) {
Player player = (Player) sender;
Party party = UserManager.getPlayer(player).getParty();
party = UserManager.getPlayer((Player) sender).getParty();
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
ChatManager.handlePartyChat(mcMMO.p, party, player.getName(), player.getDisplayName(), buildChatMessage(args, 0));
message = buildChatMessage(args, 0);
}
else {
if (args.length < 2) {
@@ -35,14 +36,17 @@ public class PartyChatCommand extends ChatCommand {
return;
}
Party party = PartyManager.getParty(args[0]);
party = PartyManager.getParty(args[0]);
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return;
}
ChatManager.handlePartyChat(mcMMO.p, party, LocaleLoader.getString("Commands.Chat.Console"), buildChatMessage(args, 1));
message = buildChatMessage(args, 1);
}
((PartyChatManager) chatManager).setParty(party);
chatManager.handleChat(sender.getName(), getDisplayName(sender), message);
}
}

View File

@@ -0,0 +1,74 @@
package com.gmail.nossr50.commands.database;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.database.DatabaseConversionTask;
import com.gmail.nossr50.util.player.UserManager;
public class ConvertDatabaseCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType();
if (previousType == newType || (newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Same", newType.toString()));
return true;
}
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType);
if (previousType == DatabaseType.CUSTOM) {
Class<?> clazz;
try {
clazz = Class.forName(args[1]);
if (!DatabaseManager.class.isAssignableFrom(clazz)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
}
catch (Throwable e) {
e.printStackTrace();
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
}
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
UserManager.saveAll();
UserManager.clearAll();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getName(), false);
if (profile.isLoaded()) {
mcMMO.getDatabaseManager().saveUser(profile);
}
UserManager.addUser(player);
}
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
return true;
default:
return false;
}
}
}

View File

@@ -10,7 +10,6 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
@@ -22,15 +21,17 @@ public class McremoveCommand implements TabExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if (UserManager.getPlayer(args[0]) == null && CommandUtils.unloadedProfile(sender, new PlayerProfile(args[0], false))) {
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
if (UserManager.getPlayer(playerName, true) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) {
return true;
}
if (mcMMO.getDatabaseManager().removeUser(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", args[0]));
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
}
else {
sender.sendMessage(args[0] + " could not be removed from the database."); // Pretty sure this should NEVER happen.
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
}
return true;
@@ -44,7 +45,7 @@ public class McremoveCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();

View File

@@ -5,36 +5,26 @@ import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.database.SQLConversionTask;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public class MmoupdateCommand implements TabExecutor {
public class MmoshowdbCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!Config.getInstance().getUseMySQL()) {
sender.sendMessage("SQL Mode is not enabled."); // TODO: Localize
return true;
}
switch (args.length) {
case 0:
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
UserManager.saveAll();
UserManager.clearAll();
new SQLConversionTask().runTaskLaterAsynchronously(mcMMO.p, 1);
Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
UserManager.addUser(player);
if (clazz != null) {
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", clazz.getName()));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Finish"));
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (Config.getInstance().getUseMySQL() ? "sql" : "flatfile")));
return true;
default:

View File

@@ -1,13 +1,13 @@
package com.gmail.nossr50.commands.experience;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
public class AddlevelsCommand extends ExperienceCommand {
@Override
@@ -21,21 +21,25 @@ public class AddlevelsCommand extends ExperienceCommand {
}
@Override
protected void handleCommand(SkillType skill) {
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
float xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.addLevels(skill, value);
if (player != null) {
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerLevelUpEvent(player, skill, value));
if (player == null) {
profile.save();
return;
}
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, true);
}
@Override
protected void handlePlayerMessageAll() {
protected void handlePlayerMessageAll(Player player, int value) {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
}
@Override
protected void handlePlayerMessageSkill() {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, SkillUtils.getSkillName(skill)));
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
}
}

View File

@@ -1,11 +1,13 @@
package com.gmail.nossr50.commands.experience;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.player.UserManager;
public class AddxpCommand extends ExperienceCommand {
@Override
@@ -19,22 +21,23 @@ public class AddxpCommand extends ExperienceCommand {
}
@Override
protected void handleCommand(SkillType skill) {
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
if (player != null) {
mcMMOPlayer.applyXpGain(skill, value);
UserManager.getPlayer(player).applyXpGain(skill, value);
}
else {
profile.addExperience(skill, value);
profile.addXp(skill, value);
profile.save();
}
}
@Override
protected void handlePlayerMessageAll() {
protected void handlePlayerMessageAll(Player player, int value) {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
}
@Override
protected void handlePlayerMessageSkill() {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, SkillUtils.getSkillName(skill)));
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
}
}

View File

@@ -0,0 +1,49 @@
package com.gmail.nossr50.commands.experience;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.database.FormulaConversionTask;
import com.gmail.nossr50.util.player.UserManager;
public class ConvertExperienceCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
FormulaType previousType = mcMMO.getFormulaManager().getPreviousFormulaType();
FormulaType newType = FormulaType.getFormulaType(args[1].toUpperCase());
if (newType == FormulaType.UNKNOWN) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Invalid"));
return true;
}
if (previousType == newType) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Same", newType.toString()));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Start", previousType.toString(), newType.toString()));
UserManager.saveAll();
UserManager.clearAll();
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
UserManager.addUser(player);
}
return true;
default:
return false;
}
}
}

View File

@@ -10,27 +10,21 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.google.common.collect.ImmutableList;
public abstract class ExperienceCommand implements TabExecutor {
protected McMMOPlayer mcMMOPlayer;
protected Player player;
protected PlayerProfile profile;
protected boolean allSkills;
protected SkillType skill;
protected int value;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
SkillType skill;
switch (args.length) {
case 2:
if (CommandUtils.noConsoleUsage(sender)) {
@@ -46,12 +40,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
profile = mcMMOPlayer.getProfile();
skill = SkillType.getSkill(args[0]);
editValues();
allSkills = false;
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]));
return true;
case 3:
@@ -64,27 +59,32 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(args[0]);
skill = SkillType.getSkill(args[1]);
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
int value = Integer.parseInt(args[2]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
profile = new PlayerProfile(args[0], false);
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
}
editValues();
profile.save(); // Since this is a temporary profile, we save it here.
editValues(null, profile, skill, value);
}
else {
profile = mcMMOPlayer.getProfile();
player = mcMMOPlayer.getPlayer();
editValues();
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
}
handleSenderMessage(sender, args[0]);
allSkills = false;
handleSenderMessage(sender, playerName, skill);
return true;
default:
@@ -96,7 +96,7 @@ public abstract class ExperienceCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
@@ -107,64 +107,38 @@ public abstract class ExperienceCommand implements TabExecutor {
protected abstract boolean permissionsCheckSelf(CommandSender sender);
protected abstract boolean permissionsCheckOthers(CommandSender sender);
protected abstract void handleCommand(SkillType skill);
protected abstract void handlePlayerMessageAll();
protected abstract void handlePlayerMessageSkill();
protected abstract void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value);
protected abstract void handlePlayerMessageAll(Player player, int value);
protected abstract void handlePlayerMessageSkill(Player player, int value, SkillType skill);
private boolean validateArguments(CommandSender sender, String skillName, String value) {
if (isInvalidInteger(sender, value) || isInvalidSkill(sender, skillName)) {
return false;
}
return true;
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
}
private boolean isInvalidInteger(CommandSender sender, String value) {
if (CommandUtils.isInvalidInteger(sender, value)) {
return true;
}
this.value = Integer.parseInt(value);
return false;
}
protected boolean isInvalidSkill(CommandSender sender, String skillName) {
if (skillName.equalsIgnoreCase("all")) {
allSkills = true;
return false;
}
else if (CommandUtils.isInvalidSkill(sender, skillName)) {
return true;
}
skill = SkillType.getSkill(skillName);
return false;
}
protected void handleSenderMessage(CommandSender sender, String playerName) {
if (allSkills) {
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillUtils.getSkillName(skill), playerName));
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
}
}
protected void editValues() {
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
handleCommand(skillType);
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, skillType, value);
}
if (player != null) {
handlePlayerMessageAll();
handlePlayerMessageAll(player, value);
}
}
else {
handleCommand(skill);
handleCommand(player, profile, skill, value);
if (player != null) {
handlePlayerMessageSkill();
handlePlayerMessageSkill(player, value, skill);
}
}
}

View File

@@ -1,13 +1,13 @@
package com.gmail.nossr50.commands.experience;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
public class MmoeditCommand extends ExperienceCommand {
@Override
@@ -21,21 +21,31 @@ public class MmoeditCommand extends ExperienceCommand {
}
@Override
protected void handleCommand(SkillType skill) {
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
int skillLevel = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.modifySkill(skill, value);
if (player != null) {
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerLevelUpEvent(player, skill, value - profile.getSkillLevel(skill)));
if (player == null) {
profile.save();
return;
}
if (value == skillLevel) {
return;
}
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel);
}
@Override
protected void handlePlayerMessageAll() {
protected void handlePlayerMessageAll(Player player, int value) {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
}
@Override
protected void handlePlayerMessageSkill() {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillUtils.getSkillName(skill), value));
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
}
}

View File

@@ -1,82 +1,88 @@
package com.gmail.nossr50.commands.experience;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
public class SkillresetCommand extends ExperienceCommand {
private CommandSender sender;
private Command command;
private int argsLength;
import com.google.common.collect.ImmutableList;
/**
* This class mirrors the structure of ExperienceCommand, except the
* value/quantity argument is removed.
*/
public class SkillresetCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
this.command = command;
this.sender = sender;
argsLength = args.length;
switch (args.length) {
case 1:
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!Permissions.skillreset(sender)) {
if (!permissionsCheckSelf(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (isInvalidSkill(sender, args[0])) {
if (!validateArguments(sender, args[0])) {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
profile = mcMMOPlayer.getProfile();
editValues();
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0]));
return true;
case 2:
if (!Permissions.skillresetOthers(sender)) {
if (!permissionsCheckOthers(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (isInvalidSkill(sender, args[1])) {
if (!validateArguments(sender, args[1])) {
return true;
}
mcMMOPlayer = UserManager.getPlayer(args[0]);
SkillType skill;
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
else {
skill = SkillType.getSkill(args[1]);
}
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
profile = new PlayerProfile(args[0], false);
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
}
editValues();
profile.save(); // Since this is a temporary profile, we save it here.
editValues(null, profile, skill);
}
else {
profile = mcMMOPlayer.getProfile();
player = mcMMOPlayer.getPlayer();
editValues();
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
}
handleSenderMessage(sender, args[0]);
handleSenderMessage(sender, playerName, skill);
return true;
default:
@@ -85,36 +91,77 @@ public class SkillresetCommand extends ExperienceCommand {
}
@Override
protected boolean permissionsCheckSelf(CommandSender sender) {
return false;
}
@Override
protected boolean permissionsCheckOthers(CommandSender sender) {
return false;
}
@Override
protected void handleCommand(SkillType skill) {
if (argsLength == 1 && !Permissions.skillreset(sender, skill) || (argsLength == 2 && !Permissions.skillresetOthers(sender, skill))) {
sender.sendMessage(command.getPermissionMessage());
return;
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
default:
return ImmutableList.of();
}
}
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill) {
int levelsRemoved = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.modifySkill(skill, 0);
if (player != null) {
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerLevelUpEvent(player, skill, 0 - profile.getSkillLevel(skill)));
if (player == null) {
profile.save();
return;
}
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false);
}
@Override
protected void handlePlayerMessageAll() {
protected boolean permissionsCheckSelf(CommandSender sender) {
return Permissions.skillreset(sender);
}
protected boolean permissionsCheckOthers(CommandSender sender) {
return Permissions.skillresetOthers(sender);
}
protected void handlePlayerMessageAll(Player player) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
}
@Override
protected void handlePlayerMessageSkill() {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", SkillUtils.getSkillName(skill)));
protected void handlePlayerMessageSkill(Player player, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
}
private boolean validateArguments(CommandSender sender, String skillName) {
return !(CommandUtils.isInvalidSkill(sender, skillName) && !skillName.equalsIgnoreCase("all"));
}
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
}
}
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, skillType);
}
if (player != null) {
handlePlayerMessageAll(player);
}
}
else {
handleCommand(player, profile, skill);
if (player != null) {
handlePlayerMessageSkill(player, skill);
}
}
}
}

View File

@@ -1,41 +1,65 @@
package com.gmail.nossr50.commands.hardcore;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
public class HardcoreCommand extends HardcoreModeCommand {
@Override
protected void disable() {
Config.getInstance().setHardcoreEnabled(false);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Disabled"));
}
@Override
protected void enable() {
Config.getInstance().setHardcoreEnabled(true);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Enabled"));
}
@Override
protected boolean checkTogglePermissions() {
protected boolean checkTogglePermissions(CommandSender sender) {
return Permissions.hardcoreToggle(sender);
}
@Override
protected boolean checkModifyPermissions() {
protected boolean checkModifyPermissions(CommandSender sender) {
return Permissions.hardcoreModify(sender);
}
@Override
protected boolean checkEnabled() {
return Config.getInstance().getHardcoreEnabled();
protected boolean checkEnabled(SkillType skill) {
if (skill == null) {
for (SkillType skillType : SkillType.values()) {
if (!skillType.getHardcoreStatLossEnabled()) {
return false;
}
}
return true;
}
return skill.getHardcoreStatLossEnabled();
}
@Override
protected void modify() {
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercent);
sender.sendMessage(LocaleLoader.getString("Hardcore.PercentageChanged", percent.format(newPercent / 100D)));
protected void enable(SkillType skill) {
toggle(true, skill);
}
@Override
protected void disable(SkillType skill) {
toggle(false, skill);
}
@Override
protected void modify(CommandSender sender, double newPercentage) {
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
}
private void toggle(boolean enable, SkillType skill) {
if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
skillType.setHardcoreStatLossEnabled(enable);
}
}
else {
skill.setHardcoreStatLossEnabled(enable);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getName())));
}
}

View File

@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
@@ -16,30 +17,22 @@ import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList;
public abstract class HardcoreModeCommand implements TabExecutor {
protected CommandSender sender;
protected double newPercent;
protected DecimalFormat percent;
public HardcoreModeCommand() {
percent = new DecimalFormat("##0.00%");
}
protected final DecimalFormat percent = new DecimalFormat("##0.00%");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
this.sender = sender;
if (!checkTogglePermissions()) {
if (!checkTogglePermissions(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (checkEnabled()) {
disable();
if (checkEnabled(null)) {
disable(null);
}
else {
enable();
enable(null);
}
return true;
@@ -51,7 +44,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true;
}
enable();
enable(null);
return true;
}
@@ -61,11 +54,11 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true;
}
disable();
disable(null);
return true;
}
if (isInvalidPercentage(sender, args[0])) {
if (CommandUtils.isInvalidDouble(sender, args[0])) {
return true;
}
@@ -74,7 +67,41 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true;
}
modify();
modify(sender, Double.parseDouble(args[0]));
return true;
case 2:
if (CommandUtils.isInvalidSkill(sender, args[0])) {
return true;
}
SkillType skill = SkillType.getSkill(args[0]);
if (!CommandUtils.isChildSkill(sender, skill)) {
return true;
}
if (CommandUtils.shouldEnableToggle(args[1])) {
if (!Permissions.hardcoreToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enable(skill);
return true;
}
if (CommandUtils.shouldDisableToggle(args[1])) {
if (!Permissions.hardcoreToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enable(skill);
return true;
}
return true;
default:
@@ -96,19 +123,10 @@ public abstract class HardcoreModeCommand implements TabExecutor {
}
}
protected abstract boolean checkTogglePermissions();
protected abstract boolean checkModifyPermissions();
protected abstract boolean checkEnabled();
protected abstract void enable();
protected abstract void disable();
protected abstract void modify();
private boolean isInvalidPercentage(CommandSender sender, String value) {
if (CommandUtils.isInvalidDouble(sender, value)) {
return true;
}
newPercent = Double.parseDouble(value);
return false;
}
protected abstract boolean checkTogglePermissions(CommandSender sender);
protected abstract boolean checkModifyPermissions(CommandSender sender);
protected abstract boolean checkEnabled(SkillType skill);
protected abstract void enable(SkillType skill);
protected abstract void disable(SkillType skill);
protected abstract void modify(CommandSender sender, double newPercentage);
}

View File

@@ -1,41 +1,65 @@
package com.gmail.nossr50.commands.hardcore;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
public class VampirismCommand extends HardcoreModeCommand {
@Override
protected boolean checkTogglePermissions() {
protected boolean checkTogglePermissions(CommandSender sender) {
return Permissions.vampirismToggle(sender);
}
@Override
protected boolean checkModifyPermissions() {
protected boolean checkModifyPermissions(CommandSender sender) {
return Permissions.vampirismModify(sender);
}
@Override
protected boolean checkEnabled() {
return Config.getInstance().getHardcoreVampirismEnabled();
protected boolean checkEnabled(SkillType skill) {
if (skill == null) {
for (SkillType skillType : SkillType.values()) {
if (!skillType.getHardcoreVampirismEnabled()) {
return false;
}
}
return true;
}
return skill.getHardcoreVampirismEnabled();
}
@Override
protected void enable() {
Config.getInstance().setHardcoreVampirismEnabled(true);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Vampirism.Enabled"));
protected void enable(SkillType skill) {
toggle(true, skill);
}
@Override
protected void disable() {
Config.getInstance().setHardcoreVampirismEnabled(false);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Vampirism.Disabled"));
protected void disable(SkillType skill) {
toggle(false, skill);
}
@Override
protected void modify() {
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercent);
sender.sendMessage(LocaleLoader.getString("Vampirism.PercentageChanged", percent.format(newPercent / 100D)));
protected void modify(CommandSender sender, double newPercentage) {
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
}
private void toggle(boolean enable, SkillType skill) {
if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
skillType.setHardcoreVampirismEnabled(enable);
}
}
else {
skill.setHardcoreVampirismEnabled(enable);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (skill == null ? "all skills" : skill)));
}
}

View File

@@ -15,8 +15,8 @@ public class PartyAcceptCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
@@ -24,11 +24,11 @@ public class PartyAcceptCommand implements CommandExecutor {
}
// Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, mcMMOPlayer.getParty(), mcMMOPlayer.getPartyInvite().getName())) {
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true;
}
PartyManager.joinInvitedParty(player, mcMMOPlayer);
PartyManager.joinInvitedParty(mcMMOPlayer);
return true;
default:

View File

@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.party;
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.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public class PartyChangeOwnerCommand implements CommandExecutor {
@@ -14,14 +16,15 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
Party playerParty = UserManager.getPlayer(sender.getName()).getParty();
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
if (!playerParty.getMembers().contains(args[1])) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", args[1]));
if (!playerParty.getMembers().contains(targetName)) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true;
}
PartyManager.setPartyLeader(args[1], playerParty);
PartyManager.setPartyLeader(targetName, playerParty);
return true;
default:

View File

@@ -3,30 +3,29 @@ package com.gmail.nossr50.commands.party;
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.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;
public class PartyChangePasswordCommand implements CommandExecutor {
private Party playerParty;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
playerParty = UserManager.getPlayer(sender.getName()).getParty();
Party party = UserManager.getPlayer((Player) sender).getParty();
switch (args.length) {
case 1:
unprotectParty(sender);
unprotectParty(party, sender);
return true;
case 2:
if (args[1].equalsIgnoreCase("clear") || args[1].equalsIgnoreCase("reset")) {
unprotectParty(sender);
unprotectParty(party, sender);
return true;
}
protectParty(sender, args[1]);
protectParty(party, sender, args[1]);
return true;
default:
@@ -36,15 +35,15 @@ public class PartyChangePasswordCommand implements CommandExecutor {
}
}
private void unprotectParty(CommandSender sender) {
playerParty.setLocked(true);
playerParty.setPassword(null);
private void unprotectParty(Party party, CommandSender sender) {
party.setLocked(true);
party.setPassword(null);
sender.sendMessage(LocaleLoader.getString("Party.Password.Removed"));
}
private void protectParty(CommandSender sender, String password) {
playerParty.setLocked(true);
playerParty.setPassword(password);
private void protectParty(Party party, CommandSender sender, String password) {
party.setLocked(true);
party.setPassword(password);
sender.sendMessage(LocaleLoader.getString("Party.Password.Set", password));
}
}

View File

@@ -1,9 +1,6 @@
package com.gmail.nossr50.commands.party;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -14,20 +11,19 @@ import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public class PartyCommand implements TabExecutor {
private McMMOPlayer mcMMOPlayer;
private Player player;
private static final List<String> PARTY_SUBCOMMANDS;
private static final List<String> EXPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
private static final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
static {
@@ -45,7 +41,7 @@ public class PartyCommand implements TabExecutor {
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
private CommandExecutor partyExpShareCommand = new PartyExpShareCommand();
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
private CommandExecutor partyKickCommand = new PartyKickCommand();
@@ -58,6 +54,7 @@ public class PartyCommand implements TabExecutor {
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
private CommandExecutor partyTeleportCommand = mcMMO.p.getCommand("ptp").getExecutor();
private CommandExecutor partyChatCommand = new PartyChatCommand();
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@@ -70,13 +67,13 @@ public class PartyCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (args.length < 1) {
if (!mcMMOPlayer.inParty()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return printUsage();
return printUsage(player);
}
return partyInfoCommand.onCommand(sender, command, label, args);
@@ -85,7 +82,7 @@ public class PartyCommand implements TabExecutor {
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
if (subcommand == null) {
return printUsage();
return printUsage(player);
}
// Can't use this for lock/unlock since they're handled by the same command
@@ -110,7 +107,7 @@ public class PartyCommand implements TabExecutor {
// Party member commands
if (!mcMMOPlayer.inParty()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return printUsage();
return printUsage(player);
}
switch (subcommand) {
@@ -135,8 +132,8 @@ public class PartyCommand implements TabExecutor {
}
switch (subcommand) {
case EXPSHARE:
return partyExpShareCommand.onCommand(sender, command, label, args);
case XPSHARE:
return partyXpShareCommand.onCommand(sender, command, label, args);
case ITEMSHARE:
return partyItemShareCommand.onCommand(sender, command, label, args);
case KICK:
@@ -152,6 +149,8 @@ public class PartyCommand implements TabExecutor {
return partyChangePasswordCommand.onCommand(sender, command, label, args);
case RENAME:
return partyRenameCommand.onCommand(sender, command, label, args);
case ALLIANCE:
return partyAllianceCommand.onCommand(sender, command, label, args);
default:
break;
}
@@ -176,10 +175,10 @@ public class PartyCommand implements TabExecutor {
case INVITE:
case KICK:
case OWNER:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
case EXPSHARE:
return StringUtil.copyPartialMatches(args[1], EXPSHARE_COMPLETIONS, new ArrayList<String>(EXPSHARE_COMPLETIONS.size()));
case XPSHARE:
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size()));
case ITEMSHARE:
return StringUtil.copyPartialMatches(args[1], ITEMSHARE_COMPLETIONS, new ArrayList<String>(ITEMSHARE_COMPLETIONS.size()));
case LOCK:
@@ -191,7 +190,7 @@ public class PartyCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
playerNames = UserManager.getPlayers().keySet();
playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
}
@@ -210,7 +209,7 @@ public class PartyCommand implements TabExecutor {
}
}
private boolean printUsage() {
private boolean printUsage(Player player) {
player.sendMessage(LocaleLoader.getString("Party.Help.0", "/party join"));
player.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create"));
player.sendMessage(LocaleLoader.getString("Party.Help.2", "/party ?"));
@@ -218,13 +217,7 @@ public class PartyCommand implements TabExecutor {
}
private String[] extractArgs(String[] args) {
String[] newArgs = new String[args.length - 1];
for (int i = 1; i < args.length; i++) {
newArgs[i - 1] = args[i];
}
return newArgs;
return Arrays.copyOfRange(args, 1, args.length - 1);
}
private boolean isItemShareCategory(String category) {

View File

@@ -5,7 +5,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
@@ -17,22 +16,20 @@ public class PartyCreateCommand implements CommandExecutor {
switch (args.length) {
case 2:
case 3:
Party newParty = PartyManager.getParty(args[1]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
// Check to see if the party exists, and if it does cancel creating a new party
if (PartyManager.checkPartyExistence(player, newParty, args[1])) {
if (PartyManager.checkPartyExistence(player, args[1])) {
return true;
}
// Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, mcMMOPlayer.getParty(), args[1])) {
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, args[1])) {
return true;
}
PartyManager.createParty(player, mcMMOPlayer, args[1], getPassword(args));
PartyManager.createParty(mcMMOPlayer, args[1], getPassword(args));
return true;
default:

View File

@@ -16,7 +16,7 @@ public class PartyDisbandCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
Party playerParty = UserManager.getPlayer(sender.getName()).getParty();
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String partyName = playerParty.getName();
for (Player member : playerParty.getOnlineMembers()) {

View File

@@ -1,70 +1,92 @@
package com.gmail.nossr50.commands.party;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.util.player.UserManager;
public class PartyInfoCommand implements CommandExecutor {
private Player player;
private Party playerParty;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
case 1:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
playerParty = mcMMOPlayer.getParty();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty();
displayPartyHeader();
displayShareModeInfo();
displayMemberInfo();
displayPartyHeader(player, party);
displayShareModeInfo(player, party);
displayPartyFeatures(player, party);
displayMemberInfo(player, mcMMOPlayer, party);
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "info"));
return true;
}
}
private String createMembersList() {
StringBuilder memberList = new StringBuilder();
private void displayPartyHeader(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Header"));
for (String memberName : playerParty.getMembers()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberName);
StringBuilder status = new StringBuilder();
status.append(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel()));
if (playerParty.getLeader().equalsIgnoreCase(memberName)) {
memberList.append(ChatColor.GOLD);
}
else if (member.isOnline()) {
memberList.append(ChatColor.WHITE);
}
else {
memberList.append(ChatColor.GRAY);
}
memberList.append(memberName).append(" ");
if (!party.hasReachedLevelCap()) {
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
}
return memberList.toString();
player.sendMessage(status.toString());
}
private void displayShareModeInfo() {
boolean xpShareEnabled = Config.getInstance().getExpShareEnabled();
boolean itemShareEnabled = Config.getInstance().getItemShareEnabled();
boolean itemSharingActive = (playerParty.getItemShareMode() != ShareHandler.ShareMode.NONE);
private void displayPartyFeatures(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Features.Header"));
List<String> unlockedPartyFeatures = new ArrayList<String>();
List<String> lockedPartyFeatures = new ArrayList<String>();
for (PartyFeature partyFeature : PartyFeature.values()) {
if (!partyFeature.hasPermission(player)) {
continue;
}
if (isUnlockedFeature(party, partyFeature)) {
unlockedPartyFeatures.add(partyFeature.getLocaleString());
}
else {
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
}
}
player.sendMessage(LocaleLoader.getString("Commands.Party.UnlockedFeatures", unlockedPartyFeatures.isEmpty() ? "None" : unlockedPartyFeatures));
for (String message : lockedPartyFeatures) {
player.sendMessage(message);
}
}
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
return party.getLevel() >= Config.getInstance().getPartyFeatureUnlockLevel(partyFeature);
}
private void displayShareModeInfo(Player player, Party party) {
boolean xpShareEnabled = isUnlockedFeature(party, PartyFeature.XP_SHARE);
boolean itemShareEnabled = isUnlockedFeature(party, PartyFeature.ITEM_SHARE);
boolean itemSharingActive = (party.getItemShareMode() != ShareMode.NONE);
if (!xpShareEnabled && !itemShareEnabled) {
return;
@@ -75,11 +97,11 @@ public class PartyInfoCommand implements CommandExecutor {
String separator = "";
if (xpShareEnabled) {
expShareInfo = LocaleLoader.getString("Commands.Party.ExpShare", playerParty.getXpShareMode().toString());
expShareInfo = LocaleLoader.getString("Commands.Party.ExpShare", party.getXpShareMode().toString());
}
if (itemShareEnabled) {
itemShareInfo = LocaleLoader.getString("Commands.Party.ItemShare", playerParty.getItemShareMode().toString());
itemShareInfo = LocaleLoader.getString("Commands.Party.ItemShare", party.getItemShareMode().toString());
}
if (xpShareEnabled && itemShareEnabled) {
@@ -87,28 +109,18 @@ public class PartyInfoCommand implements CommandExecutor {
}
player.sendMessage(LocaleLoader.getString("Commands.Party.ShareMode") + expShareInfo + separator + itemShareInfo);
if (itemSharingActive) {
player.sendMessage(LocaleLoader.getString("Commands.Party.ItemShareCategories", playerParty.getItemShareCategories()));
player.sendMessage(LocaleLoader.getString("Commands.Party.ItemShareCategories", party.getItemShareCategories()));
}
}
private void displayPartyHeader() {
player.sendMessage(LocaleLoader.getString("Commands.Party.Header"));
if (playerParty.isLocked()) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Status", playerParty.getName(), LocaleLoader.getString("Party.Status.Locked")));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Party.Status", playerParty.getName(), LocaleLoader.getString("Party.Status.Unlocked")));
}
}
private void displayMemberInfo() {
int membersNear = PartyManager.getNearMembers(player, playerParty, Config.getInstance().getPartyShareRange()).size();
int membersOnline = playerParty.getOnlineMembers().size() - 1;
private void displayMemberInfo(Player player, McMMOPlayer mcMMOPlayer, Party party) {
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);
int membersOnline = party.getOnlineMembers().size() - 1;
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", membersNear, membersOnline));
player.sendMessage(createMembersList());
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size(), membersOnline));
player.sendMessage(party.createMembersList(player.getName(), nearMembers));
}
}

View File

@@ -17,15 +17,17 @@ public class PartyInviteCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
McMMOPlayer mcMMOTarget = UserManager.getPlayer(args[1]);
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true);
if (!CommandUtils.checkPlayerExistence(sender, args[1], mcMMOTarget)) {
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
Player target = mcMMOTarget.getPlayer();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName();
if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
@@ -33,21 +35,20 @@ public class PartyInviteCommand implements CommandExecutor {
}
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", target.getName()));
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if (!PartyManager.canInvite(player, playerParty)) {
if (!PartyManager.canInvite(mcMMOPlayer)) {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
mcMMOTarget.setPartyInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getName(), player.getName()));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true;

View File

@@ -8,25 +8,25 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.ShareHandler.ShareMode;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public class PartyItemShareCommand implements CommandExecutor {
private Party playerParty;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!Config.getInstance().getItemShareEnabled()) {
sender.sendMessage(LocaleLoader.getString("Party.ItemShare.Disabled"));
Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4"));
return true;
}
switch (args.length) {
case 2:
playerParty = UserManager.getPlayer(sender.getName()).getParty();
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase());
if (mode == null) {
@@ -34,12 +34,11 @@ public class PartyItemShareCommand implements CommandExecutor {
return true;
}
handleChangingShareMode(mode);
handleChangingShareMode(party, mode);
return true;
case 3:
playerParty = UserManager.getPlayer(sender.getName()).getParty();
boolean toggle = false;
boolean toggle;
if (CommandUtils.shouldEnableToggle(args[2])) {
toggle = true;
@@ -53,7 +52,7 @@ public class PartyItemShareCommand implements CommandExecutor {
}
try {
handleToggleItemShareCategory(ItemShareType.valueOf(args[1].toUpperCase()), toggle);
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle);
}
catch (IllegalArgumentException ex) {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
@@ -68,22 +67,22 @@ public class PartyItemShareCommand implements CommandExecutor {
}
}
private void handleChangingShareMode(ShareMode mode) {
playerParty.setItemShareMode(mode);
private void handleChangingShareMode(Party party, ShareMode mode) {
party.setItemShareMode(mode);
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Item"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
for (Player member : playerParty.getOnlineMembers()) {
for (Player member : party.getOnlineMembers()) {
member.sendMessage(changeModeMessage);
}
}
private void handleToggleItemShareCategory(ItemShareType type, boolean toggle) {
playerParty.setSharingDrops(type, toggle);
private void handleToggleItemShareCategory(Party party, ItemShareType type, boolean toggle) {
party.setSharingDrops(type, toggle);
String toggleMessage = LocaleLoader.getString("Commands.Party.ToggleShareCategory", StringUtils.getCapitalized(type.toString()), toggle ? "enabled" : "disabled");
for (Player member : playerParty.getOnlineMembers()) {
for (Player member : party.getOnlineMembers()) {
member.sendMessage(toggleMessage);
}
}

View File

@@ -13,26 +13,33 @@ import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public class PartyJoinCommand implements CommandExecutor {
private McMMOPlayer mcMMOTarget;
private Player target;
private Party targetParty;
private McMMOPlayer mcMMOPlayer;
private Player player;
private Party playerParty;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
case 3:
// Verify target exists and is in a different party than the player
if (!canJoinParty(sender, args[1])) {
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return true;
}
mcMMOPlayer = UserManager.getPlayer((Player) sender);
player = mcMMOPlayer.getPlayer();
Player target = mcMMOTarget.getPlayer();
if (!mcMMOTarget.inParty()) {
sender.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party targetParty = mcMMOTarget.getParty();
if (player.equals(target) || (mcMMOPlayer.inParty() && mcMMOPlayer.getParty().equals(targetParty))) {
sender.sendMessage(LocaleLoader.getString("Party.Join.Self"));
return true;
}
String password = getPassword(args);
@@ -41,12 +48,15 @@ public class PartyJoinCommand implements CommandExecutor {
return true;
}
String partyName = targetParty.getName();
// Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, playerParty, targetParty.getName())) {
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, partyName)) {
return true;
}
PartyManager.joinParty(player, mcMMOPlayer, targetParty, password);
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName));
PartyManager.addToParty(mcMMOPlayer, targetParty);
return true;
default:
@@ -62,32 +72,4 @@ public class PartyJoinCommand implements CommandExecutor {
return null;
}
private boolean canJoinParty(CommandSender sender, String targetName) {
mcMMOTarget = UserManager.getPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
target = mcMMOTarget.getPlayer();
if (!mcMMOTarget.inParty()) {
sender.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
return false;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
playerParty = mcMMOPlayer.getParty();
targetParty = mcMMOTarget.getParty();
if (player.equals(target) || (mcMMOPlayer.inParty() && playerParty.equals(targetParty))) {
sender.sendMessage(LocaleLoader.getString("Party.Join.Self"));
return false;
}
return true;
}
}

View File

@@ -18,11 +18,11 @@ public class PartyKickCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
Party playerParty = UserManager.getPlayer(sender.getName()).getParty();
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(args[1]);
if (!playerParty.getMembers().contains(target.getName())) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", args[1]));
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", target.getName()));
return true;
}
@@ -34,6 +34,7 @@ public class PartyKickCommand implements CommandExecutor {
return true;
}
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget));
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
}

View File

@@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
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.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
@@ -11,19 +12,15 @@ import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public class PartyLockCommand implements CommandExecutor {
private Party playerParty;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
playerParty = UserManager.getPlayer(sender.getName()).getParty();
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("lock")) {
lockParty(sender, command.getPermissionMessage());
togglePartyLock(sender, true);
}
else if (args[0].equalsIgnoreCase("unlock")) {
unlockParty(sender, command.getPermissionMessage());
togglePartyLock(sender, false);
}
return true;
@@ -35,10 +32,10 @@ public class PartyLockCommand implements CommandExecutor {
}
if (CommandUtils.shouldEnableToggle(args[1])) {
lockParty(sender, command.getPermissionMessage());
togglePartyLock(sender, true);
}
else if (CommandUtils.shouldDisableToggle(args[1])) {
unlockParty(sender, command.getPermissionMessage());
togglePartyLock(sender, false);
}
else {
sendUsageStrings(sender);
@@ -52,46 +49,25 @@ public class PartyLockCommand implements CommandExecutor {
}
}
/**
* Handle locking a party.
*/
private void lockParty(CommandSender sender, String permissionMessage) {
if (!Permissions.partySubcommand(sender, PartySubcommandType.LOCK)) {
sender.sendMessage(permissionMessage);
return;
}
if (playerParty.isLocked()) {
sender.sendMessage(LocaleLoader.getString("Party.IsLocked"));
return;
}
playerParty.setLocked(true);
sender.sendMessage(LocaleLoader.getString("Party.Locked"));
}
/**
* Handle unlocking a party.
*
* @return true if party is successfully unlocked, false otherwise.
*/
private void unlockParty(CommandSender sender, String permissionMessage) {
if (!Permissions.partySubcommand(sender, PartySubcommandType.UNLOCK)) {
sender.sendMessage(permissionMessage);
return;
}
if (!playerParty.isLocked()) {
sender.sendMessage(LocaleLoader.getString("Party.IsntLocked"));
return;
}
playerParty.setLocked(false);
sender.sendMessage(LocaleLoader.getString("Party.Unlocked"));
}
private void sendUsageStrings(CommandSender sender) {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "lock", "[on|off]"));
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "unlock"));
}
private void togglePartyLock(CommandSender sender, boolean lock) {
Party party = UserManager.getPlayer((Player) sender).getParty();
if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return;
}
if (lock ? party.isLocked() : !party.isLocked()) {
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "IsLocked" : "IsntLocked")));
return;
}
party.setLocked(lock);
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "Locked" : "Unlocked")));
}
}

View File

@@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
@@ -17,13 +18,14 @@ public class PartyQuitCommand implements CommandExecutor {
switch (args.length) {
case 1:
Player player = (Player) sender;
Party playerParty = UserManager.getPlayer(player).getParty();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party playerParty = mcMMOPlayer.getParty();
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
return true;
}
PartyManager.removeFromParty(player, playerParty);
PartyManager.removeFromParty(mcMMOPlayer);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
return true;

View File

@@ -17,7 +17,7 @@ public class PartyRenameCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
Party playerParty = mcMMOPlayer.getParty();
String oldPartyName = playerParty.getName();
@@ -30,10 +30,9 @@ public class PartyRenameCommand implements CommandExecutor {
}
Player player = mcMMOPlayer.getPlayer();
Party newParty = PartyManager.getParty(newPartyName);
// Check to see if the party exists, and if it does cancel renaming the party
if (PartyManager.checkPartyExistence(player, newParty, newPartyName)) {
if (PartyManager.checkPartyExistence(player, newPartyName)) {
return true;
}

View File

@@ -7,7 +7,7 @@ public enum PartySubcommandType {
HELP,
INFO,
QUIT,
EXPSHARE,
XPSHARE,
ITEMSHARE,
INVITE,
KICK,
@@ -18,7 +18,8 @@ public enum PartySubcommandType {
PASSWORD,
RENAME,
TELEPORT,
CHAT;
CHAT,
ALLIANCE;
public static PartySubcommandType getSubcommand(String commandName) {
for (PartySubcommandType command : values()) {
@@ -37,11 +38,14 @@ public enum PartySubcommandType {
return OWNER;
}
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
return EXPSHARE;
return XPSHARE;
}
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
return ITEMSHARE;
}
else if (commandName.equalsIgnoreCase("ally")) {
return ALLIANCE;
}
return null;
}

View File

@@ -7,51 +7,49 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.party.ShareHandler.ShareMode;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public class PartyExpShareCommand implements CommandExecutor {
private Party playerParty;
public class PartyXpShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!Config.getInstance().getExpShareEnabled()) {
sender.sendMessage(LocaleLoader.getString("Party.ExpShare.Disabled"));
Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
return true;
}
switch (args.length) {
case 2:
playerParty = UserManager.getPlayer(sender.getName()).getParty();
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
handleChangingShareMode(ShareMode.NONE);
handleChangingShareMode(party, ShareMode.NONE);
}
else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
handleChangingShareMode(ShareMode.EQUAL);
handleChangingShareMode(party, ShareMode.EQUAL);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "<NONE | EQUAL>"));
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
}
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "<NONE | EQUAL>"));
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
return true;
}
}
private void handleChangingShareMode(ShareHandler.ShareMode mode) {
playerParty.setXpShareMode(mode);
private void handleChangingShareMode(Party party, ShareMode mode) {
party.setXpShareMode(mode);
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Exp"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Xp"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
for (Player member : playerParty.getOnlineMembers()) {
for (Player member : party.getOnlineMembers()) {
member.sendMessage(changeModeMessage);
}
}

View File

@@ -0,0 +1,34 @@
package com.gmail.nossr50.commands.party.alliance;
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.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
public class PartyAllianceAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyAllianceInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true;
}
PartyManager.acceptAllianceInvite(mcMMOPlayer);
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept"));
return true;
}
}
}

View File

@@ -0,0 +1,136 @@
package com.gmail.nossr50.commands.party.alliance;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public class PartyAllianceCommand implements TabExecutor {
private Player player;
private Party playerParty;
private Party targetParty;
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
playerParty = mcMMOPlayer.getParty();
switch (args.length) {
case 1:
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
return true;
}
if (playerParty.getAlly() == null) {
printUsage();
return true;
}
targetParty = playerParty.getAlly();
displayPartyHeader();
displayMemberInfo(mcMMOPlayer);
return true;
case 2:
case 3:
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
return true;
}
if (args[1].equalsIgnoreCase("invite")) {
return partyAllianceInviteCommand.onCommand(sender, command, label, args);
}
if (args[1].equalsIgnoreCase("accept")) {
return partyAllianceAcceptCommand.onCommand(sender, command, label, args);
}
if (args[1].equalsIgnoreCase("disband")) {
return partyAllianceDisbandCommand.onCommand(sender, command, label, args);
}
if (playerParty.getAlly() == null) {
printUsage();
return true;
}
targetParty = playerParty.getAlly();
displayPartyHeader();
displayMemberInfo(mcMMOPlayer);
return true;
default:
return false;
}
}
private boolean printUsage() {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.0"));
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.1"));
return true;
}
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
if (matches.size() == 0) {
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
}
return matches;
default:
return ImmutableList.of();
}
}
private void displayPartyHeader() {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Header"));
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Ally", playerParty.getName(), targetParty.getName()));
}
private void displayMemberInfo(McMMOPlayer mcMMOPlayer) {
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header"));
player.sendMessage(playerParty.createMembersList(player.getName(), nearMembers));
player.sendMessage(ChatColor.DARK_GRAY + "----------------------------");
player.sendMessage(targetParty.createMembersList(player.getName(), nearMembers));
}
}

View File

@@ -0,0 +1,36 @@
package com.gmail.nossr50.commands.party.alliance;
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.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
public class PartyAllianceDisbandCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty();
if (party.getAlly() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.None"));
return true;
}
PartyManager.disbandAlliance(player, party, party.getAlly());
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband"));
return true;
}
}
}

View File

@@ -0,0 +1,71 @@
package com.gmail.nossr50.commands.party.alliance;
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.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public class PartyAllianceInviteCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 3:
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
Player target = mcMMOTarget.getPlayer();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName();
if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
return true;
}
if (!mcMMOTarget.inParty()) {
player.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
return true;
}
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
if (!mcMMOTarget.getParty().getLeader().equalsIgnoreCase(targetName)) {
player.sendMessage(LocaleLoader.getString("Party.Target.NotOwner", targetName));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if (playerParty.getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
return true;
}
mcMMOTarget.setPartyAllianceInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.1"));
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "alliance", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
return true;
}
}
}

View File

@@ -3,9 +3,8 @@ package com.gmail.nossr50.commands.party.teleport;
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.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
@@ -18,17 +17,16 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord();
if (mcMMOPlayer.getPtpConfirmRequired()) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
if (ptpRecord.isConfirmRequired()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
}
mcMMOPlayer.togglePtpConfirmRequired();
ptpRecord.toggleConfirmRequired();
return true;
}
}

View File

@@ -7,11 +7,11 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
public class PtpAcceptCommand implements CommandExecutor {
@Override
@@ -21,22 +21,22 @@ public class PtpAcceptCommand implements CommandExecutor {
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
Player player = (Player) sender;
PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord();
if (!mcMMOPlayer.hasPtpRequest()) {
if (!ptpRecord.hasRequest()) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
return true;
}
if ((mcMMOPlayer.getPtpTimeout() + Config.getInstance().getPTPCommandTimeout()) * Misc.TIME_CONVERSION_FACTOR < System.currentTimeMillis()) {
mcMMOPlayer.removePtpRequest();
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
ptpRecord.removeRequest();
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
return true;
}
Player target = mcMMOPlayer.getPtpRequest();
mcMMOPlayer.removePtpRequest();
Player target = ptpRecord.getRequestor();
ptpRecord.removeRequest();
if (!PtpCommand.canTeleport(sender, player, target.getName())) {
return true;

View File

@@ -11,24 +11,25 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.items.TeleportationWarmup;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.google.common.collect.ImmutableList;
public class PtpCommand implements TabExecutor {
private static Player target;
private static McMMOPlayer mcMMOTarget;
public static final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
private CommandExecutor ptpToggleCommand = new PtpToggleCommand();
@@ -41,6 +42,15 @@ public class PtpCommand implements TabExecutor {
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty();
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
return true;
}
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("toggle")) {
@@ -51,9 +61,6 @@ public class PtpCommand implements TabExecutor {
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
@@ -76,10 +83,10 @@ public class PtpCommand implements TabExecutor {
}
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
long lastTeleport = mcMMOPlayer.getLastTeleport();
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
if (ptpCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Generic.Wait", timeRemaining));
@@ -87,7 +94,7 @@ public class PtpCommand implements TabExecutor {
}
}
sendTeleportRequest(sender, player, args[0]);
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
return true;
default:
@@ -102,7 +109,7 @@ public class PtpCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
}
@@ -117,13 +124,18 @@ public class PtpCommand implements TabExecutor {
return;
}
if (!mcMMOTarget.getPtpConfirmRequired()) {
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
Player target = mcMMOTarget.getPlayer();
PartyTeleportRecord ptpRecord = mcMMOTarget.getPartyTeleportRecord();
if (!ptpRecord.isConfirmRequired()) {
handleTeleportWarmup(player, target);
return;
}
mcMMOTarget.setPtpRequest(player);
mcMMOTarget.actualizePtpTimeout();
ptpRecord.setRequestor(player);
ptpRecord.actualizeTimeout();
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
@@ -132,14 +144,13 @@ public class PtpCommand implements TabExecutor {
}
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
mcMMOTarget = UserManager.getPlayer(targetName);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
target = mcMMOTarget.getPlayer();
targetName = target.getName();
Player target = mcMMOTarget.getPlayer();
if (player.equals(target)) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Self"));
@@ -151,7 +162,7 @@ public class PtpCommand implements TabExecutor {
return false;
}
if (!mcMMOTarget.getPtpEnabled()) {
if (!mcMMOTarget.getPartyTeleportRecord().isEnabled()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Disabled", targetName));
return false;
}
@@ -166,7 +177,7 @@ public class PtpCommand implements TabExecutor {
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
mcMMOTarget = UserManager.getPlayer(targetPlayer);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
long warmup = Config.getInstance().getPTPCommandWarmup();
@@ -177,25 +188,7 @@ public class PtpCommand implements TabExecutor {
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
}
else {
handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
}
}
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName());
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
teleportingPlayer.teleport(targetPlayer);
teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));
targetPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Target", teleportingPlayer.getName()));
mcMMOPlayer.actualizeRecentlyHurt();
}
}

View File

@@ -3,9 +3,8 @@ package com.gmail.nossr50.commands.party.teleport;
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.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
@@ -18,17 +17,16 @@ public class PtpToggleCommand implements CommandExecutor {
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord();
if (mcMMOPlayer.getPtpEnabled()) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
if (ptpRecord.isEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
}
mcMMOPlayer.togglePtpUse();
ptpRecord.toggleEnabled();
return true;
}
}

View File

@@ -10,6 +10,7 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
@@ -27,55 +28,62 @@ public class InspectCommand implements TabExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if (sender instanceof Player && Config.getInstance().getInspectScoreboardEnabled()) {
ScoreboardManager.setupPlayerScoreboard(sender.getName());
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
PlayerProfile profile = new PlayerProfile(args[0], false); // Temporary Profile
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile
if (CommandUtils.inspectOffline(sender, profile, Permissions.inspectOffline(sender))) {
return true;
}
if (sender instanceof Player && Config.getInstance().getInspectScoreboardEnabled()) {
ScoreboardManager.enablePlayerInspectScoreboardOffline((Player) sender, profile);
return true;
if (sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
if (!Config.getInstance().getInspectUseChat()) {
return true;
}
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", args[0]));
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
CommandUtils.displaySkill(sender, profile, SkillType.EXCAVATION);
CommandUtils.displaySkill(sender, profile, SkillType.FISHING);
CommandUtils.displaySkill(sender, profile, SkillType.HERBALISM);
CommandUtils.displaySkill(sender, profile, SkillType.MINING);
CommandUtils.displaySkill(sender, profile, SkillType.WOODCUTTING);
for (SkillType skill : SkillType.GATHERING_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
CommandUtils.displaySkill(sender, profile, SkillType.AXES);
CommandUtils.displaySkill(sender, profile, SkillType.ARCHERY);
CommandUtils.displaySkill(sender, profile, SkillType.SWORDS);
CommandUtils.displaySkill(sender, profile, SkillType.TAMING);
CommandUtils.displaySkill(sender, profile, SkillType.UNARMED);
for (SkillType skill : SkillType.COMBAT_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
CommandUtils.displaySkill(sender, profile, SkillType.ACROBATICS);
CommandUtils.displaySkill(sender, profile, SkillType.REPAIR);
for (SkillType skill : SkillType.MISC_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
}
else {
Player target = mcMMOPlayer.getPlayer();
if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
if (!Permissions.inspectOffline(sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
}
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
return true;
}
if (sender instanceof Player && Config.getInstance().getInspectScoreboardEnabled()) {
ScoreboardManager.enablePlayerInspectScoreboardOnline((Player) sender, mcMMOPlayer);
return true;
if (sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
if (!Config.getInstance().getInspectUseChat()) {
return true;
}
}
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
@@ -96,7 +104,7 @@ public class InspectCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();

View File

@@ -0,0 +1,70 @@
package com.gmail.nossr50.commands.player;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList;
public class MccooldownCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
switch (args.length) {
case 0:
Player player = (Player) sender;
if (Config.getInstance().getCooldownUseBoard()) {
ScoreboardManager.enablePlayerCooldownScoreboard(player);
if (!Config.getInstance().getCooldownUseChat()) {
return true;
}
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
for (AbilityType ability : AbilityType.values()) {
if (!ability.getPermissions(player)) {
continue;
}
int seconds = mcMMOPlayer.calculateTimeRemaining(ability);
if (seconds <= 0) {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName()));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
}
}
return true;
default:
return false;
}
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -13,12 +13,13 @@ import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList;
public class McrankCommand implements TabExecutor {
@@ -35,13 +36,7 @@ public class McrankCommand implements TabExecutor {
return true;
}
if (Config.getInstance().getMcrankScoreboardEnabled()) {
ScoreboardManager.setupPlayerScoreboard(sender.getName());
ScoreboardManager.enablePlayerRankScoreboard((Player) sender);
}
else {
display(sender, sender.getName());
}
display(sender, sender.getName());
return true;
@@ -51,27 +46,22 @@ public class McrankCommand implements TabExecutor {
return true;
}
String playerName = args[0];
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
if (mcMMOPlayer != null) {
playerName = mcMMOPlayer.getPlayer().getName();
Player player = mcMMOPlayer.getPlayer();
playerName = player.getName();
if (CommandUtils.tooFar(sender, mcMMOPlayer.getPlayer(), Permissions.mcrankFar(sender))) {
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
return true;
}
}
else if (CommandUtils.inspectOffline(sender, new PlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
return true;
}
if (sender instanceof Player && Config.getInstance().getMcrankScoreboardEnabled()) {
ScoreboardManager.setupPlayerScoreboard(sender.getName());
ScoreboardManager.enablePlayerRankScoreboardOthers((Player) sender, playerName);
}
else {
display(sender, playerName);
}
display(sender, playerName);
return true;
default:
@@ -83,7 +73,7 @@ public class McrankCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
Set<String> playerNames = UserManager.getPlayers().keySet();
Set<String> playerNames = UserManager.getPlayerNames();
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();
@@ -91,6 +81,20 @@ public class McrankCommand implements TabExecutor {
}
private void display(CommandSender sender, String playerName) {
new McrankCommandAsyncTask(playerName, sender).runTaskAsynchronously(mcMMO.p);
if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if (mcMMOPlayer.getDatabaseATS() + Misc.PLAYER_DATABASE_COOLDOWN_MILLIS > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
return;
}
mcMMOPlayer.actualizeDatabaseATS();
}
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getRankUseBoard());
boolean useChat = !useBoard || Config.getInstance().getRankUseChat();
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
}

View File

@@ -8,11 +8,11 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList;
public class McstatsCommand implements TabExecutor {
@@ -24,29 +24,30 @@ public class McstatsCommand implements TabExecutor {
switch (args.length) {
case 0:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
Player player = mcMMOPlayer.getPlayer();
Player player = (Player) sender;
if (Config.getInstance().getMcstatsScoreboardsEnabled()) {
ScoreboardManager.setupPlayerScoreboard(player.getName());
ScoreboardManager.enablePlayerStatsScoreboard(mcMMOPlayer);
if (Config.getInstance().getStatsUseBoard()) {
ScoreboardManager.enablePlayerStatsScoreboard(player);
if (!Config.getInstance().getStatsUseChat()) {
return true;
}
}
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
CommandUtils.printGatheringSkills(player);
CommandUtils.printCombatSkills(player);
CommandUtils.printMiscSkills(player);
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap != Integer.MAX_VALUE) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
}
else {
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
CommandUtils.printGatheringSkills(player);
CommandUtils.printCombatSkills(player);
CommandUtils.printMiscSkills(player);
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap != Integer.MAX_VALUE) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
}
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
}
return true;

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.player;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@@ -12,39 +11,41 @@ import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.FlatfileDatabaseManager;
import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
public class MctopCommand implements TabExecutor {
private SkillType skill;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
SkillType skill = null;
switch (args.length) {
case 0:
display(1, "ALL", sender, command);
display(1, skill, sender, command);
return true;
case 1:
if (StringUtils.isInt(args[0])) {
display(Math.abs(Integer.parseInt(args[0])), "ALL", sender, command);
display(Math.abs(Integer.parseInt(args[0])), skill, sender, command);
return true;
}
if (!extractSkill(sender, args[0])) {
skill = extractSkill(sender, args[0]);
if (skill == null) {
return true;
}
display(1, skill.toString(), sender, command);
display(1, skill, sender, command);
return true;
case 2:
@@ -52,11 +53,13 @@ public class MctopCommand implements TabExecutor {
return true;
}
if (!extractSkill(sender, args[0])) {
skill = extractSkill(sender, args[0]);
if (skill == null) {
return true;
}
display(Math.abs(Integer.parseInt(args[1])), skill.toString(), sender, command);
display(Math.abs(Integer.parseInt(args[1])), skill, sender, command);
return true;
default:
@@ -74,63 +77,44 @@ public class MctopCommand implements TabExecutor {
}
}
private void display(int page, String skill, CommandSender sender, Command command) {
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, this.skill)) {
private void display(int page, SkillType skill, CommandSender sender, Command command) {
if (skill != null && !Permissions.mctop(sender, skill)) {
sender.sendMessage(command.getPermissionMessage());
return;
}
if (sender instanceof Player && Config.getInstance().getMctopScoreboardEnabled()) {
ScoreboardManager.enableGlobalStatsScoreboard((Player) sender, skill, page);
}
else {
if (Config.getInstance().getUseMySQL()) {
sqlDisplay(page, skill, sender);
}
else {
flatfileDisplay(page, skill, sender);
if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if (mcMMOPlayer.getDatabaseATS() + Misc.PLAYER_DATABASE_COOLDOWN_MILLIS > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
return;
}
mcMMOPlayer.actualizeDatabaseATS();
}
display(page, skill, sender);
}
private void flatfileDisplay(int page, String skill, CommandSender sender) {
FlatfileDatabaseManager.updateLeaderboards(); // Make sure we have the latest information
private void display(int page, SkillType skill, CommandSender sender) {
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
if (skill.equalsIgnoreCase("all")) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", StringUtils.getCapitalized(skill)));
}
int position = (page * 10) - 9;
for (PlayerStat stat : FlatfileDatabaseManager.retrieveInfo(skill, page, 10)) {
String digit = (position < 10) ? "0" : "" + String.valueOf(position);
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + stat.name + " - " + ChatColor.WHITE + stat.statVal);
position++;
}
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
private void sqlDisplay(int page, String query, CommandSender sender) {
new MctopCommandAsyncTask(page, query, sender).runTaskAsynchronously(mcMMO.p);
}
private boolean extractSkill(CommandSender sender, String skillName) {
private SkillType extractSkill(CommandSender sender, String skillName) {
if (CommandUtils.isInvalidSkill(sender, skillName)) {
return false;
return null;
}
skill = SkillType.getSkill(skillName);
SkillType skill = SkillType.getSkill(skillName);
if (CommandUtils.isChildSkill(sender, skill)) {
return false;
return null;
}
return true;
return skill;
}
}

View File

@@ -1,8 +1,13 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.acrobatics.Acrobatics;
import com.gmail.nossr50.util.Permissions;
public class AcrobaticsCommand extends SkillCommand {
@@ -22,75 +27,71 @@ public class AcrobaticsCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// DODGE
if (canDodge) {
String[] dodgeStrings = calculateAbilityDisplayValues(Acrobatics.dodgeMaxBonusLevel, Acrobatics.dodgeMaxChance);
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DODGE, isLucky);
dodgeChance = dodgeStrings[0];
dodgeChanceLucky = dodgeStrings[1];
}
// ROLL
if (canRoll) {
String[] rollStrings = calculateAbilityDisplayValues(Acrobatics.rollMaxBonusLevel, Acrobatics.rollMaxChance);
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.ROLL, isLucky);
rollChance = rollStrings[0];
rollChanceLucky = rollStrings[1];
}
// GRACEFUL ROLL
if (canGracefulRoll) {
String[] gracefulRollStrings = calculateAbilityDisplayValues(Acrobatics.gracefulRollMaxBonusLevel, Acrobatics.gracefulRollMaxChance);
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GRACEFUL_ROLL, isLucky);
gracefulRollChance = gracefulRollStrings[0];
gracefulRollChanceLucky = gracefulRollStrings[1];
}
}
@Override
protected void permissionsCheck() {
canDodge = Permissions.dodge(player);
canRoll = Permissions.roll(player);
canGracefulRoll = Permissions.gracefulRoll(player);
protected void permissionsCheck(Player player) {
canDodge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DODGE);
canRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ROLL);
canGracefulRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL);
}
@Override
protected boolean effectsHeaderPermissions() {
return canDodge || canGracefulRoll || canRoll;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1")));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3")));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canDodge || canGracefulRoll || canRoll;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", rollChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", rollChanceLucky) : ""));
messages.add(LocaleLoader.getString("Acrobatics.Roll.Chance", rollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollChanceLucky) : ""));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", gracefulRollChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", gracefulRollChanceLucky) : ""));
messages.add(LocaleLoader.getString("Acrobatics.Roll.GraceChance", gracefulRollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", gracefulRollChanceLucky) : ""));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", dodgeChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", dodgeChanceLucky) : ""));
messages.add(LocaleLoader.getString("Acrobatics.DodgeChance", dodgeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : ""));
}
return messages;
}
}

View File

@@ -0,0 +1,103 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.alchemy.Alchemy.Tier;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
public class AlchemyCommand extends SkillCommand {
private String brewSpeed;
private String brewSpeedLucky;
private int tier;
private int ingredientCount;
private String ingredientList;
private boolean canCatalysis;
private boolean canConcoctions;
public AlchemyCommand() {
super(SkillType.ALCHEMY);
}
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
String[] displayValues = new String[2];
displayValues[0] = decimal.format(alchemyManager.getBrewSpeed()) + "x";
displayValues[1] = isLucky ? decimal.format(alchemyManager.getBrewSpeedLucky()) + "x" : null;
return displayValues;
}
@Override
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// CATALYSIS
if (canCatalysis) {
String[] catalysisStrings = calculateAbilityDisplayValues(player, isLucky);
brewSpeed = catalysisStrings[0];
brewSpeedLucky = catalysisStrings[1];
}
// CONCOCTIONS
if (canConcoctions) {
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
tier = alchemyManager.getTier();
ingredientCount = alchemyManager.getIngredients().size();
ingredientList = alchemyManager.getIngredientList();
}
}
@Override
protected void permissionsCheck(Player player) {
canCatalysis = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS);
canConcoctions = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CONCOCTIONS);
}
@Override
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canCatalysis) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Alchemy.Effect.0"), LocaleLoader.getString("Alchemy.Effect.1")));
}
if (canConcoctions) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Alchemy.Effect.2"), LocaleLoader.getString("Alchemy.Effect.3")));
}
return messages;
}
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
if (canCatalysis) {
int unlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel();
if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Alchemy.Ability.Locked.0", unlockLevel)));
}
else {
messages.add(LocaleLoader.getString("Alchemy.Catalysis.Speed", brewSpeed) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : ""));
}
}
if (canConcoctions) {
messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, Tier.values().length));
messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList));
}
return messages;
}
}

View File

@@ -1,5 +1,11 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.archery.Archery;
@@ -21,7 +27,7 @@ public class ArcheryCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// SKILL SHOT
if (canSkillShot) {
double bonus = (skillValue / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage;
@@ -30,65 +36,61 @@ public class ArcheryCommand extends SkillCommand {
// DAZE
if (canDaze) {
String[] dazeStrings = calculateAbilityDisplayValues(Archery.dazeMaxBonusLevel, Archery.dazeMaxBonus);
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DAZE, isLucky);
dazeChance = dazeStrings[0];
dazeChanceLucky = dazeStrings[1];
}
// RETRIEVE
if (canRetrieve) {
String[] retrieveStrings = calculateAbilityDisplayValues(Archery.retrieveMaxBonusLevel, Archery.retrieveMaxChance);
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.RETRIEVE, isLucky);
retrieveChance = retrieveStrings[0];
retrieveChanceLucky = retrieveStrings[1];
}
}
@Override
protected void permissionsCheck() {
canSkillShot = Permissions.bonusDamage(player, skill);
canDaze = Permissions.daze(player);
canRetrieve = Permissions.arrowRetrieval(player);
protected void permissionsCheck(Player player) {
canSkillShot = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SKILL_SHOT);
canDaze = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DAZE);
canRetrieve = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.RETRIEVE);
}
@Override
protected boolean effectsHeaderPermissions() {
return canSkillShot || canDaze || canRetrieve;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1")));
}
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3", Archery.dazeModifier)));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3", Archery.dazeModifier)));
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canSkillShot || canDaze || canRetrieve;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", skillShotBonus));
messages.add(LocaleLoader.getString("Archery.Combat.SkillshotBonus", skillShotBonus));
}
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", dazeChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", dazeChanceLucky) : ""));
messages.add(LocaleLoader.getString("Archery.Combat.DazeChance", dazeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : ""));
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", retrieveChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", retrieveChanceLucky) : ""));
messages.add(LocaleLoader.getString("Archery.Combat.RetrieveChance", retrieveChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", retrieveChanceLucky) : ""));
}
return messages;
}
}

View File

@@ -1,5 +1,11 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.axes.Axes;
@@ -8,14 +14,14 @@ import com.gmail.nossr50.util.Permissions;
public class AxesCommand extends SkillCommand {
private String critChance;
private String critChanceLucky;
private float bonusDamage;
private float impactDamage;
private double axeMasteryDamage;
private double impactDamage;
private String skullSplitterLength;
private String skullSplitterLengthEndurance;
private boolean canSkullSplitter;
private boolean canCritical;
private boolean canBonusDamage;
private boolean canAxeMastery;
private boolean canImpact;
private boolean canGreaterImpact;
@@ -24,96 +30,92 @@ public class AxesCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
// IMPACT
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// ARMOR IMPACT
if (canImpact) {
impactDamage = 1 + (skillValue / Axes.impactIncreaseLevel);
}
// SKULL SPLITTER
if (canSkullSplitter) {
String[] skullSplitterStrings = calculateLengthDisplayValues();
String[] skullSplitterStrings = calculateLengthDisplayValues(player, skillValue);
skullSplitterLength = skullSplitterStrings[0];
skullSplitterLengthEndurance = skullSplitterStrings[1];
}
// CRITICAL STRIKES
// CRITICAL HIT
if (canCritical) {
String[] criticalStrikeStrings = calculateAbilityDisplayValues(Axes.criticalHitMaxBonusLevel, Axes.criticalHitMaxChance);
critChance = criticalStrikeStrings[0];
critChanceLucky = criticalStrikeStrings[1];
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.CRITICAL_HIT, isLucky);
critChance = criticalHitStrings[0];
critChanceLucky = criticalHitStrings[1];
}
// AXE MASTERY
if (canBonusDamage) {
bonusDamage = Math.min(skillValue / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
if (canAxeMastery) {
axeMasteryDamage = Math.min(skillValue / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
}
}
@Override
protected void permissionsCheck() {
protected void permissionsCheck(Player player) {
canSkullSplitter = Permissions.skullSplitter(player);
canCritical = Permissions.criticalStrikes(player);
canBonusDamage = Permissions.bonusDamage(player, skill);
canImpact = Permissions.armorImpact(player);
canGreaterImpact = Permissions.greaterImpact(player);
canCritical = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CRITICAL_HIT);
canAxeMastery = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.AXE_MASTERY);
canImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARMOR_IMPACT);
canGreaterImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GREATER_IMPACT);
}
@Override
protected boolean effectsHeaderPermissions() {
return canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canSkullSplitter) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1")));
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3")));
}
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5")));
if (canAxeMastery) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5")));
}
if (canImpact) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7")));
}
if (canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", bonusDamage)));
if (canAxeMastery) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", axeMasteryDamage)));
}
if (canImpact) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));
}
if (canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", Axes.greaterImpactBonusDamage)));
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", Axes.greaterImpactBonusDamage)));
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", critChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", critChanceLucky) : ""));
messages.add(LocaleLoader.getString("Axes.Combat.CritChance", critChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", critChanceLucky) : ""));
}
if (canSkullSplitter) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.SS.Length", skullSplitterLength) + (hasEndurance ? LocaleLoader.getString("Perks.activationtime.bonus", skullSplitterLengthEndurance) : ""));
messages.add(LocaleLoader.getString("Axes.Combat.SS.Length", skullSplitterLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
}
return messages;
}
}

View File

@@ -1,5 +1,11 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
@@ -16,48 +22,44 @@ public class ExcavationCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// GIGA DRILL BREAKER
if (canGigaDrill) {
String gigaDrillStrings[] = calculateLengthDisplayValues();
String gigaDrillStrings[] = calculateLengthDisplayValues(player, skillValue);
gigaDrillBreakerLength = gigaDrillStrings[0];
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
}
}
@Override
protected void permissionsCheck() {
protected void permissionsCheck(Player player) {
canGigaDrill = Permissions.gigaDrillBreaker(player);
canTreasureHunt = Permissions.excavationTreasureHunter(player);
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER);
}
@Override
protected boolean effectsHeaderPermissions() {
return canGigaDrill || canTreasureHunt;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canGigaDrill) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Excavation.Effect.0"), LocaleLoader.getString("Excavation.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Excavation.Effect.0"), LocaleLoader.getString("Excavation.Effect.1")));
}
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Excavation.Effect.2"), LocaleLoader.getString("Excavation.Effect.3")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Excavation.Effect.2"), LocaleLoader.getString("Excavation.Effect.3")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canGigaDrill;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canGigaDrill) {
player.sendMessage(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.activationtime.bonus", gigaDrillBreakerLengthEndurance) : ""));
messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
}
return messages;
}
}

View File

@@ -1,25 +1,42 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.block.Biome;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.fishing.Fishing;
import com.gmail.nossr50.skills.fishing.Fishing.Tier;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
public class FishingCommand extends SkillCommand {
private int lootTier;
private String magicChance;
private String magicChanceLucky;
private String chanceRaining = "";
private String shakeChance;
private String shakeChanceLucky;
private int fishermansDietRank;
private String biteChance;
private String trapTreasure;
private String commonTreasure;
private String uncommonTreasure;
private String rareTreasure;
private String epicTreasure;
private String legendaryTreasure;
private String recordTreasure;
private String magicChance;
private boolean canTreasureHunt;
private boolean canMagicHunt;
private boolean canShake;
@@ -32,140 +49,161 @@ public class FishingCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
boolean isStorming = player.getWorld().hasStorm();
// TREASURE HUNTER
if (canTreasureHunt) {
lootTier = mcMMOPlayer.getFishingManager().getLootTier();
double enchantChance = lootTier * AdvancedConfig.getInstance().getFishingMagicMultiplier();
lootTier = fishingManager.getLootTier();
if (isStorming) {
chanceRaining = LocaleLoader.getString("Fishing.Chance.Raining");
enchantChance *= 1.1D;
// Item drop rates
trapTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.TRAP) / 100.0);
commonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0);
uncommonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0);
rareTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0);
epicTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.EPIC) / 100.0);
legendaryTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.LEGENDARY) / 100.0);
recordTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RECORD) / 100.0);
// Magic hunter drop rates
double totalEnchantChance = 0;
for (Rarity rarity : Rarity.values()) {
if (rarity != Rarity.TRAP || rarity != Rarity.RECORD) {
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
}
}
String[] treasureHunterStrings = calculateAbilityDisplayValues(enchantChance);
magicChance = treasureHunterStrings[0];
magicChanceLucky = treasureHunterStrings[1];
magicChance = percent.format(totalEnchantChance / 100.0);
}
// SHAKE
if (canShake) {
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability());
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability(), isLucky);
shakeChance = shakeStrings[0];
shakeChanceLucky = shakeStrings[1];
}
// FISHERMAN'S DIET
if (canFishermansDiet) {
fishermansDietRank = calculateRank(Fishing.fishermansDietMaxLevel, Fishing.fishermansDietRankLevel1);
fishermansDietRank = calculateRank(skillValue, Fishing.fishermansDietMaxLevel, Fishing.fishermansDietRankLevel1);
}
// MASTER ANGLER
if (canMasterAngler) {
double rawBiteChance = ((Math.max((skillValue / 200.0), 1.0)) / (isStorming ? 300 : 500));
Biome biome = player.getLocation().getBlock().getBiome();
double rawBiteChance = 1.0 / (isStorming ? 300 : 500);
Location location = fishingManager.getHookLocation();
if (location == null) {
location = player.getLocation();
}
Biome biome = location.getBlock().getBiome();
if (biome == Biome.RIVER || biome == Biome.OCEAN) {
rawBiteChance = rawBiteChance * 2.0;
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
}
if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
rawBiteChance = rawBiteChance * 2.0;
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBoatModifier();
}
biteChance = calculateAbilityDisplayValues(rawBiteChance * 100.0)[0];
biteChance = calculateAbilityDisplayValues(rawBiteChance * 100.0, isLucky)[0];
}
}
@Override
protected void permissionsCheck() {
canTreasureHunt = Permissions.fishingTreasureHunter(player);
canMagicHunt = Permissions.magicHunter(player);
canShake = Permissions.shake(player);
canFishermansDiet = Permissions.fishermansDiet(player);
canMasterAngler = Permissions.masterAngler(player);
canIceFish = Permissions.iceFishing(player);
protected void permissionsCheck(Player player) {
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER);
canMagicHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER);
canShake = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHAKE);
canFishermansDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET);
canMasterAngler = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MASTER_ANGLER);
canIceFish = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ICE_FISHING);
}
@Override
protected boolean effectsHeaderPermissions() {
return canTreasureHunt || canMagicHunt || canShake || canMasterAngler || canFishermansDiet || canIceFish;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1")));
}
if (canMagicHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3")));
}
if (canShake) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5")));
}
if (canFishermansDiet) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.6"), LocaleLoader.getString("Fishing.Effect.7")));
}
if (canMasterAngler) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.8"), LocaleLoader.getString("Fishing.Effect.9")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3")));
}
if (canIceFish) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.10"), LocaleLoader.getString("Fishing.Effect.11")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.10"), LocaleLoader.getString("Fishing.Effect.11")));
}
}
@Override
protected boolean statsHeaderPermissions() {
return canTreasureHunt || canMagicHunt || canShake || canMasterAngler || canFishermansDiet || canIceFish;
}
@Override
protected void statsDisplay() {
if (canMasterAngler) {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Chance", biteChance));
}
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", lootTier));
}
if (canMagicHunt) {
player.sendMessage(LocaleLoader.getString("Fishing.Enchant.Chance", magicChance) + chanceRaining + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", magicChanceLucky) : ""));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.8"), LocaleLoader.getString("Fishing.Effect.9")));
}
if (canShake) {
int unlockLevel = AdvancedConfig.getInstance().getShakeUnlockLevel();
if (skillValue < unlockLevel) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.0", unlockLevel)));
}
else {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", shakeChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", shakeChanceLucky) : ""));
}
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5")));
}
if (canFishermansDiet) {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.FD", fishermansDietRank));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.6"), LocaleLoader.getString("Fishing.Effect.7")));
}
return messages;
}
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
if (canTreasureHunt) {
messages.add(LocaleLoader.getString("Fishing.Ability.Rank", lootTier, Tier.values().length));
messages.add(LocaleLoader.getString("Fishing.Ability.TH.DropRate", trapTreasure, commonTreasure, uncommonTreasure, rareTreasure, epicTreasure, legendaryTreasure, recordTreasure));
}
if (canMagicHunt) {
messages.add(LocaleLoader.getString("Fishing.Ability.TH.MagicRate", magicChance));
}
if (canIceFish) {
int unlockLevel = AdvancedConfig.getInstance().getIceFishingUnlockLevel();
if (skillValue < unlockLevel) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.1", unlockLevel)));
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.1", unlockLevel)));
}
else {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.IceFishing"));
messages.add(LocaleLoader.getString("Fishing.Ability.IceFishing"));
}
}
if (canMasterAngler) {
int unlockLevel = AdvancedConfig.getInstance().getMasterAnglerUnlockLevel();
if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.2", unlockLevel)));
}
else {
messages.add(LocaleLoader.getString("Fishing.Ability.Chance", biteChance));
}
}
if (canShake) {
int unlockLevel = AdvancedConfig.getInstance().getFishingTierLevel(Tier.ONE);
if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.0", unlockLevel)));
}
else {
messages.add(LocaleLoader.getString("Fishing.Ability.Shake", shakeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
}
}
if (canFishermansDiet) {
messages.add(LocaleLoader.getString("Fishing.Ability.FD", fishermansDietRank));
}
return messages;
}
}

View File

@@ -1,7 +1,12 @@
package com.gmail.nossr50.commands.skills;
import org.bukkit.Material;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.herbalism.Herbalism;
@@ -34,132 +39,128 @@ public class HerbalismCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// GREEN TERRA
if (canGreenTerra) {
String[] greenTerraStrings = calculateLengthDisplayValues();
String[] greenTerraStrings = calculateLengthDisplayValues(player, skillValue);
greenTerraLength = greenTerraStrings[0];
greenTerraLengthEndurance = greenTerraStrings[1];
}
// FARMERS DIET
if (canFarmersDiet) {
farmersDietRank = calculateRank(Herbalism.farmersDietMaxLevel, Herbalism.farmersDietRankLevel1);
farmersDietRank = calculateRank(skillValue, Herbalism.farmersDietMaxLevel, Herbalism.farmersDietRankLevel1);
}
// GREEN THUMB
if (canGreenThumbBlocks || canGreenThumbPlants) {
greenThumbStage = calculateRank(Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
String[] greenThumbStrings = calculateAbilityDisplayValues(Herbalism.greenThumbMaxLevel, Herbalism.greenThumbMaxChance);
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GREEN_THUMB_PLANT, isLucky);
greenThumbChance = greenThumbStrings[0];
greenThumbChanceLucky = greenThumbStrings[1];
}
// DOUBLE DROPS
if (canDoubleDrop) {
String[] doubleDropStrings = calculateAbilityDisplayValues(Herbalism.doubleDropsMaxLevel, Herbalism.doubleDropsMaxChance);
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HERBALISM_DOUBLE_DROPS, isLucky);
doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1];
}
// HYLIAN LUCK
if (hasHylianLuck) {
String[] hylianLuckStrings = calculateAbilityDisplayValues(Herbalism.hylianLuckMaxLevel, Herbalism.hylianLuckMaxChance);
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HYLIAN_LUCK, isLucky);
hylianLuckChance = hylianLuckStrings[0];
hylianLuckChanceLucky = hylianLuckStrings[1];
}
// SHROOM THUMB
if (canShroomThumb) {
String[] shroomThumbStrings = calculateAbilityDisplayValues(Herbalism.shroomThumbMaxLevel, Herbalism.shroomThumbMaxChance);
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SHROOM_THUMB, isLucky);
shroomThumbChance = shroomThumbStrings[0];
shroomThumbChanceLucky = shroomThumbStrings[1];
}
}
@Override
protected void permissionsCheck() {
hasHylianLuck = Permissions.hylianLuck(player);
protected void permissionsCheck(Player player) {
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
canGreenTerra = Permissions.greenTerra(player);
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
canFarmersDiet = Permissions.farmersDiet(player);
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
canShroomThumb = Permissions.shroomThumb(player);
canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
}
@Override
protected boolean effectsHeaderPermissions() {
return canGreenTerra || canDoubleDrop || canFarmersDiet || canGreenThumbBlocks || canGreenThumbPlants || canShroomThumb;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canGreenTerra) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1")));
}
if (canGreenThumbPlants) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3")));
}
if (canGreenThumbBlocks) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5")));
}
if (canFarmersDiet) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7")));
}
if (hasHylianLuck) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.10"), LocaleLoader.getString("Herbalism.Effect.11")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.10"), LocaleLoader.getString("Herbalism.Effect.11")));
}
if (canShroomThumb) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.12"), LocaleLoader.getString("Herbalism.Effect.13")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.12"), LocaleLoader.getString("Herbalism.Effect.13")));
}
if (canDoubleDrop) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canGreenTerra || canDoubleDrop || canFarmersDiet || canGreenThumbBlocks || canGreenThumbPlants || canShroomThumb;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canGreenTerra) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", greenTerraLength) + (hasEndurance ? LocaleLoader.getString("Perks.activationtime.bonus", greenTerraLengthEndurance) : ""));
messages.add(LocaleLoader.getString("Herbalism.Ability.GTe.Length", greenTerraLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));
}
if (canGreenThumbBlocks || canGreenThumbPlants) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", greenThumbChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", greenThumbChanceLucky) : ""));
messages.add(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", greenThumbChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : ""));
}
if (canGreenThumbPlants) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", greenThumbStage));
messages.add(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", greenThumbStage));
}
if (canFarmersDiet) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", farmersDietRank));
messages.add(LocaleLoader.getString("Herbalism.Ability.FD", farmersDietRank));
}
if (hasHylianLuck) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.HylianLuck", hylianLuckChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", hylianLuckChanceLucky) : ""));
messages.add(LocaleLoader.getString("Herbalism.Ability.HylianLuck", hylianLuckChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", hylianLuckChanceLucky) : ""));
}
if (canShroomThumb) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Chance", shroomThumbChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", shroomThumbChanceLucky) : ""));
messages.add(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Chance", shroomThumbChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shroomThumbChanceLucky) : ""));
}
if (canDoubleDrop) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", doubleDropChanceLucky) : ""));
messages.add(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
}
return messages;
}
}

View File

@@ -1,11 +1,18 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.Mining;
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
public class MiningCommand extends SkillCommand {
private String doubleDropChance;
@@ -31,24 +38,24 @@ public class MiningCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// SUPER BREAKER
if (canSuperBreaker) {
String[] superBreakerStrings = calculateLengthDisplayValues();
String[] superBreakerStrings = calculateLengthDisplayValues(player, skillValue);
superBreakerLength = superBreakerStrings[0];
superBreakerLengthEndurance = superBreakerStrings[1];
}
// DOUBLE DROPS
if (canDoubleDrop) {
String[] doubleDropStrings = calculateAbilityDisplayValues(Mining.doubleDropsMaxLevel, Mining.doubleDropsMaxChance);
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.MINING_DOUBLE_DROPS, isLucky);
doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1];
}
// BLAST MINING
if (canBlast || canDemoExpert || canBiggerBombs) {
MiningManager miningManager = mcMMOPlayer.getMiningManager();
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
blastMiningRank = miningManager.getBlastMiningTier();
bonusTNTDrops = miningManager.getDropMultiplier();
@@ -60,90 +67,86 @@ public class MiningCommand extends SkillCommand {
}
@Override
protected void permissionsCheck() {
protected void permissionsCheck(Player player) {
canBiggerBombs = Permissions.biggerBombs(player);
canBlast = Permissions.remoteDetonation(player);
canDemoExpert = Permissions.demolitionsExpertise(player);
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
canSuperBreaker = Permissions.superBreaker(player);
}
@Override
protected boolean effectsHeaderPermissions() {
return canBiggerBombs || canBlast || canDemoExpert || canDoubleDrop || canSuperBreaker;
}
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1")));
}
if (canDoubleDrop) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3")));
}
if (canBlast) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5")));
}
if (canBiggerBombs) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7")));
}
if (canDemoExpert) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canBiggerBombs || canBlast || canDemoExpert || canDoubleDrop || canSuperBreaker;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canDoubleDrop) {
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", doubleDropChanceLucky) : ""));
messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
}
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.activationtime.bonus", superBreakerLengthEndurance) : ""));
messages.add(LocaleLoader.getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
}
if (canBlast) {
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRank1();
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.ONE);
if (skillValue < unlockLevel) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.0", unlockLevel)));
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.0", unlockLevel)));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, Tier.values().length, LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
}
}
if (canBiggerBombs) {
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRank2();
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.TWO);
if (skillValue < unlockLevel) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", unlockLevel)));
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", unlockLevel)));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease));
messages.add(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease));
}
}
if (canDemoExpert) {
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRank4();
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.FOUR);
if (skillValue < unlockLevel) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", unlockLevel)));
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", unlockLevel)));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
}
}
return messages;
}
}

View File

@@ -1,15 +1,22 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.repair.ArcaneForging;
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
public class RepairCommand extends SkillCommand {
private String repairMasteryBonus;
@@ -39,12 +46,12 @@ public class RepairCommand extends SkillCommand {
}
@Override
protected void dataCalculations() {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// We're using pickaxes here, not the best but it works
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE.getId());
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE.getId());
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE.getId());
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE.getId());
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE);
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
@@ -59,18 +66,18 @@ public class RepairCommand extends SkillCommand {
// SUPER REPAIR
if (canSuperRepair) {
String[] superRepairStrings = calculateAbilityDisplayValues(Repair.superRepairMaxBonusLevel, Repair.superRepairMaxChance);
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SUPER_REPAIR, isLucky);
superRepairChance = superRepairStrings[0];
superRepairChanceLucky = superRepairStrings[1];
}
}
@Override
protected void permissionsCheck() {
canSuperRepair = Permissions.superRepair(player);
canMasterRepair = Permissions.repairMastery(player);
canArcaneForge = Permissions.arcaneForging(player);
canSalvage = Permissions.salvage(player);
protected void permissionsCheck(Player player) {
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
canSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE);
canRepairDiamond = Permissions.repairDiamond(player);
canRepairGold = Permissions.repairGold(player);
canRepairIron = Permissions.repairIron(player);
@@ -82,78 +89,76 @@ public class RepairCommand extends SkillCommand {
}
@Override
protected boolean effectsHeaderPermissions() {
return canArcaneForge || canSalvage || canRepairDiamond || canRepairGold || canRepairIron || canMasterRepair || canRepairStone || canSuperRepair || canRepairString || canRepairWood || canRepairLeather;
}
protected List<String> effectsDisplay() {
List<String> messages = new ArrayList<String>();
@Override
protected void effectsDisplay() {
luckyEffectsDisplay();
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.0"), LocaleLoader.getString("Repair.Effect.1")));
if (canRepairLeather || canRepairString || canRepairWood || canRepairStone || canRepairIron || canRepairGold || canRepairDiamond) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.0"), LocaleLoader.getString("Repair.Effect.1")));
}
if (canMasterRepair) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.2"), LocaleLoader.getString("Repair.Effect.3")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.2"), LocaleLoader.getString("Repair.Effect.3")));
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.4"), LocaleLoader.getString("Repair.Effect.5")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.4"), LocaleLoader.getString("Repair.Effect.5")));
}
/* Repair Level Requirements */
if (canRepairStone && stoneLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.14", stoneLevel), LocaleLoader.getString("Repair.Effect.15")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.14", stoneLevel), LocaleLoader.getString("Repair.Effect.15")));
}
if (canRepairIron && ironLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.12", ironLevel), LocaleLoader.getString("Repair.Effect.13")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.12", ironLevel), LocaleLoader.getString("Repair.Effect.13")));
}
if (canRepairGold && goldLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.10", goldLevel), LocaleLoader.getString("Repair.Effect.11")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.10", goldLevel), LocaleLoader.getString("Repair.Effect.11")));
}
if (canRepairDiamond && diamondLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.6", diamondLevel), LocaleLoader.getString("Repair.Effect.7")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.6", diamondLevel), LocaleLoader.getString("Repair.Effect.7")));
}
if (canSalvage && Repair.salvageUnlockLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.16", Repair.salvageUnlockLevel), LocaleLoader.getString("Repair.Effect.17")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.16", Repair.salvageUnlockLevel), LocaleLoader.getString("Repair.Effect.17")));
}
if (canArcaneForge) {
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9")));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9")));
}
return messages;
}
@Override
protected boolean statsHeaderPermissions() {
return canArcaneForge || canMasterRepair || canSuperRepair;
}
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
@Override
protected void statsDisplay() {
if (canMasterRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Mastery", repairMasteryBonus));
messages.add(LocaleLoader.getString("Repair.Skills.Mastery", repairMasteryBonus));
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", superRepairChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", superRepairChanceLucky) : ""));
messages.add(LocaleLoader.getString("Repair.Skills.Super.Chance", superRepairChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", superRepairChanceLucky) : ""));
}
if (canArcaneForge) {
RepairManager repairManager = mcMMOPlayer.getRepairManager();
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", repairManager.getArcaneForgingRank()));
messages.add(LocaleLoader.getString("Repair.Arcane.Rank", repairManager.getArcaneForgingRank(), Tier.values().length));
if (ArcaneForging.arcaneForgingEnchantLoss) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", (arcaneBypass ? 100 : repairManager.getKeepEnchantChance())));
messages.add(LocaleLoader.getString("Repair.Arcane.Chance.Success", (arcaneBypass ? 100 : repairManager.getKeepEnchantChance())));
}
if (ArcaneForging.arcaneForgingDowngrades) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", (arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance())));
messages.add(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", (arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance())));
}
}
return messages;
}
}

View File

@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
import java.util.List;
import java.util.Set;
import com.gmail.nossr50.util.Motd;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -13,7 +14,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.child.FamilyTree;
@@ -23,21 +24,12 @@ import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.google.common.collect.ImmutableList;
public abstract class SkillCommand implements TabExecutor {
protected SkillType skill;
protected String skillName;
protected Player player;
protected PlayerProfile profile;
protected McMMOPlayer mcMMOPlayer;
protected float skillValue;
protected boolean isLucky;
protected boolean hasEndurance;
private String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%");
protected DecimalFormat decimal = new DecimalFormat("##0.00");
@@ -46,7 +38,7 @@ public abstract class SkillCommand implements TabExecutor {
public SkillCommand(SkillType skill) {
this.skill = skill;
skillName = SkillUtils.getSkillName(skill);
skillName = skill.getName();
skillGuideCommand = new SkillGuideCommand(skill);
}
@@ -56,31 +48,26 @@ public abstract class SkillCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
player = mcMMOPlayer.getPlayer();
switch (args.length) {
case 0:
profile = mcMMOPlayer.getProfile();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
skillValue = profile.getSkillLevel(skill);
isLucky = Permissions.lucky(sender, skill);
hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
boolean isLucky = Permissions.lucky(player, skill);
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
float skillValue = mcMMOPlayer.getSkillLevel(skill);
permissionsCheck();
dataCalculations();
permissionsCheck(player);
dataCalculations(player, skillValue, isLucky);
if (Config.getInstance().getSkillUseBoard()) {
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
}
if (!skill.isChildSkill()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
if (Config.getInstance().getSkillScoreboardEnabled()) {
ScoreboardManager.setupPlayerScoreboard(player.getName());
ScoreboardManager.enablePlayerSkillScoreboard(mcMMOPlayer, skill);
}
else {
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, profile.getSkillXpLevel(skill), profile.getXpToLevel(skill)));
}
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
}
else {
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName + " " + LocaleLoader.getString("Skills.Child")));
@@ -91,21 +78,33 @@ public abstract class SkillCommand implements TabExecutor {
Set<SkillType> parents = FamilyTree.getParents(skill);
for (SkillType parent : parents) {
player.sendMessage(SkillUtils.getSkillName(parent) + " - " + LocaleLoader.getString("Effects.Level", profile.getSkillLevel(parent), profile.getSkillXpLevel(parent), profile.getXpToLevel(parent)));
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
}
}
if (effectsHeaderPermissions()) {
List<String> effectMessages = effectsDisplay();
if (!effectMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
if (isLucky) {
player.sendMessage(Motd.PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc", skillName)));
}
for (String message : effectMessages) {
player.sendMessage(message);
}
}
effectsDisplay();
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
if (statsHeaderPermissions()) {
if (!statsMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
}
statsDisplay();
for (String message : statsMessages) {
player.sendMessage(message);
}
}
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase()));
return true;
@@ -125,11 +124,11 @@ public abstract class SkillCommand implements TabExecutor {
}
}
protected int calculateRank(int maxLevel, int rankChangeLevel) {
protected int calculateRank(float skillValue, int maxLevel, int rankChangeLevel) {
return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
}
protected String[] calculateAbilityDisplayValues(double chance) {
protected String[] calculateAbilityDisplayValues(double chance, boolean isLucky) {
String[] displayValues = new String[2];
displayValues[0] = percent.format(Math.min(chance, 100.0D) / 100.0D);
@@ -138,12 +137,14 @@ public abstract class SkillCommand implements TabExecutor {
return displayValues;
}
protected String[] calculateAbilityDisplayValues(int maxBonusLevel, double maxChance) {
return calculateAbilityDisplayValues((maxChance / maxBonusLevel) * Math.min(skillValue, maxBonusLevel));
protected String[] calculateAbilityDisplayValues(float skillValue, SecondaryAbility skillAbility, boolean isLucky) {
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility);
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(skillAbility) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
}
protected String[] calculateLengthDisplayValues() {
int maxLength = skill.getAbility().getMaxTicks();
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
int maxLength = skill.getAbility().getMaxLength();
int length = 2 + (int) (skillValue / AdvancedConfig.getInstance().getAbilityLength());
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
@@ -154,22 +155,11 @@ public abstract class SkillCommand implements TabExecutor {
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
}
protected void luckyEffectsDisplay() {
if (isLucky) {
String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", skillName)));
}
}
protected abstract void dataCalculations(Player player, float skillValue, boolean isLucky);
protected abstract void dataCalculations();
protected abstract void permissionsCheck(Player player);
protected abstract void permissionsCheck();
protected abstract List<String> effectsDisplay();
protected abstract boolean effectsHeaderPermissions();
protected abstract void effectsDisplay();
protected abstract boolean statsHeaderPermissions();
protected abstract void statsDisplay();
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
}

View File

@@ -1,6 +1,7 @@
package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.Arrays;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -9,19 +10,16 @@ import org.bukkit.command.CommandSender;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public class SkillGuideCommand implements CommandExecutor {
private String header;
private String[] guide;
private ArrayList<String> guide;
private String invalidPage;
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
public SkillGuideCommand(SkillType skillType) {
header = LocaleLoader.getString("Guides.Header", SkillUtils.getSkillName(skillType));
guide = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skillType.toString())).split("\n");
invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
public SkillGuideCommand(SkillType skill) {
header = LocaleLoader.getString("Guides.Header", skill.getName());
guide = getGuide(skill);
}
@Override
@@ -59,7 +57,7 @@ public class SkillGuideCommand implements CommandExecutor {
}
private int getTotalPageNumber() {
return (int) Math.ceil(guide.length / 8.0);
return (int) Math.ceil(guide.size() / 8.0);
}
private void sendGuide(CommandSender sender, int pageNumber) {
@@ -68,23 +66,46 @@ public class SkillGuideCommand implements CommandExecutor {
}
}
private ArrayList<String> grabPageContents(int pagenum) {
int pageIndexStart = 8 * (pagenum - 1); // Determine what string to start at
private ArrayList<String> grabPageContents(int page) {
int pageIndexStart = 8 * (page - 1); // Determine what string to start at
ArrayList<String> allStrings = new ArrayList<String>();
allStrings.add(header);
// Add targeted strings
while (allStrings.size() < 9) {
if (pageIndexStart + allStrings.size() > guide.length) {
if (pageIndexStart + allStrings.size() > guide.size()) {
allStrings.add("");
}
else {
allStrings.add(guide[pageIndexStart + (allStrings.size() - 1)]);
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
}
}
allStrings.add("Page " + pagenum + " of " + getTotalPageNumber());
allStrings.add("Page " + page + " of " + getTotalPageNumber());
return allStrings;
}
private ArrayList<String> getGuide(SkillType skill) {
ArrayList<String> guide = new ArrayList<String>();
for (int i = 0; i < 10; i++) {
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n");
if (section[0].startsWith("!")) {
break;
}
guide.addAll(Arrays.asList(section));
if (section.length < 8) {
for (int blankLine = 8 - section.length; blankLine > 0; blankLine--) {
guide.add("");
}
}
}
return guide;
}
}

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