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

Compare commits

...

1416 Commits

Author SHA1 Message Date
GJ
72a2e24c98 Weekly beta release.
PLEASE READ THE CHANGELOG.
2013-02-16 00:01:36 -05:00
GJ
593975a255 We don't have to pass the event anymore. 2013-02-16 00:00:24 -05:00
NuclearW
b16cc87ffb Turn off debug 2013-02-15 22:48:24 -05:00
NuclearW
c5e8b90d71 Reset events for debug 2013-02-15 22:48:24 -05:00
NuclearW
88a6326f87 Debugging for Metrics 2013-02-15 22:48:24 -05:00
NuclearW
0603ea0fc4 Version bump, for turt2live 2013-02-15 22:48:23 -05:00
NuclearW
c4aedd5323 Use convenience methods 2013-02-15 22:48:23 -05:00
NuclearW
6eb125c913 Chimera Wing Usage Tracker/Graph 2013-02-15 22:48:23 -05:00
NuclearW
704f7374d2 Chimera Wing Enabled Graph 2013-02-15 22:48:23 -05:00
NuclearW
009396cad9 Add in EMetrics 2013-02-15 22:48:23 -05:00
NuclearW
a38b7ca9fa Move metrics to a class of its own 2013-02-15 22:48:22 -05:00
NuclearW
c5daaffeb1 Change to use turt2live's MetricsExtension 2013-02-15 22:48:22 -05:00
bm01
83debde0a1 Changelog update 2013-02-16 03:45:26 +01:00
bm01
9c2ab19404 Slight greenThumbWheat cleanup 2013-02-16 03:42:56 +01:00
bm01
ef1a777180 Removed no longer needed check 2013-02-16 03:38:41 +01:00
bm01
77014b03ef No point in canceling the event
And it actually fixes the double call (see previous commit)
2013-02-16 03:36:27 +01:00
bm01
9143051d9f Run GreenThumbTimer on the current tick
It avoids onBlockBreak to be called twice (which basically launched
the task twice). I don't know what were the consequences but that
wasn't right anyway.
Also it would be better if we wouldn't have to cancel the event,
because there is a possibility that plugins like LogBlock don't have a
chance to process it.
2013-02-16 02:56:46 +01:00
bm01
f496ecf7b1 Fixed Green Thumb not checking rank 4 on wheat 2013-02-16 02:49:31 +01:00
GJ
fc3afc4340 Using PlantSize is cleaner. 2013-02-15 19:29:47 -05:00
GJ
fd138eb0b5 This was redundant was redundant 2013-02-15 19:20:42 -05:00
GJ
6d5835849f Fix issue with GreenThumb command display. 2013-02-15 19:18:43 -05:00
nossr50
800ebf5b64 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2013-02-15 15:33:54 -08:00
nossr50
9df149c489 Huge Mushrooms now work for Tree Feller (UNTESTED) 2013-02-15 15:32:49 -08:00
shatteredbeam
efcf80899e Permissions class removal from Skillcommand 2013-02-15 14:38:51 -08:00
shatteredbeam
c1b12c027a Permissions class removed from Listeners 2013-02-15 13:32:23 -08:00
shatteredbeam
476ea80c4e Permissions class removed from mcMMOPlayer. 2013-02-15 13:21:21 -08:00
GJ
bf4d70e8be That was an incredibly stupid way to get those permissions. 2013-02-15 14:29:32 -05:00
GJ
284002bf8b No reason to String.valueOf() these. 2013-02-15 13:56:30 -05:00
GJ
b92b9c6507 Permissions must use the English names. 2013-02-15 13:42:37 -05:00
GJ
a8cfcf31ab Remove unused import 2013-02-15 13:42:37 -05:00
GJ
d14821e385 Fix a few more missing localized names. 2013-02-15 13:42:36 -05:00
GJ
5e8b036481 Need English name for the permission. 2013-02-15 13:42:34 -05:00
GJ
27ba4ff800 Make /xplock work for localized skill names. 2013-02-15 13:42:34 -05:00
shatteredbeam
c80bb45cad Inspection references (Remove Permissions class) 2013-02-15 10:41:04 -08:00
GJ
dedcf0469b Fix teh build. 2013-02-15 13:12:11 -05:00
GJ
9ec6a6d1aa Add constructor for adding multiple levels at once. Need to work out how
to handle level-ups in order for this to be properly cancelled, however.
2013-02-15 13:10:36 -05:00
GJ
1ce01d2043 This should be abstract. 2013-02-15 13:10:36 -05:00
GJ
0701169a7e Make McMMOPlayerXPGainEvent cancellable. 2013-02-15 13:10:34 -05:00
shatteredbeam
2d0cf6413e Permissions Murder 6: The quest for more money 2013-02-15 10:08:45 -08:00
T00thpick1
4cf658b629 Make mctop asynchroneous 2013-02-15 12:47:00 -05:00
t00thpick1
8d21883c20 Only try to index tables when we are connected 2013-02-15 12:30:27 -05:00
GJ
fca0847929 Squids are not made of chocolate. 2013-02-15 12:19:02 -05:00
GJ
1d19dab71d Full change to DyeColor.COLOR.getDyeData() - *REQUIRES* CB 1.4.7 2013-02-15 12:16:31 -05:00
GJ
49fe98ac57 Already locked it once. 2013-02-15 10:46:08 -05:00
TfT_02
bc9e946618 Revert removing Chimaera wing.
We've decided to keep it, for now.
2013-02-15 16:36:21 +01:00
GJ
3d3a1abf7b OfflinePlayer.getName().toString() is pointless. 2013-02-15 10:34:42 -05:00
GJ
1ef1d53fd9 Make our commands respect localized skill names. 2013-02-15 09:26:01 -05:00
GJ
0419dca385 Config files are now backed up even when running in SQL mode 2013-02-15 07:53:44 -05:00
GJ
11bd473f55 Added config option to disable automatic zip backups 2013-02-15 07:53:43 -05:00
TfT_02
5947ad5004 Fixed wrong names names displaying when using /ptp 2013-02-15 13:51:54 +01:00
GJ
894218cac9 Gotta protect this one too. 2013-02-15 07:44:27 -05:00
GJ
4ce06de18a Nicer way to handle the ConcurrentModification issue. 2013-02-15 07:40:47 -05:00
GJ
6c4ea34811 It's (not) over 5000% - fixes #683 2013-02-15 07:32:22 -05:00
TfT_02
34736836cc Fixed a bug where a new party leader wasn't appointed, after the previous party leader left 2013-02-15 13:22:31 +01:00
TfT_02
9c09c168f8 Fix a ConcurrentModificationException 2013-02-15 12:32:35 +01:00
GJ
c61e710341 Update Locale files. 2013-02-14 23:54:18 -05:00
NuclearW
63753b8197 Changelog 2013-02-14 23:28:57 -05:00
NuclearW
20f436c646 Squash alll the bugs 2013-02-14 23:27:19 -05:00
NuclearW
092b9096e6 Locale fallback 2013-02-14 23:27:03 -05:00
GJ
caa1b0d14c Duplicate code is bad, m'kay? 2013-02-14 19:02:50 -05:00
bm01
d39ff036c7 Fixed NPE when clicking outside of the inventory window 2013-02-14 23:56:09 +01:00
GJ
6702256b4c Auto-remove buff if a player tries to move the item. 2013-02-14 17:08:06 -05:00
GJ
110fbe9478 Clear buffs on /mcrefresh 2013-02-14 16:56:55 -05:00
GJ
128c24c8f6 Fix enchants hanging around due to server crash or disconnect. 2013-02-14 16:35:14 -05:00
GJ
6cc2497182 THis wasn't removing when it should have. 2013-02-14 16:29:49 -05:00
GJ
615288e635 Things in inventory can be null. 2013-02-14 16:02:42 -05:00
GJ
1b814b937b Move PlayerDeathEvent handler into main PlayerListener. Also add check
to deal with SuperBreaker enchants on death.
2013-02-14 15:53:17 -05:00
GJ
01e26f321d Fix issues with enchant-based Superbreaker implementation. 2013-02-14 14:35:53 -05:00
GJ
e8319aee81 Changed Super Breaker & Giga Drill Breaker to be an enchantment-based
boost, rather than an instabreak.
2013-02-14 13:12:15 -05:00
GJ
ca5bf0bd09 Fix possible fallthrough. 2013-02-14 11:07:41 -05:00
GJ
88b05cd5aa Fix Super Breaker not working right with custom blocks. 2013-02-14 09:39:22 -05:00
GJ
132fcb8c74 We need to get our priorities straight. 2013-02-14 09:26:05 -05:00
GJ
1492fa473f Ch-ch-ch-changes! 2013-02-14 07:44:53 -05:00
NuclearW
9bd33ab3df Introducing Block Cracker 2013-02-14 00:34:50 -05:00
NuclearW
7d826a0cdb Add permission check for green thumb effects during Green Terra ability 2013-02-14 00:21:33 -05:00
GJ
ec6fc30f47 3rd time's the charm? 2013-02-13 19:43:26 -05:00
GJ
25a54ea802 Clean up /ptp a bit more. 2013-02-13 19:29:46 -05:00
GJ
dda9c82940 Attempt to clarify the /ptp code - I don't know that this helps much. 2013-02-13 18:58:17 -05:00
GJ
55b88f0274 These belong better in SkillTools than Misc 2013-02-13 16:45:49 -05:00
GJ
f4da69a205 Fix some missing default cases and possible fall-through issues. 2013-02-13 16:34:36 -05:00
GJ
3a919f3e4c Fix improper permission making admin chat fail. 2013-02-13 15:25:49 -05:00
GJ
6cfd124804 Remove unused import. 2013-02-13 13:50:38 -05:00
GJ
0879e1f326 Fixed bug where fired arrows could raise skill levels other than Archery 2013-02-13 12:25:57 -05:00
GJ
8312570825 Fixed bug where splash potions could raise a player's unarmed level.
Fixes #678
2013-02-13 12:10:10 -05:00
bm01
7110e6ec3d Fixed invalid plugin.yml (tabs!) 2013-02-13 18:03:31 +01:00
GJ
1455a9b3a4 Fixed minor typo in locale file. 2013-02-13 11:50:07 -05:00
GJ
2ad73e9b2c Optimized our String/number conversions a bit. Also moved all
String-related util functions from Misc.java to StringUtils.java
2013-02-13 11:45:48 -05:00
GJ
b1db0d037d Fix localized versions of /skillname not working properly. Fixes #669 2013-02-13 10:32:37 -05:00
bm01
776821a988 Readded Impact damage durability cap (and fixed it) 2013-02-13 14:49:35 +01:00
GJ
1380e64c0b Added missing * perm node for mcmmmo.commands.mcmmo 2013-02-13 08:16:55 -05:00
GJ
0319e2cbff Added '/hardcore' and '/vampirism' commands for toggling these modes on
or off, along with the necessary permissions nodes.
2013-02-13 08:15:38 -05:00
GJ
7350fdb99c Remove unused import. 2013-02-12 23:21:34 -05:00
GJ
25061e7f71 Don't loop, broadcast. 2013-02-12 23:07:01 -05:00
shatteredbeam
0cd8d2b333 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2013-02-12 19:56:47 -08:00
shatteredbeam
28dca6e66f sender, not player. 2013-02-12 19:54:17 -08:00
shatteredbeam
491a70ad82 util.perms now uses player.hasPermissions() Uniformly. 2013-02-12 19:50:46 -08:00
GJ
aa0acf767b Log ALL the things! 2013-02-12 22:18:47 -05:00
GJ
e37f5e765e Forgot to send the permissions message. 2013-02-12 21:58:53 -05:00
GJ
fe1cf40bbb Get rid of unused functions. 2013-02-12 21:55:41 -05:00
shatteredbeam
9be6a7cf3b Permissions Murder 4: The quest for revenge 2013-02-12 18:33:55 -08:00
shatteredbeam
0684b1d425 Permissions murder: The Sequel. 2013-02-12 18:26:40 -08:00
shatteredbeam
12a2107601 More permissions murder. 2013-02-12 18:06:36 -08:00
shatteredbeam
163b3d19f9 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2013-02-12 17:49:51 -08:00
shatteredbeam
15113ba7e4 SkillresetCommand.java Permission murder 2013-02-12 17:48:04 -08:00
GJ
5e9f01ac57 Fix party & admin chat not working right from console. 2013-02-12 20:38:35 -05:00
GJ
ec718f04d7 No sense in looping through all online players. 2013-02-12 20:38:35 -05:00
shatteredbeam
bb96c00cb9 Continuing Permissions Murder. 2013-02-12 17:37:34 -08:00
shatteredbeam
697cfeea64 Kill the permissions! 2013-02-12 17:31:46 -08:00
shatteredbeam
0528139c2c Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2013-02-12 17:22:51 -08:00
shatteredbeam
cbe68e7879 Import removal 2013-02-12 17:21:56 -08:00
shatteredbeam
074a798213 Kill the permissions middle man... 2013-02-12 17:16:41 -08:00
GJ
e9b016903b Removed /mcc command. Replaced with /mcmmo help.
NOTE: /mcmmo help seems to be having formatting issues currently - we're
looking into it.
2013-02-12 18:30:03 -05:00
GJ
8f4d5442b1 Better than looping. 2013-02-12 16:47:11 -05:00
GJ
2160eef1af Update plugin.yml 2013-02-12 16:26:08 -05:00
GJ
b66c5d7023 Clean up /ptp. Also fix bug where teleportation happened backwards when
accepting.
2013-02-12 16:24:17 -05:00
GJ
b21d5bdcc4 Inviting yourself is bad. 2013-02-12 15:08:07 -05:00
GJ
574770c289 Remove unused imports. 2013-02-12 15:05:23 -05:00
GJ
adda85a660 Convert /ptp to use Bukkit CommandAPI 2013-02-12 15:05:02 -05:00
GJ
92473cc56d True, not false. 2013-02-12 15:00:04 -05:00
GJ
d7e74b9fe0 That was poorly named. 2013-02-12 14:38:49 -05:00
GJ
9db2d50676 These should be under party, not skills. 2013-02-12 14:36:38 -05:00
bm01
048a979375 Minor ImpactEventHandler cleanup 2013-02-12 19:36:10 +01:00
bm01
761fb3b811 Bad copy paste 2013-02-12 19:19:13 +01:00
bm01
505d6e258f Removed no longer needed method (Misc.hasArmor) 2013-02-12 19:17:53 +01:00
bm01
9f22382506 Restored original behavior of Salvage.isSalvageable
It doesn't check for custom armors, I don't know if it's a bug or not
Added isMinecraftTool and isMinecraftArmor for clarity
2013-02-12 19:15:52 +01:00
bm01
f486492c37 For consistency with Bukkit, ItemChecks.isPants -> ItemChecks.isLeggings 2013-02-12 19:15:51 +01:00
bm01
6f1ddee0ac ItemChecks.isArmor should check for custom armors 2013-02-12 19:15:51 +01:00
bm01
2fac0170e7 Fixed Impact reducing durability of non-armor equipped blocks 2013-02-12 19:15:51 +01:00
GJ
56056797bc Check config values for exp & item sharing. 2013-02-12 12:08:04 -05:00
GJ
bbc2091b77 Aliased /party chat to work for /partychat and /party teleport to work
for /ptp
2013-02-12 12:04:37 -05:00
GJ
51493fab48 Don't pass the plugin. 2013-02-12 11:44:29 -05:00
GJ
5d693c5d8f Convert /party help to a subcommand 2013-02-12 11:42:13 -05:00
GJ
8cd9942be6 Prevent accidental overtranslation of our commands. 2013-02-12 11:37:37 -05:00
GJ
b2575c9b8f Cleanup from removal of leader checks. 2013-02-12 11:25:56 -05:00
GJ
a60a6355d2 We check the leader elsewhere. 2013-02-12 11:23:48 -05:00
GJ
6acfba1315 Use an enum to handle our subcommands. 2013-02-12 11:23:32 -05:00
GJ
ab731302e0 Remove unused imports 2013-02-12 10:42:59 -05:00
GJ
5a48d5c5f8 Convert /party info to a subcommand 2013-02-12 10:42:42 -05:00
GJ
e92c6b8f26 Convert /party rename to a subcommand 2013-02-12 09:22:57 -05:00
GJ
200ac53078 Add function to get a list of all players in a party to the API. 2013-02-12 09:22:36 -05:00
GJ
288907cfd4 Convert /party password to a subcommand. 2013-02-12 08:57:35 -05:00
GJ
c822be4a53 Add other usage string. 2013-02-12 08:39:45 -05:00
GJ
70f588cce1 Don't print usage here. 2013-02-12 01:45:56 -05:00
GJ
e5c7e81b08 No point in repeating this check over multiple classes. 2013-02-12 01:41:51 -05:00
bm01
45ebc2b89b 3% != 100% 2013-02-11 23:39:41 +01:00
GJ
76523d2988 3% != 100% - Fixes #671 2013-02-11 17:35:01 -05:00
GJ
98a64a0948 Convert /party lock & /party unlock to a subcommand. 2013-02-11 17:31:09 -05:00
GJ
2d6fb72b9d Use <>, not [] 2013-02-11 15:41:23 -05:00
GJ
e66ff53ca4 Convert /party owner to a subcommand. 2013-02-11 15:33:25 -05:00
GJ
e8ac3c812f Fix formatting. 2013-02-11 15:24:38 -05:00
GJ
a597a7d281 Add usage string. 2013-02-11 15:24:20 -05:00
GJ
1c0e392552 Convert /party disband to a subcommand 2013-02-11 15:19:41 -05:00
GJ
59a52a73bb We've got a function, might as well use it. 2013-02-11 15:17:15 -05:00
bm01
0aeff40aaa Made /party kick work on offline players 2013-02-11 14:14:43 +01:00
NuclearW
bcd8906315 Remove all spaces before newlines in config.yml 2013-02-11 03:08:03 -05:00
shatteredbeam
de9249e523 Added Global Multiplier Graph to Metrics
Added Global Curve Modifier Graph to Metrics
2013-02-10 23:29:19 -08:00
shatteredbeam
5160f5c380 Fixed build GJ broke. Silly Hat prepared. 2013-02-10 23:11:03 -08:00
GJ
5da51e78cc Change /party kick to a subcommand 2013-02-11 00:25:03 -05:00
GJ
2be57414ad Use <> not [] 2013-02-11 00:07:58 -05:00
GJ
c2293396be Fixing the rest of the issues with entities.yml 2013-02-10 15:57:55 -05:00
TfT_02
cdbc19570d Getting rid of all the snakes in the yaml 2013-02-10 09:34:32 +01:00
bm01
ccedd23342 Fixed NPE on /party join when the sender isn't in a party
Also cleaned up PartyManager.joinParty since it's no longer supposed
to create any party.
2013-02-09 16:21:13 +01:00
bm01
46b5746dcc Fixed bad player names displaying when using /party 2013-02-09 15:54:03 +01:00
bm01
97dafc45fa Fixed players not joining their parties at login 2013-02-09 15:52:09 +01:00
bm01
adf62fd332 Speeding up mcMMO startup a little 2013-02-09 15:45:41 +01:00
bm01
98bb865062 Load parties before trying to do anything with them 2013-02-09 15:42:02 +01:00
bm01
d50123085f Fixed bad parties saving 2013-02-09 15:26:41 +01:00
bm01
b628b9eb4d Attempt to fix IOOBException due getOfflinePlayer at server startup 2013-02-09 15:16:57 +01:00
bm01
317a39177b Fixed NPE on /party invite when used without a second argument 2013-02-09 14:51:36 +01:00
bm01
73924543df Fixed /party invite trying to invite "invite" 2013-02-09 14:50:03 +01:00
bm01
457754b6f1 Fixed NPE due to null itemShareMode 2013-02-09 14:35:48 +01:00
bm01
c659f8a9a9 Party now store OfflinePlayer instead of String 2013-02-09 14:34:53 +01:00
TfT_02
74df4a4fb6 Add random item share mode for parties.
Use /party itemshare random to enable random item sharing. Disable with
/party itemshare [none | false | off]
Whenever a party member picks up an item, everyone has a chance of
receiving that item instead of the player who picked it up.
2013-02-09 12:24:02 +01:00
TfT_02
b60d9032be Who knows what we will do next year,
but this minor bug has been fixed anyway :)
2013-02-09 10:59:41 +01:00
GJ
a2cbfa2668 We only need the name here, avoids NPE issues in /party create.
Fixes #655
2013-02-09 00:57:00 -05:00
GJ
340c47eebd Switch /party invite to a subcommand 2013-02-08 16:56:54 -05:00
GJ
ae5f39253e Make this work properly, finally. 2013-02-08 16:30:34 -05:00
GJ
3df5f529eb Anniversary is over for another year... 2013-02-08 16:30:34 -05:00
Glitchfinder
0fae8be816 Cleaning up minor issue with the ChunkStore. 2013-02-08 13:26:47 -08:00
Glitchfinder
f97e9bd19f Fixing an NPE with the /mcmmo command. 2013-02-08 12:23:14 -08:00
Glitchfinder
400d551295 Minor change to default permissions. 2013-02-08 12:14:59 -08:00
GJ
4957366beb Yet another stupid error. 2013-02-08 14:55:09 -05:00
GJ
27e4a2c290 This is a more applicable error message. 2013-02-08 13:28:58 -05:00
GJ
a424d36e96 This is less costly. 2013-02-08 13:27:28 -05:00
GJ
9c0518f251 Fix NPE on PartyJoin - Fixes #653 2013-02-08 13:16:12 -05:00
GJ
794071efb8 Not just for XP sharing. 2013-02-08 11:54:09 -05:00
GJ
787c4e5b73 Just in case they type it wrong. 2013-02-08 11:54:09 -05:00
GJ
33d3cd0522 Had the naming backwards, it's actually /party expshare 2013-02-08 11:54:09 -05:00
GJ
e14f8ad93c Convert /party shareexp to a subcommand 2013-02-08 11:54:08 -05:00
GJ
7a357634c7 We've already verified that they're in a party by this point. 2013-02-08 11:54:08 -05:00
GJ
ef5f72f56c Invert this check for clarity's sake. 2013-02-08 11:54:08 -05:00
GJ
ae3a95dd34 Convert /party quit to a subcommand 2013-02-08 11:54:07 -05:00
bm01
6d9db06305 Removed getSkillLevel, it doesn't belong to SkillType 2013-02-08 13:04:26 +01:00
GJ
35f243a6e6 No reason to use the SAME CODE in three different clases. 2013-02-07 23:59:02 -05:00
GJ
ea25558ac9 Back to weekly development. 2013-02-07 23:24:56 -05:00
GJ
1f09cb29f0 Weekly beta release. 2013-02-07 23:14:03 -05:00
GJ
9e4b06e0b6 Update locale files. Added "Chinese (Taiwan)" localization files (zh_TW) 2013-02-07 23:13:16 -05:00
GJ
114858505c Remove unused import. 2013-02-07 23:06:22 -05:00
GJ
3da062c4cc Update /party to use Bukkit CommandAPI for permissions & description -
usage is handled internally due to the number of subcommands.
2013-02-07 23:05:59 -05:00
GJ
291393d45d Update /party create to be a subcommand 2013-02-07 22:54:15 -05:00
GJ
3cc5cd4a04 Fixed playerParty never being initialized. 2013-02-07 22:10:31 -05:00
GJ
70ba4a0f3d Change /party accept to a subcommand. 2013-02-07 22:09:43 -05:00
GJ
9de6b4724a Changed names to refer to partyInvite for the sake of clarity. 2013-02-07 22:05:08 -05:00
GJ
79b96c380d Move handlePartyChangeEvent to PartyManager 2013-02-07 22:01:14 -05:00
GJ
3ccf79cff5 Make /party join into a subcommand. 2013-02-07 21:46:19 -05:00
nossr50
02bccf6dc1 Nerf Enderman default XP value part 2 2013-02-07 17:13:51 -08:00
nossr50
e397de99df Nerf Enderman default XP value to 1x instead of 4x 2013-02-07 17:11:20 -08:00
NuclearW
911f036723 Cancel EntityTargetEvent for when an entity wishes to target a party member without the friendly fire permission being enabled for both.
Not sure this can happen except for when an entity is made agressive to a player, then friendly fire is removed later and the player returns in range of the agressive tamed entity.

Thought: Move the permissions check for friendly fire into isFriendlyPet?  Not sure where else this is used, but if we always do a permissions check for friendly fire afterwards, it would make sense to move that check.
2013-02-07 18:56:38 -05:00
NuclearW
af1288b6f8 Add Friendly Fire permission for parties
This removes the friendly fire config option previously created
Both attacker and defender must have this option

Closes #648
2013-02-07 18:46:41 -05:00
NuclearW
366940fc14 Fix awful typo 2013-02-07 18:44:46 -05:00
GJ
4f45431dd3 Abstract the Chat commands. 2013-02-07 15:59:18 -05:00
GJ
6c266a8926 We don't need two functions that do the exact same thing. 2013-02-07 12:17:18 -05:00
GJ
c3f83302c5 Abstract our Spout commands. 2013-02-07 11:57:54 -05:00
GJ
57063246fb Anniversary is over for another year... 2013-02-07 10:23:11 -05:00
GJ
29f47d5ca7 Minor typo. 2013-02-07 10:21:54 -05:00
GJ
e0180881e2 Added the "wait" music disc to the default fishing treasures 2013-02-07 08:31:44 -05:00
GJ
7c579a1040 Remove unused import. 2013-02-07 08:26:17 -05:00
GJ
59219e3f33 Update /mchud and /xplock to use the Bukkit CommandAPI 2013-02-07 08:25:54 -05:00
GJ
b67a308a34 Readd /mcxprate alias to /xprate 2013-02-07 07:49:19 -05:00
GJ
d5550c8fd1 Changed /p and /a to use /partychat and /adminchat as the default
command name. The use of /p, /pc, /a, and /ac is still supported.
2013-02-06 17:57:16 -05:00
GJ
d0ca2b9d4b Update /mmoupdate to use Bukkit CommandAPI. Addresses #628 2013-02-06 17:10:05 -05:00
GJ
84fb7eec36 Move this out of PlayerLoginEvent and into PlayerJoinEvent -
this prevents us from creating DB entries for players that get caught by
a whitelist.
2013-02-06 16:52:36 -05:00
GJ
c04b5dc4d6 Remove unused import 2013-02-06 16:49:14 -05:00
bm01
4b4fb7fd39 Fixed updateLeaderboards causing a memory leak and a bad /mctop display 2013-02-06 22:47:05 +01:00
GJ
215bd0f4a2 Deprecated most functions in ExperienceAPI, replaced them with identical
versions that use a String for the SkillName rather than the SkillType
enum values
2013-02-06 16:13:01 -05:00
GJ
a13d28a6ec Entity config files aren't working properly yet - temporary solution is
to use a 1.0 base for any entity with an UNKNOWN type.
2013-02-06 15:33:24 -05:00
GJ
bcdd235b9f NuclearW, why did you do this? 2013-02-06 12:50:11 -05:00
GJ
6be0714872 Update /mcremove to use the Bukkit CommandAPI. 2013-02-06 12:49:43 -05:00
GJ
7e70c4001b Move aliases back to plugin.yml since setAliases doesn't work. 2013-02-06 11:45:19 -05:00
GJ
9326921e2a Revert back to ugly-alias in PlayerCommandPreprocessEvent for /skillname
commands.
2013-02-06 11:00:43 -05:00
GJ
7a0f8ea2dd Tweak a few more things with Salvage. 2013-02-06 10:28:28 -05:00
TfT_02
2799bab206 Minor cleanup 2013-02-06 15:29:21 +01:00
TfT_02
ba4d0451ff Shears are in isIronTool(), no need to check explicitly 2013-02-06 14:59:36 +01:00
TfT_02
40773ee6f6 Added Shears, Buckets, Fishing rods and Bows to the list of items that can be Salvaged 2013-02-06 14:49:36 +01:00
NuclearW
cd190eebc9 Locale Graph 2013-02-06 01:05:16 -05:00
NuclearW
c13593def1 Refactor LocaleLoader a bit 2013-02-06 01:05:09 -05:00
GJ
bbfbe1e72c Remove max level check - Bukkit now does the checking for us. 2013-02-05 23:58:15 -05:00
GJ
bb88812668 Added basic support for Mo' Creatures (and other entity mods) - specify
mob info in entities.yml
2013-02-05 22:40:19 -05:00
Glitchfinder
94a9230525 Properly defaulting ability permissions relative to their skills. 2013-02-05 18:18:12 -08:00
Glitchfinder
c7a0841c2e Properly defaulting more permissions. 2013-02-05 17:36:16 -08:00
Glitchfinder
b843970033 Properly defaulting more permissions. 2013-02-05 17:25:00 -08:00
GJ
4931ff6e4a Gut old PartyHUD stuff from the Spout config file. 2013-02-05 19:03:54 -05:00
GJ
b9ef701ff1 Changed backup task to include ALL config files 2013-02-05 19:03:54 -05:00
Glitchfinder
c07364f775 Properly defaulting permissions. 2013-02-05 15:32:52 -08:00
GJ
64d3430455 ACTUALLY ACTUALLY make /mcpurge behave right for flatfile. 2013-02-05 17:19:53 -05:00
GJ
7e4188e776 ACTUALLY make removing powerless players work for Flatfile. Old users
will only work from here forward - we never tracked login time before
for FlatFile.
2013-02-05 17:09:20 -05:00
GJ
3f6c07ba6a Updated /mcpurge for Bukkit CommandAPI, also made it work with Flatfile 2013-02-05 15:29:57 -05:00
GJ
419937f62e Refactoring - these should be with the rest of the DB files. 2013-02-05 12:56:31 -05:00
GJ
ab92aa3ffa Update /mcpurge command to use Bukkit CommandAPI. Addresses #628 2013-02-05 12:50:09 -05:00
GJ
2d9dc92f83 Added methods to ChatAPI for retrieving the current chat mode of a
player. Fixes #641
2013-02-05 12:30:15 -05:00
GJ
0f214496f2 Fixed a few incorrect usage strings. 2013-02-05 11:19:25 -05:00
GJ
9103914bc9 Update /mctop to use Bukkit CommandAPI. Addresses #628 2013-02-05 10:54:53 -05:00
GJ
aad14169fb Flip the order to short-circuit faster. 2013-02-05 10:18:24 -05:00
GJ
3550c25b7d targetParty could have been null going into the PartyChangeEvent. 2013-02-05 09:59:03 -05:00
GJ
2764368089 HerbalismBlock could be null here. 2013-02-05 09:57:03 -05:00
GJ
e46dcb69da Move setup tasks from onEnable to their own private functions for better
readability.
2013-02-05 09:51:45 -05:00
GJ
ef7aeb752e Update /mcstats to use Bukkit CommandAPI. Addresses #628 2013-02-05 09:30:47 -05:00
GJ
81ba0404b2 Fix issue with /mcstats displaying Integer.MAX_VALUE for the power level
cap when there is no power level cap.
2013-02-05 09:26:10 -05:00
GJ
9af470536b Some things should remain private. 2013-02-05 09:18:37 -05:00
GJ
5349b46122 Update /mcrank to use Bukkit CommandAPI. Addresses #628 2013-02-05 09:18:06 -05:00
GJ
0de7e22408 Adjust how we get the usage strings for the /skillname commands 2013-02-05 08:51:11 -05:00
GJ
03f96daba3 Fix typo in /mcability permissions check 2013-02-05 08:51:11 -05:00
GJ
f6aca88b36 Change /mcmmo to use Bukkit CommandAPI. Addresses #628 2013-02-05 08:51:10 -05:00
GJ
ea32cb9e12 These commands cannot work for online players, period. 2013-02-05 08:51:10 -05:00
TfT_02
1c328e7ac7 Fixed a bug which made it impossible to join other players' parties. 2013-02-05 14:47:09 +01:00
TfT_02
89eef2ce07 Added new config options to allow friendly fire in parties. 2013-02-05 14:47:09 +01:00
TfT_02
433c99e239 Clean up 2013-02-05 14:47:08 +01:00
Glitchfinder
e2faeac505 Updating blast mining permissions and alphabetizing the permissions list. 2013-02-04 15:54:19 -08:00
TfT_02
263cb2823c Oops, forgot to remove debug messages! 2013-02-05 00:46:50 +01:00
TfT_02
5769c8dea9 Update the changelog 2013-02-05 00:44:22 +01:00
TfT_02
3cff8aba16 Add an error message when the config.yml is outdated.
Adressess #626.
2013-02-05 00:44:22 +01:00
TfT_02
e5e19f77b9 Automatically remove inactive party members after 7 days (default)
Inactive meaning, the player has offline for atleast 7 days. This will
prevent the parties.yml file from getting unnecessarily large.
2013-02-05 00:44:22 +01:00
GJ
4d93f3271d Update /mcability to use Bukkit CommandAPI. Addresses #628 2013-02-04 17:35:48 -05:00
GJ
0683745dd2 Update /inspect to use Bukkit command API. Addresses #628 2013-02-04 16:43:37 -05:00
GJ
49ef013152 Add alias to /xprate through the register instead of plugin.yml 2013-02-04 16:00:04 -05:00
GJ
3153bbc973 Typo fix. 2013-02-04 15:45:15 -05:00
GJ
717a258430 Added the other permissions nodes. Addresses #628 2013-02-04 15:10:07 -05:00
GJ
bb945a765c Updating /xprate to use Bukkit command API 2013-02-04 15:09:35 -05:00
Glitchfinder
6d486401b5 Adding a permission for the /mcc command. 2013-02-04 11:58:00 -08:00
Glitchfinder
07df5edc86 Adding new permissions for the /xplock command. 2013-02-04 11:47:32 -08:00
Glitchfinder
ae5ab13533 Adding a permission for the /mchud command. 2013-02-04 11:39:43 -08:00
TfT_02
fc40f545fe Removed Chimaera Wing
"RIP Chimera wing, an archaic item from a decadent past" ~ shatteredbeam
2013-02-04 19:41:23 +01:00
TfT_02
37e01f992d Update the changelog 2013-02-04 17:58:21 +01:00
GJ
b497853e8a Changelog update. 2013-02-04 11:48:19 -05:00
TfT_02
85dc6e51d2 Bleeding particle effect added. 2013-02-04 17:41:32 +01:00
TfT_02
6d5ce1357e More party members = more XP share bonus
Sorry, broke your party settings in config.yml. So now when there are
more party members near, the party share bonus is increased. :)
2013-02-04 17:41:31 +01:00
TfT_02
ac1d556895 Moved this a bit + minor cleanup 2013-02-04 17:41:31 +01:00
GJ
4aceadd777 == is faster than .equals() for enums. 2013-02-04 11:35:52 -05:00
GJ
49de6614c0 Remove more old code from PlayerProfile 2013-02-04 11:28:59 -05:00
GJ
cc50428646 Remove old code from PlayerProfile. 2013-02-04 11:28:21 -05:00
GJ
b60bdc9b17 Fixed /mcrank not working for SQL power level after removal of
SkillType.ALL
2013-02-04 11:22:39 -05:00
bm01
35cdcb62b7 Removed needs for SkillType.ALL
Also apparently made /Skillreset work on offline players and fixed
missing permissions check
2013-02-04 16:33:34 +01:00
GJ
458f7f5f5b Fix /xprate not properly sending "Event started" messages. Fixes #624 2013-02-04 08:47:54 -05:00
GJ
284bab397a Add description string for /skillreset to the locale file 2013-02-04 08:43:42 -05:00
GJ
5f306447a0 Convert /skillreset to Bukkit command methods. Also refactored the name
to SkillresetCommand to fall in line with the naming of all other
command executor classes.
2013-02-04 08:38:13 -05:00
GJ
44b862c0bb Get rid of all the deprecated instances of Users.getProfile() 2013-02-04 08:09:24 -05:00
GJ
74c367c069 Remove unused variable 2013-02-04 07:55:01 -05:00
GJ
c3db026fd9 Changed /mmoedit to use Bukkit command info. Also fixed bug where
/mcrefresh was registered with the info of /mcgod
2013-02-04 07:54:26 -05:00
GJ
958095d11b Update /mcrefresh to use Bukkit command info. Also updated a few
description strings.
2013-02-04 00:55:17 -05:00
GJ
b21dc8631a Remove unused imports. 2013-02-04 00:55:17 -05:00
bm01
03354ed1cb Fixed #630 (null player was used) 2013-02-04 06:32:15 +01:00
Glitchfinder
1a63fc7638 Updating the permissions for the /[skillname] commands. 2013-02-03 16:43:06 -08:00
Glitchfinder
6498c711ba Updating the permissions for the /ptp command and fixing the event it files to properly show who is teleporting where. 2013-02-03 15:40:29 -08:00
Glitchfinder
57c8c94db7 Updating the permissions for the /mctop command. 2013-02-03 14:17:40 -08:00
Glitchfinder
15f212c384 Updating the permission for the /mcremove command. 2013-02-03 13:53:35 -08:00
Glitchfinder
dee384c8b9 Updating permissions for the /mcrefresh command. 2013-02-03 13:45:37 -08:00
Glitchfinder
93ffd950e9 Further updating the permissions for the /mcrank command. 2013-02-03 13:35:36 -08:00
Glitchfinder
b01d80b1f4 Updating the permissions for the /mcrank command. 2013-02-03 13:14:26 -08:00
Glitchfinder
84d01362f9 Updating the permission for the /mcpurge command. 2013-02-03 13:08:12 -08:00
Glitchfinder
939586ce1a Adding a permission for the /mcmmo command. 2013-02-03 13:03:04 -08:00
GJ
2888fdff9e Fixed bug with Hylian Luck when there are no treasures enabled. 2013-02-03 13:31:13 -05:00
bm01
b048cc1e55 Missed that one (formatting issue with /party kick) 2013-02-03 16:49:22 +01:00
bm01
3c94074533 Fixed minor formatting issue with /party owner 2013-02-03 16:47:30 +01:00
bm01
2de8962887 Fixed possible "array overflow" with /party kick 2013-02-03 16:46:46 +01:00
bm01
e37e913f6a Fixed minor formatting issue with /party invite 2013-02-03 16:37:41 +01:00
bm01
51305118fa Moving party stuff from PlayerProfile to McMMOPlayer 2013-02-03 16:27:59 +01:00
bm01
52bd48cde7 Fixed bad /Skillreset usage formatting 2013-02-03 14:08:57 +01:00
bm01
ecf32da760 Fixed /Addxp on all skills not working properly
It was broken because of one of the previous commits
2013-02-03 13:56:47 +01:00
bm01
1dbe56b026 Replaced deprecated calls to Users.getProfile() in our listeners 2013-02-03 13:40:56 +01:00
bm01
f51bdad6b4 Removed unwanted profile check in isNPCPlayer
Is the profile is null, it may be our fault, and because of this check
we would never know about it.
2013-02-03 13:27:47 +01:00
bm01
97d47c19b7 Replaced deprecated calls to Users.getProfile in our APIs 2013-02-03 12:57:29 +01:00
bm01
a1ab6f286b Made xp sharing less ugly by reworking McMMOPlayer xp methods
Notable consequence: checkXP and addLevel in ExperienceAPI are no longer
needed and became deprecated
2013-02-03 12:45:19 +01:00
bm01
6d871c9bdb Properly fixed the NPE in dropItem
It was due to bad logic in Herbalism
2013-02-03 09:12:34 +01:00
bm01
12faebca27 Fixed PlayerFishEvent.getCaught() ClassCastException 2013-02-03 06:00:12 +01:00
bm01
c231a68bb2 Fixed bad formatting with /mmoedit 2013-02-03 05:52:58 +01:00
bm01
bd3db4a425 Fixed Xp not being awarded in parties because of XpShareMode.NONE 2013-02-03 05:25:02 +01:00
NuclearW
5801981147 Chunkmeta and Storage graphs 2013-02-02 22:47:05 -05:00
NuclearW
727cb029a6 om nom nom donut graph 2013-02-02 22:03:50 -05:00
GJ
dd0933c584 Edit /addlevels a bit, along with some command info in plugin.yml 2013-02-02 21:30:21 -05:00
GJ
e92b57c50c Return normal usage, not console usage. 2013-02-02 21:29:55 -05:00
GJ
2e3c1d53f5 Update command registration for /mcgod 2013-02-02 21:25:16 -05:00
GJ
a67e0c1433 Removed the rest of the command disable code from config.yml 2013-02-02 19:22:24 -05:00
GJ
a42a1f4a9f Fixed trying to cast player to SpoutPlayer - need to use
SpoutManager.getPlayer(player) instead.
2013-02-02 19:20:31 -05:00
GJ
8f17ec96f0 Fixed teleport exploit in regards to Archery bonus XP. 2013-02-02 19:07:05 -05:00
GJ
b11e28c880 Don't need to add one here, it sends us out of bounds. 2013-02-02 17:04:11 -05:00
TfT_02
a16d5b62cf Fix issue #620 2013-02-02 20:23:40 +01:00
bm01
e9425625e2 Added missing permissions for mcrank mctop and mcstats 2013-02-02 12:20:02 +01:00
NuclearW
12324017d7 @md-5 says this is good idea
Change from the shade dumping it to org.mcstats to com.gmail.nossr50.util.mcstats
This does seem to make sense, as many plugins shading to one location seems bad.
I think he is just doing it because of an issue with Spigot lately, though.
2013-02-02 04:55:49 -05:00
NuclearW
8aabe1c148 Change metrics to be shaded in, add new graph
New graph checks if a build came from our Jenkins, and reports that
Started new graph for donut version information, waiting for confirmation on data delimiter before proceeding with enabling that
@md-5 is now in mcMMO

Closes #617
2013-02-02 04:38:15 -05:00
bm01
76ff0374ce Removed no longer needed check (related to previous commit) 2013-02-02 09:52:24 +01:00
bm01
09373c45f3 We already have a task for Profile saving 2013-02-02 09:33:19 +01:00
bm01
d0a5454333 Partially fixed /Addxp on offline player
Xp is awarded but in order to level up the player need to log in
and use his skills.
2013-02-02 09:26:44 +01:00
bm01
9ea693d3ce Fixed /Addxp not working properly with two arguments 2013-02-02 09:20:05 +01:00
NuclearW
ebca9fc2da Change getString to use varargs 2013-02-02 02:55:49 -05:00
GJ
c43e8f8f19 Remove unused imports. 2013-02-02 02:13:10 -05:00
GJ
b6b03369f7 Actually use the new /addxp registration function 2013-02-02 02:12:38 -05:00
GJ
0b6e854520 Change some checks around in /addlevels for readability. 2013-02-02 02:11:46 -05:00
GJ
55b17e7d2b Update /addxp to use Bukkit handling by default rather than ours. 2013-02-02 02:07:35 -05:00
GJ
c15fdae32e Change to new build numbering scheme.
Regular dev builds will be -dev#, weekly beta builds will be -beta#

The # increments every time after the weekly beta build.
2013-02-02 01:28:30 -05:00
GJ
0fe232e1f5 Changelog update 2013-02-02 01:07:22 -05:00
GJ
fc33f27899 Update pom.xml for weekly beta release 2013-02-02 00:31:48 -05:00
GJ
e40095977a Remove ac command alias due to Essentials compatibility issues. 2013-02-02 00:14:59 -05:00
GJ
d1f499f6fd Moved around a few more commands. 2013-02-02 00:09:47 -05:00
bm01
610bc42815 Fixing no Xp gain from previous commit 2013-02-02 05:06:47 +01:00
bm01
2006356ccd Fixing Xp share awarding full Xp to the original player 2013-02-02 05:00:39 +01:00
bm01
63e827aefb isEmpty() is prettier <3 2013-02-02 04:42:24 +01:00
bm01
1898537149 Fixed double rounding of shared Xp, rounding up final result instead 2013-02-02 04:33:26 +01:00
Glitchfinder
60033d47ec Adding support for both display names and sender names in the chat API. 2013-02-01 18:59:22 -05:00
Glitchfinder
b633f36131 Adding proper children for the deprecated permissions, and removing extra permissions checks. 2013-02-01 14:36:01 -08:00
Glitchfinder
749443454d Updating permissions for the /mcgod command. 2013-02-01 14:01:11 -08:00
GJ
d68dfe2a32 ACTUALLY fix the NPE this time. 2013-02-01 15:56:23 -05:00
GJ
f3b119b91b Changelog update. 2013-02-01 15:11:23 -05:00
GJ
aca3d5c4c6 Add back the descriptions to plugin.yml for documentation purposes. 2013-02-01 15:09:22 -05:00
GJ
b0acea3353 Fix bug in previous dev build that would make mcMMO never drop items... 2013-02-01 15:07:18 -05:00
GJ
862f5d73e1 Apparently our ItemStack can be null here. 2013-02-01 14:58:03 -05:00
GJ
52bf73aecc Remove unused imports. 2013-02-01 14:43:41 -05:00
GJ
54e5be1961 Removed redundant permissions check for skill commands. 2013-02-01 13:43:24 -05:00
GJ
7fbf3d4f27 Refactoring of general commands - the prior package structure made no
sense.

New package structure splits commands into those normally reserved for
admin use and commands normally available to all players.
2013-02-01 13:41:26 -05:00
GJ
2df285fd7c Having an option to disable commands from the config was a bad idea that
encouraged lazy admins. 

NOTE: If you were using these config options instead of relying on
permissions, you will need to reconfigure these commands to be disabled
via permissions.
2013-02-01 13:34:33 -05:00
GJ
a3e9d12f6a Rework /addlevels to use the built-in Bukkit command stuff. 2013-02-01 13:27:12 -05:00
GJ
89e5e16aad This is a much better way to work with our commands dynamically. It
allows for localized description strings, aliases, etc.

With this addition, our "ugly alias" method in CommandPreProcessEvent is
no longer needed, nor is our alias map.

This also makes us more friendly with Essentials - if Essentials is
enabled, the /repair command will be changed to /mcrepair for
compatibility reasons.
2013-02-01 12:27:24 -05:00
GJ
cec132092f Forgot to add this to the changelog. 2013-02-01 10:45:57 -05:00
GJ
01723b2d36 Locale file updates. 2013-02-01 10:45:14 -05:00
GJ
b463e4ce6f Localize a string I missed last time... 2013-02-01 10:38:28 -05:00
GJ
8c7fd7b1a6 Fix issue where the vanilla XP boost for smelting would be called
regardless of who took the item out of the furnace. Not only does this
fix the exploit, it also fixes an NPE that could occur if the player who
lit the furnance was offline when someone else extracted the items from
it.
2013-02-01 08:03:03 -05:00
GJ
2762a9d1fd Fix NPE on startup relating to old party files without an xp share mode
set.
2013-02-01 07:57:00 -05:00
bm01
137864dc04 Fixed /addlevels not working on offline players
Fixed /addlevels all throwing NPE because of Smelting
Removed use of Users.getProfile()
2013-02-01 11:50:19 +01:00
bm01
ef775f1c24 Removed some deprec(i)ated calls to Users.getProfile() 2013-02-01 11:50:19 +01:00
TfT_02
56617a1c1c Minor cleanup
No need for this here since .addXp() also does xpCheckSkill()
Also, thank you @bm01 for the cleanup! :)
2013-02-01 10:15:28 +01:00
bm01
77e048471e Forgot to use the ShareHandler enum here 2013-02-01 06:51:02 +01:00
bm01
7d83dd8283 Put McMMOPlayer to use where it made sense
It's basically a wrapper for anything related to players, as a
consequence Users.getProfile() is now depreciated.
Also removed SkillTools.xpProcessing() because of some redundancy with
McMMOPlayer.addXp().
+ some cleanup for consistency sake.
2013-02-01 06:38:25 +01:00
GJ
d0c0b9a089 Fixed /mmoedit not giving feedback when modifying another players stats.
Addresses #243
2013-01-31 21:58:09 -05:00
GJ
75894c4419 Clean up a little more from our permissions reworking. 2013-01-31 15:39:21 -05:00
GJ
d3c8a5565a Cleaning up from our deprecated permissions.
Also cleaned up the unholy mess that was SkillResetCommand.
2013-01-31 13:29:42 -05:00
GJ
bd2cd07f46 Better way to deprecate these. 2013-01-31 09:00:17 -05:00
GJ
cd35df17ec Fix a handful of Javadoc issues - need to check through the rest later to ensure that we actually have updated JDs for everything 2013-01-30 19:44:35 -05:00
GJ
a1d710fe3d Fixed the remnants of my attempt at refactoring serialized classes... 2013-01-30 19:44:34 -05:00
Glitchfinder
c34d269f33 Adding a new permissions for the /mcability command. 2013-01-30 16:29:58 -08:00
GJ
01c8b8ad4a Builder > Buffer 2013-01-30 18:58:31 -05:00
GJ
fc5dda78f5 Fixed javadoc issue, also fixed bug where we were trying to compare the Player and a string, rather than the player's name. 2013-01-30 18:49:14 -05:00
GJ
d6e78beb72 More efficient way of handling our strings when setting up Flatfile. Also no reason to initialize those strings. 2013-01-30 18:45:41 -05:00
GJ
f324181190 Remove useless toString() call. 2013-01-30 18:29:44 -05:00
bm01
5c13661c47 Slight cleanup, removed unused import
And this is how we go from build 12xx to 14xx in one week
2013-01-30 23:36:33 +01:00
bm01
8b514d631c Vanilla xp bonus should actually be in beginFishing()
or at least be called by beginFishing()
2013-01-30 23:29:36 +01:00
bm01
13a65e875f Minor Fishing "cleanup" 2013-01-30 22:51:11 +01:00
U-YUE\Sean
a1d4a4b3f8 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2013-01-30 12:26:27 -08:00
U-YUE\Sean
610b87f462 Fixing a permissions loop and reverting a package change to prevent Serialization errors. 2013-01-30 12:25:48 -08:00
TfT_02
374b758700 Fix AxesMastery displaying wrong values 2013-01-30 20:33:19 +01:00
U-YUE\Sean
d32e0962b0 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2013-01-30 11:10:32 -08:00
U-YUE\Sean
1cb9f93f0e Added permissions to the /xprate command. 2013-01-30 11:10:19 -08:00
U-YUE\Sean
4a24ade442 Adding new permissions for the /skillreset command. 2013-01-30 10:56:58 -08:00
GJ
3f6bd7894d Added vanilla XP boost for Fishing - includes permissions, config
options, etc
2013-01-30 13:24:56 -05:00
U-YUE\Sean
cbb941116f Adding new permission for the /mmoupdate command. 2013-01-30 10:03:32 -08:00
U-YUE\Sean
bcaa7ecacb Added new permissions for the /mmoedit command. 2013-01-30 09:55:22 -08:00
U-YUE\Sean
b8eb6186ed Adding permission for the /mcstats command. 2013-01-30 09:50:15 -08:00
U-YUE\Sean
6d5cf2b139 Adding new permissions for the /inspect command. 2013-01-30 09:38:08 -08:00
TfT_02
5e6b1fe362 BeastLore can now display Offline Owner names 2013-01-30 18:35:57 +01:00
GJ
1c0cafc6c8 Fixed the guide usage string showing up every time /skillname was called 2013-01-30 12:30:45 -05:00
GJ
8eee0cb0b0 Use display name for chat events. 2013-01-30 12:25:31 -05:00
GJ
bfe8403d75 Minor cleanup. 2013-01-30 12:22:14 -05:00
U-YUE\Sean
8a852ce22e Adding new permissions for the /addxp command. 2013-01-30 09:09:14 -08:00
U-YUE\Sean
64fc7bcaf8 Updating permissions for the /addlevels command. 2013-01-30 09:06:21 -08:00
GJ
599bbe73b4 More major refactoring. My OCD is better now. 2013-01-30 11:53:51 -05:00
GJ
852872f55c Custom mod support refactoring. 2013-01-30 11:35:33 -05:00
GJ
62a037a4fd Minor cleanup of new party stuff. 2013-01-30 11:25:44 -05:00
GJ
637442149c Updated locale files, added the start of Hungarian locale file (hu_Hu) 2013-01-30 11:20:09 -05:00
TfT_02
9a89c7c49f Added party XP sharing. 2013-01-30 15:17:54 +01:00
GJ
c6ef053aac Fixed a couple of our locale strings getting screwed up due to
refactoring.
2013-01-30 08:36:24 -05:00
GJ
d3b0da4186 Finished tidying up our Spout checking. 2013-01-30 08:08:29 -05:00
bm01
d09cd49f01 Attempt to fix Spout NoClassDefFoundError 2013-01-30 08:44:01 +01:00
GJ
bfa29cbf02 Fixed Spout not being able to precache our resources properly, and
therefore making our XP bars fail. Fixes #587
2013-01-30 00:09:22 -05:00
bm01
74d9fa422f Fixed Shake Mob level not being displayed correctly
Another bug introduced in previous commits
2013-01-30 05:12:34 +01:00
bm01
b43538ee78 Fixed Shake Mob using "data" value as amount
Bug introduced in one of the previous commits
2013-01-30 02:02:42 +01:00
GJ
755b9bc2a1 Removed files I didn't even know we had... 2013-01-29 19:19:36 -05:00
bm01
ae49f0b6e4 Remove unused import
Whoops D:
2013-01-30 01:15:07 +01:00
bm01
063de93eb8 Do not break 1.4.6 compatibility yet 2013-01-30 01:13:29 +01:00
bm01
ec997bd2b6 Fixed Shake Mob not dropping the correct Wool
Bug introduced by my previous commit
2013-01-30 01:02:03 +01:00
bm01
20aa312173 Removed permanent storage of config value in Woodcutting 2013-01-30 01:02:03 +01:00
bm01
48b0050451 Fishing refactoring, fixed bad enchant distribution 2013-01-30 01:02:02 +01:00
GJ
c04b14c751 Add anvil sounds to Salvage. 2013-01-29 19:00:47 -05:00
GJ
3d8aa29b52 Fix startup error from last build due to the removal of the custom spout
repair sound.
2013-01-29 18:58:42 -05:00
GJ
ac7ed67d91 We're now using Bukkit sounds instead of Spout sounds - only
current exception is the custom level-up sound.
2013-01-29 18:36:16 -05:00
GJ
20f6a55df2 Remove duplicate checks. 2013-01-29 12:02:32 -05:00
GJ
60041a1253 Added ability to config Hylian Luck drops through treasures.yml 2013-01-29 11:24:41 -05:00
gmcferrin
1e7b54ef0d Tweak archery distance XP function to reward better. 2013-01-29 10:55:06 -05:00
gmcferrin
d2cb88d93b No need to check if this is wheat... 2013-01-29 10:07:32 -05:00
GJ
659e982c47 Check if the furnace is actually a furnace - fixes ClassCastExceptions
caused by "virtual furnace" plugins.
2013-01-29 08:09:08 -05:00
TfT_02
5bf1e49e43 Edit /mcc information with new party commands
`/party password` can now be used to clear the parties password when no
argument is provided.
Also improved feedback messages when managing your party.
2013-01-29 13:17:38 +01:00
GJ
5b862a4cee Added XP bonus for Archery based on distance from shooter to target. The
farther you are from your target, the more bonus XP you'll earn.
2013-01-29 01:58:03 -05:00
GJ
2aec202e6d Attempting to make Herbalism cleaner... 2013-01-28 16:56:18 -05:00
TfT_02
f5259decab Update the locale files with recent /ptp command changes 2013-01-28 21:28:52 +01:00
TfT_02
0a17bf69c0 Implementing ptp request timeouts.
Also fix and improve a few things as suggested by bm01
2013-01-28 21:24:55 +01:00
GJ
6db78d3cda This might be a bit slower, but it's WAY cleaner. Also prevents us from
having to update this function every time Minecraft adds a new
transparent block.
2013-01-28 12:51:20 -05:00
GJ
0692dd82ad Cleaned up a few things in PartyCommand - removed unnecessary else
statements & function args, removed accidental usage of
Bukkit.getServer() command, fixed some spacing issues.

Added new CommandHelper function to take a player when checking
permissions to avoid double-checking when it's already been verified
that the sender is a player.
2013-01-28 09:16:19 -05:00
GJ
088d4ac14a Removed useless function variable. 2013-01-28 08:36:55 -05:00
GJ
92262d0e47 Cleanup PtpCommand a bit, remove some useless argument passing and else
statements.
2013-01-28 08:36:12 -05:00
GJ
1549f66fd7 Removed unused imports. 2013-01-28 08:16:09 -05:00
GJ
1118cd8ca1 Fixed Spout config files loading / generating when they shouldn't have 2013-01-28 08:15:12 -05:00
TfT_02
d744c6a46d Party teleportation now requires the target player to confirm the teleport request before the teleportation takes place. 2013-01-28 00:52:51 +01:00
TfT_02
765199eba3 Update the changelog with previous changes 2013-01-28 00:35:31 +01:00
TfT_02
cb46040309 Because you can't join your own parties. 2013-01-28 00:35:06 +01:00
TfT_02
abd8223e41 Add /ptp toggle command 2013-01-27 23:35:46 +01:00
TfT_02
e061acb44a Fixing a bug where deflect and disarm would have wrong values.
Adresses issue #593
2013-01-27 22:49:10 +01:00
GJ
cc6850b37d Fixed bug where Green Terra could possibly activate on crops that
weren't fully grown. Also fixed crop growth rates being checked twice.
2013-01-27 16:34:47 -05:00
GJ
a3c92b07cb Jack O' Lanterns are ALWAYS placed blocks. 2013-01-27 16:24:30 -05:00
GJ
e61581c4e6 Fixed mod config files loading / generating when they shouldn't have 2013-01-27 16:21:02 -05:00
GJ
43dbb94a7f Changed Excavation to have individual XP values for each block type,
rather than a base XP value
2013-01-27 01:09:20 -05:00
bm01
d43e61a49c Reimplemented TreeFeller on Jungle Trees experience nerf 2013-01-27 04:20:07 +01:00
NuclearW
7ccadae489 Changes to the changes to the ChatAPI.
mcMMO will not pass null for any events that it creates about itself.
Older plugins which are using depricated methods in ChatAPI will be null.
Newer plugins passing null to ChatAPI will also be null.

Null guarantees that it is not from mcMMO, but from an external plugin that is not specified.
2013-01-26 22:13:49 -05:00
jgeboski
251c152efa McMMOChatEvent: added a field to hold the dispatching plugin
Currently, there is no sane way to detect which plugin dispatched
an McMMOChatEvent. This is problematic for plugins using the ChatAPI
while also listening for McMMOChatEvents as it leads to a message loop
being created.

A "simple" solution is to store a reference to the dispatching plugin in
the McMMOChatEvent. This allows for a plugin to determine if it is an
event dispatched by itself, or some other plugin. In addition, this can
allow for better control within third party plugins to determine where
McMMOChatEvents are dispatched from.

This patch is backwards with existing interfaces.
2013-01-26 21:07:36 -05:00
bm01
a8fa625b5c Fixed parties not being loaded at startup
+ minor cleanup
2013-01-27 01:32:58 +01:00
TfT_02
5151be05b9 Update README.creole 2013-01-27 01:05:12 +01:00
bm01
3f44bd8eac Fixed NPE in Database.checkConnected() 2013-01-27 00:28:03 +01:00
bm01
2eb593e163 Attempt to fix NPE spam when MySQL connection failed
This is how it was before my cleanup, I find what the
methods do and/or how they're named a little weird,
We may want to do something about it.
2013-01-27 00:07:30 +01:00
bm01
2356fda67a Minor cleanup 2013-01-27 00:02:01 +01:00
bm01
bff7919c21 Major cleanup 2013-01-26 23:01:55 +01:00
TfT_02
f1075f800f Cleanup, no need for this in PartyManager 2013-01-26 19:40:20 +01:00
TfT_02
473b9e8bbe Add new party command /party rename 2013-01-26 19:31:17 +01:00
TfT_02
00c84e775f For the sake of consistency, this should be 1.0 instead of 1 2013-01-26 16:26:32 +01:00
TfT_02
a1a630bad2 Update the local files with new party strings 2013-01-26 16:26:32 +01:00
TfT_02
b91b88a74b Better feedback when trying to join a password protected party. 2013-01-26 16:26:32 +01:00
GJ
56e16acce4 Fix bug where smelting allowed for XP gain in Mining/Repair even if
permissions were not present.
2013-01-26 00:25:14 -05:00
TfT_02
4692a461eb burnTimeModifier only needs show two decimal places 2013-01-26 02:13:10 +01:00
GJ
3e04bacf73 Tweak a few things with Herbalism. 2013-01-25 19:21:33 -05:00
bm01
a0a52a3433 Added the possibility to not use a max level for Fishing
by using a negative number, changed default
treasure.yml file accordingly
2013-01-26 01:04:24 +01:00
bm01
188ad359fe Changed Fishing to always give a fish on a successful catch 2013-01-26 01:03:42 +01:00
TfT_02
d601496173 Reworked party commands.
Party commands are now all subcommands of /party. Use /party create
<party-name> to create a new party. To join an existing party, player
can now use /party join <player-name>. You can only join unlocked
parties. New parties are locked by default and require the party leader
to invite members.
2013-01-26 00:40:23 +01:00
GJ
85b909a7ab Change some stuff around with ChatManager, change ChatAPI to route
through ChatManager.
2013-01-25 18:21:17 -05:00
GJ
18a4f5ed40 Fixed bug where Iron Grip was using the attacker's skill values rather
than the defender's
2013-01-25 17:57:42 -05:00
GJ
c4ec9a6df9 Fixed issues with combat abilities not checking cooldowns in last few
dev builds.
2013-01-25 17:21:18 -05:00
bm01
a4aebdc643 Forgot to change references 2013-01-25 22:44:32 +01:00
bm01
b61410b6eb Make this constant 2013-01-25 22:34:35 +01:00
bm01
51d681974c Re-added unbreaking enchant handling for Tree Feller 2013-01-25 22:32:52 +01:00
bm01
071f7edade Fixed inverted check of mob spawner / egg entities 2013-01-25 21:45:52 +01:00
GJ
46f1157030 Clean up more of block listener. 2013-01-25 15:32:11 -05:00
GJ
3cca6d9ab4 Split the listener - those events don't need to happen at HIGHEST
priority.
2013-01-25 15:01:32 -05:00
GJ
91e8051cee Fixed abilities activating with the wrong tool in hand 2013-01-25 13:54:32 -05:00
GJ
c220f0dee5 Fixed Leaf Blower not respected the unlock level set in advanced.yml 2013-01-25 12:41:39 -05:00
GJ
a7be57241c Cleanup listeners a bit more. Also fix bug in recent dev builds where
placed blocks were not properly tracked.
2013-01-25 12:33:48 -05:00
GJ
a35af4dbe6 This is better & cleaner than just comparing the data. 2013-01-25 10:41:43 -05:00
GJ
329f779781 Refactor a bit 2013-01-25 00:56:23 -05:00
GJ
95fa688306 More cleanup. 2013-01-25 00:51:45 -05:00
GJ
3d275a4f53 Hopefully a better fix for the previously mentioned issue. 2013-01-24 23:54:07 -05:00
GJ
06cf0ff2c2 Temporary fix for some of our combat checks not being called properly. A
better fix will be coming soon.
2013-01-24 23:03:00 -05:00
GJ
ba7ebe1319 Minor Database refactoring. 2013-01-24 22:53:02 -05:00
GJ
3efc2138d6 Minor Spout refactoring 2013-01-24 22:47:12 -05:00
GJ
9b0cba9dbe More listener cleanup 2013-01-24 22:43:15 -05:00
GJ
62a5d2db5c Make sure we ignore cancelled events. 2013-01-24 22:24:07 -05:00
GJ
96d59a2e81 A little more cleanup 2013-01-24 22:22:02 -05:00
GJ
f5179cdcea Fixing awkward Bukkit bug related to Flame arrows. 2013-01-24 21:55:56 -05:00
GJ
4639b8b939 Fix typo in /smelting command display. Fixes #580 2013-01-24 20:29:04 -05:00
GJ
9cdfebda9a Trying to clean up duplicate checks & whatnot in our listeners. 2013-01-24 20:10:50 -05:00
GJ
7c59621c9e More cleaning on listeners. Also fixes NPE with itemInHand, because
Bukkit is dumb.
2013-01-24 15:46:29 -05:00
GJ
8736aae2ef Fix NPE when a furnace belonging to a player that has logged out keeps
burning.
2013-01-24 15:35:01 -05:00
GJ
76a987e1e0 PlayerListener cleanup 2013-01-24 14:19:26 -05:00
GJ
9dac898c1c Fixes possible NPE when a furnace is destroyed while someone is still
viewing it.
2013-01-24 11:50:12 -05:00
GJ
ab677e941d Start cleaning up the mess we've made of our listeners. 2013-01-24 11:50:12 -05:00
bm01
29d796b6af Partially reverted my previous fix
ItemStack constructor actually worked,
the issue was about double drops using
the original data, not about TreeFeller.
2013-01-24 16:15:10 +01:00
GJ
276800f999 Change how we handle players not being able to pick up items while using
Berserk.
2013-01-24 09:44:48 -05:00
GJ
8d22df0411 Changelog update 2013-01-24 09:44:48 -05:00
bm01
8d077ff4f2 Cleanup 2013-01-24 15:37:02 +01:00
bm01
58b01021c1 Definitely fixed sideways logs issues
... Apparently
2013-01-24 15:28:18 +01:00
bm01
5a6dc8511f Actually fixed TreeFeller and sideways logs items 2013-01-24 15:13:56 +01:00
GJ
b7bb3f4487 Don't include child skills in these loops. Fixes #577 2013-01-24 09:08:30 -05:00
GJ
bba23de31c Fix typo in Spout notification locale string. Addresses #577 2013-01-24 08:44:08 -05:00
GJ
973279ed40 Fix typo in Iron Grip skill display formatting. Fixes #575 2013-01-24 00:58:43 -05:00
GJ
a4494f0873 Changelog update 2013-01-24 00:06:31 -05:00
GJ
121354e489 We don't need two guides guides. Fixes #572 2013-01-24 00:05:10 -05:00
GJ
531e92bda3 It's over 5000!
Fixes #571
2013-01-23 23:55:51 -05:00
T00thpick1
135bfc2627 Don't cycle when on child skill 2013-01-23 23:49:01 -05:00
GJ
a01882aea5 Because we need to care about the result, not the source.
Also adds a couple of null checks, just to be safe.
2013-01-23 23:09:54 -05:00
t00thpick1
a8b5b438bf Null check 2013-01-23 21:03:02 -05:00
GJ
8ccaf3caf2 Fix ClassCastException 2013-01-23 19:19:35 -05:00
GJ
1337c45f1d Fixed NPE with startup relating to SmeltingCommand. 2013-01-23 19:10:12 -05:00
GJ
a968019799 Rearrange order of listeners in attempt to fix errors on startup. 2013-01-23 18:54:13 -05:00
GJ
0a9e1ba42e Start cleaning up BlockListener. 2013-01-23 18:54:13 -05:00
bm01
7e91776cfb Made Tree Feller a little more aggressive 2013-01-24 00:53:08 +01:00
bm01
9689c50603 Javadoc update & fixes 2013-01-24 00:53:08 +01:00
bm01
bb2eb053da Fixed Tree Feller dropping sideways log items 2013-01-24 00:53:08 +01:00
bm01
de5110310f Fixed placed-log flag checks 2013-01-24 00:53:08 +01:00
GJ
64137995c2 Add advanced.yml config options for Smelting. 2013-01-23 17:07:26 -05:00
GJ
6f45e479bd Fix typo in alias map assignment for Smelting. 2013-01-23 16:50:10 -05:00
GJ
53ac857b43 Update localization files. 2013-01-23 16:39:51 -05:00
GJ
6f0e2437e0 Smelting! 2013-01-23 16:34:01 -05:00
GJ
56d27c3d78 Fixed issues with Hylian Luck & the placed-block flag. 2013-01-23 13:06:13 -05:00
GJ
7919e591cb Move Hylian Luck into a separate listener since it actually cancels the
event.

Priority when cancelling events should not be MONITOR.
2013-01-23 12:53:12 -05:00
GJ
aabbc2f238 Is it a log? There's a function for that...
Also fix leaves dropping logs instead of saplings.
2013-01-23 12:44:00 -05:00
TfT_02
fb31cef68b Fix Gracefull Roll chance being null 2013-01-23 16:14:12 +01:00
bm01
2a89e912f8 Removed debugging code left behind 2013-01-22 23:49:06 +01:00
bm01
ee91ed8708 Fixed sideway logs handling 2013-01-22 23:44:53 +01:00
bm01
69475f92c7 Catch this 2013-01-22 22:24:53 +01:00
bm01
dc2452231d Abstract Woodcutting 2013-01-22 22:04:05 +01:00
bm01
1bbb245e32 More work on Woodcutting and Tree Feller 2013-01-22 21:51:07 +01:00
GJ
1548863a21 Oops. 2013-01-22 14:28:08 -05:00
GJ
9169f53465 Update our description in the /mcmmo command. 2013-01-22 14:05:23 -05:00
GJ
b5542effc2 Locale file updates. 2013-01-22 13:15:38 -05:00
GJ
6b0e7a9c61 Major refactoring. This WILL break any mcMMO-related plugin that
does not properly hook into the API classes. 

This consolidates the skill-related classes into their own individual
packages, and moves several misc skill classes into the main Skill
package as well. This also moves all Party & Spout related files into
their own respective packages as well.
2013-01-22 12:43:25 -05:00
GJ
00d50953ad Update /repair command 2013-01-22 12:26:35 -05:00
GJ
397dd96383 Update Woodcutting command. 2013-01-22 11:52:06 -05:00
GJ
cac5f15a37 I broke the build... 2013-01-22 11:19:26 -05:00
GJ
74c32c4e59 Cleanup of UnarmedCommand.java 2013-01-22 11:18:12 -05:00
GJ
e048a6d0d0 Cleanup Swords & Taming commands 2013-01-22 10:48:10 -05:00
GJ
65d71db72f Cleaning up Herbalism & Mining commands. 2013-01-22 02:20:05 -05:00
GJ
b4fffe154d Shoulda been a double. 2013-01-22 01:57:48 -05:00
GJ
716c4d3783 Fixed Woodcutting accidentally using Mining double drop values. 2013-01-22 01:56:54 -05:00
GJ
5a9ca96a0f Cleanup of HerbalismCommand, added config options for Hylian Luck 2013-01-22 01:52:34 -05:00
GJ
cedfb1a538 Fixed bug with checking if an entity is wearing armor. 2013-01-22 00:59:20 -05:00
GJ
176ffcc3d1 Cleanup on FishingCommand, split Farmer's Diet & Fisherman's Diet into
distinct config values. Fixes #556
2013-01-22 00:47:56 -05:00
GJ
91b318e8f7 We've been putting things in the wrong part of the changelog... 2013-01-21 23:12:29 -05:00
GJ
3cc9672ff3 Fixed an inverted check on Impact. 2013-01-21 23:03:14 -05:00
bm01
946d845987 Fixed the merge, I think 2013-01-22 02:43:49 +01:00
bm01
eef5df33b3 Changelog update 2013-01-22 02:39:13 +01:00
bm01
f0f7dee3c2 Optimized Tree Feller
And cleaned up WoodCutting a little
2013-01-22 02:39:13 +01:00
GJ
ddbf5a559a Copy-pasta code is bad. 2013-01-21 20:01:33 -05:00
GJ
67fd45ef25 Avoid a few unnecessary calls. 2013-01-21 19:36:15 -05:00
GJ
7f8beca33c Synchronizing watches... 2013-01-21 19:19:25 -05:00
GJ
0fcf033ecc Changelog update... 2013-01-21 19:08:44 -05:00
GJ
ea4048dce9 Regardless of case, we need both a position & stat value for this.
Fixes #541
2013-01-21 19:07:17 -05:00
GJ
0a295f7738 Eclipse, y u do that? 2013-01-21 17:32:31 -05:00
GJ
0711454e31 General cleanup to satisfy my OCD a little while longer. 2013-01-21 17:22:54 -05:00
GJ
900623461a Useless else statements. 2013-01-21 17:15:53 -05:00
GJ
9512879cc7 Remove unused imports. 2013-01-21 12:36:00 -05:00
GJ
299c7ff804 Because McMMOPlayerUnarmEvent is a silly name. 2013-01-21 12:35:38 -05:00
NuclearW
0276294569 Add McMMOPlayerUnarmEvent 2013-01-21 03:53:25 -05:00
GJ
06b75386b9 Because that's NOT how you spell sugar... 2013-01-20 22:37:25 -05:00
Glitchfinder
16bc359f99 Merge pull request #544 from Glitchfinder/master
Fixing a new duping bug. And this time it was NOT our fault!
2013-01-20 18:09:03 -08:00
bm01
c8013421e6 Few chunk load optimizations 2013-01-21 03:07:18 +01:00
Glitchfinder
c1e82b566e Fixing a new duping bug. And this time it was NOT our fault! 2013-01-20 18:06:30 -08:00
Glitchfinder
f7aba26be2 Merge pull request #543 from Glitchfinder/master
Slightly reducing the processing required to load and unload chunks.
2013-01-20 16:04:35 -08:00
Glitchfinder
77ffc9c3c2 Removing unnecessary ArrayLists 2013-01-20 15:59:57 -08:00
Glitchfinder
9a6ebb0b9a Slightly reducing the processing required to unload chunks. 2013-01-20 15:52:00 -08:00
Glitchfinder
57d1cd5f63 Further alleviating the time it takes to load chunks. 2013-01-20 15:46:53 -08:00
GJ
b7354779d4 Minor changes to try & reduce method calls. 2013-01-20 16:07:27 -05:00
GJ
0cdb50e538 Use variables to save on some calls. 2013-01-20 15:51:07 -05:00
GJ
37469232b0 Once more, into the breach. 2013-01-19 17:59:21 -05:00
GJ
0c52260a89 1.3.14 bugfix release. 2013-01-19 17:51:16 -05:00
Glitchfinder
a85c9679a9 Merge pull request #536 from Glitchfinder/master
Fixing a memory leak with mob tracking.
2013-01-19 14:05:17 -08:00
Glitchfinder
d625edf53e Forgot the changelog. 2013-01-19 14:04:17 -08:00
Glitchfinder
643af1c32b Fixing a memory leak involving mob tracking. 2013-01-19 14:02:23 -08:00
bm01
e7ceef479e Removed extra durability loss from Leaf Blower 2013-01-19 20:47:15 +01:00
bm01
0545ed434d Removed unnecessary calls 2013-01-19 20:44:51 +01:00
GJ
b9bf3f96d2 Added new Hylian Luck skill to Herbalism. 2013-01-19 12:33:57 -05:00
GJ
f184e7bd01 Sync all our locale files together... again. 2013-01-19 01:55:35 -05:00
NuclearW
e1804cded4 Towards 1.3.14 2013-01-18 22:00:25 -05:00
NuclearW
09eabe98c4 1.3.13 Release 2013-01-18 20:44:00 -05:00
TfT_02
173cb001cb Update the changelog 2013-01-19 02:27:42 +01:00
TfT_02
7d6a4d11fd They came pretty soon! Right? 2013-01-19 01:48:20 +01:00
GJ
11ea6b269e Fix issues with properties files & formatting. 2013-01-18 19:34:19 -05:00
Glitchfinder
372950071a Merge pull request #532 from Glitchfinder/master
Removing detritus left over from recent commits.
2013-01-18 15:47:38 -08:00
Glitchfinder
b424ecfd3e Removing ChunkletUnloader and dependents, since they are no longer necessary. 2013-01-18 15:39:02 -08:00
Glitchfinder
fc38bbd179 Merge pull request #530 from Glitchfinder/master
Updating entity tracking and such.
2013-01-18 14:57:52 -08:00
Glitchfinder
00f24fd5bd Reducing CPU usage on chunk load. 2013-01-18 14:55:29 -08:00
Glitchfinder
50de88a0a0 Fixing minor spacing issue. 2013-01-18 14:47:55 -08:00
Glitchfinder
ca2673f258 Condensing entity tracking into a single set of storage, to reduce CPU use. Also handily causes invalid falling blocks to be removed. (Fell out of the world, etc) 2013-01-18 14:43:14 -08:00
T00thpick1
7d416a90de Redundant as they are caught in finally 2013-01-18 16:18:44 -05:00
Glitchfinder
d09526e470 Changing chunk unloading to patch logic hole for entity tracking. 2013-01-18 12:39:57 -08:00
GJ
ed68f227ac Not closing the objectStream here is BAD. 2013-01-18 15:28:42 -05:00
NuclearW
f72b1e7eec Unsetting up Travis CI. 2013-01-18 14:25:06 -05:00
GJ
bbd756f0d3 Because I don't know how to format our chat properly. 2013-01-18 14:16:18 -05:00
GJ
87a9c12827 Remove my nonworking debug code so mcMMO will actually start. 2013-01-18 14:01:20 -05:00
NuclearW
ebd83e1f19 Support some new stuff in our locale files 2013-01-18 13:59:20 -05:00
GJ
5b4b99f44e Fix party/admin chat changing colors. 2013-01-18 13:22:51 -05:00
GJ
d153e3e25c Go on and remove the placed flag when it first falls. 2013-01-18 11:52:38 -05:00
GJ
e3b3b7cfdb Useless check for air.
The block will always be replacing either air, water, or lava. The check
for whether or not it's being tracked is sufficient.
2013-01-18 09:41:46 -05:00
GJ
2c78bac8f7 We only care about sand & gravel.
Technically this was already addressed because no other blocks would
have their place store set to true, but this eliminates unnecessary
overhead caused by the checking of other falling blocks - anvils, dragon
eggs, and TNT.
2013-01-18 09:37:03 -05:00
GJ
db1c0647ed Fix issue with tracking falling sand & gravel. 2013-01-17 23:26:18 -05:00
T00thpick1
2f16dbc9b5 Explicitely state desired order 2013-01-17 21:35:35 -05:00
T00thpick1
7e7ab249c2 Order correctly to match mcrank 2013-01-17 21:31:50 -05:00
T00thpick1
1d2298e5f6 Join tables in query 2013-01-17 20:57:06 -05:00
T00thpick1
b53b5bbc6c Update Changelog.txt 2013-01-17 18:37:58 -05:00
GJ
0dfd2fe9ef ACTUALLY fix issue with fishing enchantments. Also updated the
changelog.
2013-01-17 18:25:26 -05:00
T00thpick1
c0b3a4e929 Index tables 2013-01-17 18:11:28 -05:00
GJ
5830bf461d Fix fishing not handling enchants right. 2013-01-17 15:32:28 -05:00
GJ
857bb00c8a Because this way is easier. 2013-01-17 15:20:20 -05:00
GJ
c5ae4ca615 Update issue tracker in pom.xml 2013-01-17 14:48:51 -05:00
nossr50
abb0184e49 Fixed a bug where Triple Drops wouldn't happen. 2013-01-17 11:23:52 -08:00
nossr50
b11762da99 Absolutely no reason to do it that way 2013-01-17 10:28:31 -08:00
GJ
946d00cce6 Change admin chat prefix to use "[" instead of "{" due to issues with
loading properties files.
2013-01-17 12:28:16 -05:00
GJ
0262255bea Fixed bug where Skull Splitter would be applied twice. 2013-01-17 12:04:56 -05:00
GJ
38a8a6f2ff Fix possible NPE when using the PartyAPI to add a player to a party that
doesn't exist.
2013-01-17 11:26:55 -05:00
GJ
a6446563d8 Sync the rest of the localization changes. Fixes #464 2013-01-17 11:11:38 -05:00
GJ
225adb5cce Rearranged a few things in the changelog. 2013-01-17 11:03:58 -05:00
GJ
a9c722de67 Wrapping up the localizations... though I'm sure there are probably
still some that got missed.
2013-01-17 11:02:55 -05:00
GJ
49610e372f Localizing more commands. 2013-01-17 01:36:56 -05:00
GJ
a33768de1b Add missing locale strings to our two weird locale files. 2013-01-17 00:46:38 -05:00
GJ
790b31c60e Looks like we've got to escape those. Fixes #526 2013-01-17 00:05:11 -05:00
GJ
37c92b8d7c Localize /addlevels and /addxp commands 2013-01-16 23:58:12 -05:00
GJ
07211611a6 Missed one. 2013-01-16 23:36:00 -05:00
GJ
ea7fee2a53 Localize /mmoedit, /mmoupdate, and /mcpurge 2013-01-16 23:31:28 -05:00
GJ
89da8b832f Localize chat commands and /invite 2013-01-16 22:13:30 -05:00
GJ
5f4c83b6a1 Localize /mchud & /ptp 2013-01-16 18:09:02 -05:00
GJ
2e751b1438 Localize XpLock command. 2013-01-16 17:38:00 -05:00
GJ
1a888d3116 Formatting, and reminding myself to come back and fix this even further. 2013-01-16 17:37:35 -05:00
GJ
2a4fe4aa48 Because lowercase class names are just wrong... 2013-01-16 17:13:56 -05:00
GJ
4c81eb3058 Localizing, and removing a duplicate line. 2013-01-16 17:13:04 -05:00
GJ
64c20d0e24 Because toothplck1 doesn't know how to locale, apparently. 2013-01-16 16:58:00 -05:00
GJ
ff186d5d9d Make our StructureGrowEvent only care about player-planted trees. 2013-01-16 16:47:04 -05:00
GJ
734d691e00 Fix issue where Tree Feller wouldn't work on the base of a
player-planted tree. Fixes #524
2013-01-16 16:16:11 -05:00
T00thpick1
51777dbe85 Import chatColor 2013-01-16 16:15:03 -05:00
T00thpick1
fb1d48fcae Output Header along with info for mcRank 2013-01-16 16:13:31 -05:00
GJ
41ae8cbbf3 Sync all current locale changes across languages.
Also fixes the missing % signs in some locale strings.
2013-01-16 15:45:12 -05:00
nossr50
9717be3da8 Minor cleanup 2013-01-16 12:09:03 -08:00
nossr50
67a4efa03e FFS Leaderboards will only update every 10 minutes 2013-01-16 12:02:41 -08:00
nossr50
fd4f0f4096 mcrank FFS output is now consistent with SQL 2013-01-16 11:58:14 -08:00
GJ
957605d46b More localization updates. 2013-01-16 14:28:59 -05:00
GJ
55f824e0c8 More work on localization update 2013-01-16 14:03:32 -05:00
GJ
faa22002e3 Start of major localization update. 2013-01-16 14:03:31 -05:00
t00thpick1
5d0e85452a Update Changelog.txt 2013-01-16 14:03:31 -05:00
t00thpick1
8c61e35fde Update Changelog.txt 2013-01-16 14:03:30 -05:00
TfT_02
bdfdc61e7f Fixing accidental merge of Mining and Repair guides. 2013-01-16 14:03:30 -05:00
TfT_02
b333916f56 Adding Archery & Axes guides to all the other language files.
It's better to have atleast an English guide than no guide at all.
2013-01-16 14:03:30 -05:00
TfT_02
737d4e2d65 We're sorry for giving the phrase "Coming soon..." a whole new meaning.
More guides coming soon! (This time with soon, we actually mean soon)
2013-01-16 14:03:29 -05:00
T00thpick1
c0dfcfd9f6 More changes 2013-01-16 13:28:14 -05:00
T00thpick1
c073c7ed3a Make mcRank Async in SQL 2013-01-16 02:50:18 -05:00
GJ
7fa1a8c6c7 Make /mctop [skillname] work for localized skillnames 2013-01-16 00:06:14 -05:00
GJ
037fd890dc Use localized skill name in skill guide string.
Still need to localize the REST of the strings relating to the skill
guides, though.
2013-01-15 23:40:34 -05:00
GJ
d673676a8a Add localized skill names to Perks.Lucky.Desc in skill commands. 2013-01-15 23:30:58 -05:00
nossr50
793538d4ef Fixing mcrank reading from FFS when on SQL 2013-01-15 20:09:49 -08:00
GJ
92fc00bb0a Merge pull request #521 from t00thpick1/patch-2
We have to stop meeting like this, database.java
2013-01-15 20:02:20 -08:00
t00thpick1
9d70a2a9a6 We have to stop meeting like this, database.java 2013-01-15 22:42:56 -05:00
Glitchfinder
46a5245a1d Merge pull request #520 from t00thpick1/patch-2
SQL stuff
2013-01-15 19:35:06 -08:00
t00thpick1
9b94fba3a6 The final frontier 2013-01-15 22:27:47 -05:00
t00thpick1
a6144f6dee Hehe no silly hat for me 2013-01-15 22:24:46 -05:00
NuclearW
615eb9666e Add repo 2013-01-15 22:19:03 -05:00
t00thpick1
94a4f628c7 Fix mcremove for sql 2013-01-15 22:14:05 -05:00
t00thpick1
d440876bbb Close statements correctly, add update function 2013-01-15 22:08:59 -05:00
t00thpick1
32c62fd7eb Actually fix discrepencies between mcrank + mctop 2013-01-15 22:00:28 -05:00
Glitchfinder
65f78ba447 Merge pull request #519 from t00thpick1/patch-2
Fix discrepencies between mctop and mcrank in sql
2013-01-15 18:37:34 -08:00
t00thpick1
9c9a097ff3 Fix discrepencies between mctop and mcrank 2013-01-15 21:20:33 -05:00
Glitchfinder
ff6cdc3e9d Merge pull request #516 from t00thpick1/patch-2
One more change
2013-01-15 17:00:42 -08:00
t00thpick1
24367b350d One more change 2013-01-15 19:40:17 -05:00
nossr50
e0da44b34a Merge pull request #515 from t00thpick1/patch-2
Fix mcRank command for SQL
2013-01-15 16:30:35 -08:00
t00thpick1
ea13ce09c9 Apostrophe's are important 2013-01-15 19:24:10 -05:00
nossr50
ef69217b81 Merge pull request #514 from t00thpick1/patch-2
SQL for mcRank command
2013-01-15 16:16:53 -08:00
t00thpick1
7e297ac884 Name methods properly 2013-01-15 19:09:48 -05:00
t00thpick1
e6e8470851 Should be capitalized 2013-01-15 19:08:41 -05:00
t00thpick1
89a36ae47e Last change 2013-01-15 19:04:30 -05:00
t00thpick1
137c46b8ce Part two of sql mcRank 2013-01-15 19:03:13 -05:00
t00thpick1
5512bd7df6 Part one of sql for mcRank 2013-01-15 18:35:21 -05:00
nossr50
96e2cfaad6 Tip: Shoot the cyberdemon until it's dead. 2013-01-15 15:10:48 -08:00
nossr50
f7d482e7bc Sometimes I forget how to use git (all the time) 2013-01-15 14:55:41 -08:00
nossr50
6c67308a1f Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2013-01-15 14:49:55 -08:00
nossr50
6bbdbee669 FFS Leaderboard rewrites, and new mcrank command. 2013-01-15 14:49:20 -08:00
GJ
9204b23d51 Allow configuration of Skull Splitter damage modifier. 2013-01-15 17:00:56 -05:00
GJ
7203a0fcad Changelog update. 2013-01-15 16:42:20 -05:00
GJ
5bdf4b5dcc Finish Axe restructuring, modify a little bit of Swords stuff as well. 2013-01-15 16:38:44 -05:00
GJ
105f088576 Remove unused variable. 2013-01-15 16:36:39 -05:00
GJ
f40433fc99 Axe restructuring. 2013-01-15 16:16:46 -05:00
GJ
bbbd12d461 Fix issue where Tree Feller affected player-placed blocks. Fixes #507 2013-01-15 13:13:20 -05:00
GJ
81dae8c43d Fix NPE resulting from using /mcremove command on a Flatfile DB. Fixes
#509.
2013-01-15 10:51:06 -05:00
GJ
ec6a7e79d6 ACTUALLY fix issue with TNT damage - Fixes #510. 2013-01-15 10:34:13 -05:00
GJ
630b64462e Fixed a bug with Blast Mining incorrectly handling reduced TNT damage. 2013-01-15 10:01:15 -05:00
GJ
72b8eb85b0 NPEs are bad and I should feel bad. 2013-01-14 17:38:47 -05:00
Glitchfinder
a92843533b Merge pull request #506 from Glitchfinder/master
Further reducing lag when saving or unloading a world.
2013-01-14 14:25:18 -08:00
GJ
83855268d5 To keep me from accidentally deleting this again... 2013-01-14 17:23:39 -05:00
Glitchfinder
67e1defdb8 Further reducing lag when saving or unloading a world. 2013-01-14 14:18:01 -08:00
GJ
724aad8504 Allow for a chance at 3x drops from Super Breaker again - Addresses #456 2013-01-14 17:11:35 -05:00
Glitchfinder
5b1337ed07 Merge pull request #505 from Glitchfinder/master
Fixing some leaderboard-related NPEs.
2013-01-14 13:22:46 -08:00
Glitchfinder
a64e177c21 Fixing some NPEs related to having an empty leaderboard. 2013-01-14 13:09:11 -08:00
GJ
e7aafb7242 Merge pull request #504 from Glitchfinder/master
Making it impossible to attempt to drop air
2013-01-14 12:10:30 -08:00
Glitchfinder
75e52bbe66 Making it impossible to attempt to drop air. 2013-01-14 11:31:11 -08:00
GJ
348887f799 Refactoring, removing useless variables, changing ints to doubles, etc. 2013-01-14 12:41:39 -05:00
GJ
8915a535c6 No point casting from int to int. 2013-01-14 12:03:42 -05:00
GJ
0587741437 More Axe restructuring, changing some config values from int to double,
added function to duplicate code.
2013-01-14 11:55:43 -05:00
Glitchfinder
dd766d5363 Merge pull request #501 from t00thpick1/patch-1
Incorrect key on changelog entries
2013-01-13 21:53:25 -08:00
GJ
8e2707d33e Duplicate code is stupid. 2013-01-14 00:47:47 -05:00
t00thpick1
3390c2dbf2 Incorrect key on changelog entries 2013-01-14 00:35:47 -05:00
GJ
268db10361 Parameterize our ArrayLists. 2013-01-14 00:34:01 -05:00
GJ
ed5120eead This should be static access. 2013-01-14 00:27:30 -05:00
GJ
aab532f475 Remove useless else. 2013-01-14 00:27:16 -05:00
GJ
00ee75bb29 Remove unused imports. 2013-01-14 00:26:18 -05:00
GJ
e7e680fd8e Updating the SQL for the purge command, adding config options for
purging old users.
2013-01-14 00:25:31 -05:00
GJ
7b334601c6 Merge pull request #500 from t00thpick1/master
More SQL stuff
2013-01-13 21:09:40 -08:00
T00thpick1
050cb8c5f4 Speed up purgeOldUsers task 2013-01-14 00:06:01 -05:00
Glitchfinder
cb8af637e1 Merge pull request #498 from Glitchfinder/master
Reducing CPU usage as a result of unloading chunks.
2013-01-13 20:09:19 -08:00
Glitchfinder
c1bbc685e6 Fixing a minor spacing issue. 2013-01-13 20:05:20 -08:00
Glitchfinder
d5d6f7e860 Reducing CPU usage as a result of unloading chunks. 2013-01-13 20:02:11 -08:00
Glitchfinder
c2738d247a Merge pull request #495 from Glitchfinder/master
Converting the calls back to getDyeData().
2013-01-13 18:29:37 -08:00
Glitchfinder
f73d0dbc40 Missed one of the calls. 2013-01-13 18:24:43 -08:00
Glitchfinder
395e243730 Converting calls again. 2013-01-13 18:23:11 -08:00
Glitchfinder
4d1bcf1cc0 Merge pull request #494 from Glitchfinder/master
Renaming a call to patch new errors.
2013-01-13 18:01:23 -08:00
Glitchfinder
eb2c552316 Bukkit Devs renamed a method and didn't leave a mirror in the old name. 2013-01-13 17:56:05 -08:00
TfT_02
664239c567 Fixing a java.io.FileNotFoundException when using SQL 2013-01-14 00:20:48 +01:00
TfT_02
06df8e7f7b Formatting 2013-01-14 00:20:48 +01:00
GJ
21a0849a5b Fix t00thpick's mistake. :p 2013-01-13 16:22:56 -05:00
GJ
1f660c8c5b Merge pull request #492 from t00thpick1/master
Speed up powerless sql users purge
2013-01-13 13:20:50 -08:00
T00thpick1
14f5a25633 Speed up SQL powerless users purge 2013-01-13 16:09:47 -05:00
GJ
606195c78a Added option to disable gaining Acrobatics XP from dodging lightning
strikes. Fixes #481
2013-01-13 16:04:02 -05:00
TfT_02
6a7f92b4e2 Fixed missing spaces resulting in Arcane Forging Settings being ignored 2013-01-13 12:53:59 +01:00
TfT_02
0e1646e3a7 Fixed removing to many '%' from locale files 2013-01-13 12:53:59 +01:00
NuclearW
ea5af0397e Merge pull request #488 from t00thpick1/master
One more fix
2013-01-12 20:52:10 -08:00
T00thpick1
6ed0038b1e Result rows start at 1 not 0 2013-01-12 23:24:35 -05:00
Grant
00640fe39b Merge pull request #487 from t00thpick1/master
Should fix mcTop and reduce used queries from 11 to 1 - Fixes #483
2013-01-12 20:10:24 -08:00
T00thpick1
4fb7d60eee Java loop should work right now, forgot to order it earlier 2013-01-12 21:58:22 -05:00
T00thpick1
c54755b9c1 Forgot to format 2013-01-12 21:30:53 -05:00
T00thpick1
07c9b614bc Increment place for display 2013-01-12 21:29:28 -05:00
T00thpick1
7bea8f5120 Fix MctopCommand and make it more efficient 2013-01-12 21:26:48 -05:00
gmcferrin
ea97dcdb55 Fix missing Spout check. Will switch to Bukkit sounds soon. 2013-01-12 19:17:29 -05:00
TfT_02
931bafe962 Adding missing line to locale files
Forgot to add this in my previous commit
2013-01-13 00:33:54 +01:00
TfT_02
a3a6509410 Update the changelog 2013-01-13 00:26:18 +01:00
TfT_02
5e26f2e707 Fixing silly calculations by me. 2013-01-13 00:26:18 +01:00
TfT_02
54ef85e1a3 Fishing in the rain gives you a higher chance of getting magical items! 2013-01-13 00:26:18 +01:00
TfT_02
6f29e475ee Nothing to see here, just some boring patches and fixes! 2013-01-13 00:26:18 +01:00
gmcferrin
e6607783e9 One last time... 2013-01-12 01:43:40 -05:00
gmcferrin
2021a0b065 Finish fixing CASCADE_DELETE issues... I think. 2013-01-12 01:23:16 -05:00
gmcferrin
0871a96399 Fix SQL syntax issue. 2013-01-12 00:34:52 -05:00
gmcferrin
2ed5e8e717 Fixes issue #315 - Fishing will now properly respect min/max levels in
treasures.yml
2013-01-11 17:55:54 -05:00
gmcferrin
0c61cc8bdc More things can be enchanted now. 2013-01-11 17:35:28 -05:00
gmcferrin
c2bad4419b Make the purge task available as a command. 2013-01-11 16:33:49 -05:00
gmcferrin
d0e2358fab This is a much better way to delete things. 2013-01-11 15:26:56 -05:00
TfT_02
db95085b26 Use the DecimalFormatter from SkillCommand
Why didn't I do this in the first place..
2013-01-11 19:07:07 +01:00
gmcferrin
08592cbacf Hopefully speed up UserPergeTask 2013-01-11 12:12:19 -05:00
gmcferrin
487e67d208 Because NuclearW said I was wrong...
"Final is final unless it's not really final."
2013-01-10 23:15:53 -05:00
gmcferrin
a8abfdae5e Start Axe restructuring. 2013-01-10 22:39:08 -05:00
gmcferrin
6496816692 Fixed the null check I broke. 2013-01-10 22:06:50 -05:00
gmcferrin
364c18b842 Leave purge task disabled by default until we can speed it up. 2013-01-10 21:56:48 -05:00
gmcferrin
e20098d462 Fixed up the log messages. 2013-01-10 21:54:32 -05:00
gmcferrin
d25a314d3a Fix bug with UserPurgeTask... 2013-01-10 21:41:35 -05:00
gmcferrin
3dde331f9d Add some debug so we can find the problem... 2013-01-10 21:11:11 -05:00
gmcferrin
f7e56d9833 (Hopefully) Fix NPE, delay PurgeTask start for a few seconds just to be
safe.
2013-01-10 20:49:33 -05:00
gmcferrin
b554fb342a Helpful logging! 2013-01-10 20:33:48 -05:00
gmcferrin
6d9ef91315 Make purge task run options configurable. Also adds ability to disable
the task entirely.
2013-01-10 19:58:25 -05:00
gmcferrin
ce42da5806 Added task to prune old and powerless users from the SQL database.
*** WARNING: THIS WILL RUN AUTOMATICALLY ON YOUR DB. IF YOU ARE WORRIED
ABOUT DATA LOSS, BACK UP YOUR SQL DATA BEFORE INSTALLING THIS BUILD ***
2013-01-10 19:36:11 -05:00
TfT_02
5b5413c1a2 Merge pull request #475 from TfT-02/master
Moving Fishing and Arcance Forging settings to advanced.yml
2013-01-10 15:31:38 -08:00
TfT_02
6cdb27aef0 Moving Fishing and Arcance Forging settings to advanced.yml 2013-01-11 00:21:18 +01:00
Glitchfinder
2205ad0772 Merge pull request #474 from Glitchfinder/master
Added a cleanup task to remove inavlid spawned mobs.
2013-01-10 14:30:50 -08:00
Glitchfinder
637e826c1b Adding a cleanup task to remove invalid entities from the spawned mob storage. 2013-01-10 14:12:41 -08:00
TfT_02
b19395b40d Also display possible lucky perk for MagicHunter 2013-01-10 22:56:15 +01:00
TfT_02
085a25306c Make the MagicHunter Chance configurable 2013-01-10 22:54:57 +01:00
TfT_02
88c39dbb72 Now displays the new magic find chance 2013-01-10 22:11:49 +01:00
Glitchfinder
91670d3945 Merge pull request #473 from Glitchfinder/master
Alleviating hangtime on world save
2013-01-10 12:36:10 -08:00
TfT_02
bdfd7d9839 Display Endurance Perk stats in skill commands 2013-01-10 21:33:50 +01:00
TfT_02
e01b6f175c Use lucky variable; Don't use the actual permission node when not needed. 2013-01-10 21:33:50 +01:00
TfT_02
3f899380d9 Fixing two typos @Jobsti 2013-01-10 21:33:50 +01:00
Glitchfinder
2513b4ca23 Alleviating hangtime on world save. 2013-01-10 12:33:30 -08:00
gmcferrin
93180ccd06 Because 50% was too high. 2013-01-10 15:28:02 -05:00
gmcferrin
f43b4ebdc5 Clarify the way fishing enchantments work - need to fix command display
still.
2013-01-10 15:22:47 -05:00
Glitchfinder
ff4832a6a2 Merge pull request #472 from Glitchfinder/master
Alleviating excessive lag.
2013-01-10 11:25:59 -08:00
Glitchfinder
8267a10f41 Adding an explanation in the comments. 2013-01-10 11:23:58 -08:00
Glitchfinder
771ef6e16e Disabling the place store saveWorld call for when a world is saved due to excessive lag. 2013-01-10 11:13:18 -08:00
gmcferrin
f7ef2b768f Added permission nodes for using Green Thumb with cocoa. 2013-01-10 13:07:14 -05:00
gmcferrin
74c3ce0552 Support for auto-replanting cocoa. 2013-01-10 12:55:54 -05:00
Glitchfinder
67b63f84f1 Merge pull request #471 from Glitchfinder/master
Making errors during the chunk converion process silent.
2013-01-10 09:44:11 -08:00
Glitchfinder
f8c5c380b1 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2013-01-10 09:27:05 -08:00
Glitchfinder
2708449089 Making errors during the chunk conversion process silent. 2013-01-10 09:26:54 -08:00
gmcferrin
bcfec56300 Because it's not just Citizens that uses NPCs. 2013-01-10 12:18:48 -05:00
gmcferrin
ec6b9d4387 Attempted fix for CombatTag dupe glitch - don't apply AoE damage to
NPCs.
2013-01-10 12:18:08 -05:00
gmcferrin
621f739831 Axes restructuring, part 1 2013-01-10 09:26:28 -05:00
gmcferrin
607d2b8bd7 Abstraction is good. 2013-01-10 09:26:01 -05:00
gmcferrin
c1463c3257 Because we don't need that many Random objects. 2013-01-09 23:46:35 -05:00
gmcferrin
e036b7ac70 We don't need that param. 2013-01-09 23:15:29 -05:00
gmcferrin
4a4db675f1 More OCD. 2013-01-09 23:07:32 -05:00
gmcferrin
e193da2cd7 My OCD made me do it. 2013-01-09 23:03:17 -05:00
gmcferrin
c60cbe824c Function even MORE things. 2013-01-09 22:53:26 -05:00
gmcferrin
8b9432d1d9 So many useless else statements... 2013-01-09 22:43:21 -05:00
gmcferrin
75a5ffcb10 Cleanup our iterators. 2013-01-09 22:18:41 -05:00
gmcferrin
6cc2fc7a6e Functions are still better than copy-pasted code. 2013-01-09 22:09:07 -05:00
gmcferrin
4bb6f68e6f No sense in repeating static variables. 2013-01-09 21:49:17 -05:00
gmcferrin
00e1521d46 Functions >> copy-paste code. 2013-01-09 21:47:03 -05:00
gmcferrin
1055186e86 Finished Mining restructuring. 2013-01-09 21:44:53 -05:00
gmcferrin
fc17448473 Changelog update. 2013-01-09 19:47:21 -05:00
gmcferrin
1839f6ce8c Restructuring Blast Mining. 2013-01-09 19:45:34 -05:00
TfT_02
39e9e426ef Fixing #465 /swords always displaying 5 seconds as SerratedStrikes length 2013-01-09 21:35:33 +01:00
TfT_02
7c2d590951 Finishing adding comments 2013-01-09 17:21:56 +01:00
TfT_02
551b73ea74 Another confusingly named config node 2013-01-09 17:18:20 +01:00
TfT_02
fca095689e Fixed wrongly named config node 2013-01-09 16:54:01 +01:00
TfT_02
e76078fc89 Updated German translation by @Jobsti #462 2013-01-09 15:54:20 +01:00
gmcferrin
2b6b7b899e Attempting to fix some possible memory leaks. Son't know if I'm actually
helping anything though.
2013-01-09 00:01:33 -05:00
gmcferrin
4e6086e8ed Fixed typo in PartyCommand that resulted in locale string not being
output.
2013-01-08 21:56:21 -05:00
gmcferrin
97a59cd21e Fix locale stuff again. 2013-01-08 21:53:18 -05:00
Glitchfinder
9ef0ed8516 Merge pull request #461 from Glitchfinder/master
Merging in TfT-02's changes.
2013-01-08 17:54:06 -08:00
Glitchfinder
3c919c3af7 Fixing new merge conflicts. 2013-01-08 17:45:53 -08:00
gmcferrin
fbe3c70b85 Locale file update! 2013-01-08 20:33:04 -05:00
Glitchfinder
46bf22e36b Merging TfT_02's branch in. 2013-01-08 17:28:09 -08:00
gmcferrin
003c89c3a4 Missed one. 2013-01-08 18:54:22 -05:00
gmcferrin
793bd04afe Fixing merge issues, again. 2013-01-08 18:52:50 -05:00
gmcferrin
0249ae2724 Handle potions better. 2013-01-08 18:46:26 -05:00
Glitchfinder
32e0be481a Merge pull request #458 from Glitchfinder/master
Adding a bit more in the way of Dye-related backwards compatibility.
2013-01-08 15:29:57 -08:00
Glitchfinder
e5592c5da8 Resolving minor merge conflict. 2013-01-08 15:27:59 -08:00
Glitchfinder
b0500332bc Finishing up backwards compatibility for dye colors. 2013-01-08 15:14:12 -08:00
gmcferrin
78b8ac663e A little more cleanup. 2013-01-08 18:09:13 -05:00
Glitchfinder
e41ab3ac18 Merge pull request #457 from Glitchfinder/master
Minor updates.
2013-01-08 14:50:39 -08:00
gmcferrin
36d97bbcaf Store the scheduler. 2013-01-08 17:45:52 -05:00
gmcferrin
f3c89fe48b Archery cleanup. 2013-01-08 17:44:05 -05:00
Glitchfinder
9b31520684 Basic error check for backwards compatibility with dye colors. 2013-01-08 14:39:08 -08:00
Glitchfinder
660e68b0a3 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2013-01-08 14:32:30 -08:00
gmcferrin
08b46e1a7c Cover ALL the bases. 2013-01-08 17:26:11 -05:00
gmcferrin
b78299bbbd Metadata does nothing, apparently. 2013-01-08 17:24:09 -05:00
Glitchfinder
c8687bfc74 Setting up Travis CI. 2013-01-08 14:23:07 -08:00
Glitchfinder
a5219055ef Merge pull request #454 from Glitchfinder/master
Fixing a minor omission in the Permissions setup.
2013-01-08 14:07:22 -08:00
Glitchfinder
f79a9e5182 Fixing minor omission in permissions setup. 2013-01-08 14:05:41 -08:00
TfT_02
3904b172ad Better formatting for the comments 2013-01-08 22:19:03 +01:00
gmcferrin
e0da506d1a Protected, not public. 2013-01-08 16:10:19 -05:00
gmcferrin
d2f6191615 Starting on cleaning up null checks & type casting 2013-01-08 16:07:29 -05:00
gmcferrin
7c211fa50c Fix for Super Breaker & Giga Drill Breaker double/triple drops. 2013-01-08 14:56:31 -05:00
gmcferrin
fadec1a846 Remove unused import. 2013-01-08 14:27:09 -05:00
gmcferrin
d2aa19e31f Whoops, forgot to change a reference. 2013-01-08 14:23:21 -05:00
gmcferrin
ccfe1181be More mining restructuring. 2013-01-08 12:52:16 -05:00
gmcferrin
85fb12a4ec Use new Bukkit DyeColor data. 2013-01-08 11:31:07 -05:00
gmcferrin
84994c2b2f Remove a few unused imports & variables. 2013-01-08 10:50:37 -05:00
gmcferrin
1a2dfb9b19 Fixed parameterization issue. 2013-01-08 10:48:30 -05:00
gmcferrin
753652dcf9 More mining updates. 2013-01-08 10:46:19 -05:00
gmcferrin
b99d261084 Remove our workaround for NBT tag issues since Bukkit fixed it. 2013-01-08 10:45:49 -05:00
gmcferrin
aee4bcd65e More mining restructuring. 2013-01-08 09:42:37 -05:00
gmcferrin
159ec3f04d Pass location & type as params, rather than calling inside the function. 2013-01-08 09:35:41 -05:00
Glitchfinder
57ff84cd4d Merge pull request #452 from Glitchfinder/master
Fixing yet another concurrency error.
2013-01-08 01:34:31 -08:00
Glitchfinder
2933f80d69 Fixing yet another concurrency error. 2013-01-08 01:32:42 -08:00
gmcferrin
3d38892f7e Only call for an instance of Config once. 2013-01-07 17:40:33 -05:00
gmcferrin
1d990979ac Made the casting a little less complex.
No need to cast them BOTH to a double, only one is needed.
2013-01-07 17:27:52 -05:00
gmcferrin
d69cf09d4e Removed some unnecessary casting. 2013-01-07 17:08:53 -05:00
gmcferrin
b8d346d890 More work on Mining restructuring. 2013-01-07 12:51:39 -05:00
gmcferrin
5d58d85eae Remove unused import. 2013-01-07 11:39:59 -05:00
Glitchfinder
bc4d34f2fc Merge pull request #446 from Glitchfinder/master
Shutting down more concurrency errors.
2013-01-07 01:21:47 -08:00
Glitchfinder
6565d84cf9 Shutting down more concurrency errors. 2013-01-07 01:20:36 -08:00
Glitchfinder
95ed33b2ce Merge pull request #443 from Glitchfinder/master
Merge conflicts are fun.
2013-01-06 18:03:56 -08:00
Glitchfinder
e8f6d4107b Merge conflicts are fun. 2013-01-06 18:02:52 -08:00
Glitchfinder
deb0b211b4 Merge pull request #442 from Glitchfinder/master
Updating permissions to be more consistent.
2013-01-06 17:59:50 -08:00
Glitchfinder
83888f80d4 Fixing merge conflicts 2013-01-06 17:59:31 -08:00
Glitchfinder
974862a60a Updating permissions for consistency. 2013-01-06 17:52:31 -08:00
TfT_02
2965f35d6d Merge pull request #1 from WasBornForJustice/patch-1
Update src/main/resources/locale/locale_ru.properties
2013-01-06 10:30:32 -08:00
WasBornForJustice
6aa300dac0 Update src/main/resources/locale/locale_ru.properties
Little translation fixes
2013-01-06 20:58:31 +04:00
TfT_02
00020a9cbb Skill commands now show the perk effect, if any are active 2013-01-06 12:16:08 +01:00
TfT_02
99c6c46d54 Adding another missing line to all locale files 2013-01-05 11:53:35 +01:00
TfT_02
d183b1b940 Fishermans diet now uses the FoodChance value from advanced.yml 2013-01-05 00:52:11 +01:00
TfT_02
49fc2a93fa Adding missing line to locale files 2013-01-05 00:48:05 +01:00
TfT_02
1c3066aaf7 Fixing a small error pointed out by @sh4z 2013-01-04 12:16:31 +01:00
TfT_02
cdd9745341 Fixing formatting 2013-01-03 17:40:22 +01:00
Glitchfinder
d0c051a9c2 Merge pull request #419 from Glitchfinder/master
Patching two bugs.
2013-01-02 18:06:34 -08:00
Glitchfinder
d444e088c4 Patching a bug where mcMMO drops too few items, and yet another concurrent modification exception. 2013-01-02 18:03:52 -08:00
TfT_02
9ae74e0fba Began adding comments to advanced.yml
Hopefully there aren't too many spell / grammar errors in here.
2013-01-02 23:44:52 +01:00
TfT_02
447aafd106 Fishermans diet now uses the FoodChance value from advanced.yml 2013-01-02 23:20:48 +01:00
TfT_02
376b79cab3 This doesn't need to get added at any point, because users can replace the sound files inside the .jar 2013-01-02 23:20:25 +01:00
Glitchfinder
b95ac44a4c Merge pull request #409 from TfT-02/master
More fixes
2013-01-01 19:36:38 -08:00
Glitchfinder
4161952566 Merge pull request #410 from Glitchfinder/master
Fixing a concurrent modification error.
2013-01-01 19:26:39 -08:00
Glitchfinder
5b18abbea0 Fixing a concurrent modification error. 2013-01-01 19:25:35 -08:00
TfT_02
66cc9bc6db Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml 2013-01-02 02:10:16 +01:00
TfT_02
4f8337c11a Fixed a bug which caused advanced.yml not to respect every MaxChance node 2013-01-02 01:27:50 +01:00
TfT_02
3aee334fbd Fixed Arcobatics & Archery ignoring ChanceMax settings from advanced config 2013-01-02 00:34:32 +01:00
TfT_02
6d76a14ed0 Update the README
Added link to the mcMMO jenkins and removed the link to the dead forums
2013-01-02 00:18:41 +01:00
gmcferrin
48150e2002 Move permissions declaration to the constructor. 2013-01-01 17:54:58 -05:00
TfT_02
d741d9a11e Merge pull request #400 from TfT-02/master
Various fixed for issues in the issue tracker
2013-01-01 14:17:06 -08:00
gmcferrin
3194baffd7 Use finals rather than local variables. 2013-01-01 17:12:15 -05:00
TfT_02
7a49fbb0bb Update the changelog with recent changes by Glitchfinder 2013-01-01 22:42:27 +01:00
gmcferrin
1ff1704697 Fixed some parameterization issues. 2013-01-01 16:13:33 -05:00
gmcferrin
aeaad41c45 Fix static access issues. 2013-01-01 16:04:53 -05:00
gmcferrin
15cdf3bfd6 More unused imports 2013-01-01 16:03:33 -05:00
gmcferrin
146fa474a1 Removed unused import 2013-01-01 16:02:39 -05:00
gmcferrin
11468abc98 Fixed update for Mining refactoring 2013-01-01 16:01:51 -05:00
gmcferrin
ef6d47b801 Update for Mining refactoring. 2013-01-01 15:54:41 -05:00
Glitchfinder
bfdb825e0b Merge pull request #406 from Glitchfinder/master
Fixing a few issues in the Tracker
2012-12-31 20:00:29 -08:00
Glitchfinder
707a388c51 Fixed an issue where dropped items did not retain custom NBT data. 2012-12-31 19:57:21 -08:00
Glitchfinder
d33334708d Fixing recursion errors by switching from an unnecessary btree to a simple ArrayList. 2012-12-31 19:40:33 -08:00
Glitchfinder
0e853d44b7 Fixing a bug where repairing could leave items with the enchant effect but no enchantments. 2012-12-31 16:04:17 -08:00
TfT_02
c598f202f8 Updated the changelog 2012-12-31 19:09:10 +01:00
Glitchfinder
e607e04af4 Merge pull request #396 from Glitchfinder/master
Fixes and Patches
2012-12-31 10:03:19 -08:00
TfT_02
802d1dfa8e Fixed some mistakes with the path names #404 2012-12-31 18:40:15 +01:00
TfT_02
00279502e4 This does prevent using wood axes everytime you tree fell 2012-12-31 11:04:01 +01:00
TfT_02
cc18794a93 Don't damage the tool more than it's max durability 2012-12-31 11:00:27 +01:00
Glitchfinder
905e92fa4d Adding the ability to track spawned mobs when chunks unload. 2012-12-30 19:51:26 -08:00
TfT_02
7a503ea76c Updated the changelog
This hasen't got any major attention since the 14th of August, untill
now.
2012-12-31 02:24:07 +01:00
TfT_02
eed8a57ff9 Merge pull request #392 from TfT-02/master
Various fixed for issues in the issue tracker
2012-12-30 15:03:12 -08:00
TfT_02
2968803f29 Fixed formatting 2012-12-31 00:01:58 +01:00
TfT_02
6cf6e8ab54 This needs to be on this line. 2012-12-30 23:54:51 +01:00
TfT_02
3668249267 Iterate through the durability damage with Unbreaking check 2012-12-30 23:46:21 +01:00
Glitchfinder
28b092a4e3 Adding Bats, Giants, Withers, and Wither Skeletons to the combat experience list. 2012-12-30 12:33:38 -08:00
Glitchfinder
c0bba7dead Merge pull request #395 from Glitchfinder/master
Fixing an issue where players repaired items a hundred times better than they should be able to.
2012-12-30 09:39:05 -08:00
Glitchfinder
7fc8d432b5 Fixing an issue where players repaired items a hundred times better than they should be able to. 2012-12-30 09:37:38 -08:00
TfT_02
34027ee7c4 Ignore all Mac OSX filesystem dust 2012-12-30 13:37:34 +01:00
TfT_02
dc675162c9 Update the locale files 2012-12-30 13:37:07 +01:00
TfT_02
db370418f8 Add version number to /mcmmo command
Also used the logger in onEnable and onDisable
2012-12-30 00:02:39 +01:00
TfT_02
43de871392 Fixed enchantments being ignored + removed uneccesary code
Fixed Unbreaking enchantments being ignored when using Treefelling and
when hit by Armor Impact
2012-12-29 22:38:57 +01:00
TfT_02
5e9c483892 Merge pull request #387 from dualspiral/EventFix
Don't fire Party Change event if player can't change parties
2012-12-29 13:12:10 -08:00
Glitchfinder
17169903b4 Merge pull request #391 from Glitchfinder/master
Fixing Data Value issues caused by the patch to deprecated ItemStack use.
2012-12-29 13:02:07 -08:00
Glitchfinder
aa70c82824 Fixing issues caused by the patch to deprecated ItemStack changes. 2012-12-29 12:59:18 -08:00
Daniel Naylor
73a5143a17 Check to see if players are eligible to join a party before the mcMMOPartyChangeEvent is fired 2012-12-29 13:15:58 +00:00
Glitchfinder
d35e56fd37 Merge pull request #383 from Glitchfinder/master
Fixing a few more NPEs.
2012-12-28 21:11:58 -08:00
Glitchfinder
cafed2d98c Fixing remaining NPEs with custom blocks using vanilla IDs. 2012-12-28 21:11:22 -08:00
Glitchfinder
cd5df82d72 Fixing more NPEs with custom blocks. 2012-12-28 20:47:39 -08:00
Glitchfinder
5404371b35 Merge pull request #357 from TfT-02/master
Various fixes and patches
2012-12-28 12:19:44 -08:00
Glitchfinder
899bbfee40 Merge pull request #379 from Glitchfinder/master
Fixing an NPE
2012-12-28 12:16:01 -08:00
Glitchfinder
b9f2aa5eff Fixing an NPE involving custom blocks. More investigation needed to find the source of the issue. 2012-12-28 12:14:25 -08:00
TfT_02
0a028afe7f Update the changelog with recent commits 2012-12-28 12:11:54 +01:00
TfT_02
6f1ee88b78 Fixes issues #259 and #335 2012-12-28 11:40:15 +01:00
TfT_02
e5cc06e822 Fix for wrong datataypes 2012-12-28 02:12:34 +01:00
TfT_02
e13ba010bf Adresses issue #364 2012-12-28 00:41:56 +01:00
Glitchfinder
f6bc473eb4 Merge pull request #369 from Glitchfinder/master
Repairing the Repair skill.
2012-12-27 15:10:41 -08:00
Glitchfinder
b491090037 Repairing the Repair skill. 2012-12-27 15:08:10 -08:00
Glitchfinder
0416f5f4a8 Merge pull request #367 from Glitchfinder/master
Fixing level caps.
2012-12-27 13:46:37 -08:00
Glitchfinder
5177bf6c1f Fixing level caps so that 0 represents no cap rather than 0. 2012-12-27 13:45:27 -08:00
Glitchfinder
fcd2fb0f12 Merge pull request #366 from Glitchfinder/master
Fixes the broken /skillreset command.
2012-12-27 12:42:23 -08:00
Glitchfinder
37115d238b Fixing broken skillreset command. 2012-12-27 12:35:30 -08:00
TfT_02
2c8bfd6573 Implementing an durability cap for ArmorImpact 2012-12-27 17:45:10 +01:00
TfT_02
de3bae41ae Implementing an durability cap for ArmorImpact 2012-12-27 17:36:12 +01:00
Glitchfinder
bd1850db69 Merge pull request #353 from Glitchfinder/master
Reimplementing Skill Level and Power Level caps.
2012-12-26 19:56:44 -08:00
Glitchfinder
11b5c54c69 Reimplementing skill level and power level caps. 2012-12-26 19:54:20 -08:00
Glitchfinder
6f081eb1e4 Merge pull request #345 from Glitchfinder/master
Fixing issues with latest spout.
2012-12-25 21:27:50 -08:00
Glitchfinder
d367dbf767 Fixing compatibility with recent Spout updates. Why do people not understand the purpose of an API? 2012-12-25 21:22:38 -08:00
Glitchfinder
8237bd52b5 Merge branch 'master', remote-tracking branch 'mcmmo/master' 2012-12-25 21:00:44 -08:00
TfT_02
71471d3bbc Added Wooden button to list of blocks that should not trigger abilities 2012-12-25 15:35:12 +01:00
gmcferrin
34169aebaf Update POM.xml for proper version 2012-12-25 01:08:12 -05:00
gmcferrin
07e98ab79f Fixed Async deprecation issues 2012-12-25 01:06:21 -05:00
gmcferrin
9af66a8e69 Fixed ItemStack deprecation issues. 2012-12-25 01:01:10 -05:00
Glitchfinder
5e965aec2c Merge pull request #343 from Glitchfinder/fixes
Fixing conversions for a long to and int. for user data.
2012-12-24 14:58:31 -08:00
Glitchfinder
ecb38693db Fixing conversions for a long to and int. for user data. 2012-12-24 14:57:36 -08:00
Grant
36d5344ded Cleanup formatting. 2012-12-24 16:56:25 -05:00
Grant
6b3bde585d Fixed some issues with static access 2012-12-24 16:17:33 -05:00
Grant
f7ea25be61 Fixed issue with Mining using actual skill level rather than max skill
level
2012-12-24 16:17:33 -05:00
Grant
9136530618 Removed unused imports 2012-12-24 16:17:33 -05:00
Grant
f4e7e6c74a Added default cases to switch/case statements 2012-12-24 16:17:32 -05:00
Grant
c4766ad3fb Remove dead code relating to null profiles. 2012-12-24 16:17:32 -05:00
Glitchfinder
894a78c0f9 Merge pull request #342 from Glitchfinder/fixes
Fixing a few issues.
2012-12-24 13:04:21 -08:00
Glitchfinder
c082290cf1 Fixing minor typo involving a binary operation instead of a check. 2012-12-24 12:25:23 -08:00
Glitchfinder
4cac324e9f Fixing skill save timing and autosave features. 2012-12-24 12:19:19 -08:00
Glitchfinder
493353e774 Merge branches 'master' and 'fixes' into fixes 2012-12-24 12:05:41 -08:00
Grant
3289215e19 Merge pull request #340 from TfT-02/master
Small patch
2012-12-24 08:54:51 -08:00
TfT_02
cdb5fed5a5 Changed bonus to float
Fixes bug where only 1 diamond was needed to fully repair an almost
broken diamond pickaxe
2012-12-24 13:00:50 +01:00
TfT_02
bb1dbab984 Iron golem and Snowman pumpkin drop rates are now 3% for the sake of consistency 2012-12-23 22:05:10 +01:00
TfT_02
8a97718dd4 Don't use MaterialData when its not needed. 2012-12-23 18:44:39 +01:00
TfT_02
01142b67c6 Changed skull drop rates to 3% 2012-12-23 00:00:29 +01:00
TfT_02
e0bba80f55 Made skulls drops more rare. 2012-12-22 11:17:48 +01:00
TfT_02
34276539fa Got rid of reflection code, now uses Bukkit method to check if witherskeleton 2012-12-22 10:11:18 +01:00
TfT_02
4511dd79fa Now uses proper gamemode check and uses Misc.dropItem 2012-12-22 10:10:54 +01:00
nossr50
7500685115 Merge pull request #334 from Glitchfinder/fixes
More fixes.
2012-12-10 05:36:59 -08:00
Glitchfinder
658e7d64c2 Fixing dependency issues resulting from a recent change to the Spout API. 2012-12-06 11:22:22 -08:00
Glitchfinder
569079fed0 Fixing build issues caused by recent changes to CraftBukkit. 2012-12-06 11:11:12 -08:00
Glitchfinder
b042d78186 Fixing an error introduced by @TfT-02 that prevented the project from compiling. 2012-12-03 21:40:38 -08:00
Grant
abd051d07b Merge pull request #332 from TfT-02/master
Fixed and patches
2012-12-03 21:08:58 -08:00
Grant
8c5b22a8fb Merge pull request #327 from Glitchfinder/fixes
Additional fixes and patches.
2012-12-03 21:08:40 -08:00
TfT_02
de93b11c25 Fixed an error where Greater Impact was confused with Armor Impact 2012-12-02 22:54:03 +01:00
TfT_02
7f16339bd9 Fixed a small bug where players could salvage items in creative mode 2012-12-02 22:44:26 +01:00
U-YUE\Sean
42dc6e7c4f Fixing the broken repair config. 2012-11-29 12:24:56 -08:00
U-YUE\Sean
3153973c2b Fiuxing merge issue. 2012-11-29 12:18:35 -08:00
Glitchfinder
cc044fe41b Dealing with more minor typecasting issues. 2012-11-26 12:20:44 -08:00
Grant
fd5de7b218 Merge pull request #326 from Glitchfinder/fixes
More fixes and patches.
2012-11-26 11:11:51 -08:00
Glitchfinder
0037524cfd Fixing more errors with typecasting. 2012-11-25 16:40:42 -08:00
Glitchfinder
082fa2ca0d Dealing with type conversion issues in the skill commands. 2012-11-25 16:18:30 -08:00
Glitchfinder
b1cf9d139a Fixing some issues with Arcane Forging. 2012-11-24 15:47:28 -08:00
Grant
9854360ab7 Merge pull request #324 from Glitchfinder/fixes
Further fixes and refinements.
2012-11-22 20:54:14 -08:00
Glitchfinder
b8755b808e Fixing perks spam on login. 2012-11-22 13:40:55 -08:00
Glitchfinder
139812b3bc Trying to fix a new duping bug. 2012-11-22 13:15:01 -08:00
Grant
6adbe9a29b Merge pull request #322 from Glitchfinder/fixes
Resolving merge conflict with Advanced Config
2012-11-21 13:56:02 -08:00
Glitchfinder
52f7120392 Resolving merge conflict. 2012-11-21 13:47:17 -08:00
TfT_02
0d2abb95b5 Adding AdvancedConfig 2012-11-21 21:49:54 +01:00
Grant
6b2adc9359 Merge pull request #318 from mastershake71/master
Fixes Nuker Dupe
2012-11-21 12:37:51 -08:00
Grant
325f89a80d Merge pull request #311 from Glitchfinder/fixes
Additional fixes and patches.
2012-11-21 12:37:15 -08:00
mastershake71
e8152a3475 Solves nuker dupe glitch. Not all anti-cheat block damage, so check
and make sure both are allowed not just one.
2012-11-18 23:31:19 -05:00
Glitchfinder
6d42d14575 Fixed a bug where Herablism magically converted potatoes to carrots. 2012-11-15 16:34:57 -08:00
U-YUE\Sean
2b269ebf54 Adding missing permissions. 2012-11-15 12:40:20 -08:00
Glitchfinder
d2493e89ca A few more minor things. 2012-11-13 14:31:02 -08:00
Glitchfinder
a61423aa99 Dealing with a few minor issues. 2012-11-13 14:27:58 -08:00
Glitchfinder
506efec858 Merge pull request #3 from TfT-02/master
Salvage ability for Repair
2012-11-13 13:37:04 -08:00
TfT_02
8e3320ad72 Hehe, you were soo right. This is MUCH cleaner to look at. :) 2012-11-13 22:28:56 +01:00
TfT_02
ff279bf633 Moved Salvage check to ItemChecks 2012-11-13 22:17:34 +01:00
TfT_02
a582b07549 Small error fix - As mentioned by Glitchfinder 2012-11-13 22:14:26 +01:00
TfT_02
1e7fef4557 Revert "/fishing command will now also display the bonus gained from lucky perk"
This reverts commit 1bf0cd1d15.
2012-11-13 16:55:06 +01:00
TfT_02
f8b44cd8ce New Salvage ability for Repair!
Added a fully working ability to Repair. With this ability you can
salvage items and get bars in return.

- Added new permission node for Salvage ability
- Added new config options for Salvage
- Added new locale strings for Salvage
- Added a check to make sure that Repair Anvil != Salvage Anvil
2012-11-13 16:50:00 +01:00
TfT_02
b0681c10b9 About time that this got changed to 1.3.12 2012-11-13 16:47:59 +01:00
TfT_02
1bf0cd1d15 /fishing command will now also display the bonus gained from lucky perk 2012-11-13 10:08:05 +01:00
Glitchfinder
01f38537de Fixing cooldown timers so that they display the proper cooldown for players with perks. 2012-11-12 21:57:57 -08:00
Glitchfinder
adbb20d7c9 Displaying all perks upon login, and adding them to the locale files. 2012-11-12 21:43:43 -08:00
Glitchfinder
c3c7fe08b6 Fixing a bug where an entity dealing 0 damage still earned experience. 2012-11-12 19:53:55 -08:00
Glitchfinder
4a52135a0b Nerfing overpowered Herbalism double drops for melons and netherwart. 2012-11-12 19:10:14 -08:00
Glitchfinder
a56f805787 Modified drop rates for Fishing's Shake ability. Also reverted spacing to match the rest of the project. 2012-11-12 16:33:37 -08:00
Glitchfinder
3a467b3da4 Adding Fishermans Diet ability to fishing. 2012-11-12 16:18:27 -08:00
Glitchfinder
4500c4d407 Attempting to fix dupe bug with certain plugins and Super Breaker. 2012-11-12 14:58:32 -08:00
Glitchfinder
eebda74bb7 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into fixes 2012-11-12 13:48:31 -08:00
Glitchfinder
e6e8c12735 Merge branch 'master' into fixes 2012-11-12 13:47:31 -08:00
Grant
212b42c8b9 Merge pull request #305 from TfT-02/master
Changed the fishing skill shake + small fix for lucky perk in fishing
2012-11-11 11:45:55 -08:00
Grant
9c4ff30ce7 Merge pull request #304 from Glitchfinder/master
Attempting a minor reduction in lag for larger servers.
2012-11-11 11:45:11 -08:00
Grant
d7510b83c8 Merge pull request #307 from Glitchfinder/fixes
Additional fixes and patches.
2012-11-11 11:44:54 -08:00
Glitchfinder
9a9e0cc7de Modifying the amount of experience earned when using Tree Feller on jungle trees. It was nerfed a bit too much. 2012-11-10 12:45:54 -08:00
Glitchfinder
a8a90ee815 Fixing excessive null chunk before earning Woodcutting experience. 2012-11-10 12:43:08 -08:00
Glitchfinder
7859660ece Adding herbalism green thumb ability to carrots, potatoes, and netherwart. 2012-11-09 16:37:12 -08:00
Glitchfinder
b93dafee63 Applying a temporary patch to stop the wrong sand and gravel from being flagged as touched by players. 2012-11-09 09:45:50 -08:00
TfT_02
a1a61e9d4a Added new method for calculating the ShakeChance 2012-11-08 20:15:40 +01:00
TfT_02
464d6bdd35 Added the shake percentage
There are associated stats now.

Also added a '%' to Arcane chances in locale file
2012-11-08 20:15:02 +01:00
Glitchfinder
2c613d5b99 Fixing a null pointer error related to skill cooldowns. 2012-11-07 19:04:17 -08:00
Glitchfinder
d1f683b8a5 Adding the option to negate experience earned for Acrobatics or Herbalism while in a minecart to prevent afk leveling. 2012-11-07 18:41:18 -08:00
TfT_02
f4bb8ccb7d Add Shake chances in the default config.yml 2012-11-07 14:14:49 +01:00
TfT_02
00364afd8f Made the shake rank chance configurable 2012-11-07 14:02:30 +01:00
TfT_02
f5f07f7016 This wasn't right. 2012-11-07 13:32:30 +01:00
TfT_02
2bdeeb2d6e Changed shake drops from guaranteed to based upon fishing level and perks. 2012-11-07 13:30:20 +01:00
Glitchfinder
f023529d37 Reducing filesystem usage. Should help reduce lag on larger servers. THIS IS NOT A PERMANENT SOLUTION. 2012-11-06 23:15:15 -08:00
NuclearW
b8d37cb223 Merge pull request #299 from Glitchfinder/master
Fixing index error.

Better not do this all night, I'm not sticking around for that much :I
2012-11-05 20:18:26 -08:00
Glitchfinder
88ed14fe5c Fixing index error. 2012-11-05 20:14:23 -08:00
NuclearW
cd30771775 Merge pull request #298 from Glitchfinder/master
Fixing conversion lag.
2012-11-05 19:50:29 -08:00
Glitchfinder
00a5bc5cf3 Fixing lag caused by conversion. 2012-11-05 19:48:41 -08:00
Glitchfinder
a17d58fe32 Fixing previous commit. 2012-11-05 19:42:18 -08:00
Glitchfinder
c21286dbc3 Offloading chunk conversion. SHould alleviate lag. 2012-11-05 19:28:00 -08:00
Glitchfinder
7fc99630e0 Resolving a few issues with playability. Should be a bit better. 2012-11-05 18:02:53 -08:00
NuclearW
69a5cd1017 Merge pull request #295 from Glitchfinder/master
Updating block storage to a region-style format.
2012-11-05 17:37:49 -08:00
Glitchfinder
3129acfc19 General cleanup for pull request. 2012-11-05 16:03:44 -08:00
Glitchfinder
c3dd777e44 Merge remote-tracking branch 'mcmmo/master' 2012-11-05 14:02:07 -08:00
Grant
c5120b9c72 Merge pull request #293 from Glitchfinder/fixes
Additional fixes and patches.
2012-11-05 07:53:50 -08:00
Glitchfinder
91a18fe7a2 Fixing herbalism to look for cobble walls when trying to convert cobble walls. 2012-11-04 21:47:15 -08:00
Glitchfinder
62f5185a1b Attempting to fix index error. 2012-11-04 20:36:47 -08:00
Glitchfinder
f4cb83319e Fixes an NPE involving certain explosions. 2012-11-04 16:39:06 -08:00
Glitchfinder
c7b3b7a826 Green thumb now converts cobble walls to mossy cobble walls. 2012-11-04 16:06:33 -08:00
Glitchfinder
01fb245da3 Fixing double drops for herbalism so that carrots and potatoes drop items instead of blocks. 2012-11-04 15:54:22 -08:00
Glitchfinder
83e072dad1 Fixing a potential error with legacy chunklet types. 2012-11-04 13:43:14 -08:00
Glitchfinder
eb5ac80714 Updating modified block storage to a region-style format. 2012-11-04 13:36:57 -08:00
Grant
b57cc7bd59 Merge pull request #284 from Glitchfinder/master
Attempting to resolve various issues in the issue tracker.
2012-11-04 11:24:32 -08:00
Glitchfinder
d532164cd6 Incorporating #287 due to incompatible edits. 2012-11-02 08:45:50 -07:00
Glitchfinder
61ae4826d1 Addresses issue #286. 2012-11-01 16:43:59 -07:00
Glitchfinder
be4e62fe9d Hopefully addresses part of the empty enchant issue. 2012-10-31 22:47:04 -07:00
Glitchfinder
d9346ab260 Fixing default experience for the newer herbalism materials. 2012-10-31 15:44:45 -07:00
Glitchfinder
87c4f318a4 Fixing fishing a bit. 2012-10-31 12:39:04 -07:00
Glitchfinder
30b87e8035 Resolving potential conflict with #285. (Missed the newline) 2012-10-30 20:12:43 -07:00
Glitchfinder
26a85846fc Resolving potential conflict with #285. 2012-10-30 20:11:24 -07:00
Glitchfinder
cd40507609 Resolving issue #211. 2012-10-30 20:05:37 -07:00
Glitchfinder
a9ea2e0137 Resolving issue #258. 2012-10-30 19:24:20 -07:00
Glitchfinder
6964f7adfc Resolving issue #238. 2012-10-30 18:12:50 -07:00
Glitchfinder
70231b6ae0 Resolving issues #243, #241, and #234. 2012-10-30 17:59:58 -07:00
U-YUE\Sean
9354831729 Finished fixing issues #272, #266, #261, and #255. 2012-10-30 13:14:22 -07:00
U-YUE\Sean
ab7a83b37e Attempting to fix issues #272 , #266 , #261 , and #255 . 2012-10-30 11:46:52 -07:00
U-YUE\Sean
8dfa8c20f3 Resolving first half of issue #283 . Recommend closing issue and reopening with a new ticket number for the issue regarding stats. Stat bug probably involves commit @42aa42699129448ef7fa0e4e5de96840004c13ee 2012-10-30 10:26:46 -07:00
Grant
67499eeff7 Merge pull request #281 from Glitchfinder/master
Fixed checked data values for carrots and potatoes.
2012-10-30 07:01:35 -07:00
Grant
d43ff6263f Merge pull request #282 from Glitchfinder/master
Adds support for newer mobs to the fishing shake ability.
2012-10-30 07:01:25 -07:00
Glitchfinder
058dc8c611 Added support for newer mobs to fishing's shake ability. 2012-10-29 14:27:22 -07:00
Glitchfinder
8871964be0 Fixing checked data values for carrots and potatoes. 2012-10-29 12:33:13 -07:00
Grant
42aa426991 Merge pull request #271 from mcunha/better-db-handling
Better db handling
2012-10-29 10:25:49 -07:00
Grant
7cee94e0b8 Merge pull request #274 from zippy120/master
Added checks in the events to prevent errors when Citizens NPCs perform tasks.
2012-10-29 10:25:39 -07:00
Grant
fa96a6beec Merge pull request #278 from Glitchfinder/master
Basic update for 1.4.2
2012-10-29 10:25:29 -07:00
Grant
efc0edf3ef Merge pull request #279 from mcunha/fix-mossied-cobblestone
Don't award double drops to mossified cobblestone
2012-10-29 10:25:07 -07:00
Marco Cunha
f1d785777c Don't award double drops to mossified cobblestone 2012-10-29 17:17:52 +01:00
Glitchfinder
db0168205d Added herbalism food bonuses. 2012-10-28 22:47:26 -07:00
Glitchfinder
2a20ed95fa Added missed checks for potatoes and carrots. 2012-10-28 20:56:33 -07:00
Glitchfinder
11f1889f1f Added support for carrots and potatoes. Also updated to ignore beacon blocks and anvil blocks. 2012-10-28 20:53:03 -07:00
zippy120
703b5b2f3f Added checks in the events to prevent errors when Citizens NPCs perform tasks. 2012-10-28 09:26:46 -06:00
Marco Cunha
58a15e61dd Fix refactoring typos 2012-10-22 19:05:13 +02:00
Marco Cunha
896f57f0b4 Force proper disposal of resultsets and statements 2012-10-22 15:03:31 +02:00
Marco Cunha
34ae64706e Improved DB connection handling
Support for aggressive connection timeouts, with exponential backoff
for multiple failures.
2012-10-22 14:45:16 +02:00
Grant
43fe92fe3f Merge pull request #269 from Glitchfinder/master
Finished adding skill checks for Emerald Ore and Cocoa.
2012-10-18 08:34:47 -07:00
Glitchfinder
31513d52d7 Fixing spacing issues and making herbalism drop cocoa beans instead of a cocoa block. 2012-10-17 21:26:16 -07:00
Glitchfinder
70a16fe344 Finished adding skill checks for Emerald Ore and Cocoa. 2012-10-17 13:41:19 -07:00
nossr50
4570ffb8f5 Merge pull request #263 from h31ix/enderchest2
Don't activate abilities by opening an Ender Chest
2012-09-30 18:38:34 -07:00
h31ix
22f6ed324d Added ender chest to list of blocks that should not cause ability activation 2012-09-30 12:48:20 -04:00
nossr50
e29484e14b Merge pull request #252 from mcunha/master
Fix ore dupe bug with ore blocks on pistons
2012-09-09 16:50:17 -07:00
Marco Cunha
7e21fdd862 Fix ore dupe bug with ore blocks on pistons 2012-09-10 01:53:16 +03:00
nossr50
01e69cdf5e Fixing some mistakes. 2012-09-07 14:49:00 -07:00
nossr50
9ad7840236 Merge pull request #246 from matix931/patch-4
Update src/main/java/com/gmail/nossr50/config/Config.java
2012-09-05 21:11:15 -07:00
nossr50
e97ec36094 Merge pull request #247 from matix931/patch-5
Update src/main/resources/config.yml
2012-09-05 21:11:07 -07:00
nossr50
ef318eeaec Merge pull request #248 from matix931/patch-7
Update src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java
2012-09-05 21:10:58 -07:00
nossr50
3314b18318 Merge pull request #249 from matix931/patch-6
Update src/main/java/com/gmail/nossr50/skills/gathering/Mining.java
2012-09-05 21:10:44 -07:00
matix931
5f04ecfdd4 Update src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java 2012-09-05 11:45:43 +03:00
matix931
91d294acff Update src/main/java/com/gmail/nossr50/skills/gathering/Mining.java
Another change against 1.3.2
2012-09-05 11:19:34 +03:00
matix931
283cdeed6c Update src/main/resources/config.yml 2012-09-05 11:10:50 +03:00
matix931
a283fce4ec Update src/main/java/com/gmail/nossr50/config/Config.java
Doing something against 1.3.2
2012-09-05 11:09:14 +03:00
nossr50
f8d525d797 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2012-09-03 13:27:11 -07:00
nossr50
80dabad10e Nerfs to axes 2012-09-03 13:26:48 -07:00
nossr50
8181989e98 Merge pull request #240 from matix931/patch-3
Update src/main/java/com/gmail/nossr50/skills/repair/Repair.java
2012-09-02 08:04:26 -07:00
matix931
0f7bf13834 Update src/main/java/com/gmail/nossr50/skills/repair/Repair.java
When DowngradeChance is 0 random can be the same (0 to 99) so can't be <= becouse downgrade will continue
2012-08-31 18:03:54 +03:00
nossr50
c1d6e79a41 Vampirism fix 2012-08-30 09:16:08 -07:00
nossr50
6f073250f4 Merge pull request #233 from t00thpick1/master
Added missing null check
2012-08-18 06:19:00 -07:00
t00thpick1
c084ccde40 Added missing null check 2012-08-17 18:45:08 -03:00
nossr50
b73a06b9ab Merge pull request #232 from t00thpick1/master
Actually fixed dupes
2012-08-16 22:23:27 -07:00
t00thpick1
740c1131ea Made superbreaker not dupe if event is cancelled 2012-08-17 01:28:28 -03:00
t00thpick1
0a798aec30 Made gigadrill not dupe if event is cancelled 2012-08-17 01:27:41 -03:00
nossr50
9089e70155 Dupes are bad mmkay 2012-08-14 14:24:54 -07:00
nossr50
f532630d1b Another fix to make us more compatible with other plugins 2012-08-14 14:21:07 -07:00
nossr50
7b47d32a96 Citizens compatibility. Bug fix for Woodcutting/custom trees. 2012-08-14 14:09:49 -07:00
nossr50
3934392219 Did somebody say HOTFIX? 2012-08-14 13:52:31 -07:00
nossr50
ed6f48b5fe Merge pull request #215 from btarb24/master
Player command to reset a skill level (for when cap is enabled)
2012-08-09 13:10:44 -07:00
nossr50
729e4a6eac Fixed some deprecated things, removed some unneeded imports. 2012-08-07 17:41:13 -07:00
nossr50
9a39dead4f Forgot an import. 2012-08-07 17:38:28 -07:00
nossr50
cb1eabc3fa 1.3.10 release soon, added 1.3.1 compatibility 2012-08-07 16:49:25 -07:00
nossr50
b30002948c Fix for COTW and a fix for stat wipes w/ offline mode off for FlatFile 2012-08-04 15:21:34 -07:00
Bill Tarbell
d528f11082 Allow global multiplier to be a double 2012-08-01 19:32:25 -04:00
GJ
42a1fdf2df Removed deprecated function in 1.2.5-R5 2012-07-31 09:06:23 -04:00
Bill Tarbell
394ddd4e51 copy paste error. 2012-07-30 00:02:41 -04:00
Bill Tarbell
8c7d95f9ea Add player command to reset skill levels 2012-07-29 23:49:42 -04:00
Bill Tarbell
422550abfd Display power level cap on mcstats command 2012-07-29 20:05:05 -04:00
GJ
ca9ce1ba1b Fixed possible ClassCastException from catching something other than a
mob when using the Shake Mob skill
2012-07-21 09:37:17 -04:00
nossr50
ac1c420cb5 Ryokai! 2012-07-13 10:01:51 -07:00
GJ
05a9e85529 No reason to pull the ArrayLists every time. 2012-07-10 14:52:43 -04:00
GJ
ca6ed76e8f Log when someone's missing from a table. 2012-07-10 14:43:48 -04:00
GJ
3d04da39e3 Null check our DB tables. 2012-07-10 14:38:51 -04:00
GJ
127908f104 Save the tablePrefix as a String. 2012-07-10 14:32:56 -04:00
GJ
686bcd5308 Null check ALL the profiles.
We should probably find a more elegant way to do this, though.
2012-07-10 14:02:48 -04:00
GJ
07c66378c0 Some optimizations to how we handle our SQL connections and queries. 2012-07-10 12:04:18 -04:00
GJ
4e7107c8a8 Remove unused variable 2012-07-09 11:12:58 -04:00
GJ
3c2d658b37 Protect our database. 2012-07-09 11:12:46 -04:00
GJ
f0b2cc1bab Protect our file paths. 2012-07-09 10:55:33 -04:00
GJ
d038cbf357 Bad variables names are bad. 2012-07-09 10:47:33 -04:00
GJ
c3ea632cb9 This should be private. 2012-07-09 10:46:55 -04:00
GJ
a31d50924d Only create objects where we need them. 2012-07-09 10:43:16 -04:00
GJ
c567e2714a Fixed custom woodcutting blocks throwing errors. 2012-07-09 09:26:22 -04:00
bm01
a2e342b4fc Oops 2012-07-08 00:17:33 +02:00
bm01
4469637f27 NPE prevention for Users.getProfile() 2012-07-08 00:02:40 +02:00
bm01
f4ecbe7f65 Removed unused import 2012-07-07 23:48:36 +02:00
bm01
dbaab4efe1 Don't call SpoutStuff if Spout isn't enabled 2012-07-07 23:48:22 +02:00
bm01
8c178869b7 Fixed /mcremove 2012-07-07 23:38:05 +02:00
NuclearW
3c7bcb990e NPE Prevention 2012-07-07 17:02:33 -04:00
NuclearW
f7a5678814 Change ChunkletManager to a notify/demand system
Allowing NullChunkletManager to bypass the ChunkletUnloader as it is not needed.
2012-07-07 14:43:14 -04:00
NuclearW
646bb32965 Let the Unit testing begin
Could use some more test cases on the make test, though
2012-07-07 14:43:14 -04:00
NuclearW
dce7d8fdd3 Format this before GJ finds out 2012-07-07 14:43:14 -04:00
NuclearW
6dd17312f4 Change this back to private 2012-07-07 14:43:14 -04:00
NuclearW
9c64f40ea1 Changelog 2012-07-07 14:43:13 -04:00
NuclearW
da6b461408 Move our Externalizeable to PrimitveExChunkletStore
This will let us deserialize Primitive normally.

In addition, we now enforce all chunklets being of type PrimitiveEx, as any non-Ex are repalced with a new Ex on load.
2012-07-07 14:43:13 -04:00
NuclearW
77dce75108 Formatting a single line 2012-07-07 14:43:13 -04:00
NuclearW
37308917d1 Parenthesis for clarity 2012-07-07 14:43:13 -04:00
NuclearW
21d2229572 Column comment 2012-07-07 14:43:13 -04:00
NuclearW
7d372af51e Some address byte comments 2012-07-07 14:43:12 -04:00
NuclearW
a3e0753076 We must be sure to flush 2012-07-07 14:43:12 -04:00
NuclearW
a728d1f9c8 These must be called in the reverse order we open them 2012-07-07 14:43:12 -04:00
NuclearW
b893e86f3c A bit more clear
But no functional change
2012-07-07 14:43:12 -04:00
NuclearW
63cf6e9b3a Do not increment i in this location 2012-07-07 14:43:12 -04:00
NuclearW
67738d811e Move things around to fit together better 2012-07-07 14:43:12 -04:00
bm01
4d77f6d04d Introducing external chunklets 2012-07-07 14:43:11 -04:00
bm01
3702495038 Don't need to .save() for online players 2012-07-07 20:02:54 +02:00
bm01
ede08ce5ac Moved hudType back to PlayerProfile
Removed some convenient methods from PlayerProfile to avoid NPE because of
spoutHud
2012-07-07 19:59:10 +02:00
bm01
5571e0bc0c Arranged InspectCommand 2012-07-07 19:39:22 +02:00
bm01
73bb73c8ca Fixed /mmoedit 2012-07-07 19:35:32 +02:00
bm01
54011fdeb7 Removed unused OfflinePlayer from PlayerProfile 2012-07-07 19:27:47 +02:00
GJ
5b8811bd09 More work on McMMOPlayer 2012-07-06 11:57:17 -04:00
GJ
c460eec0ab Oops. 2012-07-06 09:30:30 -04:00
GJ
bc6233541a Start changing PlayerProfile to use an OfflinePlayer 2012-07-06 09:14:25 -04:00
bm01
18aef9d526 Typo 2012-07-06 07:13:52 +02:00
bm01
ccc6fd30f8 Fixed /inspect not working on offline player 2012-07-06 07:07:29 +02:00
GJ
1ba498c443 Because "final static" is just backwards. 2012-07-06 00:12:17 -04:00
GJ
64f31f2b5a Fixed issue with JSON API plugin & player chat events 2012-07-05 11:25:36 -04:00
GJ
b94085c5f4 Make 'em final 2012-07-05 09:33:57 -04:00
GJ
62b90ad552 Using .equals() is better 2012-07-05 09:25:48 -04:00
GJ
d6d1e0ffed More efficient handling of Party/Admin chat messages 2012-07-05 09:21:07 -04:00
GJ
ccd103cd88 More efficient iteration. 2012-07-05 09:11:40 -04:00
GJ
0606f16a11 pm is lazy too. 2012-07-04 15:38:26 -04:00
GJ
c9e3ea005b Because loc is lazy. 2012-07-04 15:38:25 -04:00
bm01
f009f5803f Changelog update 2012-07-04 20:24:34 +02:00
GJ
3f8268d848 Fixed custom blocks dropping the wrong thing with Super Breaker & Silk
Touch
2012-07-04 10:33:20 -04:00
GJ
cefec723d0 Javadoc typo 2012-07-04 10:12:10 -04:00
GJ
124aa72fd9 Better file handling 2012-07-04 10:00:11 -04:00
GJ
dbc7277ba9 FileWriter is pointless here. 2012-07-04 09:45:47 -04:00
GJ
24d8769b5b Remove useless FileWriter 2012-07-03 21:23:32 -04:00
GJ
4aecb9756e Improve file handling. 2012-07-03 21:21:32 -04:00
bm01
51ca29ab9f Forgot to loadKeys() 2012-07-03 23:29:26 +02:00
bm01
c6e5264b7b Print the stack trace for easier debugging 2012-07-03 23:28:58 +02:00
bm01
73203ce869 Removed unneeded method call 2012-07-03 22:05:47 +02:00
bm01
b80a29ca04 Configs rework, fixed mod config files not loading, fixed comment blocks not being copied 2012-07-03 21:57:46 +02:00
GJ
5ee440d9a5 Ensure that our stuff gets closed when working with Chunklets. 2012-07-03 15:10:35 -04:00
GJ
cda3675dc5 More bad variable names. 2012-07-03 10:14:01 -04:00
GJ
caf9c07ba3 Because PP is an awful variable name. 2012-07-03 10:04:04 -04:00
GJ
96e70aa4d2 Fixed "lower tool" messages still being displayed even when ability
messages are disabled.
2012-07-03 08:40:56 -04:00
GJ
9f1b77a007 Refactoring 2012-07-03 08:36:21 -04:00
GJ
946b5bb006 Added null checks to BlockBreak & BlockDamage events to help with mod
compatibility.
2012-07-03 07:59:36 -04:00
bm01
bebcc40987 Added missing annotations 2012-07-03 03:55:19 +02:00
bm01
d6d7f5099f Removed unused import 2012-07-03 03:54:20 +02:00
bm01
bdcc2f644b Removed unneeded instanceof 2012-07-03 03:53:51 +02:00
bm01
c3ba54a0ce Removed unneeded cast 2012-07-03 03:53:11 +02:00
bm01
1443e2f6b8 Removed unneeded null check, according to eclipse :3 2012-07-03 03:52:12 +02:00
bm01
7799acec05 Oops 2012-07-03 03:40:12 +02:00
bm01
1bbc1f28aa TrackedEntity.java cleanup 2012-07-03 03:37:11 +02:00
GJ
8257fd8e7c Tweaked a few switch statements. 2012-07-02 21:05:55 -04:00
GJ
bc58aff362 Fixed resource leak from never closing the JarFile. 2012-07-02 20:44:54 -04:00
GJ
1073954550 Lucky perk is actually a 33.3% boost. 2012-07-02 20:17:48 -04:00
GJ
c3d7a4e3de Fixed "lucky" perk making downgrades from repair more likely. 2012-07-02 19:56:48 -04:00
GJ
92ae92c116 Fixed children nodes of "lucky" perk not being set to true. 2012-07-02 19:46:47 -04:00
GJ
3c10be6d1a Added some missing defaults to switch cases. 2012-07-02 19:27:07 -04:00
bm01
f18a9bdcc7 Fixed duplication bug with sticky pistons 2012-07-02 23:54:05 +02:00
bm01
87f59cd3eb Fixed the possibility to use some abilities without the proper tool 2012-07-02 21:30:19 +02:00
GJ
819b6fcacb Added "lucky" donor perk - abilities have 25% better chance to activate 2012-07-02 11:09:55 -04:00
bm01
246961887e Build test 2012-07-01 13:09:34 +02:00
bm01
54e21333a3 Reworked some Spout stuff
among other things
2012-07-01 12:54:11 +02:00
bm01
c45beec59d Fixed repair enchant downgrade 2012-07-01 00:04:53 +02:00
bm01
c88ada489a Chunklets optimization 2012-06-30 02:38:22 +02:00
GJ
189f23f407 Fixed custom tools not handling the Ability_Enabled flag properly. 2012-06-28 11:20:53 -04:00
GJ
9789143c6d Check if player is online for EntityDamage events too. 2012-06-28 10:22:00 -04:00
GJ
f4dd7ff483 Fixed ClassDef error that prevented the server from loading unless
Spout was installed.
2012-06-28 10:03:22 -04:00
GJ
50e05c6320 Minor refactoring 2012-06-28 09:01:02 -04:00
GJ
9ba5360bfc Cleaned up inSameParty method 2012-06-28 08:14:49 -04:00
GJ
565ef693ce Fix issue with EntityDamageByEntityEvents & Offline Players 2012-06-28 08:14:49 -04:00
bm01
0c1a8eff85 Fixed NPE caused by Spout players after a /reload 2012-06-28 06:51:13 +02:00
GJ
32e9de6e9a Fix for NPE on party checks due to CombatTag plugin. 2012-06-27 23:51:18 -04:00
bm01
533955a9c7 Removed redundant calls 2012-06-28 05:35:56 +02:00
bm01
2faa0356a5 It's better that way 2012-06-27 20:46:45 +02:00
GJ
ee2a5c199a Added functionality to specify custom blocks that should not trigger
abilities.
2012-06-27 14:46:44 -04:00
bm01
bdcc522897 Fixed ConcurrentModificationException on world unload 2012-06-27 20:39:54 +02:00
GJ
71b20bdeaa Fixed ArrayIndexOutOfBounds error 2012-06-27 11:18:04 -04:00
GJ
0e85b4776a Add more XP boost permissions nodes. 2012-06-27 08:31:10 -04:00
GJ
24d2c1bc7a Fix for UTFDataFormatException 2012-06-26 14:58:51 -04:00
GJ
1610e932c6 Removed some debug code that got left in... 2012-06-26 13:23:56 -04:00
GJ
31d7bb2332 Javadoc fix 2012-06-26 08:03:19 -04:00
GJ
3d9c03c0c8 Added a few requested functions to the ExperienceAPI 2012-06-26 08:02:49 -04:00
bm01
dd94343d92 One more fix to admin chat 2012-06-25 21:35:38 +02:00
GJ
4b93dede33 Add ability to check if any ability is enabled. 2012-06-25 10:35:47 -04:00
GJ
61205989cc Cleanup cooldown monitoring a bit. 2012-06-25 10:29:29 -04:00
GJ
2559ea61d8 Added Ability API 2012-06-25 10:05:47 -04:00
GJ
eae665c1c5 Added ability for custom blocks to drop a range of items. MOD BLOCK
FILES WILL NEED TO BE REDONE.
2012-06-25 09:47:22 -04:00
bm01
d73521e0a0 Fixed admin chat being seen by everyone 2012-06-25 15:05:20 +02:00
GJ
e8deb0384a Fix Iron Grip calculations using incorrect values. 2012-06-25 08:54:05 -04:00
GJ
881f2c023e Added permission node for Iron Grip 2012-06-25 08:54:05 -04:00
bm01
5057a8a7a3 Fixed memory leak in ProfileSaveTask 2012-06-25 14:38:07 +02:00
bm01
b8e9269488 Made things cleaner 2012-06-25 14:37:18 +02:00
GJ
76afd5a7ca Back to new development. 2012-06-25 08:29:58 -04:00
bm01
dc48d467f5 Return to HashMap! 2012-06-24 22:46:45 +02:00
nossr50
0b0390620e Whoops :D 2012-06-24 13:26:49 -07:00
nossr50
24eb34c182 Back to the old way of doing things 2012-06-24 13:26:21 -07:00
nossr50
1a5bd1b6a2 Getting ready for release 2012-06-24 12:59:54 -07:00
nossr50
ab7b6ce460 Fixed bug that caused NPE when trying to compare null parties 2012-06-24 12:48:03 -07:00
GJ
c4cd677021 Added new methods to replace deprecation in latest Bukkit. Commented out
until RB.
2012-06-23 12:13:51 -04:00
bm01
6b84d39dda Fixed AE abilities not being applied correctly 2012-06-22 23:10:17 +02:00
bm01
e61342177d Simplified combat ability checks 2012-06-22 20:20:28 +02:00
bm01
d51fa92b46 Made 'shooterless' arrows dodgeable 2012-06-22 19:39:14 +02:00
bm01
3e20dc7de6 combatChecks optimization 2012-06-22 18:54:49 +02:00
GJ
dce1d7ba39 Fixed calculations on Reduced Cooldown perk 2012-06-22 10:57:51 -04:00
GJ
adffea1d52 Increased the seconds for activation time perk. 2012-06-22 10:13:37 -04:00
GJ
20b73dcc84 Fixed not checking if an Entity was a LivingEntity before applying the
Counter-Attack ability.
2012-06-22 09:47:18 -04:00
GJ
b331fa353b Added increased activate time donor perks 2012-06-21 23:01:02 -04:00
GJ
9fe14609af Locale update. 2012-06-21 22:26:29 -04:00
GJ
f6973b8907 Changelog update. 2012-06-21 21:51:43 -04:00
GJ
8738036f6f Added Reduced Cooldown perk for donors. 2012-06-21 21:50:48 -04:00
GJ
fce02dc0e5 Fixed possible NPE with Acrobatics fall checks. 2012-06-21 21:04:19 -04:00
GJ
2bef0e833f Rework of Swords handling 2012-06-21 09:04:45 -04:00
GJ
9040a2a2e3 Optimizations to Combat.java 2012-06-18 08:50:14 -04:00
NuclearW
4407ed0a6f Fixed bug with Chunklets not being reloaded on /reload 2012-06-16 21:43:04 -04:00
GJ
09721518b0 Fixed Unarmed using Taming levels.
My copy-paste skills are failing.
2012-06-15 11:11:57 -04:00
GJ
8ad6337dde Avoid calling the same thing 3 times. 2012-06-15 10:58:38 -04:00
bm01
271740d2ac Re-added mcMMO.getPlayerProfile(Player) 2012-06-15 10:03:00 +02:00
GJ
48dd537257 More reworking of Unarmed, renamed ArcheryBonusDamageEventHandler for
clarity's sake.
2012-06-14 23:59:36 -04:00
GJ
77b4aaa50d Updating Unarmed (WIP) 2012-06-14 23:59:35 -04:00
bm01
1014316581 Whoops D: 2012-06-15 03:32:46 +02:00
bm01
739cd83155 Forgot to cancel the task 2012-06-15 03:30:36 +02:00
bm01
df08bc4da0 Changelog update 2012-06-15 02:56:36 +02:00
bm01
55e832d4f6 Do not track arrow if the bow has Infinity 2012-06-15 02:53:11 +02:00
bm01
032472dcb3 Avoid unnecessary iteration 2012-06-15 02:46:41 +02:00
bm01
68bf93d1ac Remove inactive entities from the arrow tracker 2012-06-15 02:43:13 +02:00
bm01
ba133f94fc Extra equals 2012-06-15 02:34:24 +02:00
bm01
064c16f4d7 Reverted last commit 2012-06-15 02:14:53 +02:00
bm01
5a394ee744 Fixed killed entities not being removed from arrowTracker 2012-06-15 02:08:15 +02:00
bm01
3bc2f5dc55 Fixed Archery using Taming skill level 2012-06-15 02:06:06 +02:00
GJ
6f63818e5f Check for the block before throwing the fake break event. 2012-06-14 10:24:58 -04:00
GJ
a5d7bee939 Spacing 2012-06-14 00:01:31 -04:00
bm01
9d396162f1 Hardcore.java cleanup 2012-06-14 01:22:35 +02:00
bm01
4a0d9a96ab Fixed minor bug with Vampirism notification 2012-06-14 00:48:40 +02:00
GJ
9f65e5a9ab PermissionsHandler was a stupid idea. 2012-06-13 12:31:20 -04:00
GJ
c71f4e438b Organize imports. 2012-06-13 08:54:02 -04:00
GJ
14d13eb4c7 Archery rework. 2012-06-13 08:53:18 -04:00
GJ
29c629eb22 WIP on Archery rework. 2012-06-12 21:36:17 -04:00
bm01
050b794b42 Fixed NPE with /mmoedit 2012-06-12 23:31:32 +02:00
NuclearW
89b5f8c275 Changelog 2012-06-12 17:01:18 -04:00
NuclearW
f589197321 Load the lowest chunklets right now.
Thanks for @Glitchfinder for finding this glitch.

Closes #205
2012-06-12 17:00:05 -04:00
NuclearW
09575a68f0 Handle corrupt chunklets by making a new one and not throw stacktrace 2012-06-12 16:45:28 -04:00
NuclearW
c1b838e356 Typo fix 2012-06-12 16:45:00 -04:00
GJ
8ed2696315 Fix issue with trying to remove all of the item in hand. 2012-06-12 15:11:13 -04:00
GJ
ab138bdba2 Javadocs, added Lighting to the damage types affected by Shock Proof 2012-06-12 14:48:28 -04:00
GJ
5ba9fb78fd More tweaks to Taming. 2012-06-12 14:42:38 -04:00
GJ
2d47447375 Begin rework of Taming skill 2012-06-12 11:07:51 -04:00
GJ
d9eaede4c2 Spacing 2012-06-12 11:07:27 -04:00
GJ
c6db11a10b Use EntityDamage event instead of EntityDamageByEnitity 2012-06-12 10:23:34 -04:00
GJ
2225e542ad Spacing issues. 2012-06-12 09:20:39 -04:00
GJ
975e13d45f Tweaked how we check XP gain permissions. 2012-06-12 08:10:18 -04:00
bm01
534a165c45 Tweaked a few things 2012-06-12 06:18:00 +02:00
bm01
5cff6ed67b Removed xpGainATS, it actually never worked 2012-06-12 05:59:26 +02:00
bm01
3448733834 Removed unused variable 2012-06-12 05:40:07 +02:00
bm01
c382c95d24 Re-added respawnATS 2012-06-12 05:38:32 +02:00
GJ
0034226fa7 Reorder constructors to avoid errors 2012-06-11 21:03:49 -04:00
GJ
5f067a6bb5 More tweaks to Acrobatics. 2012-06-11 20:37:09 -04:00
GJ
6ab1996440 Reworking of Acrobatics, plus an Acrobatics bugfix. 2012-06-11 16:11:23 -04:00
bm01
5bff6d63f2 Removed unneeded reference 2012-06-11 08:26:48 +02:00
bm01
5fe227b874 Forgot to change getParties 2012-06-11 08:26:22 +02:00
bm01
cbaf2f8370 More work on parties 2012-06-11 07:50:10 +02:00
bm01
393ac886e2 Removed unneeded method 2012-06-10 06:57:55 +02:00
bm01
c9082083d1 Merged ProfileSaveTask and RemoveProfileFromMemory 2012-06-10 06:56:39 +02:00
bm01
5d0d89e74d Changed party name restriction 2012-06-09 22:24:04 +02:00
bm01
e9c3583fd8 Added few forgotten things 2012-06-09 20:11:11 +02:00
bm01
81eadc1418 No longer use/save party name in database and users flat file 2012-06-09 19:48:18 +02:00
bm01
dfff0efc0b Cleanup 2012-06-09 19:29:44 +02:00
bm01
3732db2226 Reworked Party 2012-06-09 03:08:36 +02:00
bm01
e9ccdcfbbe Missing space! 2012-06-08 20:04:45 +02:00
bm01
01345a5dc4 Fixed /mcremove on existing PlayerProfile 2012-06-08 20:03:02 +02:00
bm01
90c8e57ed7 Reworked a little Users.java 2012-06-08 20:00:02 +02:00
GJ
d644b4c331 Fixed NPE with repairing items that rely on metadata. 2012-06-06 18:27:52 -04:00
GJ
2f15c71412 Because making it upper case broke all the things. 2012-06-06 18:02:22 -04:00
GJ
0a44a74f59 Cleanup (Yes, I'm that picky). 2012-06-06 16:49:42 -04:00
bm01
f876fe8d25 Made API classes 'statics' 2012-06-06 22:04:21 +02:00
GJ
290032646f Protect our hashmaps from bad people. 2012-06-06 15:38:44 -04:00
GJ
e5d2ed4bb2 Because lowercase class names are evil. 2012-06-06 14:49:07 -04:00
GJ
e9ea0e0389 Created a variable for player name. 2012-06-06 09:32:01 -04:00
bm01
35565bb021 Removed PlayerProfile save on User.removeUser, it's already done in RemoveProfileFromMemoryTask 2012-06-06 02:20:33 +02:00
bm01
56aff1d191 Replaced playerName fields in PlayerProfile and Users by the Player object 2012-06-06 02:03:27 +02:00
GJ
b8be1d1866 Fix the Javadocs 2012-06-05 11:05:51 -04:00
GJ
1d7d2cd52e Make it static. 2012-06-05 11:05:44 -04:00
GJ
71446a12af Static ALL the things! 2012-06-05 10:42:56 -04:00
GJ
ca6cafaebd Cleanup 2012-06-05 10:42:56 -04:00
GJ
c97be335ee Avoid using mcMMO.p when we can 2012-06-05 10:42:56 -04:00
GJ
fd1227b87e No need for public constructor 2012-06-05 10:42:56 -04:00
bm01
7ef72c501e Cleanup 2012-06-05 16:32:26 +02:00
GJ
f7ee96aa99 Fixed bug where admin chat was displayed to the whole server. 2012-06-05 10:19:23 -04:00
GJ
b84478898d Cleanup. 2012-06-05 10:18:05 -04:00
GJ
6afe0e8a34 Organize imports. 2012-06-05 10:13:10 -04:00
GJ
6e4f4b5c8d More cleanup. 2012-06-05 10:07:45 -04:00
bm01
f86fe4a138 Changelog update 2012-06-05 16:03:08 +02:00
bm01
63c663b8c1 Fixed Archery PVP/PVE enablement not being used properly 2012-06-05 16:00:32 +02:00
bm01
a1296596fa Fixed possible NPE when a projectile doesn't have a shooter 2012-06-05 16:00:27 +02:00
GJ
1cca4de9e5 Cleanup! 2012-06-05 09:57:10 -04:00
GJ
7ada587df3 More Spout tool stuff. 2012-06-04 10:36:24 -04:00
GJ
1e58c32a5f Change XP processing to use a single function. 2012-06-04 09:30:51 -04:00
GJ
2a27048174 Functions that start with capital letters are bad. 2012-06-04 09:08:41 -04:00
GJ
2b291954cf Javadocs. 2012-06-04 09:03:25 -04:00
GJ
8f8bfc62ca Cleanup. 2012-06-04 08:51:10 -04:00
GJ
38d4d448a9 Remove unused imports. 2012-06-04 08:46:12 -04:00
nossr50
d5d11ca4bd Whoops 2012-06-03 15:39:13 -07:00
nossr50
e3e400f376 This should make us AntiCheat friendly. 2012-06-03 14:38:33 -07:00
GJ
6637758ad0 Fixed Spout item checks. 2012-06-01 15:29:16 -04:00
GJ
41e9bd3cb5 WIP - Spout custom tool support 2012-05-31 16:02:11 -04:00
GJ
c2d1909379 Changelog update. 2012-05-31 16:00:20 -04:00
GJ
77688f297f Fixed a few permissions errors. 2012-05-31 15:23:38 -04:00
GJ
714f665cc7 Woodcutting to SkillCommand 2012-05-31 15:15:00 -04:00
GJ
ec138d5741 Unarmed to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
560e5aa19a Taming to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
ad162f3366 Swords to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
5d07830339 Repair to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
b310d25ee3 Cleanup. 2012-05-31 15:14:59 -04:00
GJ
443ccbd807 Mining to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
8cdecf80c7 Herbalism to SkillCommand 2012-05-31 15:14:59 -04:00
GJ
a16d5435de Removed unneeded function call. 2012-05-31 15:14:59 -04:00
GJ
ec02422226 Fishing to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
cc5d438550 Excavation to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
806d116501 Axes to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
066c9d9fec Archery to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
5b3b9fbc30 Tweak the way SkillCommands are constructed. 2012-05-31 15:14:58 -04:00
GJ
d15e189b7c Acrobatics to SkillCommand 2012-05-31 15:14:58 -04:00
GJ
1bd9974f89 Abstract Skill Commands 2012-05-31 15:14:58 -04:00
NuclearW
90296d87df Similarly return admin chat to ye olden method 2012-05-30 11:18:47 -04:00
NuclearW
75b287771a Return party chat to ye olden method 2012-05-30 11:18:46 -04:00
GJ
5765504796 Locale updates. 2012-05-30 11:11:07 -04:00
GJ
dda8c0c9e0 Fixed bug with Tree Feller changing durability too soon. 2012-05-30 10:48:25 -04:00
GJ
ce9d668602 Fixed bug with locale strings and party teleport. 2012-05-30 10:41:22 -04:00
NuclearW
39c2c5f25f Handle EOFException in Chunklets by returning a new empty ChunkletStore and printing an error. 2012-05-29 21:02:36 -04:00
nossr50
12a7d794b4 Always forget the changelog 2012-05-28 17:02:02 -04:00
nossr50
ff8b0300ae Make the MOTD prettier about the perks 2012-05-28 16:49:21 -04:00
NuclearW
f882df4cb7 Fix this yaml error 2012-05-28 16:43:06 -04:00
nossr50
e1300005cb Notify users of their perks on login (if MOTD enabled) 2012-05-28 13:14:10 -07:00
nossr50
e599ab9214 Added permissions that will grant users 4x 3x or 2x XP 2012-05-28 13:07:52 -07:00
GJ
92acf62884 More mod fixes for Woodcutting. 2012-05-27 14:40:35 -04:00
GJ
c2fb57fce9 Fix Tree Feller not working with custom axes 2012-05-27 14:31:37 -04:00
GJ
3699d26e5d Only try to back up the mod files if they exist... 2012-05-27 10:23:13 -04:00
GJ
6eb0159ea1 More tracking of falling sand/gravel. (WIP) 2012-05-27 10:21:00 -04:00
GJ
433913c77a Another fix for falling sand/gravel tracking issues. 2012-05-27 09:42:38 -04:00
bm01
d955feef61 Fixed piston tracking 2012-05-27 10:34:04 +02:00
GJ
5377b9b618 Remove debug messages. 2012-05-26 21:11:50 -04:00
GJ
5c9371c575 Fixed falling sand/gravel stuff not being tracked 2012-05-26 19:52:24 -04:00
GJ
23d916f191 Fixed dupe exploit with pistons (again). 2012-05-26 10:50:12 -04:00
GJ
35d4914518 This has to be Arrow to keep Potions from giving XP. 2012-05-24 15:26:01 -04:00
GJ
eb2ec71d2b More priority tweaks. 2012-05-24 14:17:51 -04:00
GJ
dc50758dc9 Minor priority tweaks to the Spout XP bar. 2012-05-24 14:02:23 -04:00
GJ
9775d71c28 Cleanup. 2012-05-24 10:35:46 -04:00
GJ
c40e4ee9ee Cleanup. 2012-05-24 10:30:07 -04:00
GJ
2b469c385c Changelog update 2012-05-24 08:39:13 -04:00
GJ
a104fe45aa Fix for NoCheatPlus fight.noswing checks 2012-05-24 08:38:44 -04:00
bm01
257df25a67 Fixed NPE, Config.defaulthud was used instead of SpoutConfig.defaulthud 2012-05-24 06:58:11 +02:00
bm01
2a977557c2 Made sure that SpoutConfig.load is called when the instance is created, for safety 2012-05-24 06:18:43 +02:00
bm01
d0e9f03311 Reverted last commit from NuclearW 2012-05-24 05:29:05 +02:00
bm01
97ca699170 Removed unneeded method override 2012-05-24 05:27:29 +02:00
NuclearW
702537e8fd We don't need this 2012-05-23 15:33:08 -04:00
NuclearW
83a3488d0d Because loading a config we hadn't made yet makes sense 2012-05-23 15:32:58 -04:00
GJ
450e938092 Change Spout Config file to only load if Spout is enabled.
Removed unused imports.
2012-05-23 14:31:03 -04:00
GJ
b88e076f27 Updates to config loading. 2012-05-23 13:52:33 -04:00
GJ
0fe90df01e Cleanup. 2012-05-23 11:16:23 -04:00
GJ
66ad909908 Cleanup. 2012-05-23 11:08:56 -04:00
GJ
77d74717d2 Moved all Spout checks into one listener. 2012-05-23 11:06:02 -04:00
GJ
63f683982f Moved Spout stuff to its own config file. 2012-05-23 10:50:47 -04:00
GJ
9525ce8299 Cleanup. 2012-05-23 09:35:16 -04:00
GJ
d7b8ec1274 Cleanup. 2012-05-23 07:33:19 -04:00
GJ
96cd16faf7 Cleanup 2012-05-23 07:32:03 -04:00
NuclearW
9ddc7501fe Derp 2012-05-22 09:16:40 -04:00
NuclearW
301c496fb2 Onward to 1.3.09 2012-05-22 08:45:21 -04:00
379 changed files with 30258 additions and 20660 deletions

4
.gitignore vendored
View File

@@ -24,7 +24,7 @@
/world
# Mac filesystem dust
/.DS_Store
*.DS_Store
# intellij
*.iml
@@ -39,4 +39,4 @@
*.jar
# Atlassian Stuff
/atlassian-ide-plugin.xml
/atlassian-ide-plugin.xml

View File

@@ -7,6 +7,268 @@ Key:
! Change
- Removal
Version 1.4.00-dev
+ Added new Child Skill - Smelting!
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
+ Added config options for Hylian Luck skill
+ Added display values to Unarmed command for Iron Grip
+ Added '/party create <name>' command, use this to create a party
+ Added '/party disband' command, kicks out all members and deletes the party
+ Added '/ptp toggle' command, to disable party teleportation.
+ Added '/ptp accept' and '/ptp acceptall' commands
+ Added an automatic party kick when a party member has been offline for 7 days (default)
+ Added a permission to allow friendly fire in parties, both attacker and defender must have it for friendly fire to occur
+ Added timeout on party teleport requests
+ Added XP bonus for Archery based on distance from shooter to target
+ Added ability to config Hylian Luck drops through treasures.yml
+ Added party XP sharing, when more party members are near the share bonus increases.
+ Added vanilla XP boost for Fishing - includes permissions, config options, etc
+ Added particle effect for bleeding
+ Added methods to check if a player is in party or admin chat to the ChatAPI
+ Added /mcpurge functionality for Flatfile users
+ Added basic support for Mo' Creatures (and other entity mods) - specify mob info in entities.yml
+ Added Shears, Buckets, Fishing Rods, Flint & Steel, Carrot Sticks, and Bows to the list of items that can be Salvaged
+ Added the "wait" music disc to the default fishing treasures
+ Added "Chinese (Taiwan)" localization files (zh_TW)
+ Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
+ Added Block Cracker to Unarmed's Berserk, turn smooth brick into cracked smooth brick
+ Added config option to disable automatic zip backups.
= Fixed Green Thumb on wheat not working properly at rank 4
= Fixed Green Thumb and Green Terra consuming twice the amount of seed needed
= Fixed Green Terra not also checking Green Thumb permissions
= Fixed bug where splash potions could raise a player's unarmed level
= Fixed bug where fired arrows could raise skill levels other than Archery
= Fixed /ptp telporting the target to the player, rather than the other way around.
= Fixed Impact reducing the durability of non-armor equipped blocks
= Fixed Impact reducing improperly the durability of armors (as a consequence it is now more effective)
= Fixed multiple commands not working properly on offline players
= Fixed /mmoedit not giving feedback when modifying another players stats
= Fixed the guide usage string showing up every time /skillname was called
= Fixed Spout not being able to precache our resources properly, and therefore making our XP bars fail
= Fixed Spout config files loading / generating when they shouldn't have
= Fixed mod config files loading / generating when they shouldn't have
= Fixed bug where Green Terra could activate on crops that weren't fully grown.
= Fixed several typos relating to locale string display
= Fixed bug where all skill guide headers appeared as "Skillname Guide Guide"
= Fixed bug where Impact was applied incorrectly due to an inverted method call
= Fixed bug where Impact improperly determined the defender's armor
= Fixed a bug which made it impossible to join other players' parties
= Fixed ArrayIndexOutOfBoundsException resulting from being unranked in a skill when using FlatFile
= Fixed Woodcutting accidentally using Mining double drop values.
= Fixed Hylian Luck not removing the block-placed flag from flowers.
= Fixed Hylian Luck not checking the block-placed flag on flowers.
= Fixed Leaf Blower not respecting the unlock level set in advanced.yml
= Fixed abilities activating with the wrong tool in hand
= Fixed Experience.Gains.Mobspawners.Enabled not being used correctly (the check was inverted)
= Fixed bug where Iron Grip was using the attacker's skill values rather than the defender's.
= Fixed a bug where /party kick would trigger the PartyChangeEvent for the wrong player
= Fixed /party kick not working on offline players
= Fixed a bug where party join messages weren't displayed
= Fixed a bug where a new party leader wasn't appointed, after the previous party leader left
= Fixed a bug where Disarm and Deflect had wrong values
= Fixed Magic Hunter (Fishing ability) favoring certain enchants
! Config files are now backed up even when running in SQL mode
! Changed /p and /a to use /partychat and /adminchat as the default command name. The use of /p, /pc, /a, and /ac is still supported.
! We're now using Bukkit sounds instead of Spout sounds.
! It is now possible to use a negative number for Max_Level in treasures.yml to not use a maximum level, changed default file accordingly
! A Fishing catch will now always contains a fish even if a treasure is found
! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent
! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR.
! Changed how Tree Feller is handled, it should now put less stress on the CPU
! Changed Tree Feller to work on huge mushrooms
! Changed Fisherman's Diet and Farmer's Diet to use two seperate config values
! Major refactoring - please take note, this WILL break any mcMMO-related plugin not properly hooking into the API.
! Changed the way party commands work, use /party ? to check how to use the new commands
! Changed McMMOChatEvent to contain the plugin that the event originated from.
! Changed Excavation to have individual XP values for each block type, rather than a base XP value.
! Changed the way party teleportation works. When using /ptp, the target player needs to confirm the teleport before it takes place. (Configurable)
! Changed BeastLore: Now also displays offline player names
! Changed backup task to include ALL config files
! Deprecated most functions in ExperienceAPI, replaced them with identical versions that use a String for the SkillName rather than the SkillType enum values
! Changed Super Breaker & Giga Drill Breaker to be an enchantment-based boost, rather than an instabreak.
! Changed locales to fall back on English when translated strings cannot be found.
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
- Removed unused "healthbar" files from the resources
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
- Removed /mcc command. Replaced with /mcmmo [?|help|commands]
Version 1.3.14
+ Added new Hylian Luck skill to Herbalism.
= Fixed a memory leak involving mob tracking
- Removed extra durability loss from Leaf Blower
Version 1.3.13
+ Added task & command to prune old and powerless users from the SQL database.
+ Added Craftbukkit 1.4.6 / 1.4.7 compatibility
+ Added new /mcrank command for showing a players leader board ranking for all skills in one place
+ Added a configurable durability cap for ArmorImpact to advanced.yml
+ Added the version number to /mcmmo
+ Added bats, giants, witches, withers, and wither skeletons to the mcMMO combat experience list, and makes their experience drops configurable
+ Added the ability to track mobs spawned by mob spawners or the Taming ability when the chunks they are in unload and reload
+ Added wooden button to the list of items that shouldn't trigger abilities
+ Added a new feature to fishing. Players will have +10% chance of finding enchanted items when fishing while it's raining
+ Added displaying bonus perks on skill commands
+ Added config option to disable gaining Acrobatics XP from dodging lightning
+ Added missing skill guides. They're finally here!
+ Added more localization
+ Added a very secret easter egg
= Fix issue with Sand/Gravel tracking
= Fix possible NPE when using the PartyAPI to add a player to a party that doesn't exist.
= Fix mcremove command for mySQL
= Fix a java.io.FileNotFoundException when using SQL
= Impact now works with mobs wearing armor
= Fixed issue with Tree Feller dropping player-placed blocks
= Fixed issue with missing default cases from several switch/case statements
= Fixed issue with Mining using actual skill level rather than max skill level
= Fixed some issues with static access
= Fixed ItemStack deprecation issues
= Fixed Async deprecation issues
= Fixed a bug with MySQL databases (non-alphanumeric characters preventing MySQL access)
= Fixed a bug where the /skillreset command was broken
= Fixed a bug where skill commands displaying .x% instead of 0.x%
= Fixed a bug Unbreaking enchantments being ignored when using Treefelling and when hit by Armor Impact
= Fixed a bug where only 1 diamond was needed to fully repair a broken item: Repaired the Repair skill!
= Fixed a bug where a infinite loop of errors caused by mySQL database could cause the server to crash
= Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties
= Fixed a bug which caused advanced.yml not to work for Swords
= Fixed a bug which caused advanced.yml not to respect every MaxChance node
= Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml
= Fixed a bug where Repair would remove enchantments but the glow effect remained
= Fixed a bug where dropped items did not retain custom NBT data
= Fixed a bug which caused a potentially infinite recursion in a btree structure
= Fixed a NPE with custom blocks
= Fixed a bug with Blast Mining never dropping debris blocks
= Fixed a bug with Blast Mining incorrectly handling reduced TNT damage
= Fixed a bug with conflicting fishing enchantments
= Fixed a bug where triple drops wouldn't happen
= Fixed a bug which caused fishing to ignore max/min levels in treasures.yml
= Fixed a bug where treefeller affected player-placed blocks
= Fixed bug where Skull Splitter would be applied twice.
! GJ stopped being a lazy slacker and got stuff done
! Nossr50 actually committed something
! Changed code that uses SpoutPlugin to make it compatible with the latest version
! Reimplemented skill level and power level caps.
! Moved Arcane Forging and Fishing setting from config.yml to advanced.yml
! Overall SQL query improvements
! Reduced number of SQL queries for mcTop command from 11 to 1, speeding it up immensely
! Changed FFS Leaderboards to hold information in memory rather than doing IO work (optimizations)
! Improved chunk conversion (less errors)
! Changed Fishing Treasure Hunter, chance has increased and now actually is level dependent
! Indexed most used mySQL columns for faster queries
- Removed dead code relating to null profiles
- Removed unused imports
- Removed ChunkletUnloader and dependents, since they are no longer necessary.
Version 1.3.12
+ Added Craftbukkit 1.4.5 compatibility
+ Added the new 1.3.2 items, xp and double drops for Cocoa beans & Emeralds, EnderChest to the list of blocks that shouldn't trigger abilities
+ Added new items from Minecraft 1.4 to Herbalism (potatoes & carrots)
+ Added new configuration file for advanced users.
+ Added new permission nodes to greenthumb for the 1.4 items
+ Added new mobs from Minecraft 1.4 checks for every ability
+ Added new active ability for Repair: Salvage
+ Added options to 'config.yml' configure shake chance
+ Added the option to negate experience earned for Herbalism while in a minecart to prevent afk leveling
+ Added Green thumb now converts cobble walls to mossy cobble walls
+ Added beacons and anvils to list of blocks that don't trigger abilities
+ Added a configuration option to disable experience gains when in a minecraft for Acrobatics and Herbalism, to prevent AFK leveling
+ Added a new passive ability for Fishing, Fishermans diet. Increases hunger restored from fish
+ Added a feature to display all active perks on login
! Changed Fishing, Shake drops changed from guaranteed to based upon fishing level and perks
! Changed Woodcutting, the amount of experience earned when using Tree Feller on jungle trees has increased
! Changed Herbalism double drop rates for melons and netherwart
! Changed filesystem usage, it's reduced a lot. Should help reduce lag on larger servers
! Changed database connection handling. Support for aggressive connection timeouts, with exponential backoff for multiple failures
! Changed Cobblestone walls are now mossy-able with Greenthumb
! Changed the skull drop rates of the shake ability to 3%
= Fixed a NPE when Citizens perform certain tasks
= Fixed a NPE with Woodcutting, excessive null chunk before earning Woodcutting experience
= Fixed a NPE related to skill cooldowns
= Fixed a NPE when a players profile was null
= Fixed a NPE involving certain explosions
= Fixed a dupe bug when for players who were using a 'nuker' client
= Fixed a dupe bug where pistons were used to dupe ores
= Fixed a dupe bug with Salvage when players were in Creative mode
= Fixed a bug where the player was displayed an incorrect cooldown time
= Fixed a bug where players could earn experience when they were dealing 0 damage
= Fixed a bug where players could get double drops from mossified Cobblestone
= Fixed a bug where Herablism magically converted potatoes to carrots
= Fixed a bug where you couldn't modify the stats of offline players
= Fixed a bug where treefeller didn't work properly on tree's with side-way logs
= Fixed a bug where the Arcane forging downgrade chance should've been 0, but actually wasn't
= Fixed a bug where Fishing would sometimes give items with empty enchantments
= Fixed a bug where the lucky perk for Fishing was actually an unlucky perk
- Removed nothing
Version 1.3.11
! Changed axes to start with 1 durability damage instead of 5, gain 1 durability damage every 50 levels instead of 30, and only have a 25% chance on hit to damage armor (per armor piece)
+ Added compatibility with bow-wielding NPCs from Citizens/NPC mods
+ Added compatibility for pvp-prevention plugins for Serrated Strikes
= Fixed bug where mcMMO could throw NPE errors if trees cut down were from a custom mod and had an id of 17
= Fixed dupe bug where mcMMO would ignore other block-protection plugins for various abilities
= Fixed NPE with hardcore mode's vampirism
Version 1.3.10
+ Added 1.3.1 compatibility
+ Added permission node for Iron Grip ability (mcmmo.ability.unarmed.irongrip)
+ Added ability for custom blocks to drop a range of items.
+ Added Ability API functions
+ Added 50% & 150% XP boost perks
+ Added "lucky" perk for donors
= Fixed /inspect not working on offline players
= Fixed custom blocks, tools and armors not loading properly
= Fixed duplication bug with sticky pistons
= Fixed "GenericLabel belonging to mcMMO..." message
= Fixed menu exit button not working
= Fixed Repair enchant downgrade not working
= Fixed NPE caused by Spout players after a /reload
= Fixed ConcurrentModificationException on world unload
= Fixed players never being removed from memory (memory leak)
= Fixed admin chat being seen by everyone
= Fixed issue with UTFDataFormatException occurring on occasion when trying to load Chunklets
= Fixed ArrayIndexOutOfBounds error caused when trying to use /xplock after logging in but before gaining XP
= Fixed custom tools not properly respecting the Ability_Enabled flag.
= Fixed "lower tool" messages still being displayed even when ability messages are disabled.
= Fixed custom blocks not dropping the proper item with Super Breaker when Silk Touch is used
= Fixed custom woodcutting blocks throwing errors.
= Fixed possible ClassCastException from catching something other than a mob when using the Shake Mob skill
! Changed the format by which Chunklets are stored to be much smaller, and much faster to load
! Optimized how player placed blocks are tracked
Version 1.3.09
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
+ Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP)
+ Added reduced cooldown permission nodes as special perks (1/4, 1/3, 1/2 cooldown)
+ Added increased activation time permissions nodes as special perks (+4, +8, and +12 seconds)
+ Added API for plugins to add custom tools directly via Spout - repair / abilities do not work ATM
+ Added offline party members to the list displayed by /party
+ Added possibility to kick offline members from parties
= Fixed bug that would cause a NPE for players that had no parties
= Fixed Vampirism not notifying the correct amount of stolen levels
= Fixed bug with Acrobatics not saving you from deadly falls
= Fixed /mcremove being applied only after a reload
= Fixed Archery PVE disablement not working properly
= Fixed possible NPE when a projectile is shot by a dispenser or doesn't have any shooter
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)
= Fixed tiny memory leak concerning Archery
= Fixed bug where you could receive Archery XP from Potions
= Fixed bug where Chunklets for the < 64 y coordinates would not be properly loaded
= Fixed exploit with block duplication via piston pushing
= Fixed bug with falling sand/gravel not being tracked
= Fixed bug with Tree Feller not working with custom axes
= Fixed bug with locale strings when trying to teleport to a non-existent player
= Fixed bug with Tree Feller changing durability before checking for axe splintering
= Fixed bug with Repair Mastery permission due to typo
= Fixed bug with repairing items that use metadata
= Fixed bug with Chunklets not being reloaded on /reload
= Fixed possible NPE when falling with no item in hand
! API methods can now only be used in a static way
! Arrows shot from a bow having the Infinity enchantment can no longer be retrieved
! Arrows that aren't shot by an entity are now able to be dodged (currently only from dispensers)
! Changed Spout settings to be in their own config file (spout.yml)
! Changed file format for parties (parties.yml), previous files are no longer used
! Changed mcMMO to inform on corrupt Chunklets and make new ones
Version 1.3.08
+ Added more notifications about Vampirism and Hardcore mode on player death
+ Added information about Hardcore mode when joining a server running Hardcore mode
@@ -87,7 +349,7 @@ Version 1.3.06
= Fixed NPE error with Metrics on startup
= Fixed bug where Herbalism required double drops permission to give XP
= Fixed bug where {0} would be displayed in front of your power level in mcstats
= Fixed mmoupdate not being useable from console
= Fixed mmoupdate not being useable from console
= Fixed bug with repairing wooden tools
= Fixed bug with Nether Wart not awarding XP
= Fixed bug with fishing treasures when treasures list is empty
@@ -100,19 +362,19 @@ Version 1.3.06
! Changed how we handled the config file to prevent any bugs when returning values
! Changed locale files to use a new naming scheme. This breaks ALL old locale files. If you want to assist with re-translating anything, go to getlocalization.com/mcMMO
! Changed /mcremove to check for users in the MySQL DB before sending queries to remove them
! Changed how the tree feller threshold worked for the better
! Changed how the tree feller threshold worked for the better
! Changed /mcremove to no longer kick players when they are removed from database
! Changed /mcremove to work on offline users for FlatFile
! Changed /mcremove to work on offline users for FlatFile
! Changed PlayerProfile constructor to always take a boolean
! Changed getPlayerProfile function to work for online & offline users
! Changed Archery's Daze to deal 4 DMG on proc (2 Hearts)
! Changed /addlevel command to work for offline users
! Changed party & admin chat handling to be nicer to developers
! Changed party & admin chat handling to be nicer to developers
! Changed /mcrefresh to work from console
! Changed /mcrefresh to work for offline players
! Changed /mcrefresh to work for offline players
! Changed UpdateXPBar function to hopefully avoid errors
! Changed /party to show offline party members
! Changed Blast Mining requirements, now asks for the player to be crouching
! Changed Blast Mining requirements, now asks for the player to be crouching
Version 1.3.05
+ Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%)
@@ -161,7 +423,7 @@ Version 1.3.03
+ Added console functionality to mctop
= Fixed Green Terra not awarding Triple Drops
= Fixed ClassCastException from Taming preventDamage checks
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
= Fixed issue with block interaction returning NPEs
= Fixed issue where every block broken had a mining check applied
= Fixed issue where every block broken had a herbalism check applied
@@ -177,7 +439,7 @@ Version 1.3.03
! Changed mcMMO to be better about saving player information on server shutdown
! Changed PTP to prevent teleporting if you've been hurt in the last 30 seconds (configurable)
! Changed Chimera Wing failure check to use the maxWorldHeight.
! Changed inspect failed message to say inspect rather than whois
! Changed inspect failed message to say inspect rather than whois
! Changed Call of the Wild to activate on left-click rather than right-click
! Changed Blast Mining to track based on Entity ID vs. Location
! Changed mmoedit to save a profile when used (this will make mctop update)

View File

@@ -1,8 +1,8 @@
== mcMMO
**The RPG lovers mod**
=== Forums
http://forums.mcmmo.info Talk with developers and the community about mcMMO here
=== Dev builds
http://ci.mcmmo.info Download the latest dev build of mcMMO here.
=== Brief Description
mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.
@@ -20,8 +20,9 @@ Hearing that people enjoy mcMMO and seeing the daily youtube videos about my mod
Required Libraries:
* Spout API
* JUnit
Required to Run:
* Bukkit
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.

92
pom.xml Normal file → Executable file
View File

@@ -2,12 +2,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.3.08</version>
<version>1.4.00-beta3</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement>
<url>http://issues.mcmmo.org</url>
<system>JIRA</system>
<url>https://github.com/mcMMO-Dev/mcMMO/issues</url>
<system>GitHub</system>
</issueManagement>
<build>
<finalName>mcMMO</finalName>
@@ -19,6 +19,7 @@
<directory>${basedir}/src/main/resources/</directory>
<includes>
<include>*.yml</include>
<include>.jenkins</include>
</includes>
</resource>
<resource>
@@ -54,12 +55,12 @@
</includes>
</resource>
<resource>
<targetPath>com/gmail/nossr50/locale</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/locale/</directory>
<includes>
<include>locale*.properties</include>
</includes>
<targetPath>com/gmail/nossr50/locale</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/locale/</directory>
<includes>
<include>locale*.properties</include>
</includes>
</resource>
</resources>
<plugins>
@@ -91,7 +92,40 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<configuration>
<artifactSet>
<includes>
<include>com.turt2live.metrics:MetricsExtension</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.turt2live.metrics</pattern>
<shadedPattern>com.gmail.nossr50.util.mcstats</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>2.2</version>
</extension>
</extensions>
</build>
<repositories>
<repository>
@@ -99,7 +133,7 @@
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</snapshots>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
@@ -108,9 +142,18 @@
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<id>spout-repo</id>
<url>http://nexus.spout.org/content/groups/public/</url>
</snapshots>
<id>spout-repo</id>
<url>http://nexus.spout.org/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<id>Plugin MetricsExtension</id>
<url>http://repo.turt2live.com</url>
</repository>
</repositories>
<dependencies>
@@ -123,12 +166,31 @@
</dependency>
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutpluginapi</artifactId>
<version>dev-SNAPSHOT</version>
<artifactId>spoutplugin</artifactId>
<version>LATEST</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.turt2live.metrics</groupId>
<artifactId>MetricsExtension</artifactId>
<version>0.0.2-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>mcmmo-repo</id>
<url>file:///var/lib/jenkins/repo</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@@ -0,0 +1,51 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.skills.utilities.AbilityType;
import com.gmail.nossr50.util.Users;
public final class AbilityAPI {
private AbilityAPI() {}
public static boolean berserkEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
}
public static boolean gigaDrillBreakerEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
}
public static boolean greenTerraEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
}
public static boolean serratedStrikesEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
}
public static boolean skullSplitterEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLIITER);
}
public static boolean superBreakerEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
}
public static boolean treeFellerEnabled(Player player) {
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
}
public static boolean isAnyAbilityEnabled(Player player) {
PlayerProfile profile = Users.getPlayer(player).getProfile();
for (AbilityType ability : AbilityType.values()) {
if (profile.getAbilityMode(ability)) {
return true;
}
}
return false;
}
}

View File

@@ -1,43 +1,58 @@
package com.gmail.nossr50.api;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class ChatAPI {
public final class ChatAPI {
private ChatAPI() {}
/**
* Send a message to all members of a party
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender
* @param displayName The display name of the sender
* @param party The name of the party to send to
* @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);
}
/**
* Send a message to all members of a party
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender to display in the chat
* @param party The name of the party to send to
* @param message The message to send
*/
public void sendPartyChat(String sender, String party, String message) {
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
ChatManager.handlePartyChat(plugin, PartyManager.getParty(party), sender, sender, message);
}
if (chatEvent.isCancelled()) {
return;
}
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") ";
mcMMO.p.getLogger().info("[P](" + chatEvent.getParty() + ")" + "<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
if (Users.getProfile(player).inParty()) {
if (Users.getProfile(player).getParty().equalsIgnoreCase(chatEvent.getParty())) {
player.sendMessage(pPrefix + chatEvent.getMessage());
}
}
}
/**
* Send a message to all members of a party
* </br>
* This function is designed for API usage.
*
* @deprecated Replaced by sendPartyChat(Plugin, String, String, String)
*
* @param sender The name of the sender to display in the chat
* @param party The name of the party to send to
* @param message The message to send
*/
@Deprecated
public static void sendPartyChat(String sender, String party, String message) {
sendPartyChat(null, party, sender, sender, message);
}
/**
@@ -45,24 +60,80 @@ public class ChatAPI {
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender
* @param displayName The display name of the sender
* @param message The message to send
*/
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
ChatManager.handleAdminChat(plugin, sender, displayName, message);
}
/**
* Send a message to administrators
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender to display in the chat
* @param message The message to send
*/
public void sendAdminChat(String sender, String message) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
public static void sendAdminChat(Plugin plugin, String sender, String message) {
ChatManager.handleAdminChat(plugin, sender, sender, message);
}
if (chatEvent.isCancelled()) {
return;
}
/**
* Send a message to administrators
* </br>
* This function is designed for API usage.
*
* @deprecated Replaced by sendAdminChat(Plugin, String, String)
*
* @param sender The name of the sender to display in the chat
* @param message The message to send
*/
@Deprecated
public static void sendAdminChat(String sender, String message) {
sendAdminChat(null, sender, sender, message);
}
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} ";
/**
* Check if a player is currently talking in party chat.
*
* @param player The player to check
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(Player player) {
return Users.getPlayer(player).getPartyChatMode();
}
mcMMO.p.getLogger().info("[A]<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
/**
* Check if a player is currently talking in party chat.
*
* @param playerName The name of the player to check
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(String playerName) {
return Users.getPlayer(playerName).getPartyChatMode();
}
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp())
player.sendMessage(aPrefix + chatEvent.getMessage());
}
/**
* Check if a player is currently talking in admin chat.
*
* @param player The player to check
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(Player player) {
return Users.getPlayer(player).getAdminChatMode();
}
/**
* Check if a player is currently talking in admin chat.
*
* @param playerName The name of the player to check
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(String playerName) {
return Users.getPlayer(playerName).getAdminChatMode();
}
}

View File

@@ -2,29 +2,43 @@ package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Users;
public class ExperienceAPI {
public final class ExperienceAPI {
private ExperienceAPI() {}
/**
* Check the XP of a player. This should be called after giving XP to process level-ups.
*
* @param player The player to check
* @param skillType The skill to check
* @deprecated Calling this function is no longer needed and should be avoided
*/
private void checkXP(Player player, SkillType skillType) {
if (skillType.equals(SkillType.ALL)) {
Skills.XpCheckAll(player);
}
else {
Skills.XpCheckSkill(skillType, player);
}
@Deprecated
private static void checkXP(Player player, SkillType skillType) {
SkillTools.xpCheckSkill(skillType, player, Users.getProfile(player));
}
/**
* Adds XP to the player, doesn't calculate for XP Rate or other modifiers.
* Adds raw XP to the player.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addRawXP(Player, String, int)} instead
*/
@Deprecated
public static void addRawXP(Player player, SkillType skillType, int XP) {
Users.getPlayer(player).applyXpGain(skillType, XP);
}
/**
* Adds raw XP to the player.
* </br>
* This function is designed for API usage.
*
@@ -32,13 +46,27 @@ public class ExperienceAPI {
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public void addRawXP(Player player, SkillType skillType, int XP) {
Users.getProfile(player).addXPOverride(skillType, XP);
checkXP(player, skillType);
public static void addRawXP(Player player, String skillType, int XP) {
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), XP);
}
/**
* Adds XP to the player, calculates for XP Rate but not skill modifiers.
* Adds XP to the player, calculates for XP Rate only.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addMultipliedXP(Player, String, int)} instead
*/
@Deprecated
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
Users.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate only.
* </br>
* This function is designed for API usage.
*
@@ -46,13 +74,27 @@ public class ExperienceAPI {
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public void addMultipliedXP(Player player, SkillType skillType, int XP) {
Users.getProfile(player).addXPOverrideBonus(skillType, XP);
checkXP(player, skillType);
public static void addMultipliedXP(Player player, String skillType, int XP) {
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
* Adds XP to the player, calculates for XP Rate and skill modifiers.
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* </br>
* This function is designed for API usage.
*
* @param player The player to add XP to
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
* @deprecated Use {@link #addXP(Player, String, int)} instead
*/
@Deprecated
public static void addXP(Player player, SkillType skillType, int XP) {
Users.getPlayer(player).beginXpGain(skillType, XP);
}
/**
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
* </br>
* This function is designed for API usage.
*
@@ -60,9 +102,23 @@ public class ExperienceAPI {
* @param skillType The skill to add XP to
* @param XP The amount of XP to add
*/
public void addXP(Player player, SkillType skillType, int XP) {
Users.getProfile(player).addXP(player, skillType, XP);
checkXP(player, skillType);
public static void addXP(Player player, String skillType, int XP) {
Users.getPlayer(player).beginXpGain(SkillType.getSkill(skillType), XP);
}
/**
* Get the amount of XP a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
* @deprecated Use {@link #getXP(Player, String)} instead
*/
@Deprecated
public static int getXP(Player player, SkillType skillType) {
return Users.getPlayer(player).getProfile().getSkillXpLevel(skillType);
}
/**
@@ -74,8 +130,23 @@ public class ExperienceAPI {
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
*/
public int getXP(Player player, SkillType skillType) {
return Users.getProfile(player).getSkillXpLevel(skillType);
public static int getXP(Player player, String skillType) {
return Users.getPlayer(player).getProfile().getSkillXpLevel(SkillType.getSkill(skillType));
}
/**
* Get the amount of XP left before leveling up.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the XP amount for
* @param skillType The skill to get the XP amount for
* @return the amount of XP left before leveling up a specifc skill
* @deprecated Use {@link #getXPToNextLevel(Player, String)} instead
*/
@Deprecated
public static int getXPToNextLevel(Player player, SkillType skillType) {
return Users.getPlayer(player).getProfile().getXpToLevel(skillType);
}
/**
@@ -87,8 +158,8 @@ public class ExperienceAPI {
* @param skillType The skill to get the XP amount for
* @return the amount of XP left before leveling up a specifc skill
*/
public int getXPToNextLevel(Player player, SkillType skillType) {
return Users.getProfile(player).getXpToLevel(skillType);
public static int getXPToNextLevel(Player player, String skillType) {
return Users.getPlayer(player).getProfile().getXpToLevel(SkillType.getSkill(skillType));
}
/**
@@ -99,9 +170,10 @@ public class ExperienceAPI {
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @param notify True if this should fire a level up notification, false otherwise.
* @param notify Unused argument
* @deprecated Use addLevel(Player, SKillType, int) instead
*/
public void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
Users.getProfile(player).addLevels(skillType, levels);
if (notify) {
@@ -109,6 +181,49 @@ public class ExperienceAPI {
}
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
* @deprecated Use {@link #addLevel(Player, String, int)} instead
*/
@Deprecated
public static void addLevel(Player player, SkillType skillType, int levels) {
Users.getPlayer(player).getProfile().addLevels(skillType, levels);
}
/**
* Add levels to a skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to add levels to
* @param skillType Type of skill to add levels to
* @param levels Number of levels to add
*/
public static void addLevel(Player player, String skillType, int levels) {
Users.getPlayer(player).getProfile().addLevels(SkillType.getSkill(skillType), levels);
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the level for
* @param skillType The skill to get the level for
* @return the level of a given skill
* @deprecated Use {@link #getLevel(Player, String)} instead
*/
@Deprecated
public static int getLevel(Player player, SkillType skillType) {
return Users.getPlayer(player).getProfile().getSkillLevel(skillType);
}
/**
* Get the level a player has in a specific skill.
* </br>
@@ -118,8 +233,8 @@ public class ExperienceAPI {
* @param skillType The skill to get the level for
* @return the level of a given skill
*/
public int getLevel(Player player, SkillType skillType) {
return Users.getProfile(player).getSkillLevel(skillType);
public static int getLevel(Player player, String skillType) {
return Users.getPlayer(player).getProfile().getSkillLevel(SkillType.getSkill(skillType));
}
/**
@@ -130,7 +245,91 @@ public class ExperienceAPI {
* @param player The player to get the power level for
* @return the power level of the player
*/
public int getPowerLevel(Player player) {
return Users.getProfile(player).getPowerLevel();
public static int getPowerLevel(Player player) {
return Users.getPlayer(player).getPowerLevel();
}
/**
* Sets the level of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
* @deprecated Use {@link #setLevel(Player, String, int)} instead
*/
@Deprecated
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
Users.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
}
/**
* Sets the level of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the level of
* @param skillType The skill to set the level for
* @param skillLevel The value to set the level to
*/
public static void setLevel(Player player, String skillType, int skillLevel) {
Users.getPlayer(player).getProfile().modifySkill(SkillType.getSkill(skillType), skillLevel);
}
/**
* Sets the XP of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the XP of
* @param skillType The skill to set the XP for
* @param newValue The value to set the XP to
* @deprecated Use {@link #setXP(Player, String, int)} instead
*/
@Deprecated
public static void setXP(Player player, SkillType skillType, int newValue) {
Users.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
}
/**
* Sets the XP of a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to set the XP of
* @param skillType The skill to set the XP for
* @param newValue The value to set the XP to
*/
public static void setXP(Player player, String skillType, int newValue) {
Users.getPlayer(player).getProfile().setSkillXpLevel(SkillType.getSkill(skillType), newValue);
}
/**
* Removes XP from a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to change the XP of
* @param skillType The skill to change the XP for
* @param xp The amount of XP to remove
* @deprecated Use {@link #removeXP(Player, String, int)} instead
*/
@Deprecated
public static void removeXP(Player player, SkillType skillType, int xp) {
Users.getPlayer(player).getProfile().removeXp(skillType, xp);
}
/**
* Removes XP from a player in a specific skill type.
* </br>
* This function is designed for API usage.
*
* @param player The player to change the XP of
* @param skillType The skill to change the XP for
* @param xp The amount of XP to remove
*/
public static void removeXP(Player player, String skillType, int xp) {
Users.getPlayer(player).getProfile().removeXp(SkillType.getSkill(skillType), xp);
}
}

View File

@@ -1,13 +1,17 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class PartyAPI {
public final class PartyAPI {
private PartyAPI() {}
/**
* Get the name of the party a player is in.
@@ -17,8 +21,8 @@ public class PartyAPI {
* @param player The player to check the party name of
* @return the name of the player's party
*/
public String getPartyName(Player player) {
return Users.getProfile(player).getParty();
public static String getPartyName(Player player) {
return Users.getPlayer(player).getParty().getName();
}
/**
@@ -29,8 +33,8 @@ public class PartyAPI {
* @param player The player to check
* @return true if the player is in a party, false otherwise
*/
public boolean inParty(Player player) {
return Users.getProfile(player).inParty();
public static boolean inParty(Player player) {
return Users.getPlayer(player).inParty();
}
/**
@@ -42,19 +46,19 @@ public class PartyAPI {
* @param playerb The second player to check
* @return true if the two players are in the same party, false otherwise
*/
public boolean inSameParty(Player playera, Player playerb) {
return Party.getInstance().inSameParty(playera, playerb);
public static boolean inSameParty(Player playera, Player playerb) {
return PartyManager.inSameParty(playera, playerb);
}
/**
* Get a list of all current party names.
* Get a list of all current parties.
* </br>
* This function is designed for API usage.
*
* @return the list of parties.
*/
public ArrayList<String> getParties() {
return Party.getInstance().getParties();
public static List<Party> getParties() {
return PartyManager.getParties();
}
/**
@@ -65,8 +69,16 @@ public class PartyAPI {
* @param player The player to add to the party
* @param partyName The party to add the player to
*/
public void addToParty(Player player, String partyName) {
Party.getInstance().addToParty(player, Users.getProfile(player), partyName, false, null);
public static void addToParty(Player player, String partyName) {
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party();
party.setName(partyName);
party.setLeader(player.getName());
}
PartyManager.addToParty(player, Users.getPlayer(player), party);
}
/**
@@ -76,8 +88,8 @@ public class PartyAPI {
*
* @param player The player to remove
*/
public void removeFromParty(Player player) {
Party.getInstance().removeFromParty(player, Users.getProfile(player));
public static void removeFromParty(Player player) {
PartyManager.removeFromParty(player, Users.getPlayer(player).getParty());
}
/**
@@ -88,8 +100,8 @@ public class PartyAPI {
* @param partyName The party name
* @return the leader of the party
*/
public Player getPartyLeader(String partyName) {
return Party.getInstance().getPartyLeader(partyName);
public static String getPartyLeader(String partyName) {
return PartyManager.getPartyLeader(partyName);
}
/**
@@ -100,8 +112,28 @@ public class PartyAPI {
* @param partyName The name of the party to set the leader of
* @param player The player to set as leader
*/
public void setPartyLeader(String partyName, String player) {
Party.getInstance().setPartyLeader(partyName, player);
public static void setPartyLeader(String partyName, String player) {
PartyManager.setPartyLeader(player, PartyManager.getParty(partyName));
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
* @deprecated
*/
@Deprecated
public static List<String> getAllMembers(Player player) {
List<String> memberNames = new ArrayList<String>();
for (OfflinePlayer member : PartyManager.getAllMembers(player)) {
memberNames.add(member.getName());
}
return memberNames;
}
/**
@@ -112,8 +144,8 @@ public class PartyAPI {
* @param player The player to check
* @return all the players in the player's party
*/
public ArrayList<Player> getAllMembers(Player player) {
return Party.getInstance().getAllMembers(player);
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
return PartyManager.getAllMembers(player);
}
/**
@@ -124,8 +156,8 @@ public class PartyAPI {
* @param partyName The party to check
* @return all online players in this party
*/
public ArrayList<Player> getOnlineMembers(String partyName) {
return Party.getInstance().getOnlineMembers(partyName);
public static List<Player> getOnlineMembers(String partyName) {
return PartyManager.getOnlineMembers(partyName);
}
/**
@@ -136,7 +168,7 @@ public class PartyAPI {
* @param player The player to check
* @return all online players in the player's party
*/
public ArrayList<Player> getOnlineMembers(Player player) {
return Party.getInstance().getOnlineMembers(player);
public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getOnlineMembers(player);
}
}

View File

@@ -0,0 +1,53 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.skills.utilities.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,67 @@
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.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
public final class ChatManager {
public ChatManager () {}
public static void handleAdminChat(Plugin plugin, String playerName, String displayName, String message) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(plugin, playerName, displayName, message);
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return;
}
if(Config.getInstance().getAdminDisplayNames())
displayName = chatEvent.getDisplayName();
else
displayName = chatEvent.getSender();
String adminMessage = chatEvent.getMessage();
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Commands.AdminChat.Prefix", displayName) + adminMessage, "mcmmo.chat.adminchat");
mcMMO.p.getLogger().info("[A]<" + ChatColor.stripColor(displayName) + "> " + adminMessage);
}
public static void handleAdminChat(Plugin plugin, String senderName, String message) {
handleAdminChat(plugin, senderName, senderName, message);
}
public static void handlePartyChat(Plugin plugin, Party party, String playerName, String displayName, String message) {
String partyName = party.getName();
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(plugin, playerName, displayName, partyName, message);
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 static void handlePartyChat(Plugin plugin, Party party, String senderName, String message) {
handlePartyChat(plugin, party, senderName, senderName, message);
}
}

View File

@@ -0,0 +1,70 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.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,28 @@
package com.gmail.nossr50.chat.commands;
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;
public class AdminChatCommand extends ChatCommand {
public AdminChatCommand() {
super(ChatMode.ADMIN);
}
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
String message = buildChatMessage(args, 0);
if (sender instanceof Player) {
Player player = (Player) sender;
ChatManager.handleAdminChat(mcMMO.p, player.getName(), player.getDisplayName(), message);
}
else {
ChatManager.handleAdminChat(mcMMO.p, LocaleLoader.getString("Commands.Chat.Console"), message);
}
}
}

View File

@@ -0,0 +1,88 @@
package com.gmail.nossr50.chat.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.chat.ChatMode;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.util.Users;
public abstract class ChatCommand implements CommandExecutor {
protected McMMOPlayer mcMMOPlayer;
protected ChatMode chatMode;
public ChatCommand (ChatMode chatMode) {
this.chatMode = chatMode;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
if (!(sender instanceof Player)) {
return false;
}
mcMMOPlayer = Users.getPlayer((Player) sender);
if (chatMode.isEnabled(mcMMOPlayer)) {
disableChatMode(sender);
}
else {
enableChatMode(sender);
}
return true;
default:
if (args.length == 1) {
if (args[0].equalsIgnoreCase("on")) {
if (!(sender instanceof Player)) {
return false;
}
enableChatMode(sender);
return true;
}
if (args[0].equalsIgnoreCase("off")) {
if (!(sender instanceof Player)) {
return false;
}
disableChatMode(sender);
return true;
}
}
handleChatSending(sender, args);
return true;
}
}
private void enableChatMode(CommandSender sender) {
chatMode.enable(mcMMOPlayer);
sender.sendMessage(chatMode.getEnabledMessage());
}
private void disableChatMode(CommandSender sender) {
chatMode.disable(mcMMOPlayer);
sender.sendMessage(chatMode.getDisabledMessage());
}
protected String buildChatMessage(String[] args, int index) {
StringBuilder builder = new StringBuilder();
builder.append(args[index]);
for (int i = index + 1; i < args.length; i++) {
builder.append(" ");
builder.append(args[i]);
}
return builder.toString();
}
protected abstract void handleChatSending(CommandSender sender, String[] args);
}

View File

@@ -0,0 +1,48 @@
package com.gmail.nossr50.chat.commands;
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.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public class PartyChatCommand extends ChatCommand {
public PartyChatCommand() {
super(ChatMode.PARTY);
}
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
Party party = Users.getPlayer(player).getParty();
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
ChatManager.handlePartyChat(mcMMO.p, party, player.getName(), player.getDisplayName(), buildChatMessage(args, 0));
}
else {
if (args.length < 2) {
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
return;
}
Party 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));
}
}
}

View File

@@ -4,33 +4,12 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
public class CommandHelper {
/**
* Checks for command permissions.
*
* @param sender The command sender
* @param permission The permission to check
* @return true if the sender is a player without permissions, false otherwise
*/
public static boolean noCommandPermissions(CommandSender sender, String permission) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player != null && !Permissions.getInstance().permission(player, permission)) {
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return true;
}
}
return false;
}
public final class CommandHelper {
private CommandHelper() {}
public static boolean noConsoleUsage(CommandSender sender) {
if (!(sender instanceof Player)) {
@@ -45,100 +24,98 @@ public class CommandHelper {
* Print out details on Gathering skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param profile The player's profile
* @param display The sender to display stats to
*/
public static void printGatheringSkills(Player inspect, CommandSender display) {
if (Skills.hasGatheringSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
public static void printGatheringSkills(Player inspect, PlayerProfile profile, CommandSender display) {
if (SkillTools.hasGatheringSkills(inspect)) {
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
if (Permissions.getInstance().excavation(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
if (inspect.hasPermission("mcmmo.skills.excavation")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
}
if (Permissions.getInstance().fishing(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
if (inspect.hasPermission("mcmmo.skills.fishing")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
}
if (Permissions.getInstance().herbalism(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
if (inspect.hasPermission("mcmmo.skills.fishing")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
}
if (Permissions.getInstance().mining(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
if (inspect.hasPermission("mcmmo.skills.mining")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
}
if (Permissions.getInstance().woodcutting(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
if (inspect.hasPermission("mcmmo.skills.woodcutting")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
}
}
}
public static void printGatheringSkills(Player player) {
printGatheringSkills(player, player);
public static void printGatheringSkills(Player player, PlayerProfile profile) {
printGatheringSkills(player, profile, player);
}
/**
* Print out details on Combat skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param profile The player's profile
* @param display The sender to display stats to
*/
public static void printCombatSkills(Player inspect, CommandSender display) {
if (Skills.hasCombatSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
public static void printCombatSkills(Player inspect, PlayerProfile profile, CommandSender display) {
if (SkillTools.hasCombatSkills(inspect)) {
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
if (Permissions.getInstance().axes(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
if (inspect.hasPermission("mcmmo.skills.axes")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
}
if (Permissions.getInstance().archery(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
if (inspect.hasPermission("mcmmo.skills.archery")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
}
if (Permissions.getInstance().swords(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
if (inspect.hasPermission("mcmmo.skills.swords")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
}
if (Permissions.getInstance().taming(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
if (inspect.hasPermission("mcmmo.skills.taming")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
}
if (Permissions.getInstance().unarmed(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
if (inspect.hasPermission("mcmmo.skills.unarmed")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
}
}
}
public static void printCombatSkills(Player player) {
printCombatSkills(player, player);
public static void printCombatSkills(Player player, PlayerProfile profile) {
printCombatSkills(player, profile, player);
}
/**
* Print out details on Misc skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param profile The player's profile
* @param display The sender to display stats to
*/
public static void printMiscSkills(Player inspect, CommandSender display) {
if (Skills.hasMiscSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
public static void printMiscSkills(Player inspect, PlayerProfile profile, CommandSender display) {
if (SkillTools.hasMiscSkills(inspect)) {
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
if (Permissions.getInstance().acrobatics(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
if (inspect.hasPermission("mcmmo.skills.acrobatics")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
}
if (Permissions.getInstance().repair(inspect)) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
if (inspect.hasPermission("mcmmo.skills.repair")) {
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
}
}
}
public static void printMiscSkills(Player player) {
printMiscSkills(player, player);
public static void printMiscSkills(Player player, PlayerProfile profile) {
printMiscSkills(player, profile, player);
}
}

View File

@@ -0,0 +1,361 @@
package com.gmail.nossr50.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.PluginCommand;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.chat.commands.AdminChatCommand;
import com.gmail.nossr50.chat.commands.PartyChatCommand;
import com.gmail.nossr50.commands.admin.AddlevelsCommand;
import com.gmail.nossr50.commands.admin.AddxpCommand;
import com.gmail.nossr50.commands.admin.HardcoreCommand;
import com.gmail.nossr50.commands.admin.McgodCommand;
import com.gmail.nossr50.commands.admin.McrefreshCommand;
import com.gmail.nossr50.commands.admin.MmoeditCommand;
import com.gmail.nossr50.commands.admin.SkillresetCommand;
import com.gmail.nossr50.commands.admin.VampirismCommand;
import com.gmail.nossr50.commands.admin.XprateCommand;
import com.gmail.nossr50.commands.player.InspectCommand;
import com.gmail.nossr50.commands.player.McabilityCommand;
import com.gmail.nossr50.commands.player.McmmoCommand;
import com.gmail.nossr50.commands.player.McrankCommand;
import com.gmail.nossr50.commands.player.McstatsCommand;
import com.gmail.nossr50.commands.player.MctopCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.commands.McpurgeCommand;
import com.gmail.nossr50.database.commands.McremoveCommand;
import com.gmail.nossr50.database.commands.MmoupdateCommand;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.commands.PartyCommand;
import com.gmail.nossr50.party.commands.PtpCommand;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
import com.gmail.nossr50.skills.archery.ArcheryCommand;
import com.gmail.nossr50.skills.axes.AxesCommand;
import com.gmail.nossr50.skills.excavation.ExcavationCommand;
import com.gmail.nossr50.skills.fishing.FishingCommand;
import com.gmail.nossr50.skills.herbalism.HerbalismCommand;
import com.gmail.nossr50.skills.mining.MiningCommand;
import com.gmail.nossr50.skills.repair.RepairCommand;
import com.gmail.nossr50.skills.smelting.SmeltingCommand;
import com.gmail.nossr50.skills.swords.SwordsCommand;
import com.gmail.nossr50.skills.taming.TamingCommand;
import com.gmail.nossr50.skills.unarmed.UnarmedCommand;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingCommand;
import com.gmail.nossr50.spout.commands.MchudCommand;
import com.gmail.nossr50.spout.commands.XplockCommand;
import com.gmail.nossr50.util.StringUtils;
public final class CommandRegistrationHelper {
private CommandRegistrationHelper() {};
private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
public static void registerSkillCommands() {
for (SkillType skill : SkillType.values()) {
String commandName = skill.toString().toLowerCase();
String localizedName = SkillTools.getSkillName(skill);
PluginCommand command;
command = mcMMO.p.getCommand(commandName);
command.setDescription(LocaleLoader.getString("Commands.Description.Skill", StringUtils.getCapitalized(localizedName)));
command.setPermission("mcmmo.commands." + commandName);
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", localizedName));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", localizedName, "?", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
switch (skill) {
case ACROBATICS:
command.setExecutor(new AcrobaticsCommand());
break;
case ARCHERY:
command.setExecutor(new ArcheryCommand());
break;
case AXES:
command.setExecutor(new AxesCommand());
break;
case EXCAVATION:
command.setExecutor(new ExcavationCommand());
break;
case FISHING:
command.setExecutor(new FishingCommand());
break;
case HERBALISM:
command.setExecutor(new HerbalismCommand());
break;
case MINING:
command.setExecutor(new MiningCommand());
break;
case REPAIR:
command.setExecutor(new RepairCommand());
break;
case SMELTING:
command.setExecutor(new SmeltingCommand());
break;
case SWORDS:
command.setExecutor(new SwordsCommand());
break;
case TAMING:
command.setExecutor(new TamingCommand());
break;
case UNARMED:
command.setExecutor(new UnarmedCommand());
break;
case WOODCUTTING:
command.setExecutor(new WoodcuttingCommand());
break;
default:
break;
}
}
}
public static void registerAddlevelsCommand() {
PluginCommand command = mcMMO.p.getCommand("addlevels");
command.setDescription(LocaleLoader.getString("Commands.Description.addlevels"));
command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
command.setExecutor(new AddlevelsCommand());
}
public static void registerAddxpCommand() {
PluginCommand command = mcMMO.p.getCommand("addxp");
command.setDescription(LocaleLoader.getString("Commands.Description.addxp"));
command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">"));
command.setExecutor(new AddxpCommand());
}
public static void registerMcgodCommand() {
PluginCommand command = mcMMO.p.getCommand("mcgod");
command.setDescription(LocaleLoader.getString("Commands.Description.mcgod"));
command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McgodCommand());
}
public static void registerMcrefreshCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrefresh");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh"));
command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McrefreshCommand());
}
public static void registerMmoeditCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoedit");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit"));
command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
command.setExecutor(new MmoeditCommand());
}
public static void registerSkillresetCommand() {
PluginCommand command = mcMMO.p.getCommand("skillreset");
command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
command.setExecutor(new SkillresetCommand());
}
public static void registerXprateCommand() {
List<String> aliasList = new ArrayList<String>();
aliasList.add("mcxprate");
PluginCommand command = mcMMO.p.getCommand("xprate");
command.setDescription(LocaleLoader.getString("Commands.Description.xprate"));
command.setPermission("mcmmo.commands.xprate;mcmmo.commands.xprate.reset;mcmmo.commands.xprate.set");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "xprate", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">", "<true|false>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xprate", "reset"));
command.setAliases(aliasList);
command.setExecutor(new XprateCommand());
}
public static void registerInspectCommand() {
PluginCommand command = mcMMO.p.getCommand("inspect");
command.setDescription(LocaleLoader.getString("Commands.Description.inspect"));
command.setPermission("mcmmo.commands.inspect;mcmmo.commands.inspect.far;mcmmo.commands.inspect.offline");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "inspect", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
command.setExecutor(new InspectCommand());
}
public static void registerMcabilityCommand() {
PluginCommand command = mcMMO.p.getCommand("mcability");
command.setDescription(LocaleLoader.getString("Commands.Description.mcability"));
command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcability", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McabilityCommand());
}
public static void registerMcmmoCommand() {
PluginCommand command = mcMMO.p.getCommand("mcmmo");
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
command.setPermission("mcmmo.commands.mcmmo;mcmmo.commands.mcmmo.help");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmo"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "mcmmo", "help"));
command.setExecutor(new McmmoCommand());
}
public static void registerMcrankCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrank");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrank"));
command.setPermission("mcmmo.commands.mcrank;mcmmo.commands.mcrank.others;mcmmo.commands.mcrank.others.far;mcmmo.commands.mcrank.others.offline");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrank", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McrankCommand());
}
public static void registerMcstatsCommand() {
PluginCommand command = mcMMO.p.getCommand("mcstats");
command.setDescription(LocaleLoader.getString("Commands.Description.mcstats"));
command.setPermission("mcmmo.commands.mcstats");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcstats"));
command.setExecutor(new McstatsCommand());
}
public static void registerMctopCommand() {
PluginCommand command = mcMMO.p.getCommand("mctop");
command.setDescription(LocaleLoader.getString("Commands.Description.mctop"));
command.setPermission("mcmmo.commands.mctop"); // Only need the main one, not the individual skill ones
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "mctop", "[" + LocaleLoader.getString("Commands.Usage.Skill") + "]", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
command.setExecutor(new MctopCommand());
}
public static void registerMcpurgeCommand() {
PluginCommand command = mcMMO.p.getCommand("mcpurge");
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
command.setPermission("mcmmo.commands.mcpurge");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
command.setExecutor(new McpurgeCommand());
}
public static void registerMcremoveCommand() {
PluginCommand command = mcMMO.p.getCommand("mcremove");
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
command.setPermission("mcmmo.commands.mcremove");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
command.setExecutor(new McremoveCommand());
}
public static void registerMmoupdateCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoupdate");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
command.setPermission("mcmmo.commands.mmoupdate");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
command.setExecutor(new MmoupdateCommand());
}
public static void registerAdminChatCommand() {
PluginCommand command = mcMMO.p.getCommand("adminchat");
command.setDescription(LocaleLoader.getString("Commands.Description.adminchat"));
command.setPermission("mcmmo.chat.adminchat");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "adminchat"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
command.setExecutor(new AdminChatCommand());
}
public static void registerPartyChatCommand() {
PluginCommand command = mcMMO.p.getCommand("partychat");
command.setDescription(LocaleLoader.getString("Commands.Description.partychat"));
command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "partychat"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
command.setExecutor(new PartyChatCommand());
}
public static void registerMchudCommand() {
PluginCommand command = mcMMO.p.getCommand("mchud");
command.setDescription(LocaleLoader.getString("Commands.Description.mchud"));
command.setPermission("mcmmo.commands.mchud");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mchud", "<DISABLED | STANDARD | SMALL | RETRO>"));
command.setExecutor(new MchudCommand());
}
public static void registerXplockCommand() {
PluginCommand command = mcMMO.p.getCommand("xplock");
command.setDescription(LocaleLoader.getString("Commands.Description.xplock"));
command.setPermission("mcmmo.commands.xplock");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "xplock"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
command.setExecutor(new XplockCommand());
}
public static void registerPartyCommand() {
PluginCommand command = mcMMO.p.getCommand("party");
command.setDescription(LocaleLoader.getString("Commands.Description.party"));
command.setPermission("mcmmo.commands.party;mcmmo.commands.party.accept;mcmmo.commands.party.create;mcmmo.commands.party.disband;" +
"mcmmo.commands.party.expshare;mcmmo.commands.party.invite;mcmmo.commands.party.itemshare;mcmmo.commands.party.join;" +
"mcmmo.commands.party.kick;mcmmo.commands.party.lock;mcmmo.commands.party.owner;mcmmo.commands.party.password;" +
"mcmmo.commands.party.quit;mcmmo.commands.party.rename;mcmmo.commands.party.unlock");
command.setPermissionMessage(permissionsMessage);
command.setExecutor(new PartyCommand());
}
public static void registerPtpCommand() {
PluginCommand command = mcMMO.p.getCommand("ptp");
command.setDescription(LocaleLoader.getString("Commands.Description.ptp"));
command.setPermission("mcmmo.commands.ptp;mcmmo.commands.ptp.accept;mcmmo.commands.ptp.acceptall;mcmmo.commands.ptp.toggle");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "ptp", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "ptp", "<toggle|accept|acceptall>"));
command.setExecutor(new PtpCommand());
}
public static void registerHardcoreCommand() {
PluginCommand command = mcMMO.p.getCommand("hardcore");
command.setDescription(LocaleLoader.getString("Commands.Description.hardcore"));
command.setPermission("mcmmo.commands.hardcore;mcmmo.commands.hardcore.toggle;mcmmo.commands.hardcore.modify");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "hardcore", "[on|off]"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "hardcore", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
command.setExecutor(new HardcoreCommand());
}
public static void registerVampirismCommand() {
PluginCommand command = mcMMO.p.getCommand("vampirism");
command.setDescription(LocaleLoader.getString("Commands.Description.vampirism"));
command.setPermission("mcmmo.commands.vampirism;mcmmo.commands.vampirism.toggle;mcmmo.commands.vampirism.modify");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "vampirism", "[on|off]"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "vampirism", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
command.setExecutor(new VampirismCommand());
}
}

View File

@@ -0,0 +1,153 @@
package com.gmail.nossr50.commands.admin;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.Users;
public class AddlevelsCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
int levels;
boolean allSkills = false;
SkillType skill = null;
switch (args.length) {
case 2:
if (!sender.hasPermission("mcmmo.commands.addlevels")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (args[0].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!StringUtils.isInt(args[1])) {
return false;
}
levels = Integer.parseInt(args[1]);
profile = Users.getPlayer((Player) sender).getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.addLevels(skillType, levels);
}
}
else {
skill = SkillType.getSkill(args[0]);
profile.addLevels(skill, levels);
}
if (allSkills) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, SkillTools.getSkillName(skill)));
}
return true;
case 3:
if (!sender.hasPermission("mcmmo.commands.addlevels.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (args[1].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!StringUtils.isInt(args[2])) {
return false;
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
levels = Integer.parseInt(args[2]);
// 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);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.addLevels(skillType, levels);
}
}
else {
skill = SkillType.getSkill(args[1]);
profile.addLevels(skill, levels);
}
profile.save(); // Since this is a temporary profile, we save it here.
}
else {
profile = mcMMOPlayer.getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.addLevels(skillType, levels);
}
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
}
else {
skill = SkillType.getSkill(args[1]);
profile.addLevels(skill, levels);
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, SkillTools.getSkillName(skill)));
}
}
if (allSkills) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillTools.getSkillName(skill), args[0]));
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,150 @@
package com.gmail.nossr50.commands.admin;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.Users;
public class AddxpCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
int xp;
McMMOPlayer mcMMOPlayer;
PlayerProfile profile;
boolean allSkills = false;
SkillType skill = null;
switch (args.length) {
case 2:
if (!sender.hasPermission("mcmmo.commands.addxp")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (args[0].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!StringUtils.isInt(args[1])) {
return false;
}
xp = Integer.parseInt(args[1]);
mcMMOPlayer = Users.getPlayer((Player) sender);
profile = mcMMOPlayer.getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
mcMMOPlayer.applyXpGain(skillType, xp);
}
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
}
else {
skill = SkillType.getSkill(args[0]);
mcMMOPlayer.applyXpGain(skill, xp);
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, SkillTools.getSkillName(skill)));
}
return true;
case 3:
if (!sender.hasPermission("mcmmo.commands.addxp.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (args[1].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!StringUtils.isInt(args[2])) {
return false;
}
mcMMOPlayer = Users.getPlayer(args[0]);
xp = Integer.parseInt(args[2]);
// 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);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
// TODO: Currently the offline player doesn't level up automatically
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.setSkillXpLevel(skillType, xp);
}
}
else {
skill = SkillType.getSkill(args[1]);
profile.setSkillXpLevel(skill, xp);
}
profile.save(); // Since this is a temporary profile, we save it here.
}
else {
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
mcMMOPlayer.applyXpGain(skillType, xp);
}
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
}
else {
skill = SkillType.getSkill(args[1]);
mcMMOPlayer.applyXpGain(skill, xp);
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, SkillTools.getSkillName(skill)));
}
}
if (allSkills) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillTools.getSkillName(skill), args[0]));
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,85 @@
package com.gmail.nossr50.commands.admin;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
public class HardcoreCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (Config.getInstance().getHardcoreEnabled()) {
disableHardcore();
}
else {
enableHardcore();
}
return true;
case 1:
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enableHardcore();
return true;
}
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
disableHardcore();
return true;
}
if (!StringUtils.isDouble(args[0])) {
return false;
}
if (!sender.hasPermission("mcmmo.commands.hardcore.modify")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
DecimalFormat percent = new DecimalFormat("##0.00%");
double newPercent = Double.parseDouble(args[0]);
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercent);
sender.sendMessage(LocaleLoader.getString("Hardcore.PercentageChanged", percent.format(newPercent / 100D)));
return true;
default:
return false;
}
}
private void disableHardcore() {
Config.getInstance().setHardcoreEnabled(false);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Disabled"));
}
private void enableHardcore() {
Config.getInstance().setHardcoreEnabled(true);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Enabled"));
}
}

View File

@@ -0,0 +1,88 @@
package com.gmail.nossr50.commands.admin;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McgodCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
switch (args.length) {
case 0:
if (!sender.hasPermission("mcmmo.commands.mcgod")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
profile = Users.getPlayer((Player) sender).getProfile();
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (profile.getGodMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
}
profile.toggleGodMode();
return true;
case 1:
if (!sender.hasPermission("mcmmo.commands.mcgod.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
if (mcMMOPlayer == null) {
profile = new PlayerProfile(args[0], false);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;
}
profile = mcMMOPlayer.getProfile();
Player player = mcMMOPlayer.getPlayer();
if (!player.isOnline()) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;
}
if (profile.getGodMode()) {
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
}
profile.toggleGodMode();
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,82 @@
package com.gmail.nossr50.commands.admin;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.util.Users;
public class McrefreshCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
switch (args.length) {
case 0:
if (!sender.hasPermission("mcmmo.commands.mcrefresh")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
profile = Users.getPlayer(sender.getName()).getProfile();
profile.setRecentlyHurt(0);
profile.resetCooldowns();
profile.resetToolPrepMode();
profile.resetAbilityMode();
SkillTools.handleAbilitySpeedDecrease((Player) sender); //Remove enchants left over
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
return true;
case 1:
if (!sender.hasPermission("mcmmo.commands.mcrefresh.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
if (mcMMOPlayer == null) {
profile = new PlayerProfile(args[0], false);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;
}
profile = mcMMOPlayer.getProfile();
Player player = mcMMOPlayer.getPlayer();
if (!player.isOnline()) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;
}
profile.setRecentlyHurt(0);
profile.resetCooldowns();
profile.resetToolPrepMode();
profile.resetAbilityMode();
SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,149 @@
package com.gmail.nossr50.commands.admin;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.Users;
public class MmoeditCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
int newValue;
boolean allSkills = false;
SkillType skill = null;
switch (args.length) {
case 2:
if (!sender.hasPermission("mcmmo.commands.mmoedit")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (args[0].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!StringUtils.isInt(args[1])) {
return false;
}
newValue = Integer.parseInt(args[1]);
profile = Users.getPlayer((Player) sender).getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.modifySkill(skillType, newValue);
}
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
}
else {
skill = SkillType.getSkill(args[0]);
profile.modifySkill(skill, newValue);
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillTools.getSkillName(skill), newValue));
}
return true;
case 3:
if (!sender.hasPermission("mcmmo.commands.mmoedit.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (args[1].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!StringUtils.isInt(args[2])) {
return false;
}
newValue = Integer.parseInt(args[2]);
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
// 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);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.modifySkill(skillType, newValue);
}
}
else {
skill = SkillType.getSkill(args[1]);
profile.modifySkill(skill, newValue);
}
profile.save(); // Since this is a temporary profile, we save it here.
}
else {
profile = mcMMOPlayer.getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
profile.modifySkill(skillType, newValue);
}
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
}
else {
skill = SkillType.getSkill(args[1]);
profile.modifySkill(skill, newValue);
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillTools.getSkillName(skill), newValue));
}
}
if (allSkills) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", SkillTools.getSkillName(skill), args[0]));
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,168 @@
package com.gmail.nossr50.commands.admin;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Users;
public class SkillresetCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
boolean allSkills = false;
SkillType skill = null;
String skillName = "";
switch (args.length) {
case 1:
if (!sender.hasPermission("mcmmo.commands.skillreset")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (args[0].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
profile = Users.getPlayer((Player) sender).getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
if (!sender.hasPermission("mcmmo.commands.skillreset." + skillType.toString().toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
continue;
}
profile.modifySkill(skillType, 0);
}
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
}
else {
skill = SkillType.getSkill(args[0]);
skillName = SkillTools.getSkillName(skill);
if (!sender.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
profile.modifySkill(skill, 0);
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skillName));
}
return true;
case 2:
if (!sender.hasPermission("mcmmo.commands.skillreset.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (args[1].equalsIgnoreCase("all")) {
allSkills = true;
}
else if (!SkillTools.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (!allSkills) {
skill = SkillType.getSkill(args[1]);
skillName = SkillTools.getSkillName(skill);
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
// 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);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillType.toString().toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
continue;
}
profile.modifySkill(skillType, 0);
}
}
else {
profile.modifySkill(skill, 0);
}
profile.save(); // Since this is a temporary profile, we save it here.
}
else {
profile = mcMMOPlayer.getProfile();
if (allSkills) {
for (SkillType skillType : SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillType.toString().toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
continue;
}
profile.modifySkill(skillType, 0);
}
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.All"));
}
else {
profile.modifySkill(skill, 0);
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.Single", skillName));
}
}
if (allSkills) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", skillName, args[0]));
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,90 @@
package com.gmail.nossr50.commands.admin;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
public class VampirismCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!Config.getInstance().getHardcoreEnabled()) {
sender.sendMessage(LocaleLoader.getString("Hardcore.Disabled"));
return true;
}
switch (args.length) {
case 0:
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (Config.getInstance().getHardcoreVampirismEnabled()) {
disableVampirism();
}
else {
enableVampirism();
}
return true;
case 1:
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enableVampirism();
return true;
}
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
disableVampirism();
return true;
}
if (!StringUtils.isDouble(args[0])) {
return false;
}
if (!sender.hasPermission("mcmmo.commands.vampirism.modify")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
DecimalFormat percent = new DecimalFormat("##0.00%");
double newPercent = Double.parseDouble(args[0]);
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercent);
sender.sendMessage(LocaleLoader.getString("Vampirism.PercentageChanged", percent.format(newPercent / 100D)));
return true;
default:
return false;
}
}
private void disableVampirism() {
Config.getInstance().setHardcoreVampirismEnabled(false);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Vampirism.Disabled"));
}
private void enableVampirism() {
Config.getInstance().setHardcoreVampirismEnabled(true);
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Vampirism.Enabled"));
}
}

View File

@@ -0,0 +1,68 @@
package com.gmail.nossr50.commands.admin;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
public class XprateCommand implements CommandExecutor {
private static double originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if (!args[0].equalsIgnoreCase("reset")) {
return false;
}
if (!sender.hasPermission("mcmmo.commands.xprate.reset")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (mcMMO.p.isXPEventEnabled()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.over"));
mcMMO.p.toggleXpEventEnabled();
}
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
return true;
case 2:
if (!StringUtils.isInt(args[0])) {
return false;
}
if (!sender.hasPermission("mcmmo.commands.xprate.set")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!args[1].equalsIgnoreCase("true") && !args[1].equalsIgnoreCase("false")) {
return false;
}
mcMMO.p.setXPEventEnabled(Boolean.valueOf(args[1]));
int newXpRate = Integer.parseInt(args[0]);
Config.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if (mcMMO.p.isXPEventEnabled()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.0"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.1", newXpRate));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
}
return true;
default:
return false;
}
}
}

View File

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

View File

@@ -1,129 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
//TODO: Any way we can make this work for offline use?
public class AddxpCommand implements CommandExecutor {
private final mcMMO plugin;
public AddxpCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player modifiedPlayer;
int xp;
SkillType skill;
String skillName;
String usage = ChatColor.RED + "Proper usage is /addxp [playername] <skill> <xp>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true;
}
switch (args.length) {
case 2:
if (sender instanceof Player) {
if (!Skills.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender;
xp = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]);
Users.getProfile(modifiedPlayer).addXPOverride(skill, xp);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = Misc.getCapitalized(skill.toString());
}
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
if (skill.equals(SkillType.ALL)) {
Skills.XpCheckAll(modifiedPlayer);
}
else {
Skills.XpCheckSkill(skill, modifiedPlayer);
}
}
else {
sender.sendMessage(usage);
}
}
else {
sender.sendMessage(usage);
}
return true;
case 3:
modifiedPlayer = plugin.getServer().getPlayer(args[0]);
String playerName = modifiedPlayer.getName();
if (!Users.getProfile(modifiedPlayer).isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!Skills.isSkill(args[1])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[2])) {
xp = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]);
String message;
Users.getProfile(modifiedPlayer).addXPOverride(skill, xp);
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
}
else {
skillName = Misc.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
}
sender.sendMessage(message);
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
if (skill.equals(SkillType.ALL)) {
Skills.XpCheckAll(modifiedPlayer);
}
else {
Skills.XpCheckSkill(skill, modifiedPlayer);
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,95 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class InspectCommand implements CommandExecutor {
private final mcMMO plugin;
public InspectCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer target;
PlayerProfile PP;
String usage = "Proper usage is /inspect <player>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
return true;
}
switch (args.length) {
case 1:
target = plugin.getServer().getOfflinePlayer(args[0]);
PP = Users.getProfile(target);
if (target.isOnline()) {
Player player = (Player) target;
if (sender instanceof Player && !sender.isOp() && !Misc.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0) && !Permissions.getInstance().inspectDistanceBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", new Object[] { target.getName() }));
CommandHelper.printGatheringSkills(player, sender);
CommandHelper.printCombatSkills(player, sender);
CommandHelper.printMiscSkills(player, sender);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { PP.getPowerLevel() }));
return true;
}
else {
if (sender instanceof Player && !sender.isOp() && !Permissions.getInstance().inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
if (!PP.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
return true;
}
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

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

View File

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

View File

@@ -1,51 +0,0 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.runnables.SQLConversionTask;
import com.gmail.nossr50.util.Users;
public class MmoupdateCommand implements CommandExecutor {
private final mcMMO plugin;
public MmoupdateCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true;
}
sender.sendMessage(ChatColor.GRAY + "Starting conversion..."); //TODO: Needs more locale.
Users.clearUsers();
convertToMySQL();
for (Player x : plugin.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
sender.sendMessage(ChatColor.GREEN + "Conversion finished!"); //TODO: Needs more locale.
return true;
}
/**
* Convert FlatFile data to MySQL data.
*/
private void convertToMySQL() {
if (!Config.getInstance().getUseMySQL()) {
return;
}
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new SQLConversionTask(plugin), 1);
}
}

View File

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

View File

@@ -1,38 +0,0 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McabilityCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ability")) {
return true;
}
PlayerProfile PP = Users.getProfile((Player) sender);
if (PP.getAbilityUse()) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
}
PP.toggleAbilityUse();
return true;
}
}

View File

@@ -1,72 +0,0 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
//TODO: Rework this whole thing. It's ugly. Also is missing all the admin & spout commands.
public class MccCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
Player player = (Player) sender;
player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---"); //TODO: Needs more locale.
if (Permissions.getInstance().party(player)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
player.sendMessage("/party " + LocaleLoader.getString("Commands.Party"));
player.sendMessage("/party q " + LocaleLoader.getString("Commands.Party.Quit"));
if (Permissions.getInstance().partyChat(player)) {
player.sendMessage("/p " + LocaleLoader.getString("Commands.Party.Toggle"));
}
player.sendMessage("/invite " + LocaleLoader.getString("Commands.Party.Invite"));
player.sendMessage("/accept " + LocaleLoader.getString("Commands.Party.Accept"));
if (Permissions.getInstance().partyTeleport(player)) {
player.sendMessage("/ptp " + LocaleLoader.getString("Commands.Party.Teleport"));
}
}
player.sendMessage(LocaleLoader.getString("Commands.Other"));
player.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
player.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
if (Permissions.getInstance().mcAbility(player)) {
player.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
}
if (Permissions.getInstance().adminChat(player)) {
player.sendMessage("/a " + LocaleLoader.getString("Commands.AdminToggle"));
}
if (Permissions.getInstance().inspect(player)) {
player.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
}
if (Permissions.getInstance().mmoedit(player)) {
player.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
}
if (Permissions.getInstance().mcgod(player)) {
player.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
}
player.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
player.sendMessage("/mcmmo " + LocaleLoader.getString("Commands.ModDescription"));
return true;
}
}

View File

@@ -1,38 +0,0 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McgodCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcgod")) {
return true;
}
PlayerProfile PP = Users.getProfile((Player) sender);
if (PP.getGodMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
}
PP.toggleGodMode();
return true;
}
}

View File

@@ -1,34 +0,0 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String description = LocaleLoader.getString("mcMMO.Description");
String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) {
if (Config.getInstance().spoutEnabled && sender instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) sender;
sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "mcmmodev@gmail.com", Material.DIAMOND);
}
sender.sendMessage(ChatColor.DARK_AQUA + "Donation Info:");
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "mcmmodev@gmail.com" + ChatColor.GOLD + " Paypal");
}
return true;
}
}

View File

@@ -1,75 +0,0 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McrefreshCommand implements CommandExecutor {
private final mcMMO plugin;
public McrefreshCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer player;
PlayerProfile PP;
String usage = ChatColor.RED + "Proper usage is /mcrefresh [player]"; //TODO: Needs more locale
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcrefresh")) {
return true;
}
switch (args.length) {
case 0:
if (sender instanceof Player) {
player = (Player) sender;
PP = Users.getProfile(player);
}
else {
sender.sendMessage(usage);
return true;
}
break;
case 1:
player = plugin.getServer().getOfflinePlayer(args[0]);
PP = Users.getProfile(player);
String playerName = player.getName();
if (!PP.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage("You have refreshed " + playerName + "'s cooldowns!"); //TODO: Use locale
break;
default:
sender.sendMessage(usage);
return true;
}
PP.setRecentlyHurt((long) 0);
PP.resetCooldowns();
PP.resetToolPrepMode();
PP.resetAbilityMode();
if (player.isOnline()) {
((Player) player).sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
}
return true;
}
}

View File

@@ -1,143 +0,0 @@
package com.gmail.nossr50.commands.mc;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
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.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McremoveCommand implements CommandExecutor {
private final String location;
private final mcMMO plugin;
public McremoveCommand (mcMMO plugin) {
this.plugin = plugin;
this.location = plugin.usersFile;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String playerName;
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
String databaseName = Config.getInstance().getMySQLDatabaseName();
String usage = ChatColor.RED + "Proper usage is /mcremove <player>"; //TODO: Needs more locale.
String success;
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mcremove")) {
return true;
}
switch (args.length) {
case 1:
playerName = args[0];
success = ChatColor.GREEN + playerName + "was successfully removed from the database!"; //TODO: Locale
break;
default:
sender.sendMessage(usage);
return true;
}
/* MySQL */
if (Config.getInstance().getUseMySQL()) {
int userId = 0;
userId = mcMMO.database.getInt("SELECT id FROM " + tablePrefix + "users WHERE user = '" + playerName + "'");
if (userId > 0) {
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "users WHERE "
+ tablePrefix + "users.id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "cooldowns WHERE "
+ tablePrefix + "cooldowns.user_id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "huds WHERE "
+ tablePrefix + "huds.user_id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "skills WHERE "
+ tablePrefix + "skills.user_id=" + userId);
mcMMO.database.write("DELETE FROM "
+ databaseName + "."
+ tablePrefix + "experience WHERE "
+ tablePrefix + "experience.user_id=" + userId);
sender.sendMessage(success);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
}
}
else {
if (removeFlatFileUser(playerName)) {
sender.sendMessage(success);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
}
}
//Force PlayerProfile stuff to update
Player player = plugin.getServer().getPlayer(playerName);
if (player != null && Users.players.containsKey(playerName.toLowerCase())) {
Users.removeUser(player);
Users.addUser(player);
}
return true;
}
private boolean removeFlatFileUser(String playerName) {
boolean worked = false;
try {
FileReader file = new FileReader(location);
BufferedReader in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null) {
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
writer.append(line).append("\r\n");
}
else {
System.out.println("User found, removing...");
worked = true;
continue; //Skip the player
}
}
in.close();
FileWriter out = new FileWriter(location); //Write out the new file
out.write(writer.toString());
out.close();
return worked;
}
catch (Exception e) {
plugin.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
return worked;
}
}
}

View File

@@ -1,154 +0,0 @@
package com.gmail.nossr50.commands.mc;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
public class MctopCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /mctop [skill] [page]"; //TODO: Needs more locale.
if (!Config.getInstance().getUseMySQL()) {
switch (args.length) {
case 0:
flatfileDisplay(1, "ALL", sender);
return true;
case 1:
if (Misc.isInt(args[0])) {
flatfileDisplay(Integer.valueOf(args[0]), "ALL", sender);
}
else if (Skills.isSkill(args[0])) {
flatfileDisplay(1, args[0].toUpperCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
case 2:
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) {
flatfileDisplay(Integer.valueOf(args[1]), args[0].toUpperCase(), sender);
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
else {
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
switch (args.length) {
case 0:
sqlDisplay(1, powerlevel, sender);
return true;
case 1:
if (Misc.isInt(args[0])) {
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender);
}
else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
case 2:
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) {
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}
private void flatfileDisplay(int page, String skill, CommandSender sender) {
String[] info = Leaderboard.retrieveInfo(skill, page);
if (skill == "ALL") {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(skill) }));
}
int n = (page * 10) - 9; // Position
for (String x : info) {
if (x != null) {
String digit = String.valueOf(n);
if (n < 10) {
digit = "0" + digit;
}
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
}
private void sqlDisplay(int page, String query, CommandSender sender) {
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + query + ", user_id FROM " + tablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC ");
if (query == "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing") {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(query) }));
}
for (int i = (page * 10) - 9; i <= (page * 10); i++) {
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) {
break;
}
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
}
}
}

View File

@@ -1,100 +0,0 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ACommand implements CommandExecutor {
private final mcMMO plugin;
public ACommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile PP;
String usage = ChatColor.RED + "Proper usage is /a <message>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
return true;
}
switch (args.length) {
case 0:
if (sender instanceof Player) {
PP = Users.getProfile((Player) sender);
if (PP.getPartyChatMode()) {
PP.togglePartyChat();
}
PP.toggleAdminChat();
if (PP.getAdminChatMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
String message = args[0];
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
}
if (sender instanceof Player) {
Player player = (Player) sender;
PP = Users.getProfile(player);
if (PP.getAdminChatMode()) {
player.chat(message);
}
else {
PP.toggleAdminChat();
player.chat(message);
PP.toggleAdminChat();
}
}
else {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
message = chatEvent.getMessage();
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
plugin.getLogger().info("[A]<*Console*> " + message);
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp()) {
player.sendMessage(prefix + message);
}
}
}
return true;
}
}
}

View File

@@ -1,68 +0,0 @@
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class AcceptCommand implements CommandExecutor {
private final mcMMO plugin;
public AcceptCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (PP.hasPartyInvite()) {
Party partyInstance = Party.getInstance();
if (PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), PP.getInvite(), EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, PP.getInvite(), EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
}
PP.acceptInvite();
partyInstance.addToParty(player, PP, PP.getParty(), true, null);
}
else {
player.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
}
return true;
}
}

View File

@@ -1,76 +0,0 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
//TODO: Make this work from console.
public class InviteCommand implements CommandExecutor {
private final mcMMO plugin;
public InviteCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /invite <player>"; //TODO: Needs more locale.
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
switch (args.length) {
case 1:
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
Party partyInstance = Party.getInstance();
if (!PP.inParty()) {
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true;
}
Player target = plugin.getServer().getPlayer(args[0]);
if (target != null) {
if (partyInstance.canInvite(player, PP)) {
PlayerProfile PPt = Users.getProfile(target);
PPt.modifyInvite(PP.getParty());
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", new Object[] { PPt.getInvite(), player.getName() }));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true;
}
else {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
}
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,120 +0,0 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PCommand implements CommandExecutor {
private final mcMMO plugin;
public PCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile PP;
String usage = ChatColor.RED + "Proper usage is /p <party-name> <message>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
switch (args.length) {
case 0:
if (sender instanceof Player) {
PP = Users.getProfile((Player) sender);
if (PP.getAdminChatMode()) {
PP.toggleAdminChat();
}
PP.togglePartyChat();
if (PP.getPartyChatMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
}
}
else {
sender.sendMessage(usage);
}
return true;
default:
if (sender instanceof Player) {
Player player = (Player) sender;
PP = Users.getProfile(player);
if (!PP.inParty()) {
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true;
}
String message = args[0];
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
}
if (PP.getPartyChatMode()) {
player.chat(message);
}
else {
PP.togglePartyChat();
player.chat(message);
PP.togglePartyChat();
}
}
else {
if (args.length < 2) {
sender.sendMessage(usage);
return true;
}
if (!Party.getInstance().isParty(args[0])) {
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return true;
}
String message = args[1];
for (int i = 2; i < args.length; i++) {
message = message + " " + args [i];
}
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent("Console", args[0], message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
message = chatEvent.getMessage();
String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
plugin.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + message);
for (Player player : Party.getInstance().getOnlineMembers(args[0])) {
player.sendMessage(prefix + message);
}
}
return true;
}
}
}

View File

@@ -1,267 +0,0 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PartyCommand implements CommandExecutor {
private final mcMMO plugin;
public PartyCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
return true;
}
Player player = (Player) sender;
String playerName = player.getName();
PlayerProfile PP = Users.getProfile(player);
Party partyInstance = Party.getInstance();
boolean inParty = PP.inParty();
String partyName = PP.getParty();
boolean isLeader = partyInstance.isPartyLeader(playerName, partyName);
if (PP.inParty() && (!partyInstance.isParty(PP.getParty()) || !partyInstance.isInParty(player, PP))) {
partyInstance.addToParty(player, PP, PP.getParty(), false, null);
}
switch (args.length) {
case 0:
if (!inParty) {
player.sendMessage(LocaleLoader.getString("Party.Help.0"));
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(LocaleLoader.getString("Party.Help.2"));
}
else {
String tempList = "";
for (Player p : partyInstance.getAllMembers(player)) {
if (p.equals(partyInstance.getPartyLeader(partyName))) {
tempList += ChatColor.GOLD;
}
else {
tempList += ChatColor.WHITE;
}
tempList += p.getName() + " ";
}
player.sendMessage(LocaleLoader.getString("Commands.Party.InParty", new Object[] { partyName }));
player.sendMessage(LocaleLoader.getString("Commands.Party.Members", new Object[] { tempList }));
}
return true;
case 1:
if (args[0].equalsIgnoreCase("q")) {
if (inParty) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.LEFT_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
player.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
}
else {
player.sendMessage("Commands.Party.None");
}
}
else if (args[0].equals("?")) {
player.sendMessage(LocaleLoader.getString("Party.Help.3"));
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(LocaleLoader.getString("Party.Help.4"));
player.sendMessage(LocaleLoader.getString("Party.Help.5"));
player.sendMessage(LocaleLoader.getString("Party.Help.6"));
player.sendMessage(LocaleLoader.getString("Party.Help.7"));
}
else if (args[0].equalsIgnoreCase("lock")) {
if (inParty) {
if (isLeader) {
if (partyInstance.isPartyLocked(partyName)) {
player.sendMessage(LocaleLoader.getString("Party.IsLocked"));
}
else {
partyInstance.lockParty(partyName);
player.sendMessage(LocaleLoader.getString("Party.Locked"));
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else {
player.sendMessage("Commands.Party.None");
}
}
else if (args[0].equalsIgnoreCase("unlock")) {
if (inParty) {
if (isLeader) {
if (!partyInstance.isPartyLocked(partyName)) {
player.sendMessage(LocaleLoader.getString("Party.IsntLocked"));
}
else {
partyInstance.unlockParty(partyName);
player.sendMessage(LocaleLoader.getString("Party.Unlocked"));
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else {
player.sendMessage("Commands.Party.None");
}
}
else {
if (inParty) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
}
partyInstance.addToParty(player, PP, args[0], false, null);
}
return true;
case 2:
if (PP.inParty()) {
if (args[0].equalsIgnoreCase("password")) {
if (isLeader) {
if (!partyInstance.isPartyLocked(partyName)) {
partyInstance.lockParty(partyName);
}
partyInstance.setPartyPassword(partyName, args[1]);
player.sendMessage(LocaleLoader.getString("Party.PasswordSet", new Object[] { args[1] }));
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else if (args[0].equalsIgnoreCase("kick")) {
if (isLeader) {
Player target = plugin.getServer().getPlayer(args[1]);
if (target == null) {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
}
PlayerProfile PPt = Users.getProfile(target);
String targetName = target.getName();
if (!partyInstance.inSameParty(player, (Player) target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { targetName }));
return true;
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(target, PPt);
target.sendMessage(LocaleLoader.getString("Commands.Party.Kick", new Object[] { partyName }));
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else if (args[0].equalsIgnoreCase("owner")) {
if (isLeader) {
Player target = plugin.getServer().getPlayer(args[1]);
if (target == null) {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
}
String targetName = target.getName();
if (!partyInstance.inSameParty(player, (Player) target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { targetName }));
return true;
}
else {
partyInstance.setPartyLeader(partyName, targetName);
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
}
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
partyInstance.addToParty(player, PP, args[0], false, args[1]);
}
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.addToParty(player, PP, args[0], false, args[1]);
}
return true;
default:
player.sendMessage(LocaleLoader.getString("Party.Help.0"));
player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(LocaleLoader.getString("Party.Help.2"));
return true;
}
}
}

View File

@@ -1,93 +0,0 @@
package com.gmail.nossr50.commands.party;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PtpCommand implements CommandExecutor {
private final mcMMO plugin;
public PtpCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /ptp <player>"; //TODO: Needs more locale.
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ptp")) {
return true;
}
switch (args.length) {
case 1:
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (!Party.getInstance().isInParty(player, PP)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true;
}
if (PP.getRecentlyHurt() + (Config.getInstance().getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", new Object[] { Config.getInstance().getPTPCommandCooldown() }));
return true;
}
Player target = plugin.getServer().getPlayer(args[0]);
if (player.equals(target)) {
player.sendMessage("You can't teleport to yourself!"); //TODO: Use locale
return true;
}
if (target == null) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Invalid"));
return true;
}
if (target.isDead()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead"));
return true;
}
if (Party.getInstance().inSameParty(player, target)) {
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, PP.getParty());
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
player.teleport(target);
player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", new Object[] { target.getName() }));
target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", new Object[] { player.getName() }));
}
else {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { target.getName() }));
return true;
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -0,0 +1,90 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class InspectCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
switch (args.length) {
case 1:
if (!sender.hasPermission("mcmmo.commands.inspect")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
// 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); //Temporary Profile
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (sender instanceof Player && !sender.hasPermission("mcmmo.commands.inspect.offline")) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", args[0]));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
}
else {
Player target = mcMMOPlayer.getPlayer();
if (sender instanceof Player) {
Player inspector = (Player) sender;
if (!Misc.isNear(inspector.getLocation(), target.getLocation(), 5.0) && !inspector.hasPermission("mcmmo.commands.inspect.far")) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true;
}
}
profile = mcMMOPlayer.getProfile();
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
CommandHelper.printGatheringSkills(target, profile, sender);
CommandHelper.printCombatSkills(target, profile, sender);
CommandHelper.printMiscSkills(target, profile, sender);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,79 @@
package com.gmail.nossr50.commands.player;
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.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McabilityCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerProfile profile;
switch (args.length) {
case 0:
if (!sender.hasPermission("mcmmo.commands.mcability")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
profile = Users.getPlayer((Player) sender).getProfile();
if (profile.getAbilityUse()) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
}
profile.toggleAbilityUse();
return true;
case 1:
if (!sender.hasPermission("mcmmo.commands.mcability.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
if (mcMMOPlayer == null) {
profile = new PlayerProfile(args[0], false);
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;
}
Player player = mcMMOPlayer.getPlayer();
profile = mcMMOPlayer.getProfile();
if (!player.isOnline()) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;
}
if (profile.getAbilityUse()) {
player.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
}
profile.toggleAbilityUse();
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,107 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
String description = LocaleLoader.getString("mcMMO.Description");
String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) {
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
SpoutPlayer spoutPlayer = (SpoutPlayer) sender;
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND);
}
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()));
return true;
case 1:
if (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("commands")) {
if (!sender.hasPermission("mcmmo.commands.mcmmo.help")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mcc.Header"));
displayPartyCommands(sender);
displayOtherCommands(sender);
}
return true;
default:
return false;
}
}
private void displayPartyCommands(CommandSender sender) {
if (sender.hasPermission("mcmmo.commands.party")) {
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"));
if (sender.hasPermission("mcmmo.chat.party")) {
sender.sendMessage("/party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
}
sender.sendMessage("/party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
sender.sendMessage("/party accept " + LocaleLoader.getString("Commands.Party.Accept"));
if (sender.hasPermission("mcmmo.commands.ptp")) {
sender.sendMessage("/party teleport " + LocaleLoader.getString("Commands.Party.Teleport"));
}
}
}
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 (sender.hasPermission("mcmmo.commands.skillreset")) {
sender.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
}
if (sender.hasPermission("mcmmo.commands.mcability")) {
sender.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
}
if (sender.hasPermission("mcmmo.chat.admin")) {
sender.sendMessage("/adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
}
if (sender.hasPermission("mcmmo.commands.inspect")) {
sender.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
}
if (sender.hasPermission("mcmmo.commands.mmoedit")) {
sender.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
}
if (sender.hasPermission("mcmmo.commands.mcgod")) {
sender.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
}
sender.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
}
}

View File

@@ -0,0 +1,123 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.Bukkit;
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.database.Leaderboard;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.McRankAsync;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class McrankCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
if (!sender.hasPermission("mcmmo.commands.mcrank")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (Config.getInstance().getUseMySQL()) {
sqlDisplay(sender, sender.getName());
}
else {
Leaderboard.updateLeaderboards(); // Make sure the information is up to date
flatfileDisplay(sender, sender.getName());
}
return true;
case 1:
if (!sender.hasPermission("mcmmo.commands.mcrank.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
if (mcMMOPlayer == null) {
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (sender instanceof Player && !!sender.hasPermission("mcmmo.commands.mcrank.others.offline")) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
}
else {
Player target = mcMMOPlayer.getPlayer();
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !sender.hasPermission("mcmmo.commands.mcrank.others.far")) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true;
}
}
if (Config.getInstance().getUseMySQL()) {
sqlDisplay(sender, args[0]);
}
else {
Leaderboard.updateLeaderboards(); // Make sure the information is up to date
flatfileDisplay(sender, args[0]);
}
return true;
default:
return false;
}
}
private void flatfileDisplay(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
for (SkillType skillType : SkillType.values()) {
int[] rankInts = Leaderboard.getPlayerRank(playerName, skillType);
if (skillType.isChildSkill()) {
continue;
}
if (rankInts[1] == 0) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), rankInts[0]));
}
}
// Show the powerlevel ranking
int[] rankInts = Leaderboard.getPlayerRank(playerName);
if (rankInts[1] == 0) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Overall", LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Overall", rankInts[0]));
}
}
private void sqlDisplay(CommandSender sender, String playerName) {
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new McRankAsync(playerName, sender));
}
}

View File

@@ -0,0 +1,50 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McstatsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
switch (args.length) {
case 0:
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
PlayerProfile profile = mcMMOPlayer.getProfile();
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
CommandHelper.printGatheringSkills(player, profile);
CommandHelper.printCombatSkills(player, profile);
CommandHelper.printMiscSkills(player, profile);
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap != Integer.MAX_VALUE) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", mcMMOPlayer.getPowerLevel(), powerLevelCap));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,114 @@
package com.gmail.nossr50.commands.player;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.Leaderboard;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.McTopAsync;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.StringUtils;
public class MctopCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
boolean useMySQL = Config.getInstance().getUseMySQL();
switch (args.length) {
case 0:
display(1, "ALL", sender, useMySQL, command);
return true;
case 1:
if (StringUtils.isInt(args[0])) {
display(Integer.parseInt(args[0]), "ALL", sender, useMySQL, command);
}
else if (SkillTools.isSkill(args[0])) {
display(1, SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
case 2:
if (!StringUtils.isInt(args[1])) {
return false;
}
if (SkillTools.isSkill(args[0])) {
display(Integer.parseInt(args[1]), SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
default:
return false;
}
}
private void display(int page, String skill, CommandSender sender, boolean sql, Command command) {
if (sql) {
if (skill.equalsIgnoreCase("all")) {
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender, command);
}
else {
sqlDisplay(page, skill, sender, command);
}
}
else {
flatfileDisplay(page, skill, sender, command);
}
}
private void flatfileDisplay(int page, String skill, CommandSender sender, Command command) {
if (!skill.equalsIgnoreCase("all") && !sender.hasPermission("mcmmo.commands.mctop." + skill.toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
return;
}
Leaderboard.updateLeaderboards(); //Make sure we have the latest information
String[] info = Leaderboard.retrieveInfo(skill, page);
if (skill.equalsIgnoreCase("all")) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", StringUtils.getCapitalized(skill)));
}
int n = (page * 10) - 9; // Position
for (String x : info) {
if (x != null) {
String digit = String.valueOf(n);
if (n < 10) {
digit = "0" + digit;
}
String[] splitx = x.split(":");
// Format: 1. Playername - skill value
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
n++;
}
}
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
}
private void sqlDisplay(int page, String query, CommandSender sender, Command command) {
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new McTopAsync(page, query, sender, command));
}
}

View File

@@ -1,118 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class AcrobaticsCommand implements CommandExecutor {
private float skillValue;
private String dodgeChance;
private String rollChance;
private String gracefulRollChance;
private boolean canDodge;
private boolean canRoll;
private boolean canGracefulRoll;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.acrobatics")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.ACROBATICS);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Acrobatics.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Acrobatics") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
if (canDodge || canGracefulRoll || canRoll) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1") }));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3") }));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5") }));
}
if (canDodge || canGracefulRoll || canRoll) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
}
Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
if (skillValue >= 1000) {
dodgeChance = "20.00%";
rollChance = "100.00%";
gracefulRollChance = "100.00%";
}
else if (skillValue >= 800) {
dodgeChance = "20.00%";
rollChance = percent.format(skillValue / 1000);
gracefulRollChance = "100.00%";
}
else if (skillValue >= 500) {
dodgeChance = percent.format(skillValue / 4000);
rollChance = percent.format(skillValue / 1000);
gracefulRollChance = "100.00%";
}
else {
dodgeChance = percent.format(skillValue / 4000);
rollChance = percent.format(skillValue / 1000);
gracefulRollChance = percent.format(skillValue / 500);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canDodge = permInstance.dodge(player);
canRoll = permInstance.roll(player);
canGracefulRoll = permInstance.gracefulRoll(player);
}
}

View File

@@ -1,108 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ArcheryCommand implements CommandExecutor {
private float skillValue;
private String skillShotBonus;
private String dazeChance;
private String retrieveChance;
private boolean canSkillShot;
private boolean canDaze;
private boolean canRetrieve;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.archery")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.ARCHERY);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Archery.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Archery") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
if (canSkillShot || canDaze || canRetrieve) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") }));
}
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") }));
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") }));
}
if (canSkillShot || canDaze || canRetrieve) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
}
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
}
Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
if (skillValue >= 1000) {
skillShotBonus = "200.00%";
dazeChance = "50.00%";
retrieveChance = "100.00%";
}
else {
skillShotBonus = percent.format(((int) skillValue / 50) * 0.1D); //TODO: Not sure if this is the best way to calculate this or not...
dazeChance = percent.format(skillValue / 2000);
retrieveChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canSkillShot = permInstance.archeryBonus(player);
canDaze = permInstance.daze(player);
canRetrieve = permInstance.trackArrows(player);
}
}

View File

@@ -1,133 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class AxesCommand implements CommandExecutor {
private float skillValue;
private String critChance;
private String bonusDamage;
private String impactDamage;
private String greaterImpactDamage;
private String skullSplitterLength;
private boolean canSkullSplitter;
private boolean canCritical;
private boolean canBonusDamage;
private boolean canImpact;
private boolean canGreaterImpact;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.axes")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.AXES);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Axes.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Axes") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
if (canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canSkullSplitter) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1") }));
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3") }));
}
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5") }));
}
if (canImpact) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7") }));
}
if (canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9") }));
}
if (canSkullSplitter || canCritical || canBonusDamage || canImpact || canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", new Object[] {bonusDamage}) }));
}
if (canImpact) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", new Object[] {impactDamage}) }));
}
if (canGreaterImpact) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }));
}
if (canSkullSplitter) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.SS.Length", new Object[] { skullSplitterLength }));
}
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
impactDamage = String.valueOf(5 + ((int) skillValue / 30));
skullSplitterLength = String.valueOf(2 + ((int) skillValue / 50));
greaterImpactDamage = "2";
if (skillValue >= 750) {
critChance = "37.50";
bonusDamage = "4";
}
else if (skillValue >= 200) {
critChance = percent.format(skillValue / 2000);
bonusDamage = "4";
}
else {
critChance = percent.format(skillValue / 2000);
bonusDamage = String.valueOf((int) skillValue / 50);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canSkullSplitter = permInstance.skullSplitter(player);
canCritical = permInstance.criticalHit(player);
canBonusDamage = permInstance.axeBonus(player);
canImpact = permInstance.impact(player);
canGreaterImpact = permInstance.greaterImpact(player);
}
}

View File

@@ -1,76 +0,0 @@
package com.gmail.nossr50.commands.skills;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ExcavationCommand implements CommandExecutor {
private float skillValue;
private String gigaDrillBreakerLength;
private boolean canGigaDrill;
private boolean canTreasureHunt;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.excavation")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.EXCAVATION);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Excavation.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Excavation") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
if (canGigaDrill || canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canGigaDrill) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.0"), LocaleLoader.getString("Excavation.Effect.1") }));
}
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.2"), LocaleLoader.getString("Excavation.Effect.3") }));
}
if (canGigaDrill) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(LocaleLoader.getString("Excavation.Effect.Length", new Object[] { gigaDrillBreakerLength }));
}
Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args);
return true;
}
private void dataCalculations(float skillValue) {
gigaDrillBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canGigaDrill = permInstance.gigaDrillBreaker(player);
canTreasureHunt = permInstance.excavationTreasures(player);
}
}

View File

@@ -1,104 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.gathering.Fishing;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class FishingCommand implements CommandExecutor {
private int lootTier;
private String magicChance;
private boolean canTreasureHunt;
private boolean canMagicHunt;
private boolean canShake;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.fishing")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
lootTier = Fishing.getFishingLootTier(PP);
dataCalculations(lootTier);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Fishing.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Fishing") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
if (canTreasureHunt || canMagicHunt || canShake) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1") }));
}
if (canMagicHunt) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3") }));
}
if (canShake) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5") }));
}
if (canTreasureHunt || canMagicHunt || canShake) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canTreasureHunt) {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", new Object[] { lootTier }));
}
if (canMagicHunt) {
player.sendMessage(LocaleLoader.getString("Fishing.Enchant.Chance", new Object[] { magicChance }));
}
if (canShake) {
//TODO: Do we really need to display this twice? Not like there are any associated stats.
if (PP.getSkillLevel(SkillType.FISHING) < 150) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake"));
}
}
Page.grabGuidePageForSkill(SkillType.FISHING, player, args);
return true;
}
private void dataCalculations(int lootTier) {
DecimalFormat percent = new DecimalFormat("##0.00%");
magicChance = percent.format((float) lootTier / 15);
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canTreasureHunt = permInstance.fishingTreasures(player);
canMagicHunt = permInstance.fishingMagic(player);
canShake = permInstance.shakeMob(player);
}
}

View File

@@ -1,168 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class HerbalismCommand implements CommandExecutor {
private float skillValue;
private String greenTerraLength;
private String greenThumbChance;
private String greenThumbStage;
private String farmersDietRank;
private String doubleDropChance;
private boolean canGreenTerra;
private boolean canGreenThumbWheat;
private boolean canGreenThumbBlocks;
private boolean canFarmersDiet;
private boolean canDoubleDrop;
private boolean doubleDropsDisabled;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.herbalism")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.HERBALISM);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Herbalism.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Herbalism") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
if (canGreenTerra || (canDoubleDrop && !doubleDropsDisabled )|| canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canGreenTerra) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
}
if (canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3") }));
}
if (canGreenThumbBlocks) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5") }));
}
if (canFarmersDiet) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9") }));
}
if (canGreenTerra || (canDoubleDrop && !doubleDropsDisabled ) || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canGreenTerra) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
}
if (canGreenThumbBlocks || canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
}
if (canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
}
if (canFarmersDiet) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } ));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
}
Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
greenTerraLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 1500) {
greenThumbChance = "100.00%";
greenThumbStage = "4";
farmersDietRank = "5";
doubleDropChance = "100.00%";
}
else if (skillValue >= 1000) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "4";
farmersDietRank = "5";
doubleDropChance = "100.00%";
}
else if (skillValue >= 800) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "4";
farmersDietRank = "4";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 600) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "4";
farmersDietRank = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 400) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "3";
farmersDietRank = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 200) {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "2";
farmersDietRank = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else {
greenThumbChance = percent.format(skillValue / 1500);
greenThumbStage = "1";
farmersDietRank = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
Config configInstance = Config.getInstance();
canGreenTerra = permInstance.greenTerra(player);
canGreenThumbWheat = permInstance.greenThumbWheat(player);
canGreenThumbBlocks = permInstance.greenThumbBlocks(player);
canFarmersDiet = permInstance.farmersDiet(player);
canDoubleDrop = permInstance.herbalismDoubleDrops(player);
doubleDropsDisabled = configInstance.herbalismDoubleDropsDisabled();
}
}

View File

@@ -1,196 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class MiningCommand implements CommandExecutor {
private float skillValue;
private String doubleDropChance;
private String superBreakerLength;
private String blastMiningRank;
private String blastRadiusIncrease;
private String blastDamageDecrease;
private boolean canSuperBreaker;
private boolean canDoubleDrop;
private boolean canBlast;
private boolean canBiggerBombs;
private boolean canDemoExpert;
private boolean doubleDropsDisabled;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.mining")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.MINING);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Mining.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Mining") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
if (canBiggerBombs || canBlast || canDemoExpert || (canDoubleDrop && !doubleDropsDisabled ) || canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3") }));
}
if (canBlast) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5") }));
}
if (canBiggerBombs) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7") }));
}
if (canDemoExpert) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9") }));
}
if (canBiggerBombs || canBlast || canDemoExpert || (canDoubleDrop && !doubleDropsDisabled ) || canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
}
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
}
if (canBlast) {
if (PP.getSkillLevel(SkillType.MINING) < 125) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (Misc.getInt(blastMiningRank) - 1)) }));
}
}
if (canBiggerBombs) {
if (PP.getSkillLevel(SkillType.MINING) < 250) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", new Object[] { blastRadiusIncrease }));
}
}
if (canDemoExpert) {
if (PP.getSkillLevel(SkillType.MINING) < 500) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", new Object[] { blastDamageDecrease }));
}
}
Page.grabGuidePageForSkill(SkillType.MINING, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
superBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 1000) {
blastMiningRank = "8";
blastDamageDecrease = "100.00%";
blastRadiusIncrease = "4";
doubleDropChance = "100.00%";
}
else if (skillValue >= 875) {
blastMiningRank = "7";
blastDamageDecrease = "50.00%";
blastRadiusIncrease = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 750) {
blastMiningRank = "6";
blastDamageDecrease = "50.00%";
blastRadiusIncrease = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 625) {
blastMiningRank = "5";
blastDamageDecrease = "25.00%";
blastRadiusIncrease = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 500) {
blastMiningRank = "4";
blastDamageDecrease = "25.00%";
blastRadiusIncrease = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 375) {
blastMiningRank = "3";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 250) {
blastMiningRank = "2";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 125) {
blastMiningRank = "1";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "0";
doubleDropChance = percent.format(skillValue / 1000);
}
else {
blastMiningRank = "0";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "0";
doubleDropChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
Config configInstance = Config.getInstance();
canBiggerBombs = permInstance.biggerBombs(player);
canBlast = permInstance.blastMining(player);
canDemoExpert = permInstance.demolitionsExpertise(player);
canDoubleDrop = permInstance.miningDoubleDrops(player);
canSuperBreaker = permInstance.superBreaker(player);
doubleDropsDisabled = configInstance.miningDoubleDropsDisabled();
}
}

View File

@@ -1,169 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class RepairCommand implements CommandExecutor {
private float skillValue;
private String repairMasteryBonus;
private String superRepairChance;
private boolean canSuperRepair;
private boolean canMasterRepair;
private boolean canArcaneForge;
private boolean canRepairStone;
private boolean canRepairIron;
private boolean canRepairGold;
private boolean canRepairDiamond;
private boolean canRepairString;
private boolean canRepairLeather;
private boolean canRepairWood;
private int diamondLevel;
private int goldLevel;
private int ironLevel;
private int stoneLevel;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.repair")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.REPAIR);
dataCalculations(skillValue);
permissionsCheck(player);
int arcaneForgingRank = Repair.getArcaneForgingRank(PP);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Repair.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Repair") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
if (canArcaneForge || canRepairDiamond || canRepairGold || canRepairIron || canMasterRepair || canRepairStone || canSuperRepair || canRepairString || canRepairWood || canRepairLeather) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.0"), LocaleLoader.getString("Repair.Effect.1") }));
if (canMasterRepair) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.2"), LocaleLoader.getString("Repair.Effect.3") }));
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.4"), LocaleLoader.getString("Repair.Effect.5") }));
}
/* Repair Level Requirements */
if (canRepairStone && stoneLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.14", new Object[] { stoneLevel }), LocaleLoader.getString("Repair.Effect.15") }));
}
if (canRepairIron && ironLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.12", new Object[] { ironLevel }), LocaleLoader.getString("Repair.Effect.13") }));
}
if (canRepairGold && goldLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.10", new Object[] { goldLevel }), LocaleLoader.getString("Repair.Effect.11") }));
}
if (canRepairDiamond && diamondLevel > 0) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.6", new Object[] { diamondLevel }), LocaleLoader.getString("Repair.Effect.7") }));
}
if (canArcaneForge) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9") }));
}
if (canArcaneForge || canMasterRepair || canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canMasterRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Mastery", new Object[] { repairMasteryBonus }));
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }));
}
if (canArcaneForge) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank }));
if (Config.getInstance().getArcaneForgingEnchantLossEnabled()) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", new Object[] { Repair.getEnchantChance(arcaneForgingRank) }));
}
if (Config.getInstance().getArcaneForgingDowngradeEnabled()) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", new Object[] { Repair.getDowngradeChance(arcaneForgingRank) }));
}
}
Page.grabGuidePageForSkill(SkillType.REPAIR, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
// We're using pickaxes here, not the best but works
Repairable diamondRepairable = mcMMO.repairManager.getRepairable(278);
Repairable goldRepairable = mcMMO.repairManager.getRepairable(285);
Repairable ironRepairable = mcMMO.repairManager.getRepairable(257);
Repairable stoneRepairable = mcMMO.repairManager.getRepairable(274);
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel();
ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel();
stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel();
repairMasteryBonus = percent.format(skillValue / 500);
if (skillValue >= 1000) {
superRepairChance = "100.00%";
}
else {
superRepairChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canSuperRepair = permInstance.repairBonus(player);
canMasterRepair = permInstance.repairMastery(player);
canArcaneForge = permInstance.arcaneForging(player);
canRepairDiamond = permInstance.diamondRepair(player);
canRepairGold = permInstance.goldRepair(player);
canRepairIron = permInstance.ironRepair(player);
canRepairStone = permInstance.stoneRepair(player);
canRepairString = permInstance.stringRepair(player);
canRepairLeather = permInstance.leatherRepair(player);
canRepairWood = permInstance.woodRepair(player);
}
}

View File

@@ -1,119 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class SwordsCommand implements CommandExecutor {
private float skillValue;
private String counterAttackChance;
private String bleedLength;
private String bleedChance;
private String serratedStrikesLength;
private boolean canCounter;
private boolean canSerratedStrike;
private boolean canBleed;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.swords")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.SWORDS);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Swords.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Swords") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
if (canBleed || canCounter || canSerratedStrike) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canCounter) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1") }));
}
if (canSerratedStrike) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5") }));
}
if (canBleed) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7") }));
}
if (canBleed || canCounter || canSerratedStrike) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canCounter) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
}
if (canBleed) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
}
if (canSerratedStrike) {
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", new Object[] { serratedStrikesLength }));
}
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
serratedStrikesLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 750) {
bleedLength = "3";
bleedChance = "75.00%";
counterAttackChance = "30.00%";
}
else if (skillValue >= 600) {
bleedLength = "2";
bleedChance = percent.format(skillValue / 1000);
counterAttackChance = "30.00%";
}
else {
bleedLength = "2";
bleedChance = percent.format(skillValue / 1000);
counterAttackChance = percent.format(skillValue / 2000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canBleed = permInstance.swordsBleed(player);
canCounter = permInstance.counterAttack(player);
canSerratedStrike = permInstance.serratedStrikes(player);
}
}

View File

@@ -1,172 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class TamingCommand implements CommandExecutor {
private float skillValue;
private String goreChance;
private boolean canBeastLore;
private boolean canGore;
private boolean canSharpenedClaws;
private boolean canEnvironmentallyAware;
private boolean canThickFur;
private boolean canShockProof;
private boolean canCallWild;
private boolean canFastFood;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.taming")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.TAMING);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Taming.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Taming") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
if (canBeastLore || canCallWild || canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canBeastLore) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1") }));
}
if (canGore) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3") }));
}
if (canSharpenedClaws) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5") }));
}
if (canEnvironmentallyAware) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7") }));
}
if (canThickFur) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9") }));
}
if (canShockProof) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11") }));
}
if (canFastFood) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17") }));
}
if (canCallWild) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13") }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.14", new Object[] { Config.getInstance().getTamingCOTWOcelotCost() }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.15", new Object[] { Config.getInstance().getTamingCOTWWolfCost() }));
}
if (canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canFastFood) {
if (PP.getSkillLevel(SkillType.TAMING) < 50) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.4") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9") }));
}
}
if (canEnvironmentallyAware) {
if (PP.getSkillLevel(SkillType.TAMING) < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1") }));
}
}
if (canThickFur) {
if (PP.getSkillLevel(SkillType.TAMING) < 250) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3") }));
}
}
if (canShockProof) {
if (PP.getSkillLevel(SkillType.TAMING) < 500) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.2") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5") }));
}
}
if (canSharpenedClaws) {
if (PP.getSkillLevel(SkillType.TAMING) < 750) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.3") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7") }));
}
}
if (canGore) {
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
}
Page.grabGuidePageForSkill(SkillType.TAMING, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
if (skillValue >= 1000) {
goreChance = "100.00%";
}
else {
goreChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canBeastLore = permInstance.beastLore(player);
canCallWild = permInstance.callOfTheWild(player);
canEnvironmentallyAware = permInstance.environmentallyAware(player);
canFastFood = permInstance.fastFoodService(player);
canGore = permInstance.gore(player);
canSharpenedClaws = permInstance.sharpenedClaws(player);
canShockProof = permInstance.shockProof(player);
canThickFur = permInstance.thickFur(player);
}
}

View File

@@ -1,126 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class UnarmedCommand implements CommandExecutor {
private float skillValue;
private String berserkLength;
private String deflectChance;
private String disarmChance;
private String ironArmBonus;
private boolean canBerserk;
private boolean canDisarm;
private boolean canBonusDamage;
private boolean canDeflect;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.unarmed")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.UNARMED);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Unarmed.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Unarmed") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
if (canBerserk || canBonusDamage || canDeflect || canDisarm) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canBerserk) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.0"), LocaleLoader.getString("Unarmed.Effect.1") }));
}
if (canDisarm) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.2"), LocaleLoader.getString("Unarmed.Effect.3") }));
}
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.4"), LocaleLoader.getString("Unarmed.Effect.5") }));
}
if (canDeflect) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.6"), LocaleLoader.getString("Unarmed.Effect.7") }));
}
if (canBerserk || canBonusDamage || canDeflect || canDisarm) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canBonusDamage) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", new Object[] {ironArmBonus}) }));
}
if (canDeflect) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }));
}
if (canDisarm) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }));
}
if (canBerserk) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Berserk.Length", new Object[] { berserkLength }));
}
Page.grabGuidePageForSkill(SkillType.UNARMED, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
berserkLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 1000) {
disarmChance = "33.33%";
deflectChance = "50.00%";
ironArmBonus = "8";
}
else if (skillValue >= 250) {
disarmChance = percent.format(skillValue / 3000);
deflectChance = percent.format(skillValue / 2000);
ironArmBonus = "8";
}
else {
disarmChance = percent.format(skillValue / 3000);
deflectChance = percent.format(skillValue / 2000);
ironArmBonus = String.valueOf(3 + ((int) skillValue / 50));
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canBerserk = permInstance.berserk(player);
canBonusDamage = permInstance.unarmedBonus(player);
canDeflect = permInstance.deflect(player);
canDisarm = permInstance.disarm(player);
}
}

View File

@@ -1,115 +0,0 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class WoodcuttingCommand implements CommandExecutor {
private float skillValue;
private String treeFellerLength;
private String doubleDropChance;
private boolean canTreeFell;
private boolean canLeafBlow;
private boolean canDoubleDrop;
private boolean doubleDropsDisabled;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.woodcutting")) {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
skillValue = (float) PP.getSkillLevel(SkillType.UNARMED);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Woodcutting.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.WoodCutting") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
if ((canDoubleDrop && !doubleDropsDisabled ) || canLeafBlow || canTreeFell) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canTreeFell) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.0"), LocaleLoader.getString("Woodcutting.Effect.1") }));
}
if (canLeafBlow) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.2"), LocaleLoader.getString("Woodcutting.Effect.3") }));
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.4"), LocaleLoader.getString("Woodcutting.Effect.5") }));
}
if ((canDoubleDrop && !doubleDropsDisabled ) || canLeafBlow || canTreeFell) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
//TODO: Remove? Basically duplicates the above.
if (canLeafBlow) {
if (PP.getSkillLevel(SkillType.WOODCUTTING) < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Woodcutting.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1") }));
}
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }));
}
if (canTreeFell) {
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Length", new Object[] { treeFellerLength }));
}
Page.grabGuidePageForSkill(SkillType.WOODCUTTING, player, args);
return true;
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
treeFellerLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 1000) {
doubleDropChance = "100.00%";
}
else {
doubleDropChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
Config configInstance = Config.getInstance();
canTreeFell = permInstance.treeFeller(player);
canDoubleDrop = permInstance.woodcuttingDoubleDrops(player);
canLeafBlow = permInstance.leafBlower(player);
doubleDropsDisabled = configInstance.woodcuttingDoubleDropsDisabled();
}
}

View File

@@ -1,77 +0,0 @@
package com.gmail.nossr50.commands.spout;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class MchudCommand implements CommandExecutor {
private final mcMMO plugin;
public MchudCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /mchud <hud-type>"; //TODO: Locale
String invalid = ChatColor.RED + "That is not a valid HUD type."; //TODO: Locale
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
switch (args.length) {
case 1:
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
HUDType hud;
if (args[0].equalsIgnoreCase("disabled")) {
hud = HUDType.DISABLED;
}
else if (args[0].equalsIgnoreCase("standard")) {
hud = HUDType.STANDARD;
}
else if (args[0].equalsIgnoreCase("small")) {
hud = HUDType.SMALL;
}
else if (args[0].equalsIgnoreCase("retro")) {
hud = HUDType.RETRO;
}
else {
player.sendMessage(invalid);
return true;
}
if (SpoutStuff.playerHUDs.containsKey(player)) {
SpoutStuff.playerHUDs.get(player).resetHUD();
SpoutStuff.playerHUDs.remove(player);
PP.setHUDType(hud);
SpoutStuff.playerHUDs.put(player, new HUDmmo(player, plugin));
}
return true;
default:
sender.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,79 +0,0 @@
package com.gmail.nossr50.commands.spout;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
public class XplockCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /xplock [skill]";
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
switch (args.length) {
case 0:
if (PP.getXpBarLocked()) {
PP.toggleXpBarLocked();
player.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
return true;
}
SkillType lastGained = PP.getLastGained();
if (lastGained != null) {
PP.toggleXpBarLocked();
PP.setSkillLock(lastGained);
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(lastGained.toString()) }));
return true;
}
case 1:
if (Skills.isSkill(args[0])) {
if (Permissions.getInstance().permission(player, "mcmmo.skills." + args[0].toLowerCase())) {
PP.setXpBarLocked(true);
PP.setSkillLock(Skills.getSkillType(args[0]));
SpoutStuff.updateXpBar(player);
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(args[0]) }));
return true;
}
else {
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return true;
}
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
default:
player.sendMessage(usage);
return true;
}
}
}

View File

@@ -0,0 +1,226 @@
package com.gmail.nossr50.config;
public class AdvancedConfig extends ConfigLoader {
private static AdvancedConfig instance;
private AdvancedConfig() {
super("advanced.yml");
loadKeys();
}
public static AdvancedConfig getInstance() {
if (instance == null) {
instance = new AdvancedConfig();
}
return instance;
}
@Override
protected void loadKeys() {
// TODO Do we need to use this?
}
/* GENERAL */
public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); }
/* ACROBATICS */
public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge_ChanceMax", 20.0D); }
public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); }
public double getRollChanceMax() { return config.getDouble("Skills.Acrobatics.Roll_ChanceMax", 100.0D); }
public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); }
public double getGracefulRollChanceMax() { return config.getDouble("Skills.Acrobatics.GracefulRoll_ChanceMax", 100.0D); }
public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); }
public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); }
public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); }
public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); }
/* ARCHERY */
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); }
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); }
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot_MaxBonus", 2.0D); }
public double getDazeBonusMax() { return config.getDouble("Skills.Archery.Daze_MaxChance", 50.0D); }
public int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze_MaxBonusLevel", 1000); }
public int getDazeModifier() { return config.getInt("Skills.Archery.Daze_BonusDamage", 4); }
public double getRetrieveChanceMax() { return config.getDouble("Skills.Archery.Retrieve_MaxBonus", 100.0D); }
public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); }
/* AXES */
public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); }
public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); }
public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical_MaxChance", 37.50D); }
public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical_MaxBonusLevel", 750); }
public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5D); }
public double getAxesCriticalPVEModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVE_Modifier", 2.0D); }
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact_Chance", 25.0D); }
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); }
public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); }
public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); }
public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20.0D); }
public int getSkullSplitterModifier() { return config.getInt("Skills.Axes.SkullSplitter_DamagerModifier", 2); }
/* EXCAVATION */
//Nothing to configure, everything is already configurable in config.yml
/* FISHING */
public int getFishingTierLevelsTier1() { return config.getInt("Skills.Fishing.Tier_Levels.Tier1", 0); }
public int getFishingTierLevelsTier2() { return config.getInt("Skills.Fishing.Tier_Levels.Tier2", 200); }
public int getFishingTierLevelsTier3() { return config.getInt("Skills.Fishing.Tier_Levels.Tier3", 400); }
public int getFishingTierLevelsTier4() { return config.getInt("Skills.Fishing.Tier_Levels.Tier4", 600); }
public int getFishingTierLevelsTier5() { return config.getInt("Skills.Fishing.Tier_Levels.Tier5", 800); }
public int getFishingMagicMultiplier() { return config.getInt("Skills.Fishing.MagicHunter_Multiplier", 5); }
public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.Fisherman_Diet_RankChange", 200); }
/* Shake */
public int getShakeUnlockLevel() { return config.getInt("Skills.Fishing.Shake_UnlockLevel", 150); }
public int getShakeChanceRank1() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_1", 25); }
public int getShakeChanceRank2() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_2", 40); }
public int getShakeChanceRank3() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_3", 55); }
public int getShakeChanceRank4() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_4", 60); }
public int getShakeChanceRank5() { return config.getInt("Skills.Fishing.Shake_Chance.Rank_5", 75); }
/* Vanilla XP Boost */
public int getFishingVanillaXPModifierRank1() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_1", 1); }
public int getFishingVanillaXPModifierRank2() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_2", 2); }
public int getFishingVanillaXPModifierRank3() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_3", 3); }
public int getFishingVanillaXPModifierRank4() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_4", 4); }
public int getFishingVanillaXPModifierRank5() { return config.getInt("Skills.Fishing.VanillaXPBoost.Rank_5", 5); }
/* HERBALISM */
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.Farmer_Diet_RankChange", 200); }
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb_StageChange", 200); }
public double getGreenThumbChanceMax() { return config.getDouble("Skills.Herbalism.GreenThumb_ChanceMax", 100.0D); }
public int getGreenThumbMaxLevel() { return config.getInt("Skills.Herbalism.GreenThumb_MaxBonusLevel", 1500); }
public double getHerbalismDoubleDropsChanceMax() { return config.getDouble("Skills.Herbalism.DoubleDrops_ChanceMax", 100.0D); }
public int getHerbalismDoubleDropsMaxLevel() { return config.getInt("Skills.Herbalism.DoubleDrops_MaxBonusLevel", 1000); }
public double getHylianLuckChanceMax() { return config.getDouble("Skills.Herbalism.HylianLuck_ChanceMax", 10.0D); }
public int getHylianLucksMaxLevel() { return config.getInt("Skills.Herbalism.HylianLuck_MaxBonusLevel", 1000); }
/* MINING */
public double getMiningDoubleDropChance() { return config.getDouble("Skills.Mining.DoubleDrops_ChanceMax", 100.0D); }
public int getMiningDoubleDropMaxLevel() { return config.getInt("Skills.Mining.DoubleDrops_MaxBonusLevel", 1000); }
public int getBlastMiningRank1() { return config.getInt("Skills.Mining.BlastMining_Rank1", 125); }
public int getBlastMiningRank2() { return config.getInt("Skills.Mining.BlastMining_Rank2", 250); }
public int getBlastMiningRank3() { return config.getInt("Skills.Mining.BlastMining_Rank3", 375); }
public int getBlastMiningRank4() { return config.getInt("Skills.Mining.BlastMining_Rank4", 500); }
public int getBlastMiningRank5() { return config.getInt("Skills.Mining.BlastMining_Rank5", 625); }
public int getBlastMiningRank6() { return config.getInt("Skills.Mining.BlastMining_Rank6", 750); }
public int getBlastMiningRank7() { return config.getInt("Skills.Mining.BlastMining_Rank7", 875); }
public int getBlastMiningRank8() { return config.getInt("Skills.Mining.BlastMining_Rank8", 1000); }
/* REPAIR */
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery_MaxBonusPercentage", 200.0D); }
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusLevel", 1000); }
public double getSuperRepairChanceMax() { return config.getDouble("Skills.Repair.SuperRepair_ChanceMax", 100.0D); }
public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); }
/* Arcane Forging */
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.Arcane_Forging.Downgrades.Enabled", true); }
public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_1", 75); }
public int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_2", 50); }
public int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_3", 25); }
public int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_4", 15); }
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.Arcane_Forging.May_Lose_Enchants", true); }
public int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); }
public int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); }
public int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); }
public int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); }
public int getArcaneForgingRankLevels1() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_1", 100); }
public int getArcaneForgingRankLevels2() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_2", 250); }
public int getArcaneForgingRankLevels3() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_3", 500); }
public int getArcaneForgingRankLevels4() { return config.getInt("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_4", 750); }
/* SMELTING */
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency_MaxBonusLevel", 1000); }
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency_Multiplier", 3.0D); }
public int getSecondSmeltMaxLevel() { return config.getInt("Skills.Smelting.SecondSmelt_MaxBonusLevel", 1000); }
public double getSecondSmeltMaxChance() { return config.getDouble("Skills.Smelting.SecondSmelt_MaxBonusChance", 100.0D); }
public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining_UnlockLevel", 250); }
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining_Chance", 33.0D); }
public int getSmeltingVanillaXPBoostRank1Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank1Level", 100); }
public int getSmeltingVanillaXPBoostRank2Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank2Level", 300); }
public int getSmeltingVanillaXPBoostRank3Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank3Level", 500); }
public int getSmeltingVanillaXPBoostRank4Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank4Level", 700); }
public int getSmeltingVanillaXPBoostRank5Level() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank5Level", 900); }
public int getSmeltingVanillaXPBoostRank1Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank1Multiplier", 2); }
public int getSmeltingVanillaXPBoostRank2Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank2Multiplier", 3); }
public int getSmeltingVanillaXPBoostRank3Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank3Multiplier", 4); }
public int getSmeltingVanillaXPBoostRank4Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank4Multiplier", 5); }
public int getSmeltingVanillaXPBoostRank5Multiplier() { return config.getInt("Skills.Smelting.VanillaXPBoost_Rank5Multiplier", 6); }
/* SWORDS */
public double getBleedChanceMax() { return config.getDouble("Skills.Swords.Bleed_ChanceMax", 75.0D); }
public int getBleedMaxBonusLevel() { return config.getInt("Skills.Swords.Bleed_MaxBonusLevel", 750); }
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed_MaxTicks", 3); }
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed_BaseTicks", 2); }
public double getCounterChanceMax() { return config.getDouble("Skills.Swords.Counter_ChanceMax", 30.0D); }
public int getCounterMaxBonusLevel() { return config.getInt("Skills.Swords.Counter_MaxBonusLevel", 600); }
public int getCounterModifier() { return config.getInt("Skills.Swords.Counter_DamageModifier", 2); }
public int getSerratedStrikesModifier() { return config.getInt("Skills.Swords.SerratedStrikes_DamageModifier", 4); }
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes_BleedTicks", 5); }
/* TAMING */
public double getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); }
public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); }
public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore_BleedTicks", 2); }
public int getGoreModifier() { return config.getInt("Skills.Taming.Gore_Modifier", 2); }
public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood_UnlockLevel", 50); }
public double getFastFoodChance() { return config.getInt("Skills.Taming.FastFood_Chance", 50); }
public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware_UnlockLevel", 100); }
public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur_UnlockLevel", 250); }
public int getThickFurModifier() { return config.getInt("Skills.Taming.ThickFur_Modifier", 2); }
public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof_UnlockLevel", 500); }
public int getShockProofModifier() { return config.getInt("Skills.Taming.ShockProof_Modifier", 6); }
public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws_UnlockLevel", 750); }
public int getSharpenedClawsBonus() { return config.getInt("Skills.Taming.SharpenedClaws_Bonus", 2); }
/* UNARMED */
public double getDisarmChanceMax() { return config.getDouble("Skills.Unarmed.Disarm_ChanceMax", 33.0D); }
public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm_MaxBonusLevel", 1000); }
public double getDeflectChanceMax() { return config.getDouble("Skills.Unarmed.Deflect_ChanceMax", 50.0D); }
public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); }
public double getIronGripChanceMax() { return config.getDouble("Skills.Unarmed.IronGrip_ChanceMax", 100.0D); }
public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); }
public int getIronArmMaxBonus() { return config.getInt("Skills.Unarmed.IronArm_BonusMax", 8); }
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); }
/* WOODCUTTING */
public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); }
public double getWoodcuttingDoubleDropChance() { return config.getDouble("Skills.Woodcutting.DoubleDrops_ChanceMax", 100.0D); }
public int getWoodcuttingDoubleDropMaxLevel() { return config.getInt("Skills.Woodcutting.DoubleDrops_MaxBonusLevel", 1000); }
/* SPOUT STUFF*/
public int getSpoutNotificationTier1() { return config.getInt("Spout.Notifications.Tier1", 200); }
public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); }
public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); }
public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); }
}

View File

@@ -1,26 +1,30 @@
package com.gmail.nossr50.config;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType;
public class Config extends ConfigLoader {
public int xpGainMultiplier = 1;
private static Config instance;
private Config() {
super("config.yml");
loadKeys();
}
public static Config getInstance() {
if (instance == null) {
instance = new Config(mcMMO.p);
instance.load();
instance = new Config();
}
return instance;
}
@Override
protected void loadKeys() {}
/*
* GENERAL SETTINGS
*/
@@ -28,68 +32,83 @@ public class Config extends ConfigLoader {
/* General Settings */
public String getLocale() { return config.getString("General.Locale", "en_us"); }
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
public boolean getBackupsEnabled() { return config.getBoolean("General.Generate_Backups", true); }
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.p.Use_Display_Names", true); }
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.a.Use_Display_Names", true); }
/* Database Purging */
public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); }
/* mySQL */
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
public String getMySQLDatabaseName() { return config.getString("MySQL.Database.Name", "DatabaseName"); }
public String getMySQLUserName() { return config.getString("MySQL.Database.User_Name", "UserName"); } //Really should be labeled under MySQL.User_Name instead...
public String getMySQLDatabaseName() { return getStringIncludingInts(config, "MySQL.Database.Name"); }
public String getMySQLUserName() { return getStringIncludingInts(config, "MySQL.Database.User_Name"); }
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
public String getMySQLUserPassword() {
if (config.getString("MySQL.Database.User_Password", null) != null) {
return config.getString("MySQL.Database.User_Password", null);
}
else {
return "";
if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) {
return getStringIncludingInts(config, "MySQL.Database.User_Password");
}
return "";
}
private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
String str = cfg.getString(key);
if (str == null)
str = String.valueOf(cfg.getInt(key));
if (str == null)
str = "No value set for '" + key + "'";
return str;
}
/* Hardcore Mode */
public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); }
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75); }
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism_Stat_Leech_Percentage", 5); }
public void setHardcoreEnabled(boolean enabled) { config.set("Hardcore.Enabled", enabled); }
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75.0); }
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss_Penalty_Percentage", value); }
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism_Stat_Leech_Percentage", 5.0); }
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism_Stat_Leech_Percentage", value); }
public boolean getHardcoreVampirismEnabled() { return config.getBoolean("Hardcore.Vampirism", false); }
public void setHardcoreVampirismEnabled(boolean enabled) { config.set("Hardcore.Vampirism", enabled); }
/* SMP Mods */
public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
/* Commands */
public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
public boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); }
public boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); }
public boolean getCommandAddLevelsEnabled() { return config.getBoolean("Commands.addlevels.Enabled", true); }
public boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); }
public boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); }
public boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); }
public boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); }
public boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); }
public boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); }
public boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); }
public boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); }
public boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); }
public boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); }
public boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); }
public boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); }
public boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); }
public boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); }
public boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); }
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); }
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
/* Items */
public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
/* PARTY SETTINGS */
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }
public boolean getExpShareEnabled() { return config.getBoolean("Party.Sharing.ExpShare_enabled", true); }
public double getPartyShareBonusBase() { return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1); }
public double getPartyShareBonusIncrease() { return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05); }
public double getPartyShareBonusCap() { return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5); }
public boolean getItemShareEnabled() { return config.getBoolean("Party.Sharing.ItemShare_enabled", true); }
public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0); }
/* Party Teleport Settings */
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); }
public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Confirm_Required", true); }
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
/*
* ABILITY SETTINGS
*/
@@ -136,16 +155,17 @@ public class Config extends ConfigLoader {
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
/* Excavation */
public int getExcavationBaseXP() { return config.getInt("Experience.Excavation.Base", 40); }
public int getExcavationClayXP() { return config.getInt("Experience.Excavation.Clay", 40); }
public int getExcavationDirtXP() { return config.getInt("Experience.Excavation.Dirt", 40); }
public int getExcavationGrassXP() { return config.getInt("Experience.Excavation.Grass", 40); }
public int getExcavationGravelXP() { return config.getInt("Experience.Excavation.Gravel", 40); }
public int getExcavationMycelXP() { return config.getInt("Experience.Excavation.Mycel", 40); }
public int getExcavationSandXP() { return config.getInt("Experience.Excavation.Sand", 40); }
public int getExcavationSoulSandXP() { return config.getInt("Experience.Excavation.SoulSand", 40); }
/* Fishing */
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
public boolean getFishingDropsEnabled() { return config.getBoolean("Fishing.Drops_Enabled", true); }
public int getFishingTierLevelsTier1() { return config.getInt("Fishing.Tier_Levels.Tier1", 0); }
public int getFishingTierLevelsTier2() { return config.getInt("Fishing.Tier_Levels.Tier2", 200); }
public int getFishingTierLevelsTier3() { return config.getInt("Fishing.Tier_Levels.Tier3", 400); }
public int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); }
public int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); }
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
/* Herbalism */
public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); }
@@ -158,8 +178,12 @@ public class Config extends ConfigLoader {
public int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); }
public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); }
public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); }
public int getHerbalismXPCocoa() { return config.getInt("Experience.Herbalism.Cocoa", 30); }
public int getHerbalismXPCarrot() { return config.getInt("Experience.Herbalism.Carrot", 50); }
public int getHerbalismXPPotato() { return config.getInt("Experience.Herbalism.Potato", 50); }
public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); }
public boolean getHerbalismGreenThumbCobbleWallToMossyWall() { return config.getBoolean("Skills.Herbalism.Green_Thumb.CobbleWall_To_MossyWall", true); }
public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); }
public boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); }
@@ -175,28 +199,16 @@ public class Config extends ConfigLoader {
public boolean getVinesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Vines", true); }
public boolean getWaterLiliesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Water_Lilies", true); }
public boolean getYellowFlowersDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Yellow_Flowers", true); }
public boolean getCocoaDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cocoa", true); }
public boolean getCarrotDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Carrot", true); }
public boolean getPotatoDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Potato", true); }
public boolean herbalismDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Herbalism");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Herbalism." + key)) {
disabled = false;
break;
}
}
return disabled;
return doubleDropsDisabled("Herbalism");
}
/* Mining */
public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); }
public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); }
public int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); }
public int getMiningXPIronOre() { return config.getInt("Experience.Mining.Iron", 250); }
public int getMiningXPRedstoneOre() { return config.getInt("Experience.Mining.Redstone", 150); }
@@ -209,6 +221,7 @@ public class Config extends ConfigLoader {
public int getMiningXPSandstone() { return config.getInt("Experience.Mining.Sandstone", 30); }
public int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); }
public int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); }
public int getMiningXPEmeraldOre() { return config.getInt("Experience.Mining.Emerald", 1000); }
public boolean getCoalDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Coal", true); }
public boolean getDiamondDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Diamond", true); }
@@ -223,24 +236,10 @@ public class Config extends ConfigLoader {
public boolean getRedstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Redstone", true); }
public boolean getSandstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Sandstone", true); }
public boolean getStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Stone", true); }
public boolean getEmeraldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Emerald", true); }
public boolean miningDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Mining");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Mining." + key)) {
disabled = false;
break;
}
}
return disabled;
return doubleDropsDisabled("Mining");
}
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
@@ -248,6 +247,23 @@ public class Config extends ConfigLoader {
/* Repair */
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
public boolean getSalvageEnabled() { return config.getBoolean("Skills.Repair.Salvage_enabled", true); }
public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); }
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage_UnlockLevel", 600); }
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
/* Smelting */
public int getSmeltingXPCoal() { return config.getInt("Experience.Smelting.Coal", 10); }
public int getSmeltingXPRedstone() { return config.getInt("Experience.Smelting.Redstone", 15); }
public int getSmeltingXPIron() { return config.getInt("Experience.Smelting.Iron", 25); }
public int getSmeltingXPGold() { return config.getInt("Experience.Smelting.Gold", 35); }
public int getSmeltingXPDiamond() { return config.getInt("Experience.Smelting.Diamond", 75); }
public int getSmeltingXPLapis() { return config.getInt("Experience.Smelting.Lapis", 40); }
public int getSmeltingXPEmerald() { return config.getInt("Experience.Smelting.Emerald", 100); }
/* Unarmed */
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
/* Taming */
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
@@ -260,6 +276,9 @@ public class Config extends ConfigLoader {
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
@@ -267,54 +286,72 @@ public class Config extends ConfigLoader {
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
public boolean woodcuttingDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Woodcutting");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Woodcutting." + key)) {
disabled = false;
break;
}
}
return disabled;
return doubleDropsDisabled("Woodcutting");
}
/* Arcane Forging */
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); }
public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); }
public int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); }
public int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); }
public int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); }
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); }
public int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); }
public int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); }
public int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); }
public int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); }
public int getArcaneForgingRankLevels1() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); }
public int getArcaneForgingRankLevels2() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); }
public int getArcaneForgingRankLevels3() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); }
public int getArcaneForgingRankLevels4() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); }
/* AFK Leveling */
public boolean getAcrobaticsAFKDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
public boolean getHerbalismAFKDisabled() { return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true); }
/* Dogde Lightning */
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
/* Level Caps */
public int getLevelCapAcrobatics() { return config.getInt("Skills.Acrobatics.Level_Cap", 0); }
public int getLevelCapArchery() { return config.getInt("Skills.Archery.Level_Cap", 0); }
public int getLevelCapAxes() { return config.getInt("Skills.Axes.Level_Cap", 0); }
public int getLevelCapExcavation() { return config.getInt("Skills.Excavation.Level_Cap", 0); }
public int getLevelCapFishing() { return config.getInt("Skills.Fishing.Level_Cap", 0); }
public int getLevelCapHerbalism() { return config.getInt("Skills.Herbalism.Level_Cap", 0); }
public int getLevelCapMining() { return config.getInt("Skills.Mining.Level_Cap", 0); }
public int getLevelCapRepair() { return config.getInt("Skills.Repair.Level_Cap", 0); }
public int getLevelCapSwords() { return config.getInt("Skills.Swords.Level_Cap", 0); }
public int getLevelCapTaming() { return config.getInt("Skills.Taming.Level_Cap", 0); }
public int getLevelCapUnarmed() { return config.getInt("Skills.Unarmed.Level_Cap", 0); }
public int getLevelCapWoodcutting() { return config.getInt("Skills.Woodcutting.Level_Cap", 0); }
public int getPowerLevelCap() { return config.getInt("General.Power_Level_Cap", 0); }
public int getLevelCapAcrobatics() {
return getLevelCap("Skills.Acrobatics.Level_Cap");
}
public int getLevelCapArchery() {
return getLevelCap("Skills.Archery.Level_Cap");
}
public int getLevelCapAxes() {
return getLevelCap("Skills.Axes.Level_Cap");
}
public int getLevelCapExcavation() {
return getLevelCap("Skills.Excavation.Level_Cap");
}
public int getLevelCapFishing() {
return getLevelCap("Skills.Fishing.Level_Cap");
}
public int getLevelCapHerbalism() {
return getLevelCap("Skills.Herbalism.Level_Cap");
}
public int getLevelCapMining() {
return getLevelCap("Skills.Mining.Level_Cap");
}
public int getLevelCapRepair() {
return getLevelCap("Skills.Repair.Level_Cap");
}
public int getLevelCapSmelting() {
return getLevelCap("Skills.Smelting.Level_Cap");
}
public int getLevelCapSwords() {
return getLevelCap("Skills.Swords.Level_Cap");
}
public int getLevelCapTaming() {
return getLevelCap("Skills.Taming.Level_Cap");
}
public int getLevelCapUnarmed() {
return getLevelCap("Skills.Unarmed.Level_Cap");
}
public int getLevelCapWoodcutting() {
return getLevelCap("Skills.Woodcutting.Level_Cap");
}
public int getPowerLevelCap() {
return getLevelCap("General.Power_Level_Cap");
}
/* PVP & PVE Settings */
public boolean getAcrobaticsPVP() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVP", true); }
@@ -337,11 +374,11 @@ public class Config extends ConfigLoader {
/* General Settings */
public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); }
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
public int getExperienceGainsGlobalMultiplier() { return config.getInt("Experience.Gains.Multiplier.Global", 1); }
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience.Gains.Multiplier.Global", 1.0); }
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience.Gains.Multiplier.Global", value); }
/* Combat XP Multipliers */
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); }
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
public double getCreeperXP() { return config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); }
public double getSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); }
@@ -350,13 +387,17 @@ public class Config extends ConfigLoader {
public double getSlimeXP() { return config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); }
public double getZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); }
public double getPigZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); }
public double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0); }
public double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 1.0); }
public double getCaveSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); }
public double getSilverfishXP() { return config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); }
public double getBlazeXP() { return config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); }
public double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); }
public double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); }
public double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); }
public double getGiantXP() { return config.getDouble("Experience.Combat.Multiplier.Giant", 4.0); }
public double getWitherXP() { return config.getDouble("Experience.Combat.Multiplier.Wither", 7.0); }
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
public double getWitchXP() { return config.getDouble("Experience.Combat.Multiplier.Witch", 4.0); }
/* XP Formula Multiplier */
public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); }
@@ -373,103 +414,30 @@ public class Config extends ConfigLoader {
public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); }
public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); }
/*
* SPOUT SETTINGS
*/
private boolean doubleDropsDisabled(String skillName) {
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
public boolean spoutEnabled;
public boolean getShowPowerLevelForSpout() { return config.getBoolean("Spout.HUD.Show_Power_Level", true); }
/* Spout XP Bar */
public boolean getSpoutXPBarEnabled() { return config.getBoolean("Spout.XP.Bar.Enabled", true); }
public boolean getSpoutXPBarIconEnabled() { return config.getBoolean("Spout.XP.Icon.Enabled", true); }
public int getSpoutXPBarXPosition() { return config.getInt("Spout.XP.Bar.X_POS", 95); }
public int getSpoutXPBarYPosition() { return config.getInt("Spout.XP.Bar.Y_POS", 6); }
public int getSpoutXPIconXPosition() { return config.getInt("Spout.XP.Icon.X_POS", 78); }
public int getSpoutXPIconYPosition() { return config.getInt("Spout.XP.Icon.Y_POS", 2); }
/* Spout HUD Colors */
public double getSpoutRetroHUDXPBorderRed() { return config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); }
public double getSpoutRetroHUDXPBorderGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); }
public double getSpoutRetroHUDXPBorderBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); }
public double getSpoutRetroHUDXPBackgroundRed() { return config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); }
public double getSpoutRetroHUDXPBackgroundGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); }
public double getSpoutRetroHUDXPBackgroundBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); }
public double getSpoutRetroHUDAcrobaticsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); }
public double getSpoutRetroHUDAcrobaticsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); }
public double getSpoutRetroHUDAcrobaticsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); }
public double getSpoutRetroHUDArcheryRed() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); }
public double getSpoutRetroHUDArcheryGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); }
public double getSpoutRetroHUDArcheryBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); }
public double getSpoutRetroHUDAxesRed() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); }
public double getSpoutRetroHUDAxesGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); }
public double getSpoutRetroHUDAxesBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); }
public double getSpoutRetroHUDExcavationRed() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); }
public double getSpoutRetroHUDExcavationGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); }
public double getSpoutRetroHUDExcavationBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); }
public double getSpoutRetroHUDHerbalismRed() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); }
public double getSpoutRetroHUDHerbalismGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); }
public double getSpoutRetroHUDHerbalismBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); }
public double getSpoutRetroHUDMiningRed() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); }
public double getSpoutRetroHUDMiningGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); }
public double getSpoutRetroHUDMiningBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); }
public double getSpoutRetroHUDRepairRed() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); }
public double getSpoutRetroHUDRepairGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); }
public double getSpoutRetroHUDRepairBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); }
public double getSpoutRetroHUDSwordsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); }
public double getSpoutRetroHUDSwordsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); }
public double getSpoutRetroHUDSwordsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); }
public double getSpoutRetroHUDTamingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); }
public double getSpoutRetroHUDTamingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); }
public double getSpoutRetroHUDTamingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); }
public double getSpoutRetroHUDUnarmedRed() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); }
public double getSpoutRetroHUDUnarmedGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); }
public double getSpoutRetroHUDUnarmedBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); }
public double getSpoutRetroHUDWoodcuttingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); }
public double getSpoutRetroHUDWoodcuttingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); }
public double getSpoutRetroHUDWoodcuttingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); }
public double getSpoutRetroHUDFishingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); }
public double getSpoutRetroHUDFishingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); }
public double getSpoutRetroHUDFishingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); }
/*
* CONFIG LOADING
*/
public HUDType defaulthud;
private Config(mcMMO plugin) {
super(plugin, "config.yml");
config = plugin.getConfig();
xpGainMultiplier = getExperienceGainsGlobalMultiplier();
}
@Override
protected void load() {
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveDefaultConfig();
if (section == null) {
mcMMO.p.getLogger().warning("The configuration files are outdated!"); //TODO Locale and more descriptive message!
return false;
}
addDefaults();
loadKeys();
}
Set<String> keys = section.getKeys(false);
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO config.yml File...");
boolean disabled = true;
// Setup default HUD
String temp = config.getString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().toLowerCase().equalsIgnoreCase(temp.toString().toLowerCase())) {
defaulthud = x;
for (String key : keys) {
if (config.getBoolean("Double_Drops." + skillName + "." + key)) {
disabled = false;
break;
}
}
if(defaulthud == null)
defaulthud = HUDType.STANDARD;
return disabled;
}
private int getLevelCap(String configString) {
int cap = config.getInt(configString, 0);
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
}
}

View File

@@ -1,54 +1,79 @@
package com.gmail.nossr50.config;
import java.io.File;
import java.io.IOException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
public abstract class ConfigLoader {
protected static final mcMMO plugin = mcMMO.p;
protected String fileName;
protected File configFile;
protected File dataFolder;
protected final mcMMO plugin;
protected FileConfiguration config;
public ConfigLoader(mcMMO plugin, String fileName){
this.plugin = plugin;
dataFolder = plugin.getDataFolder();
configFile = new File(dataFolder, File.separator + fileName);
public ConfigLoader(String relativePath, String fileName) {
this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
loadFile();
}
/**
* Load this config file.
*/
protected abstract void load();
public ConfigLoader(String fileName) {
this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), fileName);
loadFile();
}
/**
* Save this config file.
*/
private void saveConfig() {
try {
config.save(configFile);
protected void loadFile() {
if (!configFile.exists()) {
plugin.getLogger().info("Creating mcMMO " + fileName + " File...");
createFile();
}
catch (IOException e) {
e.printStackTrace();
else {
plugin.getLogger().info("Loading mcMMO " + fileName + " File...");
}
config = YamlConfiguration.loadConfiguration(configFile);
}
/**
* Add the defaults to this config file.
*/
protected void addDefaults() {
// Load from included config.yml
config.options().copyDefaults(true);
saveConfig();
}
/**
* Load the keys from this config file.
*/
protected abstract void loadKeys();
protected void createFile() {
if (configFile.exists()) {
return;
}
configFile.getParentFile().mkdirs();
InputStream inputStream = plugin.getResource(fileName);
if (inputStream != null) {
try {
copyStreamToFile(inputStream, configFile);
} catch (Exception e) {
e.printStackTrace();
}
}
else {
plugin.getLogger().severe("Missing resource file: '" + fileName + "' please notify the plugin authors");
}
}
private static void copyStreamToFile(InputStream inputStream, File file) throws Exception {
OutputStream outputStream = new FileOutputStream(file);
int read = 0;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
inputStream.close();
outputStream.close();
}
}

View File

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

View File

@@ -2,32 +2,23 @@ package com.gmail.nossr50.config;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.datatypes.treasure.Treasure;
public class TreasuresConfig extends ConfigLoader{
public class TreasuresConfig extends ConfigLoader {
private static TreasuresConfig instance;
public static TreasuresConfig getInstance() {
if (instance == null) {
instance = new TreasuresConfig(mcMMO.p);
instance.load();
}
return instance;
}
public List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
@@ -35,39 +26,33 @@ public class TreasuresConfig extends ConfigLoader{
public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
public List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
public List<FishingTreasure> fishingRewardsTier5 = new ArrayList<FishingTreasure>();
private TreasuresConfig(mcMMO plugin) {
super(plugin, "treasures.yml");
config = plugin.getTreasuresConfig();
public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>();
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
public List<FishingTreasure> fishingRewards = new ArrayList<FishingTreasure>();
private TreasuresConfig() {
super("treasures.yml");
loadKeys();
}
@Override
protected void load() {
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveTreasuresConfig();
public static TreasuresConfig getInstance() {
if (instance == null) {
instance = new TreasuresConfig();
}
addDefaults();
loadKeys();
return instance;
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO treasures.yml File...");
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
Set<String> treasureConfigSet = treasureSection.getKeys(false);
Iterator<String> iterator = treasureConfigSet.iterator();
while (iterator.hasNext()) {
String treasureName = iterator.next();
for (String treasureName : treasureConfigSet) {
// Validate all the things!
List<String> reason = new ArrayList<String>();
@@ -140,7 +125,7 @@ public class TreasuresConfig extends ConfigLoader{
* Drops From & Max Level
*/
ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data);
ItemStack item = (new MaterialData(id, (byte) data)).toItemStack(amount);
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
@@ -153,10 +138,6 @@ public class TreasuresConfig extends ConfigLoader{
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
if (maxLevel < 0) {
reason.add("Invalid Max_Level: " + maxLevel);
}
if (noErrorsInTreasure(reason)) {
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
treasures.put(treasureName, fTreasure);
@@ -164,6 +145,7 @@ public class TreasuresConfig extends ConfigLoader{
}
else {
ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
HylianTreasure hTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) {
eTreasure.setDropsFromDirt();
@@ -193,53 +175,64 @@ public class TreasuresConfig extends ConfigLoader{
eTreasure.setDropsFromSoulSand();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Bushes", false)) {
hTreasure.setDropsFromBushes();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Flowers", false)) {
hTreasure.setDropsFromFlowers();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Pots", false)) {
hTreasure.setDropsFromPots();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
reason.add("Excavation drops cannot also be fishing drops");
}
if (noErrorsInTreasure(reason)) {
if (noErrorsInTreasure(reason) && hTreasure.getDropsFrom() == (byte) 0x0) {
treasures.put(treasureName, eTreasure);
}
else if (noErrorsInTreasure(reason) && eTreasure.getDropsFrom() == (byte) 0x0){
treasures.put(treasureName, hTreasure);
}
}
}
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
Iterator<String> treasureIterator = treasures.keySet().iterator();
List<String> hylianTreasures = config.getStringList("Hylian_Luck.Treasure");
while (treasureIterator.hasNext()) {
String treasureKey = treasureIterator.next();
Treasure treasure = treasures.get(treasureKey);
for (Entry<String,Treasure> nextEntry : treasures.entrySet()) {
String treasureKey = nextEntry.getKey();
Treasure treasure = nextEntry.getValue();
if (treasure instanceof FishingTreasure) {
if (!fishingTreasures.contains(treasureKey)) {
continue;
}
FishingTreasure fTreasure = (FishingTreasure) treasure;
int dropLevel = fTreasure.getDropLevel();
int maxLevel = fTreasure.getMaxLevel();
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) {
fishingRewardsTier1.add(fTreasure);
fishingRewards.add((FishingTreasure) treasure);
}
else if (treasure instanceof HylianTreasure) {
if (!hylianTreasures.contains(treasureKey)) {
continue;
}
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
fishingRewardsTier2.add(fTreasure);
HylianTreasure hTreasure = (HylianTreasure) treasure;
if (hTreasure.getDropsFromBushes()) {
hylianFromBushes.add(hTreasure);
}
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier3() && maxLevel >= Config.getInstance().getFishingTierLevelsTier3()) {
fishingRewardsTier3.add(fTreasure);
if (hTreasure.getDropsFromFlowers()) {
hylianFromFlowers.add(hTreasure);
}
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier4() && maxLevel >= Config.getInstance().getFishingTierLevelsTier4()) {
fishingRewardsTier4.add(fTreasure);
if (hTreasure.getDropsFromPots()) {
hylianFromPots.add(hTreasure);
}
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier5() && maxLevel >= Config.getInstance().getFishingTierLevelsTier5()) {
fishingRewardsTier5.add(fTreasure);
}
}
else if (treasure instanceof ExcavationTreasure) {
if (!excavationTreasures.contains(treasureKey)) {
@@ -283,11 +276,10 @@ public class TreasuresConfig extends ConfigLoader{
if (issues.isEmpty()) {
return true;
}
else {
for (String issue : issues) {
plugin.getLogger().warning(issue);
}
return false;
for (String issue : issues) {
plugin.getLogger().warning(issue);
}
return false;
}
}

View File

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

View File

@@ -0,0 +1,610 @@
package com.gmail.nossr50.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.runnables.SQLReconnect;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.spout.SpoutTools;
import com.gmail.nossr50.spout.huds.SpoutHud;
import com.gmail.nossr50.util.Users;
public final class Database {
private static String connectionString;
private static String tablePrefix = Config.getInstance().getMySQLTablePrefix();
private static Connection connection = null;
// Scale waiting time by this much per failed attempt
private static final double SCALING_FACTOR = 40;
// Minimum wait in nanoseconds (default 500ms)
private static final long MIN_WAIT = 500L*1000000L;
// Maximum time to wait between reconnects (default 5 minutes)
private static final long MAX_WAIT = 5L * 60L * 1000L * 1000000L;
// How long to wait when checking if connection is valid (default 3 seconds)
private static final int VALID_TIMEOUT = 3;
// When next to try connecting to Database in nanoseconds
private static long nextReconnectTimestamp = 0L;
// How many connection attemtps have failed
private static int reconnectAttempt = 0;
private Database() {}
/**
* Attempt to connect to the mySQL database.
*/
public static void connect() {
Config configInstance = Config.getInstance();
connectionString = "jdbc:mysql://" + configInstance.getMySQLServerName() + ":" + configInstance.getMySQLServerPort() + "/" + configInstance.getMySQLDatabaseName();
try {
mcMMO.p.getLogger().info("Attempting connection to MySQL...");
// Force driver to load if not yet loaded
Class.forName("com.mysql.jdbc.Driver");
Properties connectionProperties = new Properties();
connectionProperties.put("user", configInstance.getMySQLUserName());
connectionProperties.put("password", configInstance.getMySQLUserPassword());
connectionProperties.put("autoReconnect", "false");
connectionProperties.put("maxReconnects", "0");
connection = DriverManager.getConnection(connectionString, connectionProperties);
mcMMO.p.getLogger().info("Connection to MySQL was a success!");
} catch (SQLException ex) {
connection = null;
if (reconnectAttempt == 0 || reconnectAttempt >= 11) {
mcMMO.p.getLogger().info("Connection to MySQL failed!");
}
} catch (ClassNotFoundException ex) {
connection = null;
if (reconnectAttempt == 0 || reconnectAttempt >= 11) {
mcMMO.p.getLogger().info("MySQL database driver not found!");
}
}
}
/**
* Attempt to create the database structure.
*/
public static void createStructure() {
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` ("
+ "`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
+ "`user` varchar(40) NOT NULL,"
+ "`lastlogin` int(32) unsigned NOT NULL,"
+ "PRIMARY KEY (`id`),"
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
+ "`user_id` int(10) unsigned NOT NULL,"
+ "`hudtype` varchar(50) NOT NULL DEFAULT 'STANDARD',"
+ "PRIMARY KEY (`user_id`),"
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` ("
+ "`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`),"
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
+ "`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`),"
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` ("
+ "`user_id` int(10) unsigned NOT NULL,"
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`),"
+ "FOREIGN KEY (`user_id`) REFERENCES `" + tablePrefix + "users` (`id`) "
+ "ON DELETE CASCADE) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
checkDatabaseStructure(DatabaseUpdate.FISHING);
checkDatabaseStructure(DatabaseUpdate.BLAST_MINING);
checkDatabaseStructure(DatabaseUpdate.CASCADE_DELETE);
checkDatabaseStructure(DatabaseUpdate.INDEX);
}
/**
* Check database structure for missing values.
*
* @param update Type of data to check updates for
*/
private static void checkDatabaseStructure(DatabaseUpdate update) {
String sql = null;
ResultSet resultSet = null;
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
switch (update) {
case BLAST_MINING:
sql = "SELECT * FROM `" + tablePrefix + "cooldowns` ORDER BY `" + tablePrefix + "cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
break;
case CASCADE_DELETE:
write("ALTER TABLE `" + tablePrefix + "huds` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
write("ALTER TABLE `" + tablePrefix + "experience` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
write("ALTER TABLE `" + tablePrefix + "cooldowns` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
write("ALTER TABLE `" + tablePrefix + "skills` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE;");
break;
case FISHING:
sql = "SELECT * FROM `" + tablePrefix + "experience` ORDER BY `" + tablePrefix + "experience`.`fishing` ASC LIMIT 0 , 30";
break;
case INDEX:
if (read("SHOW INDEX FROM " + tablePrefix + "skills").size() != 13 && checkConnected()) {
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
write("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_taming` (`taming`) USING BTREE, "
+ "ADD INDEX `idx_mining` (`mining`) USING BTREE, "
+ "ADD INDEX `idx_woodcutting` (`woodcutting`) USING BTREE, "
+ "ADD INDEX `idx_repair` (`repair`) USING BTREE, "
+ "ADD INDEX `idx_unarmed` (`unarmed`) USING BTREE, "
+ "ADD INDEX `idx_herbalism` (`herbalism`) USING BTREE, "
+ "ADD INDEX `idx_excavation` (`excavation`) USING BTREE, "
+ "ADD INDEX `idx_archery` (`archery`) USING BTREE, "
+ "ADD INDEX `idx_swords` (`swords`) USING BTREE, "
+ "ADD INDEX `idx_axes` (`axes`) USING BTREE, "
+ "ADD INDEX `idx_acrobatics` (`acrobatics`) USING BTREE, "
+ "ADD INDEX `idx_fishing` (`fishing`) USING BTREE;");
}
break;
default:
break;
}
PreparedStatement statement = null;
try {
if (!checkConnected()) return;
statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
while (resultSet.next()) {
ArrayList<String> column = new ArrayList<String>();
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
column.add(resultSet.getString(i));
}
rows.put(resultSet.getRow(), column);
}
}
catch (SQLException ex) {
switch (update) {
case BLAST_MINING:
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Blast Mining...");
write("ALTER TABLE `"+tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
break;
case FISHING:
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
break;
default:
break;
}
} finally {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException e) {
// Ignore the error, we're leaving
}
}
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
// Ignore the error, we're leaving
}
}
}
}
/**
* Attempt to write the SQL query.
*
* @param sql Query to write.
* @return true if the query was successfully written, false otherwise.
*/
public static boolean write(String sql) {
if (checkConnected()) {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(sql);
statement.executeUpdate();
return true;
}
catch (SQLException ex) {
printErrors(ex);
return false;
} finally {
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
printErrors(e);
return false;
}
}
}
}
return false;
}
/**
* Returns the number of rows affected by either a DELETE or UPDATE query
*
* @param sql SQL query to execute
* @return the number of rows affected
*/
public static int update(String sql) {
int ret = 0;
if (checkConnected()) {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(sql);
ret = statement.executeUpdate();
return ret;
} catch (SQLException ex) {
printErrors(ex);
return 0;
} finally {
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
printErrors(e);
return 0;
}
}
}
}
return ret;
}
/**
* Get the Integer. Only return first row / first field.
*
* @param sql SQL query to execute
* @return the value in the first row / first field
*/
public static int getInt(String sql) {
ResultSet resultSet;
int result = 0;
if (checkConnected()) {
try {
PreparedStatement statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
if (resultSet.next()) {
result = resultSet.getInt(1);
}
else {
result = 0;
}
statement.close();
}
catch (SQLException ex) {
printErrors(ex);
}
}
return result;
}
/**
* Check connection status and re-establish if dead or stale.
*
* If the very first immediate attempt fails, further attempts
* will be made in progressively larger intervals up to MAX_WAIT
* intervals.
*
* This allows for MySQL to time out idle connections as needed by
* server operator, without affecting McMMO, while still providing
* protection against a database outage taking down Bukkit's tick
* processing loop due to attemping a database connection each
* time McMMO needs the database.
*
* @return the boolean value for whether or not we are connected
*/
public static boolean checkConnected() {
boolean isClosed = true;
boolean isValid = false;
boolean exists = (connection != null);
// If we're waiting for server to recover then leave early
if (nextReconnectTimestamp > 0 && nextReconnectTimestamp > System.nanoTime()) {
return false;
}
if (exists) {
try {
isClosed = connection.isClosed();
} catch (SQLException e) {
isClosed = true;
e.printStackTrace();
printErrors(e);
}
if (!isClosed) {
try {
isValid = connection.isValid(VALID_TIMEOUT);
} catch (SQLException e) {
// Don't print stack trace because it's valid to lose idle connections
// to the server and have to restart them.
isValid = false;
}
}
}
// Leave if all ok
if (exists && !isClosed && isValid) {
// Housekeeping
nextReconnectTimestamp = 0;
reconnectAttempt = 0;
return true;
}
// Cleanup after ourselves for GC and MySQL's sake
if (exists && !isClosed) {
try {
connection.close();
} catch (SQLException ex) {
// This is a housekeeping exercise, ignore errors
}
}
// Try to connect again
connect();
// Leave if connection is good
try {
if (connection != null && !connection.isClosed()) {
// Schedule a database save if we really had an outage
if (reconnectAttempt > 1) {
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new SQLReconnect(), 5);
}
nextReconnectTimestamp = 0;
reconnectAttempt = 0;
return true;
}
} catch (SQLException e) {
// Failed to check isClosed, so presume connection is bad and attempt later
e.printStackTrace();
printErrors(e);
}
reconnectAttempt++;
nextReconnectTimestamp = (long)(System.nanoTime() + Math.min(MAX_WAIT, (reconnectAttempt*SCALING_FACTOR*MIN_WAIT)));
return false;
}
/**
* Read SQL query.
*
* @param sql SQL query to read
* @return the rows in this SQL query
*/
public static HashMap<Integer, ArrayList<String>> read(String sql) {
ResultSet resultSet;
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
if (checkConnected()) {
try {
PreparedStatement statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
while (resultSet.next()) {
ArrayList<String> column = new ArrayList<String>();
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
column.add(resultSet.getString(i));
}
rows.put(resultSet.getRow(), column);
}
statement.close();
}
catch (SQLException ex) {
printErrors(ex);
}
}
return rows;
}
public static Map<String, Integer> readSQLRank(String playerName) {
ResultSet resultSet;
Map<String, Integer> skills = new HashMap<String, Integer>();
if (checkConnected()) {
try {
for (SkillType skillType: SkillType.values()) {
if (skillType.isChildSkill()) {
continue;
}
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " > (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "')";
PreparedStatement statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
resultSet.next();
int rank = resultSet.getInt("rank");
sql = "SELECT user, " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " = (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "') ORDER BY user";
statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
skills.put(skillType.name(), rank + resultSet.getRow());
break;
}
}
statement.close();
}
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > 0 AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "')";
PreparedStatement statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
resultSet.next();
int rank = resultSet.getInt("rank");
sql = "SELECT user, taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > 0 AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing = (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "') ORDER BY user";
statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
while (resultSet.next()) {
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
skills.put("ALL", rank + resultSet.getRow());
break;
}
}
statement.close();
}
catch (SQLException ex) {
printErrors(ex);
}
}
return skills;
}
public static void purgePowerlessSQL() {
mcMMO.p.getLogger().info("Purging powerless users...");
HashMap<Integer, ArrayList<String>> usernames = read("SELECT u.user FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE s.user_id = u.id AND (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0");
write("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.id IN (SELECT * FROM (SELECT u.id FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE s.user_id = u.id AND (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0) AS p)");
int purgedUsers = 0;
for (int i = 1; i <= usernames.size(); i++) {
String playerName = usernames.get(i).get(0);
if (playerName == null || Bukkit.getOfflinePlayer(playerName).isOnline()) {
continue;
}
profileCleanup(playerName);
purgedUsers++;
}
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
}
public static void purgeOldSQL() {
mcMMO.p.getLogger().info("Purging old users...");
long currentTime = System.currentTimeMillis();
long purgeTime = 2630000000L * Config.getInstance().getOldUsersCutoff();
HashMap<Integer, ArrayList<String>> usernames = read("SELECT user FROM " + tablePrefix + "users WHERE ((" + currentTime + " - lastlogin*1000) > " + purgeTime + ")");
write("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.id IN (SELECT * FROM (SELECT id FROM " + tablePrefix + "users WHERE ((" + currentTime + " - lastlogin*1000) > " + purgeTime + ")) AS p)");
int purgedUsers = 0;
for (int i = 1; i <= usernames.size(); i++) {
String playerName = usernames.get(i).get(0);
if (playerName == null) {
continue;
}
profileCleanup(playerName);
purgedUsers++;
}
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
}
private static void printErrors(SQLException ex) {
mcMMO.p.getLogger().severe("SQLException: " + ex.getMessage());
mcMMO.p.getLogger().severe("SQLState: " + ex.getSQLState());
mcMMO.p.getLogger().severe("VendorError: " + ex.getErrorCode());
}
public static void profileCleanup(String playerName) {
McMMOPlayer mcmmoPlayer = Users.getPlayer(playerName);
if (mcmmoPlayer != null) {
Player player = mcmmoPlayer.getPlayer();
SpoutHud spoutHud = mcmmoPlayer.getProfile().getSpoutHud();
if (spoutHud != null) {
spoutHud.removeWidgets();
}
Users.remove(playerName);
if (player.isOnline()) {
Users.addUser(player);
if (mcMMO.spoutEnabled) {
SpoutTools.reloadSpoutPlayer(player);
}
}
}
}
}

View File

@@ -0,0 +1,8 @@
package com.gmail.nossr50.database;
public enum DatabaseUpdate {
FISHING,
BLAST_MINING,
CASCADE_DELETE,
INDEX;
}

View File

@@ -0,0 +1,401 @@
package com.gmail.nossr50.database;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.StringUtils;
public final class Leaderboard {
private static HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
private static List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
private static long lastUpdate = 0;
private Leaderboard() {}
/**
* Update the leader boards.
*/
public static void updateLeaderboards() {
if(System.currentTimeMillis() < lastUpdate + 600000) {
return; //Only update FFS leaderboards every 10 minutes.. this puts a lot of strain on the server (depending on the size of the database) and should not be done frequently
}
lastUpdate = System.currentTimeMillis(); //Log when the last update was run
//Initialize lists
List<PlayerStat> mining, woodcutting, herbalism, excavation, acrobatics, repair, swords, axes, archery, unarmed, taming, fishing;
mining = new ArrayList<PlayerStat>();
woodcutting = new ArrayList<PlayerStat>();
herbalism = new ArrayList<PlayerStat>();
excavation = new ArrayList<PlayerStat>();
acrobatics = new ArrayList<PlayerStat>();
repair = new ArrayList<PlayerStat>();
swords = new ArrayList<PlayerStat>();
axes = new ArrayList<PlayerStat>();
archery = new ArrayList<PlayerStat>();
unarmed = new ArrayList<PlayerStat>();
taming = new ArrayList<PlayerStat>();
fishing = new ArrayList<PlayerStat>();
powerLevels = new ArrayList<PlayerStat>();
//Read from the FlatFile database and fill our arrays with information
try {
FileReader file = new FileReader(mcMMO.getUsersFilePath());
BufferedReader in = new BufferedReader(file);
String line = "";
ArrayList<String> players = new ArrayList<String>();
while ((line = in.readLine()) != null) {
String[] character = line.split(":");
String p = character[0];
int powerLevel = 0;
//Prevent the same player from being added multiple times (I'd like to note that this shouldn't happen...)
if (players.contains(p)) {
continue;
}
players.add(p);
if (character.length > 1 && StringUtils.isInt(character[1])) {
mining.add(new PlayerStat(p, Integer.parseInt(character[1])));
powerLevel += Integer.parseInt(character[1]);
}
if (character.length > 5 && StringUtils.isInt(character[5])) {
woodcutting.add(new PlayerStat(p, Integer.parseInt(character[5])));
powerLevel += Integer.parseInt(character[5]);
}
if (character.length > 7 && StringUtils.isInt(character[7])) {
repair.add(new PlayerStat(p, Integer.parseInt(character[7])));
powerLevel += Integer.parseInt(character[7]);
}
if (character.length > 8 && StringUtils.isInt(character[8])) {
unarmed.add(new PlayerStat(p, Integer.parseInt(character[8])));
powerLevel += Integer.parseInt(character[8]);
}
if (character.length > 9 && StringUtils.isInt(character[9])) {
herbalism.add(new PlayerStat(p, Integer.parseInt(character[9])));
powerLevel += Integer.parseInt(character[9]);
}
if (character.length > 10 && StringUtils.isInt(character[10])) {
excavation.add(new PlayerStat(p, Integer.parseInt(character[10])));
powerLevel += Integer.parseInt(character[10]);
}
if (character.length > 11 && StringUtils.isInt(character[11])) {
archery.add(new PlayerStat(p, Integer.parseInt(character[11])));
powerLevel += Integer.parseInt(character[11]);
}
if (character.length > 12 && StringUtils.isInt(character[12])) {
swords.add(new PlayerStat(p, Integer.parseInt(character[12])));
powerLevel += Integer.parseInt(character[12]);
}
if (character.length > 13 && StringUtils.isInt(character[13])) {
axes.add(new PlayerStat(p, Integer.parseInt(character[13])));
powerLevel += Integer.parseInt(character[13]);
}
if (character.length > 14 && StringUtils.isInt(character[14])) {
acrobatics.add(new PlayerStat(p, Integer.parseInt(character[14])));
powerLevel += Integer.parseInt(character[14]);
}
if (character.length > 24 && StringUtils.isInt(character[24])) {
taming.add(new PlayerStat(p, Integer.parseInt(character[24])));
powerLevel += Integer.parseInt(character[24]);
}
if (character.length > 34 && StringUtils.isInt(character[34])) {
fishing.add(new PlayerStat(p, Integer.parseInt(character[34])));
powerLevel += Integer.parseInt(character[34]);
}
powerLevels.add(new PlayerStat(p, powerLevel));
}
in.close();
}
catch (Exception e) {
mcMMO.p.getLogger().severe(("Exception while reading " + mcMMO.getUsersFilePath() + " (Are you sure you formatted it correctly?)" + e.toString()));
}
SkillComparator c = new SkillComparator();
Collections.sort(mining, c);
Collections.sort(woodcutting, c);
Collections.sort(repair, c);
Collections.sort(unarmed, c);
Collections.sort(herbalism, c);
Collections.sort(excavation, c);
Collections.sort(archery, c);
Collections.sort(swords, c);
Collections.sort(axes, c);
Collections.sort(acrobatics, c);
Collections.sort(taming, c);
Collections.sort(fishing, c);
Collections.sort(powerLevels, c);
playerStatHash.put(SkillType.MINING, mining);
playerStatHash.put(SkillType.WOODCUTTING, woodcutting);
playerStatHash.put(SkillType.REPAIR, repair);
playerStatHash.put(SkillType.UNARMED, unarmed);
playerStatHash.put(SkillType.HERBALISM, herbalism);
playerStatHash.put(SkillType.EXCAVATION, excavation);
playerStatHash.put(SkillType.ARCHERY, archery);
playerStatHash.put(SkillType.SWORDS, swords);
playerStatHash.put(SkillType.AXES, axes);
playerStatHash.put(SkillType.ACROBATICS, acrobatics);
playerStatHash.put(SkillType.TAMING, taming);
playerStatHash.put(SkillType.FISHING, fishing);
}
/**
* Retrieve leaderboard info.
*
* @param skillType Skill to retrieve info on.
* @param pageNumber Which page in the leaderboards to retrieve
* @return the requested leaderboard information
*/
public static String[] retrieveInfo(String skillType, int pageNumber) {
String[] info = new String[10];
List<PlayerStat> statsList;
if (skillType.equalsIgnoreCase("all")) {
statsList = powerLevels;
}
else {
statsList = playerStatHash.get(SkillType.getSkill(skillType));
}
int destination;
// How many lines to skip through
if (pageNumber == 1) {
destination = 0;
}
else {
destination = (pageNumber * 10) - 9;
}
int currentPos = 0;
for (PlayerStat ps : statsList) {
if (currentPos == 10) {
break;
}
if (destination > 1) {
destination--;
continue;
}
info[currentPos] = ps.name + ":" + ps.statVal;
currentPos++;
}
return info;
}
public static int[] getPlayerRank(String playerName) {
int currentPos = 1;
if (powerLevels != null) {
for (PlayerStat stat : powerLevels) {
if (stat.name.equalsIgnoreCase(playerName)) {
return new int[] {currentPos, stat.statVal};
}
currentPos++;
continue;
}
return new int[] {0, 0};
}
return new int[] {0, 0};
}
public static int[] getPlayerRank(String playerName, SkillType skillType) {
int currentPos = 1;
List<PlayerStat> statsList = playerStatHash.get(skillType);
if (statsList != null) {
for (PlayerStat stat : statsList) {
if (stat.name.equalsIgnoreCase(playerName)) {
return new int[] {currentPos, stat.statVal};
}
currentPos++;
continue;
}
return new int[] {0, 0};
}
return new int[] {0, 0};
}
private static class SkillComparator implements Comparator<PlayerStat> {
@Override
public int compare(PlayerStat o1, PlayerStat o2) {
return (o2.statVal - o1.statVal);
}
}
public static boolean removeFlatFileUser(String playerName) {
boolean worked = false;
BufferedReader in = null;
FileWriter out = null;
String usersFilePath = mcMMO.getUsersFilePath();
try {
FileReader file = new FileReader(usersFilePath);
in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null) {
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
writer.append(line).append("\r\n");
}
else {
mcMMO.p.getLogger().info("User found, removing...");
worked = true;
continue; //Skip the player
}
}
out = new FileWriter(usersFilePath); //Write out the new file
out.write(writer.toString());
}
catch (Exception e) {
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
}
finally {
if (in != null) {
try {
in.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
if (out != null) {
try {
out.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
return worked;
}
public static void purgePowerlessFlatfile() {
mcMMO.p.getLogger().info("Purging powerless users...");
int purgedUsers = 0;
for (PlayerStat stat : powerLevels) {
if (stat.statVal == 0 && removeFlatFileUser(stat.name) && !Bukkit.getOfflinePlayer(stat.name).isOnline()) {
purgedUsers++;
}
}
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
}
public static void purgeOldFlatfile() {
mcMMO.p.getLogger().info("Purging old users...");
int purgedUsers = removeOldFlatfileUsers();
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
}
private static int removeOldFlatfileUsers() {
int removedPlayers = 0;
long currentTime = System.currentTimeMillis();
long purgeTime = 2630000000L * Config.getInstance().getOldUsersCutoff();
BufferedReader in = null;
FileWriter out = null;
String usersFilePath = mcMMO.getUsersFilePath();
try {
FileReader file = new FileReader(usersFilePath);
in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null) {
/* Write out the same file but when we get to the player we want to remove, we skip his line. */
String[] splitLine = line.split(":");
if (splitLine.length > 37) {
if (currentTime - (StringUtils.getLong(line.split(":")[37]) * 1000) <= purgeTime) {
writer.append(line).append("\r\n");
}
else {
mcMMO.p.getLogger().info("User found, removing...");
removedPlayers++;
continue; //Skip the player
}
}
else {
writer.append(line).append("\r\n");
}
}
out = new FileWriter(usersFilePath); //Write out the new file
out.write(writer.toString());
}
catch (Exception e) {
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
}
finally {
if (in != null) {
try {
in.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
if (out != null) {
try {
out.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
return removedPlayers;
}
}

View File

@@ -0,0 +1,11 @@
package com.gmail.nossr50.database;
public class PlayerStat {
public String name;
public int statVal = 0;
public PlayerStat(String name, int value) {
this.name = name;
this.statVal = value;
}
}

View File

@@ -0,0 +1,39 @@
package com.gmail.nossr50.database.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.Database;
import com.gmail.nossr50.database.Leaderboard;
import com.gmail.nossr50.locale.LocaleLoader;
public class McpurgeCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
if (Config.getInstance().getUseMySQL()) {
Database.purgePowerlessSQL();
if (Config.getInstance().getOldUsersCutoff() != -1) {
Database.purgeOldSQL();
}
}
else {
Leaderboard.purgePowerlessFlatfile();
if (Config.getInstance().getOldUsersCutoff() != -1) {
Leaderboard.purgeOldFlatfile();
}
}
sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success"));
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,45 @@
package com.gmail.nossr50.database.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.Database;
import com.gmail.nossr50.database.Leaderboard;
import com.gmail.nossr50.locale.LocaleLoader;
public class McremoveCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
/* MySQL */
if (Config.getInstance().getUseMySQL()) {
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
if (Database.update("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.user = '" + args[0] + "'") != 0) {
Database.profileCleanup(args[0]);
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", args[0]));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
}
}
else {
if (Leaderboard.removeFlatFileUser(args[0])) {
Database.profileCleanup(args[0]);
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", args[0]));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
}
}
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,45 @@
package com.gmail.nossr50.database.commands;
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.database.runnables.SQLConversionTask;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class MmoupdateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
Users.clearAll();
convertToMySQL();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
Users.addUser(player);
}
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Finish"));
return true;
default:
return false;
}
}
/**
* Convert FlatFile data to MySQL data.
*/
private void convertToMySQL() {
if (!Config.getInstance().getUseMySQL()) {
return;
}
mcMMO.p.getServer().getScheduler().runTaskLaterAsynchronously(mcMMO.p, new SQLConversionTask(), 1);
}
}

View File

@@ -1,23 +1,20 @@
package com.gmail.nossr50.runnables;
package com.gmail.nossr50.database.runnables;
import java.io.BufferedReader;
import java.io.FileReader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.Database;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils;
public class SQLConversionTask implements Runnable {
private final mcMMO plugin;
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
public SQLConversionTask(mcMMO plugin) {
this.plugin = plugin;
}
@Override
public void run() {
String location = plugin.usersFile;
String location = mcMMO.getUsersFilePath();
try {
FileReader file = new FileReader(location);
@@ -164,7 +161,7 @@ public class SQLConversionTask implements Runnable {
}
//Check to see if the user is in the DB
id = mcMMO.database.getInt("SELECT id FROM "
id = Database.getInt("SELECT id FROM "
+ tablePrefix
+ "users WHERE user = '" + playerName + "'");
@@ -172,112 +169,112 @@ public class SQLConversionTask implements Runnable {
theCount++;
//Update the skill values
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "users SET lastlogin = " + 0
+ " WHERE id = " + id);
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "skills SET "
+ " taming = taming+" + Misc.getInt(taming)
+ ", mining = mining+" + Misc.getInt(mining)
+ ", repair = repair+" + Misc.getInt(repair)
+ ", woodcutting = woodcutting+" + Misc.getInt(woodcutting)
+ ", unarmed = unarmed+" + Misc.getInt(unarmed)
+ ", herbalism = herbalism+" + Misc.getInt(herbalism)
+ ", excavation = excavation+" + Misc.getInt(excavation)
+ ", archery = archery+" + Misc.getInt(archery)
+ ", swords = swords+" + Misc.getInt(swords)
+ ", axes = axes+" + Misc.getInt(axes)
+ ", acrobatics = acrobatics+" + Misc.getInt(acrobatics)
+ ", fishing = fishing+" + Misc.getInt(fishing)
+ " taming = taming+" + StringUtils.getInt(taming)
+ ", mining = mining+" + StringUtils.getInt(mining)
+ ", repair = repair+" + StringUtils.getInt(repair)
+ ", woodcutting = woodcutting+" + StringUtils.getInt(woodcutting)
+ ", unarmed = unarmed+" + StringUtils.getInt(unarmed)
+ ", herbalism = herbalism+" + StringUtils.getInt(herbalism)
+ ", excavation = excavation+" + StringUtils.getInt(excavation)
+ ", archery = archery+" + StringUtils.getInt(archery)
+ ", swords = swords+" + StringUtils.getInt(swords)
+ ", axes = axes+" + StringUtils.getInt(axes)
+ ", acrobatics = acrobatics+" + StringUtils.getInt(acrobatics)
+ ", fishing = fishing+" + StringUtils.getInt(fishing)
+ " WHERE user_id = " + id);
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "experience SET "
+ " taming = " + Misc.getInt(tamingXP)
+ ", mining = " + Misc.getInt(miningXP)
+ ", repair = " + Misc.getInt(repairXP)
+ ", woodcutting = " + Misc.getInt(woodCuttingXP)
+ ", unarmed = " + Misc.getInt(unarmedXP)
+ ", herbalism = " + Misc.getInt(herbalismXP)
+ ", excavation = " + Misc.getInt(excavationXP)
+ ", archery = " + Misc.getInt(archeryXP)
+ ", swords = " + Misc.getInt(swordsXP)
+ ", axes = " + Misc.getInt(axesXP)
+ ", acrobatics = " + Misc.getInt(acrobaticsXP)
+ ", fishing = " + Misc.getInt(fishingXP)
+ " taming = " + StringUtils.getInt(tamingXP)
+ ", mining = " + StringUtils.getInt(miningXP)
+ ", repair = " + StringUtils.getInt(repairXP)
+ ", woodcutting = " + StringUtils.getInt(woodCuttingXP)
+ ", unarmed = " + StringUtils.getInt(unarmedXP)
+ ", herbalism = " + StringUtils.getInt(herbalismXP)
+ ", excavation = " + StringUtils.getInt(excavationXP)
+ ", archery = " + StringUtils.getInt(archeryXP)
+ ", swords = " + StringUtils.getInt(swordsXP)
+ ", axes = " + StringUtils.getInt(axesXP)
+ ", acrobatics = " + StringUtils.getInt(acrobaticsXP)
+ ", fishing = " + StringUtils.getInt(fishingXP)
+ " WHERE user_id = " + id);
}
else {
theCount++;
//Create the user in the DB
mcMMO.database.write("INSERT INTO "
Database.write("INSERT INTO "
+ tablePrefix
+ "users (user, lastlogin) VALUES ('"
+ playerName + "',"
+ System.currentTimeMillis() / 1000 + ")");
id = mcMMO.database.getInt("SELECT id FROM "
+ tablePrefix
+ "users WHERE user = '"
+ playerName + "'");
mcMMO.database.write("INSERT INTO "
+ System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR + ")");
id = Database.getInt("SELECT id FROM "
+ tablePrefix
+ "users WHERE user = '"
+ playerName + "'");
Database.write("INSERT INTO "
+ tablePrefix
+ "skills (user_id) VALUES (" + id + ")");
mcMMO.database.write("INSERT INTO "
Database.write("INSERT INTO "
+ tablePrefix
+ "experience (user_id) VALUES (" + id
+ ")");
//Update the skill values
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "users SET lastlogin = " + 0
+ " WHERE id = " + id);
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "users SET party = '" + party
+ "' WHERE id = " + id);
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "skills SET "
+ " taming = taming+" + Misc.getInt(taming)
+ ", mining = mining+" + Misc.getInt(mining)
+ ", repair = repair+" + Misc.getInt(repair)
+ ", woodcutting = woodcutting+" + Misc.getInt(woodcutting)
+ ", unarmed = unarmed+" + Misc.getInt(unarmed)
+ ", herbalism = herbalism+" + Misc.getInt(herbalism)
+ ", excavation = excavation+" + Misc.getInt(excavation)
+ ", archery = archery+" + Misc.getInt(archery)
+ ", swords = swords+" + Misc.getInt(swords)
+ ", axes = axes+" + Misc.getInt(axes)
+ ", acrobatics = acrobatics+" + Misc.getInt(acrobatics)
+ ", fishing = fishing+" + Misc.getInt(fishing)
+ " taming = taming+" + StringUtils.getInt(taming)
+ ", mining = mining+" + StringUtils.getInt(mining)
+ ", repair = repair+" + StringUtils.getInt(repair)
+ ", woodcutting = woodcutting+" + StringUtils.getInt(woodcutting)
+ ", unarmed = unarmed+" + StringUtils.getInt(unarmed)
+ ", herbalism = herbalism+" + StringUtils.getInt(herbalism)
+ ", excavation = excavation+" + StringUtils.getInt(excavation)
+ ", archery = archery+" + StringUtils.getInt(archery)
+ ", swords = swords+" + StringUtils.getInt(swords)
+ ", axes = axes+" + StringUtils.getInt(axes)
+ ", acrobatics = acrobatics+" + StringUtils.getInt(acrobatics)
+ ", fishing = fishing+" + StringUtils.getInt(fishing)
+ " WHERE user_id = " + id);
mcMMO.database.write("UPDATE "
Database.write("UPDATE "
+ tablePrefix
+ "experience SET "
+ " taming = " + Misc.getInt(tamingXP)
+ ", mining = " + Misc.getInt(miningXP)
+ ", repair = " + Misc.getInt(repairXP)
+ ", woodcutting = " + Misc.getInt(woodCuttingXP)
+ ", unarmed = " + Misc.getInt(unarmedXP)
+ ", herbalism = " + Misc.getInt(herbalismXP)
+ ", excavation = " + Misc.getInt(excavationXP)
+ ", archery = " + Misc.getInt(archeryXP)
+ ", swords = " + Misc.getInt(swordsXP)
+ ", axes = " + Misc.getInt(axesXP)
+ ", acrobatics = " + Misc.getInt(acrobaticsXP)
+ ", fishing = " + Misc.getInt(fishingXP)
+ " taming = " + StringUtils.getInt(tamingXP)
+ ", mining = " + StringUtils.getInt(miningXP)
+ ", repair = " + StringUtils.getInt(repairXP)
+ ", woodcutting = " + StringUtils.getInt(woodCuttingXP)
+ ", unarmed = " + StringUtils.getInt(unarmedXP)
+ ", herbalism = " + StringUtils.getInt(herbalismXP)
+ ", excavation = " + StringUtils.getInt(excavationXP)
+ ", archery = " + StringUtils.getInt(archeryXP)
+ ", swords = " + StringUtils.getInt(swordsXP)
+ ", axes = " + StringUtils.getInt(axesXP)
+ ", acrobatics = " + StringUtils.getInt(acrobaticsXP)
+ ", fishing = " + StringUtils.getInt(fishingXP)
+ " WHERE user_id = " + id);
}
}
System.out.println("[mcMMO] MySQL Updated from users file, " + theCount + " items added/updated to MySQL DB"); //TODO: Locale
mcMMO.p.getLogger().info("[mcMMO] MySQL Updated from users file, " + theCount + " items added/updated to MySQL DB");
in.close();
}
catch (Exception e) {
plugin.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
mcMMO.p.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
}
}
}

View File

@@ -0,0 +1,21 @@
package com.gmail.nossr50.database.runnables;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.database.Database;
import com.gmail.nossr50.util.Users;
public class SQLReconnect implements Runnable {
@Override
public void run() {
if (Database.checkConnected()) {
Users.saveAll(); //Save all profiles
Users.clearAll(); //Clear the profiles
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
Users.addUser(player); //Add in new profiles, forcing them to 'load' again from MySQL
}
}
}
}

View File

@@ -0,0 +1,25 @@
package com.gmail.nossr50.database.runnables;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.Database;
import com.gmail.nossr50.database.Leaderboard;
public class UserPurgeTask implements Runnable {
@Override
public void run() {
if (Config.getInstance().getUseMySQL()) {
Database.purgePowerlessSQL();
if (Config.getInstance().getOldUsersCutoff() != -1) {
Database.purgeOldSQL();
}
}
else {
Leaderboard.purgePowerlessFlatfile();
if (Config.getInstance().getOldUsersCutoff() != -1) {
Leaderboard.purgeOldFlatfile();
}
}
}
}

View File

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

View File

@@ -1,8 +0,0 @@
package com.gmail.nossr50.datatypes;
public enum HUDType {
DISABLED,
STANDARD,
SMALL,
RETRO;
}

View File

@@ -1,413 +0,0 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.gui.GenericGradient;
import org.getspout.spoutapi.gui.GenericTexture;
import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class HUDmmo {
private int center_x = 427 / 2;
private String playerName;
private final mcMMO plugin;
private Widget xpbar = null;
private GenericGradient xpfill = null;
private GenericGradient xpbg = null;
private GenericGradient xpicon_bg = null;
private GenericGradient xpicon_border = null;
private GenericTexture xpicon = null;
public HUDmmo(Player player, mcMMO plugin) {
this.playerName = player.getName();
this.plugin = plugin;
initializeHUD(player);
}
/**
* Initialize the HUD.
*
* @param player Player whose HUD to initialize
*/
public void initializeHUD(Player player) {
HUDType type = Users.getProfile(player).getHUDType();
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
switch (type) {
case RETRO:
initializeXpBarDisplayRetro(sPlayer);
break;
case STANDARD:
initializeXpBarDisplayStandard(sPlayer);
break;
case SMALL:
initializeXpBarDisplaySmall(sPlayer);
break;
case DISABLED:
break;
default:
break;
}
}
/**
* Update the XP bar.
*
* @param type Type of XP bar
* @param player Player whose XP bar to update
*/
public void updateXpBarDisplay(HUDType type, Player player) {
PlayerProfile PP = Users.getProfile(player);
switch (type) {
case RETRO:
updateXpBarRetro(player, PP);
break;
case STANDARD:
updateXpBarStandard(player, PP);
break;
case SMALL:
updateXpBarStandard(player, PP);
break;
case DISABLED:
break;
default:
break;
}
}
/**
* Reset a player's HUD.
*/
public void resetHUD() {
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
if (sPlayer != null) {
sPlayer.getMainScreen().removeWidgets(plugin);
//Reset the objects
xpbar = null;
xpfill = null;
xpbg = null;
xpicon = null;
sPlayer.getMainScreen().setDirty(true);
}
}
/**
* Initialize Retro XP bar.
*
* @param sPlayer Player to initialize XP bar for
*/
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) {
Color border = new Color((float) Config.getInstance().getSpoutRetroHUDXPBorderRed(), (float) Config.getInstance().getSpoutRetroHUDXPBorderGreen(), (float) Config.getInstance().getSpoutRetroHUDXPBorderBlue(), 1f);
Color green = new Color(0f, 1f, 0f, 1f);
Color background = new Color((float) Config.getInstance().getSpoutRetroHUDXPBackgroundRed(), (float) Config.getInstance().getSpoutRetroHUDXPBackgroundGreen(), (float) Config.getInstance().getSpoutRetroHUDXPBackgroundBlue(), 1f);
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
xpicon = new GenericTexture();
xpbar = new GenericGradient();
xpfill = new GenericGradient();
xpbg = new GenericGradient();
xpicon_bg = new GenericGradient();
xpicon_border = new GenericGradient();
xpicon_bg.setBottomColor(darkbg);
xpicon_bg.setTopColor(darkbg);
xpicon_bg.setWidth(4);
xpicon_bg.setHeight(4);
xpicon_bg.setPriority(RenderPriority.High);
xpicon_bg.setX(142);
xpicon_bg.setY(10);
xpicon_bg.setDirty(true);
xpicon_border.setBottomColor(border);
xpicon_border.setTopColor(border);
xpicon_border.setWidth(6);
xpicon_border.setHeight(6);
xpicon_border.setPriority(RenderPriority.Highest);
xpicon_border.setX(141);
xpicon_border.setY(9);
xpicon_border.setDirty(true);
xpicon.setWidth(6);
xpicon.setHeight(6);
xpicon.setX(141);
xpicon.setY(9);
xpicon.setPriority(RenderPriority.Normal);
xpicon.setDirty(true);
xpicon.setUrl("Icon_r.png");
xpbar.setWidth(128);
xpbar.setHeight(4);
xpbar.setX(149);
xpbar.setY(10);
((GenericGradient) xpbar).setBottomColor(border);
((GenericGradient) xpbar).setTopColor(border);
xpbar.setPriority(RenderPriority.Highest);
xpbar.setDirty(true);
xpfill.setWidth(0);
xpfill.setHeight(2);
xpfill.setX(150);
xpfill.setY(11);
xpfill.setBottomColor(green);
xpfill.setTopColor(green);
xpfill.setPriority(RenderPriority.Lowest);
xpfill.setDirty(true);
xpbg.setWidth(126);
xpbg.setHeight(2);
xpbg.setX(150);
xpbg.setY(11);
xpbg.setBottomColor(background);
xpbg.setTopColor(background);
xpbg.setPriority(RenderPriority.Low);
xpbg.setDirty(true);
if (Config.getInstance().getSpoutXPBarEnabled()) {
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpfill);
sPlayer.getMainScreen().attachWidget(plugin, xpbg);
if (Config.getInstance().getSpoutXPBarIconEnabled()) {
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
sPlayer.getMainScreen().attachWidget(plugin, xpicon_bg);
sPlayer.getMainScreen().attachWidget(plugin, xpicon_border);
}
}
sPlayer.getMainScreen().setDirty(true);
}
/**
* Initialize Standard XP bar.
*
* @param sPlayer Player to initialize XP bar for
*/
public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) {
if (Config.getInstance().getSpoutXPBarEnabled()) {
xpbar = new GenericTexture();
((GenericTexture) xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(Config.getInstance().getSpoutXPBarXPosition());
xpbar.setY(Config.getInstance().getSpoutXPBarYPosition());
xpbar.setHeight(8);
xpbar.setWidth(256);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (Config.getInstance().getSpoutXPBarIconEnabled()) {
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(16);
xpicon.setWidth(32);
xpicon.setX(Config.getInstance().getSpoutXPIconXPosition());
xpicon.setY(Config.getInstance().getSpoutXPIconYPosition());
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
}
sPlayer.getMainScreen().setDirty(true);
}
/**
* Initialize Small XP bar.
*
* @param sPlayer Player to initialize XP bar for
*/
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) {
if (Config.getInstance().getSpoutXPBarEnabled()) {
xpbar = new GenericTexture();
((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(center_x - 64);
xpbar.setY(Config.getInstance().getSpoutXPBarYPosition());
xpbar.setHeight(4);
xpbar.setWidth(128);
sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (Config.getInstance().getSpoutXPBarIconEnabled()) {
xpicon = new GenericTexture();
xpicon.setUrl("Icon.png");
xpicon.setHeight(8);
xpicon.setWidth(16);
xpicon.setX(center_x - (8 + 64));
xpicon.setY(Config.getInstance().getSpoutXPIconYPosition() + 2);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
}
sPlayer.getMainScreen().setDirty(true);
}
/**
* Update XP bar for Standard & Small styles.
*
* @param player Player whose XP bar to update
* @param PP Profile of the given player
*/
private void updateXpBarStandard(Player player, PlayerProfile PP) {
if (!Config.getInstance().getSpoutXPBarEnabled()) {
return;
}
SkillType theType = getType(PP);
if (theType == null) { //Can this ever actually BE null? (Yes, it's null when the player has just logged in. It's not null when they gain XP in anything)
return;
}
((GenericTexture) xpicon).setUrl(Misc.getCapitalized(theType.toString()) + ".png");
xpicon.setDirty(true);
((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
xpbar.setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
/**
* Update XP bar for Retro styles.
*
* @param player Player whose XP bar to update
* @param PP Profile of the given player
*/
private void updateXpBarRetro(Player player, PlayerProfile PP) {
if (!Config.getInstance().getSpoutXPBarEnabled()) {
return;
}
SkillType theType = getType(PP);
if (theType == null) { //Can this ever actually BE null? (Yes, it's null when the player has just logged in. It's not null when they gain XP in anything)
return;
}
Color color = getRetroColor(theType);
xpicon.setUrl(Misc.getCapitalized(theType.toString()) + "_r.png");
xpfill.setBottomColor(color);
xpfill.setTopColor(color);
xpfill.setWidth(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO));
xpfill.setDirty(true);
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
}
private static Color getRetroColor(SkillType type) {
switch (type) {
case ACROBATICS:
return new Color((float) Config.getInstance().getSpoutRetroHUDAcrobaticsRed(), (float) Config.getInstance().getSpoutRetroHUDAcrobaticsGreen(), (float) Config.getInstance().getSpoutRetroHUDAcrobaticsBlue(), 1f);
case ARCHERY:
return new Color((float) Config.getInstance().getSpoutRetroHUDArcheryRed(), (float) Config.getInstance().getSpoutRetroHUDArcheryGreen(), (float) Config.getInstance().getSpoutRetroHUDArcheryBlue(), 1f);
case AXES:
return new Color((float) Config.getInstance().getSpoutRetroHUDAxesRed(), (float) Config.getInstance().getSpoutRetroHUDAxesGreen(), (float) Config.getInstance().getSpoutRetroHUDAxesBlue(), 1f);
case EXCAVATION:
return new Color((float) Config.getInstance().getSpoutRetroHUDExcavationRed(), (float) Config.getInstance().getSpoutRetroHUDExcavationGreen(), (float) Config.getInstance().getSpoutRetroHUDExcavationBlue(), 1f);
case HERBALISM:
return new Color((float) Config.getInstance().getSpoutRetroHUDHerbalismRed(), (float) Config.getInstance().getSpoutRetroHUDHerbalismGreen(), (float) Config.getInstance().getSpoutRetroHUDHerbalismBlue(), 1f);
case MINING:
return new Color((float) Config.getInstance().getSpoutRetroHUDMiningRed(), (float) Config.getInstance().getSpoutRetroHUDMiningGreen(), (float) Config.getInstance().getSpoutRetroHUDMiningBlue(), 1f);
case REPAIR:
return new Color((float) Config.getInstance().getSpoutRetroHUDRepairRed(), (float) Config.getInstance().getSpoutRetroHUDRepairGreen(), (float) Config.getInstance().getSpoutRetroHUDRepairBlue(), 1f);
case SWORDS:
return new Color((float) Config.getInstance().getSpoutRetroHUDSwordsRed(), (float) Config.getInstance().getSpoutRetroHUDSwordsGreen(), (float) Config.getInstance().getSpoutRetroHUDSwordsBlue(), 1f);
case TAMING:
return new Color((float) Config.getInstance().getSpoutRetroHUDTamingRed(), (float) Config.getInstance().getSpoutRetroHUDTamingGreen(), (float) Config.getInstance().getSpoutRetroHUDTamingBlue(), 1f);
case UNARMED:
return new Color((float) Config.getInstance().getSpoutRetroHUDUnarmedRed(), (float) Config.getInstance().getSpoutRetroHUDUnarmedGreen(), (float) Config.getInstance().getSpoutRetroHUDUnarmedBlue(), 1f);
case WOODCUTTING:
return new Color((float) Config.getInstance().getSpoutRetroHUDWoodcuttingRed(), (float) Config.getInstance().getSpoutRetroHUDWoodcuttingGreen(), (float) Config.getInstance().getSpoutRetroHUDWoodcuttingBlue(), 1f);
case FISHING:
return new Color((float) Config.getInstance().getSpoutRetroHUDFishingRed(), (float) Config.getInstance().getSpoutRetroHUDFishingGreen(), (float) Config.getInstance().getSpoutRetroHUDFishingBlue(), 1f);
default:
return new Color(0.3f, 0.3f, 0.75f, 1f);
}
}
private static String getUrlBar(Integer number) {
char[] num = number.toString().toCharArray();
switch (num.length) {
case 1:
return "xpbar_inc00" + number + ".png";
case 2:
return "xpbar_inc0" + number + ".png";
default:
return "xpbar_inc" + number + ".png";
}
}
private static Integer getXpInc(int skillxp, int xptolevel, HUDType hud) {
double percentage = (double) skillxp / xptolevel;
double inc;
switch (hud) {
case RETRO:
inc = 0.0079365079365079;
break;
case STANDARD:
inc = 0.0039370078740157;
break;
default:
return 1;
}
return (int) (percentage / inc);
}
private static SkillType getType(PlayerProfile PP) {
if (PP.getXpBarLocked()) {
return PP.getSkillLock();
}
else {
return PP.getLastGained();
}
}
}

View File

@@ -0,0 +1,282 @@
package com.gmail.nossr50.datatypes;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.mods.ModChecks;
import com.gmail.nossr50.mods.datatypes.CustomTool;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.spout.huds.SpoutHud;
import com.gmail.nossr50.util.Misc;
public class McMMOPlayer {
private Player player;
private PlayerProfile profile;
private Party party;
private Party invite;
private Player ptpRequest;
private boolean ptpEnabled = true;
private boolean ptpConfirmRequired = Config.getInstance().getPTPCommandConfirmRequired();
private long ptpTimeout;
private boolean partyChatMode;
private boolean adminChatMode;
public McMMOPlayer (Player player) {
String playerName = player.getName();
this.player = player;
this.profile = new PlayerProfile(playerName, true);
this.party = PartyManager.getPlayerParty(playerName);
}
/**
* Gets the power level of this player.
*
* @return the power level of the player
*/
public int getPowerLevel() {
int powerLevel = 0;
for (SkillType type : SkillType.values()) {
if (type.isChildSkill()) {
continue;
}
if (player.hasPermission("mcmmo.skills." + type.toString().toLowerCase())) {
powerLevel += profile.getSkillLevel(type);
}
}
return powerLevel;
}
/**
* Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party
*
* @param skillType Skill being used
* @param xp Experience amount to process
*/
public void beginXpGain(SkillType skillType, int xp) {
// Return if the experience has been shared
if (party != null && ShareHandler.handleXpShare(xp, this, skillType)) {
return;
}
beginUnsharedXpGain(skillType, xp);
}
/**
* Begins an experience gain. The amount will be affected by skill modifiers, global rate and perks
*
* @param skillType Skill being used
* @param xp Experience amount to process
*/
public void beginUnsharedXpGain(SkillType skillType, int xp) {
xp = modifyXpGain(skillType, xp);
if (xp == 0) {
return;
}
applyXpGain(skillType, xp);
}
/**
* Applies an experience gain
*
* @param skillType Skill being used
* @param xp Experience amount to add
*/
public void applyXpGain(SkillType skillType, int xp) {
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skillType, xp);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
profile.setSkillXpLevel(skillType, profile.getSkillXpLevel(skillType) + event.getXpGained());
SpoutHud spoutHud = profile.getSpoutHud();
if (spoutHud != null) {
spoutHud.setLastGained(skillType);
}
SkillTools.xpCheckSkill(skillType, player, profile);
}
/**
* Modifies an experience gain using skill modifiers, global rate and perks
*
* @param skillType Skill being used
* @param xp Experience amount to process
* @return Modified experience
*/
private int modifyXpGain(SkillType skillType, int xp) {
if (player.getGameMode() == GameMode.CREATIVE) {
return 0;
}
if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Misc.getPowerLevelCap() < getPowerLevel() + 1)) {
return 0;
}
xp = (int) (xp / skillType.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier());
if (Config.getInstance().getToolModsEnabled()) {
ItemStack item = player.getItemInHand();
CustomTool tool = ModChecks.getToolFromItemStack(item);
if (tool != null) {
xp *= tool.getXpMultiplier();
}
}
// TODO: Too many permission checks here, is there no way to avoid that?
if (player.hasPermission("mcmmo.perks.xp.quadruple")) {
xp *= 4;
}
else if (player.hasPermission("mcmmo.perks.xp.triple")) {
xp *= 3;
}
else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
xp *= 2.5;
}
else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
xp *= 2;
}
else if (player.hasPermission("mcmmo.perks.xp.50percentboost")) {
xp *= 1.5;
}
return xp;
}
// Players & Profiles
public Player getPlayer() {
return player;
}
public void setPlayer(Player player) {
this.player = player;
}
public PlayerProfile getProfile() {
return profile;
}
// Party Stuff
public void setPartyInvite(Party invite) {
this.invite = invite;
}
public Party getPartyInvite() {
return invite;
}
public boolean hasPartyInvite() {
if (invite != null) {
return true;
}
return false;
}
public void setParty(Party party) {
this.party = party;
}
public Party getParty() {
return party;
}
public boolean inParty() {
if (party != null) {
return true;
}
return false;
}
public void removeParty() {
party = null;
}
public void removePartyInvite() {
invite = null;
}
public boolean getPtpEnabled() {
return ptpEnabled;
}
public void togglePtpUse() {
ptpEnabled = !ptpEnabled;
}
public Player getPtpRequest() {
return ptpRequest;
}
public void setPtpRequest(Player ptpRequest) {
this.ptpRequest = ptpRequest;
}
public boolean hasPtpRequest() {
return (ptpRequest != null) ? true : false;
}
public void removePtpRequest() {
ptpRequest = null;
}
public boolean getPtpConfirmRequired() {
return ptpConfirmRequired;
}
public void togglePtpConfirmRequired() {
ptpConfirmRequired = !ptpConfirmRequired;
}
public long getPtpTimeout() {
return ptpTimeout;
}
public void actualizePtpTimeout() {
ptpTimeout = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
}
public boolean getAdminChatMode() {
return adminChatMode;
}
public void setAdminChat(boolean enabled) {
adminChatMode = enabled;
}
public void toggleAdminChat() {
adminChatMode = !adminChatMode;
}
public boolean getPartyChatMode() {
return partyChatMode;
}
public void setPartyChat(boolean enabled) {
partyChatMode = enabled;
}
public void togglePartyChat() {
partyChatMode = !partyChatMode;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
package com.gmail.nossr50.datatypes;
public class PlayerStat {
public String name;
public int statVal = 0;
}

View File

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

View File

@@ -1,52 +0,0 @@
package com.gmail.nossr50.datatypes;
import java.util.ArrayList;
import com.gmail.nossr50.datatypes.PlayerStat;
public class TreeNode {
TreeNode left = null;
TreeNode right = null;
PlayerStat ps = new PlayerStat();
public TreeNode(String p, int in) {
ps.statVal = in;
ps.name = p;
}
public void add (String p, int in) {
if (in >= ps.statVal) {
if (left == null) {
left = new TreeNode(p, in);
}
else {
left.add(p, in);
}
}
else if(in < ps.statVal) {
if (right == null) {
right = new TreeNode(p, in);
}
else {
right.add(p, in);
}
}
}
public ArrayList<PlayerStat> inOrder(ArrayList<PlayerStat> a) {
//if left node is not null than assign arrayList(a) to left.inOrder()
//GOES THROUGH THE ENTIRE LEFT BRANCH AND GRABS THE GREATEST NUMBER
if (left != null) {
a = left.inOrder(a);
}
a.add(ps);
if (right != null) {
a = right.inOrder(a);
}
return a;
}
}

View File

@@ -1,13 +0,0 @@
package com.gmail.nossr50.datatypes.buttons;
import org.getspout.spoutapi.gui.GenericButton;
public class ButtonEscape extends GenericButton {
public ButtonEscape() {
this.setText("EXIT");
this.setWidth(60);
this.setHeight(20);
this.setDirty(true);
}
}

View File

@@ -1,14 +0,0 @@
package com.gmail.nossr50.datatypes.buttons;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class ButtonHUDStyle extends ButtonToggle {
public ButtonHUDStyle(PlayerProfile PP) {
super("HUD Type: ", PP.getHUDType().toString(), "Change your HUD style!"); //TODO: Needs more locale
}
public void updateText(PlayerProfile PP) {
super.updateText("HUD Type: ", PP.getHUDType().toString()); //TODO: Needs more locale
}
}

View File

@@ -1,14 +0,0 @@
package com.gmail.nossr50.datatypes.buttons;
import com.gmail.nossr50.datatypes.PlayerProfile;
public class ButtonPartyToggle extends ButtonToggle {
public ButtonPartyToggle(PlayerProfile PP) {
super("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString(), "Toggle the Party HUD!"); //TODO: Needs more locale
}
public void updateText(PlayerProfile PP) {
super.updateText("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString()); //TODO: Needs more locale
}
}

View File

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

View File

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

View File

@@ -1,57 +0,0 @@
package com.gmail.nossr50.datatypes.popups;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.gui.GenericLabel;
import org.getspout.spoutapi.gui.GenericPopup;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
public class PopupMMO extends GenericPopup {
private ButtonHUDStyle HUDButton = null;
private ButtonEscape EscapeButton = null;
private GenericLabel mcMMO_label = new GenericLabel();
private GenericLabel tip_escape = new GenericLabel();
private int center_x = 427 / 2;
private int center_y = 240 / 2;
public PopupMMO(Player player, PlayerProfile PP, mcMMO plugin) {
//240, 427 are the bottom right
mcMMO_label.setText(ChatColor.GOLD + "~mcMMO Menu~"); //TODO: Needs more locale
mcMMO_label.setX(center_x - 35);
mcMMO_label.setY((center_y / 2) - 20);
mcMMO_label.setDirty(true);
tip_escape.setText(ChatColor.GRAY + "Press ESCAPE to exit!"); //TODO: Needs more locale
tip_escape.setX(mcMMO_label.getX() - 15);
tip_escape.setY(mcMMO_label.getY() + 10);
tip_escape.setDirty(true);
HUDButton = new ButtonHUDStyle(PP);
HUDButton.setX(center_x - (HUDButton.getWidth() / 2));
HUDButton.setY(center_y / 2);
HUDButton.setDirty(true);
EscapeButton = new ButtonEscape();
EscapeButton.setX(center_x - (EscapeButton.getWidth() / 2));
EscapeButton.setY((center_y / 2) + (HUDButton.getHeight() * 2) + 5);
EscapeButton.setDirty(true);
this.attachWidget(plugin, HUDButton);
this.attachWidget(plugin, mcMMO_label);
this.attachWidget(plugin, tip_escape);
this.attachWidget(plugin, EscapeButton);
this.setDirty(true);
}
public void updateButtons(PlayerProfile PP) {
HUDButton.updateText(PP);
//PartyButton.updateText(PP);
this.setDirty(true);
}
}

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class ExcavationTreasure extends Treasure {
// dirt | grass | sand | gravel | clay | mycel | soulsand
// 00000001 - dirt 1
// 00000010 - grass 2

View File

@@ -0,0 +1,76 @@
package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class HylianTreasure extends Treasure {
// bushes | flowers | pots
// 00000001 - bushes 1
// 00000010 - flowers 2
// 00000100 - pots 4
private byte dropsFrom = 0x0;
public HylianTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
super(drop, xp, dropChance, dropLevel);
}
// Raw getters and setters
public byte getDropsFrom() {
return dropsFrom;
}
public void setDropsFrom(byte dropsFrom) {
this.dropsFrom = dropsFrom;
}
// Getters
public boolean getDropsFromBushes() {
return getDropFromMask(1);
}
public boolean getDropsFromFlowers() {
return getDropFromMask(2);
}
public boolean getDropsFromPots() {
return getDropFromMask(4);
}
private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false;
}
// Setters
public void setDropsFromBushes() {
setDropFromMask(1);
}
public void setDropsFromFlowers() {
setDropFromMask(2);
}
public void setDropsFromPots() {
setDropFromMask(4);
}
private void setDropFromMask(int mask) {
dropsFrom |= mask;
}
// Un-setters
public void unsetDropsFromBushes() {
unsetDropFromMask(1);
}
public void unsetDropsFromFlowers() {
unsetDropFromMask(2);
}
public void unsetDropsFromPots() {
unsetDropFromMask(4);
}
private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask;
}
}

View File

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

View File

@@ -3,17 +3,29 @@ package com.gmail.nossr50.events.chat;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
public class McMMOChatEvent extends Event implements Cancellable{
public abstract class McMMOChatEvent extends Event implements Cancellable {
private boolean cancelled;
private Plugin plugin;
private String sender;
private String displayName;
private String message;
public McMMOChatEvent(String sender, String message) {
protected McMMOChatEvent(Plugin plugin, String sender, String displayName, String message) {
this.plugin = plugin;
this.sender = sender;
this.displayName = displayName;
this.message = message;
}
/**
* @return The plugin responsible for this event, note this can be null
*/
public Plugin getPlugin() {
return plugin;
}
/**
* @return String name of the player who sent the chat, or "Console"
*/
@@ -21,6 +33,13 @@ public class McMMOChatEvent extends Event implements Cancellable{
return sender;
}
/**
* @return String display name of the player who sent the chat, or "Console"
*/
public String getDisplayName() {
return displayName;
}
/**
* @return String message that will be sent
*/
@@ -28,6 +47,13 @@ public class McMMOChatEvent extends Event implements Cancellable{
return message;
}
/**
* @param displayName String display name of the player who sent the chat
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @param message String message to be sent in chat
*/

View File

@@ -1,13 +1,15 @@
package com.gmail.nossr50.events.chat;
import org.bukkit.plugin.Plugin;
/**
* Called when a chat is sent to a party channel
*/
public class McMMOPartyChatEvent extends McMMOChatEvent{
public class McMMOPartyChatEvent extends McMMOChatEvent {
private String party;
public McMMOPartyChatEvent(String sender, String party, String message) {
super(sender, message);
public McMMOPartyChatEvent(Plugin plugin, String sender, String displayName, String party, String message) {
super(plugin, sender, displayName, message);
this.party = party;
}

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