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

Compare commits

..

225 Commits

Author SHA1 Message Date
nossr50
4f1532cf96 add Maces permission nodes 2024-06-30 15:09:04 -07:00
nossr50
5bbb389d9a update Changelog.txt 2024-06-30 14:49:37 -07:00
nossr50
87bd92a5b0 maces wip pt 3 2024-06-30 14:47:54 -07:00
nossr50
c94039ab45 maces wip pt 2 2024-06-30 14:43:03 -07:00
nossr50
e1dee2778d maces wip 2024-06-29 16:49:10 -07:00
nossr50
02c732bdf2 2.2.014 2024-06-28 18:31:24 -07:00
nossr50
e32bde3c32 fix luck of the sea being applied for super break and other abilities Fixes #5026 2024-06-28 18:28:51 -07:00
nossr50
a11ac782fa 2.2.013 2024-06-22 13:32:31 -07:00
nossr50
10e8b19e53 update Changelog.txt 2024-06-22 13:30:50 -07:00
nossr50
ac3c6da298 add xp for Bogged and Breeze 2024-06-19 16:29:10 -07:00
nossr50
4fce053804 minor refactoring 2024-06-19 12:15:00 -07:00
nossr50
eeecf18caf add missing entries for xbows/tridents/maces 2024-06-19 12:14:53 -07:00
nossr50
b9b1127087 update changelog 2024-06-08 13:23:06 -07:00
DonaldBear
009f64cba1 feat(locale): Updated locale zh_TW (#5015)
* Update locale_zh_TW.properties

Updated this line:
Skills.AbilityGateRequirementFail=&7你還需要 &e{0}&7 級以上的 &3{1}&7 來使用這個能力。

Added: "還" (meaning = stills)  in Skills.AbilityGateRequirementFail

Avoid player misconception, indicate that players still need such a level to have the ability to use these skills.

* Add files via upload

* Update locale_zh_TW.properties

Updated zh_TW locale, added new translations and corrected some wrong translation

* Update locale_zh_TW.properties

Fixed missing color code

* Update locale_zh_TW.properties

Added new translations

* Update locale_zh_TW.properties
2024-06-08 13:14:25 -07:00
haha44444
2a4487cde2 Fix properties key error (#5010) 2024-06-08 13:13:10 -07:00
nossr50
8633f7b63a more refactoring for spawning items conditionally 2024-05-25 12:25:00 -07:00
nossr50
0708b0a6a2 some more refactoring 2024-05-24 13:30:17 -07:00
nossr50
6c1502fc67 refactoring 2024-05-24 13:07:45 -07:00
nossr50
4277384c22 move item related utils from Misc to ItemUtils 2024-05-24 12:58:39 -07:00
nossr50
590b00aeca minor refactoring 2024-05-23 18:14:07 -07:00
Momshroom
2f1278c784 Fix sapling drops to ignore reduction and obey Knock on Wood (#5012)
* Fixed NPE when party creation doesn't use password.  Solves bug reported here: https://discord.com/channels/526933440214597677/526938425161416727/1213131451235827753

Signed-off-by: Momshroom <Momshroom@gmail.com>

* Actually don't reduce sapling drop if KnockOnWood unlocked. (Prior fix didn't)

Signed-off-by: Momshroom <Momshroom@gmail.com>

* removed unnecessary getPlayer() calls.
clarified comment
clarified location variable name

Signed-off-by: Momshroom <Momshroom@gmail.com>

* made new method more generic.
Removed no longer needed dropString variable

Signed-off-by: Momshroom <Momshroom@gmail.com>

---------

Signed-off-by: Momshroom <Momshroom@gmail.com>
2024-05-23 18:02:29 -07:00
nossr50
d0ab2bdb2f clean up if/else formatting 2024-05-19 14:09:00 -07:00
nossr50
7266563ca9 Back to Java 17 for now 2024-05-19 13:53:46 -07:00
nossr50
364d4cd6e7 spring-cleaning, update all the dependencies 2024-05-19 13:48:25 -07:00
nossr50
32ff8c6818 update maven-release-plugin 2024-05-19 13:24:14 -07:00
nossr50
fc600796ca minor refactor 2024-05-19 13:24:06 -07:00
nossr50
db9f8e46d1 update github workflow runner to use 21 2024-05-19 13:18:39 -07:00
nossr50
19a8a9ff52 update maven compiler plugin 2024-05-19 13:14:39 -07:00
nossr50
ab8ba8acbe update maven shade plugin 2024-05-19 13:11:12 -07:00
nossr50
d38404927b minor refactor 2024-05-19 13:05:10 -07:00
nossr50
b65247cbb0 require java 21 2024-05-19 13:05:00 -07:00
nossr50
9b09f06ad8 add more sensibly named API for grabbing the UserBlockTracker 2024-05-19 12:58:51 -07:00
nossr50
8b82163e3d update UserBlockTracker API 2024-05-19 12:44:34 -07:00
nossr50
c2054a5d45 2.2.012 fix for daze in 1.20.4 and older 2024-05-18 12:30:44 -07:00
nossr50
46c9ea5a25 2.2.011 2024-05-17 17:24:31 -07:00
nossr50
e6ff219a5c more verbose logging for alchemy potion lookups 2024-05-17 12:02:44 -07:00
nossr50
fc66c9f3fd 2.2.010 2024-05-15 16:06:16 -07:00
nossr50
8d2a08c421 fix REGEN potion not loading 2024-05-13 10:59:57 -07:00
nossr50
291effdbc8 if( -> if ( 2024-05-12 14:13:34 -07:00
nossr50
435a6fde34 update Changelog.txt 2024-05-12 14:11:59 -07:00
nossr50
3ba6b93135 Fixed possible NPE in our events, and BrewingStands now remember who last interacted with them, this allows for hoppers to be used with Alchemy Fixes #5004 Fixes #4958 Fixes #4641 2024-05-12 14:09:51 -07:00
nossr50
17052861d1 2.2.009 2024-05-12 09:34:02 -07:00
nossr50
cae2132d8d 2.2.008 2024-05-11 16:08:05 -07:00
nossr50
ed0c9469e2 don't show unimplemented supers for mccooldowns 2024-05-11 16:01:47 -07:00
nossr50
64206c3ac8 Fixed mccooldowns on SQL not working Fixes #5006 2024-05-11 15:58:49 -07:00
nossr50
0bf1bbe6ac Fixed messages not being sent to the action bar 2024-05-11 15:48:11 -07:00
nossr50
b3edca5304 Fix italicized potion names 2024-05-11 15:27:47 -07:00
nossr50
07b4736be3 update changelog 2024-05-11 15:07:45 -07:00
IAISI
df6ddd6faa CombatUtils: Don't run checks against party features if parties are disabled (#5005)
Co-authored-by: Dieu <info@l4b.org>
2024-05-11 15:07:01 -07:00
nossr50
fb0c8ec934 Fix potions not brewing as the correct type 2024-05-11 15:05:37 -07:00
nossr50
5ba6305ad4 2.2.007 2024-05-04 10:26:43 -07:00
nossr50
75561350c1 fix issues with Alchemy and older MC versions 2024-05-03 13:53:53 -07:00
nossr50
5b822bc626 add armadillos to xp 2024-05-02 06:39:20 -07:00
nossr50
e29a977b9a fix mistake in skillranks.yml 2024-05-02 06:32:47 -07:00
nossr50
78558107b3 WIP 1.20.6 support 2024-05-02 06:28:20 -07:00
nossr50
5628df988f update changelog 2024-04-21 16:04:05 -07:00
nossr50
c078e853eb Fix bug where Green Thumb did not replant if seeds were solely in the offhand Fixes #4994 2024-04-21 14:57:57 -07:00
nossr50
0db5330416 release should be 17 not 16 2024-04-16 14:26:32 -07:00
nossr50
1cac6b1165 2.2.006 2024-04-13 15:18:12 -07:00
nossr50
c0952a2ba3 Add support for hex color codes in locale 2024-04-13 12:58:52 -07:00
nossr50
4d98d25215 Fix wiki links being outdated 2024-04-06 15:10:02 -07:00
nossr50
ffc6061f8b Add custom_item_support config file to optionally disable repair/salvage on items with custom models 2024-04-06 14:26:57 -07:00
nossr50
0363ee2e90 2.2.005 2024-04-06 12:59:35 -07:00
nossr50
b6e512b09e fix probability being unbounded 2024-04-06 12:44:56 -07:00
nossr50
aecf17a2a2 dev mode 2024-04-02 13:30:09 -07:00
nossr50
c769813892 2.2.004 2024-04-02 13:25:35 -07:00
nossr50
e509876658 fix xp multiplier not getting applied 2024-04-01 15:13:49 -07:00
nossr50
a047bca94c Fix crossbows not getting added to schema for some users 2024-03-31 14:28:14 -07:00
nossr50
b5a50da09b Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2024-03-31 13:55:08 -07:00
nossr50
2d79b364db Fix lastlogin value being too large for SQLDB 2024-03-31 13:54:57 -07:00
Robert Alan Chapton
657d7cafa7 Update README.md 2024-03-31 10:41:34 -07:00
nossr50
d92c60fc84 2.2.002 2024-03-31 08:50:05 -07:00
nossr50
b56ddebde8 fix trickshot not applying shot from crossbow to bounced arrows 2024-03-31 08:46:04 -07:00
nossr50
cf49fc7599 fix thrown tridents not getting XP or subskill benefits 2024-03-31 08:44:06 -07:00
nossr50
86a5d14a9b 2.2.001 2024-03-30 06:57:55 -07:00
nossr50
d45e48c401 changelog update 2024-03-30 06:37:49 -07:00
nossr50
77f6a3945f 2.2.000 2024-03-30 06:35:58 -07:00
nossr50
6016e69663 update changelog 2024-03-30 06:28:51 -07:00
nossr50
8902c86864 update changelog 2024-03-30 06:27:21 -07:00
nossr50
f6d2479f2e update changelog 2024-03-30 06:25:34 -07:00
nossr50
81ac48904c mcMMO 2.2.000-RC1 candidate for release 2024-03-30 06:16:10 -07:00
Robert Alan Chapton
2594dc1bca Endgame Update (#4840)
General
Added Crossbows Skill, this skill is a WIP and feedback on discord is appreciated.
Added Tridents Skill, this skill is a WIP and feedback on discord is appreciated.
Added the "endgame" triple drop subskill 'Mother Lode' to Mining
Added the "endgame" triple drop subskill 'Clean Cuts' to Woodcutting
Added the "endgame" triple drop subskill 'Verdant Bounty' to Herbalism
Added /mmopower command which simply shows your power level (aliases /mmopowerlevel /powerlevel)

Config
Added 'Send_To_Console' settings to chat.yml to toggle sending party or admin chat messages to console.
Replaced 'Experience_Formula.Modifier' in experience.yml with 'Experience_Formula.Skill_Multiplier' which is easier to understand and less prone to divide by zero bugs.
child.yml config is gone now, feel free to delete it.

Tweaks
Tree Feller now drops 90% less non-wood block rewards (leaves/etc) on average from Knock on Wood.
Treasure drop rate from Shake, Fishing, Hylian, and Excavation now benefit from the Luck perk.
Updated advanced.yml with entries for the new skills

Permission nodes
Added 'mcmmo.commands.mmopower' permission node for the new /mmopower command
Added 'mcmmo.commands.crossbows' permission node
Added 'mcmmo.ability.crossbows.crossbowslimitbreak' permission node
Added 'mcmmo.ability.crossbows.trickshot' permission node
Added 'mcmmo.ability.herbalism.verdantbounty' permission node
Added 'mcmmo.ability.mining.motherlode' permission node
Added 'mcmmo.ability.woodcutting.cleancuts' permission node

Locale
Added locale entries for motherlode, cleancuts, and verdant bounty.

Codebase
Major rewrite for how random chance was handled in the code.
Many skills with RNG elements now send out a SubSkillEvent (which can be used to modify probability or cancel the results), some skills without RNG still send out this event when activated, this event is cancellable so it can be used to make a skill fail.
A lot of new unit tests were added to help keep mcMMO stable as part of this update, of course, more could always be added.

NOTES:
One feature of this update is to provide an endgame benefits to some skills that you can grind for a long time, ideally for a long while. I will likely expand upon this idea in future updates.
A few skills have these endgame-oriented subskills, these new subskills provide a small benefit at first that grows and scales up to level 10,000 (or 1,000 for Standard mode which no one uses) and does not have ranks (other than the initial rank to unlock it).
These endgame sub skills unlock at level 1000 for users with default mcMMO settings, or 100 for those using the optional Standard scaling.
You can tweak the benefits of these skills in advanced.yml, the default settings are meant to be a good starting point.

Crossbows and Tridents are WIP skills, I would like feedback on discord about them.

More info on the new Triple Drop skills (Mother Lode, Clean Cuts, Verdant Bounty):
Currently these start at about 5%  chance and can reach a maximum 50% chance if a player acquired 10,000 skill, you can adjust this in advanced.yml
These skills respect double drop settings from config.yml just like the corresponding Double Drop skills do, if a double drop is disabled for an item, then it's disabled for triple drops too.
I added a new Power Level Command, for now this just shows you your current power level. If I ever add features based on power level, this command will likely display output related to those features.

Regarding Maces, I will likely add that as a WIP skill when the next Minecraft update drops.
2024-03-30 06:09:59 -07:00
gecko10000
bead5feb14 Make PAPI expansion persist (#4986) 2024-03-30 05:31:47 -07:00
nossr50
ed8c8107f9 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2024-03-19 16:16:11 -07:00
nossr50
b6697141f7 add ExploitFix.PreventArmorStandInteraction to prevent combat abilities going off on armor stands 2024-03-14 13:24:57 -07:00
Lorenzo Cardinali
04ed2a47d4 Fixed import errors related to Alchemy data in AdvancedConfig (#4983) 2024-03-10 18:59:15 -07:00
nossr50
7da8c8c83a 2.1.231 2024-03-09 21:16:59 -08:00
Mangchi__
4d060b192b Update locale_ko.properties (#4977)
* Update locale_ko.properties

* Update locale_ko.properties fixed-1
2024-03-09 20:17:14 -08:00
Momshroom
2117c67084 Fixed NPE when party creation doesn't use password. Solves bug reported here: https://discord.com/channels/526933440214597677/526938425161416727/1213131451235827753 (#4981)
Signed-off-by: Momshroom <Momshroom@gmail.com>
2024-03-09 20:16:14 -08:00
nossr50
4d85f24d98 2.1.230 2024-02-22 18:04:57 -08:00
nossr50
416c5383c9 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2024-02-22 17:57:17 -08:00
IAISI
7f9ed94d23 Fix exceptions on EntityCombustByEntityEvent, EntityDamageByEntityEvent, PartyAutoKickTask if parties are disabled (#4976)
* Only run EntityListener#checkParties on EntityCombustByEntityEvent if Parties are enabled

* Only run PartyAutoKickTask Task if Parties are enabled

* Only run EntityListener#checkParties on EntityDamageByEntityEvent if Parties are enabled

* Check if Parties are enabled before running inSameParty in CombatUtils#processCombatXP

---------

Co-authored-by: Dieu <info@l4b.org>
2024-02-22 17:57:05 -08:00
nossr50
b0d0030d60 2.1.230 2024-02-22 17:54:42 -08:00
IAISI
cdc187b211 Fix PartySaving related NPEs (only save parties if they're enabled) (#4973)
Co-authored-by: Dieu <info@l4b.org>
2024-02-20 09:20:08 -08:00
nossr50
3361d28887 Party system can now be disabled via config
Closes #4873
2024-02-19 17:55:57 -08:00
nossr50
c358c8ce0b Add missing getHandlerList() to McMMOEntityDamageByRuptureEvent fixes #4972 2024-02-19 16:12:39 -08:00
nossr50
aa65be0e1b dev mode 2024-02-17 16:30:47 -08:00
nossr50
85f27fdbdb 2.1.228 2024-02-14 13:17:46 -08:00
nossr50
5bfca3c218 Fix spigot api break for entity damage events 2024-02-13 18:04:00 -08:00
nossr50
94754b150c Dev mode 2024-01-02 23:31:48 -08:00
nossr50
415e3df226 2.1.227 2024-01-02 22:45:38 -08:00
Robert Alan Chapton
b5608ccb01 Update README.md 2023-12-23 15:53:30 -08:00
Robert Alan Chapton
d57e225576 Update README.md 2023-12-23 15:53:08 -08:00
Robert Alan Chapton
2f166507ca Update README.md 2023-12-23 15:50:49 -08:00
MithicSpirit
347e6112fb Make mcMMO anvil sounds categorized (#4954)
Default anvil sound is way too loud, and being in the master category
makes it hard to manage player-side without making the entire game too
soft.
2023-12-21 17:54:29 -08:00
Min Sa-Hun
65dfcb492d Renewed and completed the Korean locale (#4956)
Co-authored-by: Pindang2 <workspace@pindang2.com>
2023-12-21 17:53:38 -08:00
YuanYuanOwO
23a549a6d3 Update locale_zh_CN.properties (#4953)
Update language file to fix a typo error
2023-12-21 17:52:51 -08:00
nossr50
a522ab7b2f updata todo note 2023-12-16 17:59:40 -08:00
nossr50
a0923ad786 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-12-16 17:46:37 -08:00
nossr50
dd04ee48b9 2.1.226 2023-12-16 17:45:17 -08:00
PikaMug
89b895af81 Update pom.xml with WorldEdit (#4951) 2023-10-27 11:19:38 -07:00
nossr50
9e1f5b44a6 dev mode 2023-10-15 12:29:27 -07:00
nossr50
a54590576f 2.1.225 2023-10-15 12:18:12 -07:00
Spongecade
06160c6d04 Update Minecraft wiki link to new domain (#4944) 2023-10-15 10:47:21 -07:00
nossr50
12e5a7f054 Bamboo is now treated like a cactus/sugar cane 2023-10-08 16:51:59 -07:00
nossr50
1f20e6344b 2.1.224 2023-10-02 18:16:02 -07:00
nossr50
13ba51cdf1 Fixed some mistakes in shake config 2023-09-30 15:46:20 -07:00
nossr50
4f22391465 Spelling/Grammar 2023-09-30 15:44:56 -07:00
nossr50
5f1a545437 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-09-30 15:43:30 -07:00
nossr50
bad7023129 Shake has 8 ranks again 2023-09-30 15:43:19 -07:00
Huynh Tien
785f18c13a update FoliaLib (#4935)
- fix an issue with 0 ticks setting
- disable scheduler warning
2023-09-03 16:41:35 -07:00
nossr50
357995ecb0 2.1.223 Folia Support Added 2023-08-26 16:21:09 -07:00
nossr50
3e26eca48e Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-08-26 16:17:39 -07:00
nossr50
dd339c20ea Updated API 2023-08-26 16:17:31 -07:00
Yomamaeatstoes
c34230a82e mcMMO-Folia-PR (#4925)
Folia Support

---------

Co-authored-by: Rockyers <ethan@yocom.org>
Co-authored-by: TechnicallyCoded <technicallycoded@gmail.com>
Co-authored-by: HSGamer <huynhqtienvtag@gmail.com>
2023-08-26 16:16:18 -07:00
Greymagic27
192626f4da Fix packaging error on windows #4911 (#4919) 2023-08-19 14:23:05 -07:00
nossr50
24a57fab3d 2.1.222 2023-07-09 14:43:38 -07:00
nossr50
78596dc00e Glow Lichen nerf 2023-06-25 13:51:00 -07:00
nossr50
0b1b753d4c Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-06-25 13:47:25 -07:00
nossr50
3cbdcddcc1 Crossbows do not count as unarmed item with unarmed items setting 2023-06-25 13:47:04 -07:00
dependabot[bot]
25ecb6e1de Bump guava from 31.1-jre to 32.0.0-jre (#4903)
Bumps [guava](https://github.com/google/guava) from 31.1-jre to 32.0.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 18:46:30 -07:00
nossr50
019d22d92a Make mcMMO quieter by moving most log messages to debug only 2023-06-19 16:26:30 -07:00
nossr50
e39022cc64 2.1.221 2023-06-19 14:11:53 -07:00
nossr50
a41106ee30 Update changelog 2023-06-17 20:34:18 -07:00
nossr50
b2110d4e1c PAPI Support pt 2 2023-06-17 20:32:51 -07:00
nossr50
f22043ebb5 PAPI Support WIP 2023-06-17 20:22:49 -07:00
nossr50
cc1b511c02 Don't look up offline players by name 2023-06-17 15:56:36 -07:00
nossr50
e9a020565f Added fail safes against bonus drop meta not being cleaned up 2023-05-29 14:34:47 -07:00
nossr50
44ab8d93ab Dev mode 2023-05-29 14:15:04 -07:00
Warrior
78922ea337 Fix blast mining bonus drops option not working (#4895) 2023-05-29 13:58:24 -07:00
nossr50
db01b61371 2.1.220 2023-05-13 14:42:14 -07:00
Warrior
133a60c4bf Fix child skills counting towards power level in /inspect (#4889) 2023-04-23 11:08:06 -07:00
nossr50
684e96ff6b Fix RankConfig 2023-04-17 12:17:28 -07:00
nossr50
f40f68bdf0 Fix RankConfig not using the new updating config system 2023-04-17 12:07:59 -07:00
nossr50
640f4b0a9b Fix mcMMO attempting to copy out custom repair/salvage configs 2023-04-17 12:07:41 -07:00
nossr50
978ee4a9a3 Optimize the imports 2023-04-11 15:49:37 -07:00
nossr50
0ab93586fd Config files will update automatically again 2023-04-11 15:48:14 -07:00
nossr50
921a0228db Merge remote-tracking branch 'origin/master' 2023-04-07 17:00:13 -07:00
nossr50
ac68c4ebe6 2.1.219 2023-04-07 17:00:01 -07:00
Smudge
4553310bb9 Fixed fishing exploiting compatibility (#4859)
* Fixed fishing exploiting compatibility

* Moved same target to class variable
2023-04-03 17:52:00 -07:00
Warrior
9b0632d63c Make party loading more resilient (#4881) 2023-04-03 17:49:35 -07:00
Warrior
69ef484b86 Fix dots not being replaced when renaming party (#4882) 2023-04-03 17:48:53 -07:00
Warrior
606a92f1ef Fix /party teleport NPE (#4885) 2023-04-03 17:48:01 -07:00
nossr50
79730383ab Fixed wiki url being incorrect in various commands 2023-04-03 16:47:58 -07:00
nossr50
7264e1a8d6 Small tweaks 2023-04-03 12:07:34 -07:00
nossr50
e011f545a7 Added smithing_table to tool readiness blacklist 2023-04-02 20:44:00 -07:00
nossr50
283fa14380 Add Camel, Sniffer, and Snifflet to taming XP 2023-04-02 20:42:06 -07:00
nossr50
5f388a9906 Add support for torchflower replanting to herbalism 2023-04-02 20:38:05 -07:00
nossr50
cd96bc79d8 Change isHerbalismDrop to use strings.. this method still needs more work 2023-04-02 20:24:04 -07:00
nossr50
ae961caeab Added Torchflower to herbalism experience and bonus drops 2023-04-02 20:11:10 -07:00
nossr50
0b4d87aebc Add Sniffer and Snifflet to combat experience in experience.yml 2023-04-02 20:07:50 -07:00
nossr50
6106f70c24 Added Pitcher_Plants to bonus drops and herbalism experience 2023-04-02 20:05:52 -07:00
nossr50
100a7f8a8f Added pink_petals, cherry_wood, and cherry_log to bonus drops in config.yml 2023-04-02 20:02:32 -07:00
nossr50
4c792c4f2c Added Pink_Petals to experience.yml 2023-04-02 20:00:58 -07:00
nossr50
db4b820f80 Add new hanging signs to tool readiness blacklist 2023-04-02 19:58:16 -07:00
nossr50
ca710b4302 Add chiseled_bookshelf to tool readiness blacklist 2023-04-02 19:55:30 -07:00
nossr50
668cc0e4a3 Add support for upcoming Cherry trees 2023-04-02 19:53:13 -07:00
nossr50
6d0542b524 Merge remote-tracking branch 'origin/master' 2023-03-26 13:22:41 -07:00
nossr50
d84a5b37b7 Update kyori dependencies 2023-03-26 13:22:31 -07:00
optimizing-ci-builds
c072ae4990 disable xml report (#4880) 2023-03-21 22:05:40 -07:00
nossr50
2d78eaa495 Fixed Beetroots double drop issue #4667 2023-03-19 21:21:54 -07:00
Warrior
6bdc51be76 Fix missing return in notify command (#4870) 2023-02-25 15:20:45 -08:00
nossr50
af15617196 Add config toggle for Blast Mining bonus drops to advanced.yml 2023-02-19 13:40:14 -08:00
CuteLittleSky
643dff7915 Update locale_zh_CN.properties (#4858) 2023-02-09 18:16:26 -08:00
Justin
01fbfccc0d feat: Make power level display for offline players (#4861)
Fixes #4599
2023-02-09 18:12:46 -08:00
Jok
2362fe994a Don't call EntityDamageByEntityEvent with null damager (#4863)
Co-authored-by: Elioby <elioby@users.noreply.github.com>
2023-02-09 18:11:30 -08:00
nopeless
08b08b1285 Fix: player is no longer immune to projectiles shot by themselves (#4856) 2023-01-28 11:57:31 -08:00
nossr50
965540dfaf 2.1.218 2022-12-04 14:32:34 -08:00
destro174
75822472fc Add item in mainhand when spawning in lumber bonus blocks. (#4826) 2022-12-04 14:22:37 -08:00
Daniil Z
59aecb79a1 Update Russian locale (#4832)
Added/updated some lines
Fixed new-line characters
2022-12-04 14:21:44 -08:00
DarkKnights22
c865c2d2e3 Fix bug where players could know staff are invis (#4833)
* Fix bug where players could know staff are invis

* remove whitespace
2022-12-04 14:21:22 -08:00
MrPowerGamerBR
93c64a8770 Fix pt_BR ability on typo (#4837) 2022-12-04 14:19:48 -08:00
Greymagic27
30ac82181e Updated plugins to latest version (#4817) 2022-08-09 07:35:12 -07:00
nossr50
2b219f48ec Dev mode 2022-08-07 16:13:18 -07:00
nossr50
fed0483d40 2.1.217 2022-08-07 16:03:55 -07:00
nossr50
101c43a4bc Tree Feller now partially destroys trees if the whole tree is too big
Fixes #4811
2022-08-07 15:55:19 -07:00
nossr50
fb738d85f6 Mangrove trees are now properly marked natural from growth
Fixes #4810
2022-08-07 15:54:22 -07:00
nossr50
032a407c8a Update changelog and version 2022-08-07 14:27:42 -07:00
Greymagic27
33e615f0f1 Updated dependencies to fix hovering over subskills for 1.19.2 (#4814)
* Updated dependencies that should fix the issue

* Updated spigotmc version

* Updated rest of dependencies

* Updated dependencies that fix the issue. Investigating what dependency update breaks compiling.

* Found the dependency that caused the compile issue, so have not updated that one
2022-08-07 14:19:46 -07:00
dod0lp
8feba60e2c Update config.yml (#4809) 2022-08-03 07:43:03 -07:00
nossr50
8a4fe8ae5d 2.1.216 2022-07-24 10:09:48 -07:00
nossr50
45f96793a5 Revert "Players who used unarmed combat are still considered using unarmed while not holding weapons for a brief time period"
This reverts commit 993b418fbc.
2022-07-24 10:05:56 -07:00
nossr50
df0362bcba Allow mining benefits while using Hoe 2022-07-23 17:04:43 -07:00
nossr50
25d558a5fa Added Sculk blocks to Mining 2022-07-23 16:57:42 -07:00
nossr50
c0e4d7a43d 2.1.215 - Unarmed change + Bug Fixes 2022-07-23 16:22:02 -07:00
nossr50
993b418fbc Players who used unarmed combat are still considered using unarmed while not holding weapons for a brief time period 2022-07-23 16:13:49 -07:00
nossr50
9cf856221d update changelog 2022-07-23 14:47:32 -07:00
nossr50
4db6e03517 Hacky workaround for Spigot API bug not showing burntime to the client when burntime was too high 2022-07-23 14:43:24 -07:00
nossr50
eb1393c02c Fix burnTime debug prints on mmodebug players 2022-07-23 14:24:31 -07:00
nossr50
e1a54b72a9 update changelog 2022-07-23 13:34:38 -07:00
Greymagic27
b266c7ce5b Updated Dependencies (#4798)
* Updated Dependencies

* Fix spelling mistake in dependencies

* Fixed dependency error that would prevent the plugin from loading.

Turned out I put in the wrong acf-bukkit, preventing the plugin from working. Oops!
2022-07-17 14:59:19 -07:00
nossr50
38f937fa01 revert potential furnace animation bug fix 2022-07-17 14:56:44 -07:00
nossr50
6d7982c0cf Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2022-07-17 14:03:10 -07:00
nossr50
89fa26d0eb Potential fix for #3005 2022-07-17 14:00:03 -07:00
Greymagic27
edd85c2f19 Updated kyori adventure-platform dependencies (#4797) 2022-07-17 13:38:44 -07:00
Greymagic27
88b6517f88 Added Dripstone Block to experience.yml (#4796) 2022-07-15 15:07:19 -07:00
PikaMug
2c09a0fdb6 Switch to new sk89q repo (#4791) 2022-07-02 19:25:27 -07:00
nossr50
90721ee859 Add missing Mangrove_Log to experience.yml 2022-06-26 18:43:09 -07:00
destro174
aa4011a226 Use item in mainhand to get drops when using treefeller (#4781) 2022-06-11 16:41:27 -07:00
nossr50
fa82fe8e67 Level up broadcasts should be visible to the player of origin 2022-06-09 22:50:36 -07:00
nossr50
444e1532f2 2.1.214 2022-06-09 22:39:11 -07:00
Smudge
1a34d2f647 Added 25% xp boost permission (#4773) 2022-06-09 14:31:06 -07:00
abridgedcarp
d543843235 Fix Maven build failure (#4779) 2022-06-09 14:26:50 -07:00
nossr50
c40af913f4 mcMMO 2.1.213 2022-06-07 18:07:14 -07:00
nossr50
f6268fe291 Add in new 1.19 stuff and tweak treasures.yml 2022-06-07 18:00:32 -07:00
nossr50
27854720f0 Add some exploit prevention to fishing 2022-05-15 15:24:25 -07:00
nossr50
d19cf1e260 2.1.212 - Fixed herbalism exploit and added damage limit for XP
calculations used in combat
2022-04-28 18:31:10 -07:00
Warrior
4a8630262e Fix hanging plants searching up instead of down. (#4766) 2022-04-28 08:33:45 -07:00
Werner
c41d2d1f39 Bump shade-plugin to 3.3.1 (#4762)
fixes building
2022-04-10 13:09:03 -07:00
nossr50
8821fb0b2f 2.1.211 2022-03-18 15:07:02 -07:00
nossr50
5ab55c1653 mcMMO will no longer use the DamageModifier API (potentially fix immortal player bug) 2022-03-17 19:58:42 -07:00
nossr50
8066f7f7f2 Tweak damage debug info to show modifier values 2022-03-17 16:08:50 -07:00
nossr50
5ea18e8ba7 Add combat debug info for player versus player combat /mmodebug 2022-03-17 15:03:42 -07:00
nossr50
0bf3f98d95 2.1.210 2022-03-17 13:59:17 -07:00
nossr50
fa33fa3d32 Revert 3 commits (work will be continued in branch)
Revert "Disabling mcMMO when the config breaks is dumb"

This reverts commit 86e7bfbf89.

Revert "Config validation rewrite part 1"

This reverts commit 16e90da8fd.

Revert "Update changelog"

This reverts commit 0ccd89fad4.
2022-03-17 13:49:46 -07:00
405 changed files with 15027 additions and 9667 deletions

View File

@@ -49,4 +49,4 @@ jobs:
# 4. Build via Maven # 4. Build via Maven
- name: Build via Maven - name: Build via Maven
run: mvn verify -B --file pom.xml run: mvn verify -B --file pom.xml -DdisableXmlReport=true

1
.gitignore vendored
View File

@@ -55,3 +55,4 @@
# Atlassian Stuff # Atlassian Stuff
/atlassian-ide-plugin.xml /atlassian-ide-plugin.xml
/nulllocale_override.properties

View File

@@ -1,9 +1,462 @@
Version 2.1.210 Version 2.2.015
Fixed a memory leak involving mob metadata Added Maces skill
mcMMO doesn't disable itself when configs are invalid anymore Added Mace to repair.vanilla.yml (see notes)
mcMMO will fix bad config values when loading (WIP) Fixed a bug where spamming attacks would still apply full bonus dmg and full chance to proc abilities (see notes)
Fixed some misc missing permissions for crossbows/tridents
NOTES: NOTES:
You shouldn't need to update repair.vanilla.yml, it should update automatically
Maces is a new skill that is in early development, feedback is appreciated.
Some ideas I had for the Maces are on hold as they are lacking proper API from Spigot.
This is mostly pertaining to smash attacks, I had some ideas for enhancing them but without the proper API I will hold off for now.
While working on Maces, I noticed a bug where spamming attacks would still apply full bonus damage and full chance to proc abilities, this has been fixed.
When you swing your weapon in Minecraft, you gain an "Attack Strength" value, which is relative to your cooldown, mcMMO was supposed to be making use of this value, but at some point in the past this was broken.
I have fixed this and now mcMMO will use the attack strength value to determine the bonus damage and chance to proc abilities.
For servers modifying Minecraft combat to not have this "cooldown", mcMMO should behave as you would expect, with full damage and full chance to proc abilities.
Version 2.2.014
Fixed a bug where Luck Of The Sea was being applied for Super Breaker (and other abilities)
Version 2.2.013
Added Breeze to experience.yml
Added Bogged to experience.yml
(Locale) Updates to zh_TW (thanks chunkiuu)
(Locale) Updates to zh_CN (thanks haha44444)
Modified the RNG for dropping non-ore blocks from Blast Mining to yield about 50% of what was destroyed
(API) Deprecated com.gmail.nossr50.mcMMO.getPlaceStore
(API) Added com.gmail.nossr50.mcMMO.getUserBlockTracker
(API) Added com.gmail.nossr50.mcMMO.getChunkManager
(API) Added new methods to com.gmail.nossr50.util.blockmeta.UserBlockTracker for easier readability
(API) Deprecated many poorly named methods in UserBlockTracker (see notes)
(Codebase) Cleaned up and organized unit tests relating to UserBlockTracker
Added missing entries for Tridents/Xbows/Maces to config.yml (see notes)
NOTES:
Some settings such as Hardcore.Death_Stat_Loss.Enabled were missing entries for the new skills, I have added them to the default config.
Missing entries does not mean these things wouldn't work without them present, as default values will be used when config entries are not present.
These missing entries should be added to your config upon start up with this update.
Regarding the API changes, not planning to delete the deprecated methods in UserBlockTracker anytime soon, as nothing has really changed other than the names.
For anyone consuming mcMMO API, I would still recommend switching off these deprecated methods as soon as you can, just for future-proofing.
Version 2.2.012
Fixed a bug where Daze would cause an exception in older game versions (1.20.4 and older)
Version 2.2.011
Fixed bug where some potions on older versions (1.20.4 and older) were not brewable (night vision extended, etc)
Improved logging for Alchemy potion look up (see notes)
NOTES:
Added detailed logging when multiple configured potions match an ItemStack.
This will help identify issues with potion configuration.
Version 2.2.010
Fixed being unable to load REGEN potion type on new versions of Paper/Spigot 1.20.6
Fixed some potions not gaining XP when brewed (Level 2 potions, etc)
BrewingStands will now remember who owns them, this persists across restarts (see notes)
Fixed rare NPE in mcMMO events when player data was unable to be retrieved
Fixed a NPE that could happen when damaging armor with Axes
Fixed a bug where Alchemy brewing would be cancelled if the player died
(API) Added getMcMMOPlayer() to McMMOPlayerSkillEvent
(API) Added new ctor McMMOPlayerSkillEvent(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType)
(API) Deprecated ctor McMMOPlayerSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Added ctor McMMOPlayerAbilityEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Deprecated ctor McMMOPlayerAbilityEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Deprecated ctor McMMOPlayerAbilityActivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Added ctor McMMOPlayerAbilityActivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Deprecated ctor McMMOPlayerCatalysisEvent(org.bukkit.entity.Player, double)
(API) Added ctor McMMOPlayerCatalysisEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, double)
(API) Deprecated util method EventUtils.callPlayerAbilityActivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Added util method EventUtils.callPlayerAbilityActivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Deprecated ctor McMMOPlayerFishingEvent(org.bukkit.entity.Player)
(API) Added ctor McMMOPlayerFishingEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer)
(API) Deprecated ctor McMMOPlayerFishingTreasureEvent.McMMOPlayerFishingTreasureEvent(org.bukkit.entity.Player, org.bukkit.inventory.ItemStack, int)
(API) Added ctor McMMOPlayerFishingTreasureEvent.McMMOPlayerFishingTreasureEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, org.bukkit.inventory.ItemStack, int)
(API) Deprecated ctor McMMOPlayerMagicHunterEvent(org.bukkit.entity.Player, org.bukkit.inventory.ItemStack, int, java.util.Map<org.bukkit.enchantments.Enchantment,java.lang.Integer>)
(API) Added ctor McMMOPlayerMagicHunterEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, org.bukkit.inventory.ItemStack, int, java.util.Map<org.bukkit.enchantments.Enchantment,java.lang.Integer>)
(API) Deprecated ctor McMMOPlayerAbilityDeactivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Added ctor McMMOPlayerAbilityDeactivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.PrimarySkillType)
(API) Deprecated util method EventUtils.callAbilityDeactivateEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SuperAbilityType)
(API) Added util method EventUtils.callAbilityDeactivateEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SuperAbilityType)
(API) Deprecated util EventUtils.callSubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SubSkillType)
(API) Added util EventUtils.callSubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SubSkillType)
(API) Deprecated ctor SubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SubSkillType)
(API) Added ctor SubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SubSkillType)
(API) Deprecated ctor SubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.SubSkillType, double)
(API) Added ctor SubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.SubSkillType, double)
(API) Deprecated ctor SubSkillEvent(org.bukkit.entity.Player, com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill)
(API) Added ctor SubSkillEvent(com.gmail.nossr50.datatypes.player.McMMOPlayer, com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill)
(API) Deprecated ctor AlchemyBrewCheckTask(org.bukkit.entity.Player, org.bukkit.block.BrewingStand)
(API) Added ctor AlchemyBrewCheckTask(org.bukkit.block.BrewingStand)
NOTES:
You can now use hoppers and brewing stands and not have to worry about having to re-interact with the brewing stand over and over again
Ownership of a brewing stand is whoever last interacted with it, this persists across restarts
This is not an exhaustive list of API changes in this update, but most of the important ones should be documented here.
Version 2.2.009
Fixed a bug that prevented mcMMO from loading on MC versions older than 1.20.6
Dramatically increased the base XP for Alchemy again (see notes)
NOTES:
Alchemy leveling still felt too slow, so I've increased it again. You can either delete experience.yml to get the new values or adjust them manually.
If you haven't updated mcMMO since 2.2.006 or older you don't need to do anything to get these new values.
The new default values are...
Potion_Brewing:
Stage_1: 666
Stage_2: 1111
Stage_3: 1750
Stage_4: 2250
Version 2.2.008
Fixed alchemy potions not upgrading correctly (This will only affect new potions made, see notes)
Fixed a bug where alchemy potions had italicized names
Fixed a bug where messages were not being sent to the action bar in 1.20.6
(SQL) Fixed bug that broke /mccooldowns and /archery in some circumstances
Fixed some exceptions that could happen with parties disabled (thanks IAISI)
NOTES:
mcMMO-exclusive Potions (haste, etc) made on version 2.2.007 of mcMMO will not upgrade correctly, you'll just have to make new ones. Sorry for the inconvenience.
Alchemy potions will now be brewed as type "Mundane" behind the scenes, this used to be Uncraftable/Water. This led to some issues. So I've changed it to be Mundane.
Version 2.2.007
Compatibility with the 1.20.5 / 1.20.6 MC Update
Fixed bug where Alchemy was not brewing certain potions (haste, etc)
Tree Feller no longer restricts how many saplings can drop
Tree Feller now drops leaves 25% of the time (up from 10%)
Alchemy XP has been DRAMATICALLY increased, it was extremely grindy by default
Alchemy experience values in experience.yml are now found under 'Experience_Values.Alchemy.Potion_Brewing'
Fixed bug where the probability of success of Graceful Roll was not being calculated correctly
Fixed bug where Green Thumb did not replant if seed was in the off hand
Added armadillo to combat experience in experience.yml
NOTES:
While fixing various Alchemy bugs, I noticed Alchemy leveled SUPER slow, I have increased it dramatically. Feel free to change it back by modifying the new values in experience.yml
I did my best to keep mcMMO compatible with older versions of Minecraft for this update.
This update to MC was quite large, with breaking changes to a lot of code relating to Alchemy, and some other things.
I expect there to be bugs, please report them on GitHub or Discord, but preferably GitHub.
I will be working on fixing these bugs as they come in, so please be patient.
Version 2.2.006
Added new config custom_item_support.yml
Added support for hex color codes in the locale file, uses the format &#RRGGBB (see notes)
Added setting to disable repair on items with custom models, this is not on by default
Fixed a bug where sometimes the locale name of a skill would get lowercased
Fixed a bug where JSON text components did not get colored properly some of the time
Fixed en_US locale string 'Commands.Skill.Leaderboard' not being colored properly
Fixed skill commands incorrectly telling you to use their locale name, this isn't currently possible
Updated outdated wiki URLs in commands to point to the new wiki
Removed the msg about skills being migrated to a new system when using /mmoinfo command
Added new locale entry 'Anvil.Repair.Reject.CustomModelData'
Added new locale entry 'Anvil.Salvage.Reject.CustomModelData'
Updated en_US locale entry 'JSON.DescriptionHeader'
(API/Codebase) Added some util methods and basic unit tests for LocaleLoader
NOTES:
Hex Color support in locale files is here!
The hex color code format for the locale files is &#RRGGBB
An example entry applying yellow as a hex color code would look like this:
Axes.SkillName=&#FFFF00Axes
In general, JSON locale entries will either not work with hex color codes or will have the color code stripped out, in the future I will add support for the JSON components to use hex colors from the locale
Let me know in detail what kind of support you'd like to see in mcMMO regarding custom items, I'm open to suggestions.
This update adds a new config file to allow server owners to disable repair or salvage on items with custom models,
This prevention mechanism is not enabled by default, change the settings in custom_item_support.yml if you want to enable it.
This feature is off by default for now to keep compatibility with existing servers, but it may be enabled by default in the future if feedback suggests it should be.
As a reminder, anyone can update the wiki by clicking on the "edit on github" link on various pages, this will take you to the wiki's source code on GitHub, submit a PR to make changes
Version 2.2.005
Fixed a bug where certain skills such as Dodge/Arrow Deflect had no skill cap and would continue improving forever
Reduced messages on startup for SQL DB
(API) Constructor for ProbabilityImpl now takes a raw value between 0 and 1 instead of an inflated percentage
(API) Added some convenience methods to Probability, and ProbabilityUtil classes
(Codebase) Added more unit tests revolving around Probability/RNG
Version 2.2.004
Fixed bug where values from Experience_Formula.Skill_Multiplier were not functioning
NOTES:
A reminder that these values are multipliers and no longer divisors, if you want 10x lower XP, a value of .1 would do the job.
Version 2.2.003
(SQLDB) Fixed a bug where lastlogin was using a value that was too large
(SQLDB) Fixed bug where crossbows was not getting added to SQL schema for some users
Version 2.2.002
Fixed bug where thrown tridents did not grant XP or benefit from subskills
Fixed bug where trickshot marked bounced arrows as being shot from a bow instead of being shot from a crossbow
Version 2.2.001
Fixed Crossbow's Powered shot showing the text for the wrong skill from the locale when using /crossbows command
Version 2.2.000
General
Added Crossbows Skill, this skill is an early preview / WIP and feedback on discord is appreciated
Added Tridents Skill, this skill is an early preview / WIP and feedback on discord is appreciated
Added an "endgame" triple drop subskill 'Mother Lode' to Mining
Added an "endgame" triple drop subskill 'Clean Cuts' to Woodcutting
Added an "endgame" triple drop subskill 'Verdant Bounty' to Herbalism
Added /mmopower command which simply shows your power level (aliases /mmopowerlevel /powerlevel)
Quite a few misc bugs were patched relating to random chance, some involving perk permissions
Config
Added 'Send_To_Console' settings to chat.yml to toggle sending party or admin chat messages to console
Replaced 'Experience_Formula.Modifier' in experience.yml with 'Experience_Formula.Skill_Multiplier' which is easier to understand and less prone to divide by zero bugs
child.yml config is gone now, feel free to delete it
Added ExploitFix.PreventArmorStandInteraction to experience.yml to prevent players from triggering mcMMO abilities off armor stands
Tweaks
Tree Feller now drops 90% less non-wood block rewards (leaves/etc) on average from Knock on Wood.
Treasure drop rate from Shake, Fishing, Hylian, and Excavation now benefit from the Luck perk
Updated advanced.yml with entries for the new skills
Permission nodes
Added 'mcmmo.commands.mmopower' permission node for the new /mmopower command
Added 'mcmmo.commands.crossbows' permission node
Added 'mcmmo.ability.crossbows.crossbowslimitbreak' permission node
Added 'mcmmo.ability.crossbows.trickshot' permission node
Added 'mcmmo.ability.crossbows.poweredshot' permission node
Added 'mcmmo.commands.tridents' permission node
Added 'mcmmo.ability.tridents.tridentslimitbreak' permission node
Added 'mcmmo.ability.tridents.impale' permission node
Added 'mcmmo.ability.herbalism.verdantbounty' permission node
Added 'mcmmo.ability.mining.motherlode' permission node
Added 'mcmmo.ability.woodcutting.cleancuts' permission node
Locale
Added locale entries for all the new skills/subskills
Codebase / Misc
PAPI's '/papi reload' command will no longer unload mcMMO (thanks gecko10000)
Major rewrite for how random chance was handled in the code
Many skills with RNG elements now send out a SubSkillEvent (which can be used to modify probability or cancel the results), some skills without RNG still send out this event when activated, this event is cancellable so it can be used to make a skill fail
A lot of new unit tests were added to help keep mcMMO stable as part of this update, of course, more could always be added.
NOTES:
One feature of this update is to provide a endgame benefits to some skills that you can grind for a long time, ideally for a long while. I will likely expand upon this idea in future updates.
A few skills have these endgame oriented subskills, these new subskills provide a small benefit at first that grows and scales up to level 10,000 (or 1,000 for Standard mode which no one uses) and does not have ranks (other than the initial rank to unlock it).
These endgame sub skills unlock at level 1000 for users with default mcMMO settings, or 100 for those using the optional Standard scaling.
You can tweak the benefits of these skills in advanced.yml, the default settings are meant to be a good starting point.
Crossbows and Tridents are WIP skills, I would like feedback on discord about them.
Tridents especially is very early, I have some ideas but I want to hear what you think about it.
More info on the new Triple Drop skills (Mother Lode, Clean Cuts, Verdant Bounty):
Currently these start at about 5% chance and can reach a maximum 50% chance if a player acquired 10,000 skill, you can adjust this in advanced.yml
These skills respect double drop settings from config.yml just like the corresponding Double Drop skills do, if a double drop is disabled for an item, then its disabled for triple drops too.
I added a new Power Level Command, for now this just shows you your current power level. If I ever add features based on power level, this command will likely display output related to those features.
Regarding Maces, I will likely add that as a WIP skill when the next Minecraft update drops.
Version 2.1.231
Fixed a bug preventing parties from being made without passwords (Thanks Momshroom)
Updated korean locale (thanks mangchi57)
Added some unit tests for party creation
Version 2.1.230
Fixed an error that could happen when mcMMO was saving when parties were disabled by party.yml (thanks IAISI & L4BORG)
Fixed several exceptions when checking PVP damage when parties were disabled by party.yml (thanks IAISI & L4BORG)
Version 2.1.229
Added new party.yml config, which lets admins disable the party system entirely without having to use permissions
Fixed error caused by missing API in McMMOEntityDamageByRuptureEvent
(API) Major API changes to PartyManager
(API) PartyManager is no longer a static singleton class, use mcMMO.getPartyManager() to get the PartyManager
(API) Added com.gmail.nossr50.mcMMO.isPartySystemEnabled to check if the party system is enabled
(API) Added com.gmail.nossr50.api.PartyAPI.isPartySystemEnabled as an alternative, to check if the party system is enabled
(API) Added missing com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent.getHandlerList
NOTES:
Admins can now enable/disable the whole party system with a setting in the new party.yml config
You'll have to start your server one time to generate the config, then change the setting and reboot your server.
Version 2.1.228
Fixed a stack trace due to Spigot API break on EntityDamageEvent and EntityDamageByEntity event
(API) - Removed FakeEntityDamageEvent and FakeEntityDamageByEntityEvent
(API) - Reworked McMMOEntityDamageByRuptureEvent, this no longer extends EntityDamageByEntityEvent, instead it extends EntityEvent
Notes:
Some care went into keeping mcMMO compatible with older versions despite a big API break from Spigot, this may introduce some new bugs, so please report them if you run into any.
Version 2.1.227
Fixed bug where some text would not be displayed to players (Adventure dependency update)
Repair sound effect from mcMMO can now be adjusted in Minecraft sound options (Thanks MithicSpirit)
Korean locale updated (Thanks Pindang2)
Simplified Chinese locale updated (Thanks YuanYuanOwO)
NOTES:
For those curious, mcMMO uses Adventure to do a lot of the message sending to players.
It typically needs updating when new versions of MC come out, sorry for the delay on my part.
Version 2.1.226
Added Short_Grass to experience.yml for Herbalism
Updated Hylian Treasures "Bushes" alias to use short_grass when playing on new Minecraft versions
Fixed dirt_path and grass_block not being correctly whitelisted for herbalism abilities
Version 2.1.225
Fixed text from mcMMO not being sent or displayed to the player
Updated Adventure dependencies
Added new API McMMOPlayerNotificationEvent.getPlayer
Version 2.1.224
Updated to a new build of ACF to fix NoSuchFieldException locale
Improved Folia Support (Thanks HSGamer)
Fishing Shake has 8 ranks again
NOTES:
At some point Shake got reduced to 1 rank, this didn't really make sense as it was meant to be a skill that ranked up and got better over time.
It now has 8 ranks again, you may need to update advanced.yml and skillranks.yml to get the new ranks.
Version 2.1.223
Folia Support added (Thanks to HSGamer, TechnicallyCoded, Rockyers, and Yomamaeatstoes)
NOTES: This update brings mcMMO to Folia, not all features are guaranteed to work but from limited testing it appears to be working well.
Version 2.1.222
Fixed dupe exploit
Glow Lichen default XP changed from 200 to 5
A lot of mcMMO logging was moved from INFO to DEBUG, this should reduce the amount of noise in your logs and console
NOTES: If you want to see all logging messages, modify config.yml and set General.Verbose_Logging to true
You will have to adjust experience.yml to get the balance changes, or delete it to generate a new one
Version 2.1.221
PAPI Support is now built into mcMMO and loads when mcMMO loads (as long as you have PAPI running)
Fixed blast mining bonus drops not working (Thanks warriiorrrr)
Added fail safes to prevent bonus drops metadata from lingering on blocks
NOTES: Placeholders were brought in from electroniccat's original work on a PAPI expansion for mcMMO, the placeholders are the same as a result
I will be adding a leaderboard placeholder in the next patch (most likely). Feel free to share details of what functionality you'd want from additional placeholders on discord.
Version 2.1.220
(API) Added TreeFellerBlockBreakEvent class which extends FakeBlockBreakEvent (see notes), this is sent out during Tree Feller processing to allow other plugins to differentiate between Tree Feller and other fake block break events
Config files update automatically again
Default configs are now copied to plugins/mcMMO/defaults for easy reference
Fixed child skills counting towards power level in /inspect (Thanks Wariorrrr)
NOTES: For a while configs were not updating automatically as a rewrite of how config files were loaded was partially done, this is now complete and configs will update automatically again.
Fake block break events have been sent out historically by mcMMO to check other plugins for a players permission to break or place a block, Tree Feller will now specify via inheritance its own event type for this so mcMMO plugins can handle Tree Feller fake block break events differently if they so choose.
You can now view the default configs more easily as they are now copied to plugins/mcMMO/defaults, these configs will be overwritten on start up to match the default values of the config in the JAR
Version 2.1.219
Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge)
Fixed wiki url being incorrect in commands
Party loading is more resilient (Thanks Wariorrrr)
Fixed periods not being replaced whe nrenaming party (Thanks Wariorrrr)
Fixed Party Teleport NPE (Thanks Wariorrrr)
Added support for various new things from Minecraft 1.20
Fixed double drop issue with Beetroots
Added 'Camel' to taming experience in experience.yml
Added 'Sniffer' to taming experience in experience.yml
Added 'Snifflet' to taming experience in experience.yml
Added 'Pitcher_Plant' to bonus drops in config.yml
Added 'Torchflower' to bonus drops in config.yml
Added 'Pink_Petals' to bonus drops in config.yml
Added 'Cherry_Log' to bonus drops in config.yml
Added 'Cherry_Wood' to bonus drops in config.yml
Added 'Camel' to combat experience in experience.yml
Added 'Sniffer' to combat experience in experience.yml
Added 'Snifflet' to combat experience in experience.yml
Added 'Torchflower' to herbalism experience in experience.yml
Added 'Pitcher_Plant' to herbalism experience in experience.yml
Added 'Pink_Petals' to herbalism experience in experience.yml
Added 'Cherry_Log' to woodcutting experience in experience.yml
Added 'Cherry_Wood' to woodcutting experience in experience.yml
Added 'Stripped_Cherry_Log' to woodcutting experience in experience.yml
Added 'Stripped_Cherry_Wood' to woodcutting experience in experience.yml
Added 'Skills.Mining.BlastMining.Bonus_Drops.Enabled' to advanced.yml to enable/disable bonus drops from Blast Mining
NOTE: There are plans to add experience and potentially subskills for discovering items via the new brushing mechanic, but this will have to wait for new Spigot API to become available
Version 2.1.218
Fixed locale pt_BR type (thanks MrPowerGamerBR)
Updated Russian Locale (thanks imDaniX)
Harvest Lumber checks main hand enchantments when delivering bonuses (thanks destro174)
Fixed bug where players could use inspect to determine if vanished players were online (thanks DarkKnights22)
Version 2.1.217
Tree Feller will now break blocks within the limit instead of refusing to fell the entire tree (partial big tree destruction)
Mangrove trees resulting from growth are now marked as natural (existing trees marked unnatural before this update will not be retroactively fixed)
Fixed a bug removing comments from configs (see notes)
Fixed mouse-hover tooltip windows (thanks Greymagic27)
NOTES:
Regarding the secure chat feature Minecraft rolled out, once APIs have updated I will look into rolling support for that into admin/party chat.
Comments should no longer get removed from config but I haven't added any code to add missing comments back in, for now if you want comments you can delete the config file to regenerate it (sorry for the inconvenience)
Version 2.1.216
Reverted Unarmed changes from 2.1.215 (fixes block breaker/beserk active at all time for all players)
Added Sculk_* blocks to Mining XP
You can use Hoe(s) to gain mining XP, Hoe(s) won't benefit from Super Breaker nor will they activate it (see notes)
NOTES:
Hoe's being able to gain Mining XP is primarily for Sculk blocks which have Hoe as the fastest tool yet to me feel like Mining blocks, let me know what you think
The Sculk blocks don't quite fit perfectly as mining-related, especially since hoes are the fastest tool to use for them. Let me know what you think.
Version 2.1.215
Fixed Coal Blocks and potentially other fuel sources not showing burning animation to players (see notes)
Level up broadcasts from level milestones will now be visible to the player who achieved them
Fixed a bug where hovering over skill descriptions did not display anything (thanks Greymagic27)
Added Dripstone to experience.yml (thanks Greymagic27)
Added Mangrove_Log to experience.yml (should fix behavior for tree-feller etc)
Item in main hand is now used for Tree Feller drops (thanks destro174)
NOTES:
The burning animation bug is actually in Spigot, it takes an int for setBurnTime when it really should only take a short as the game is expecting a short value, I implemented a hacky workaround via Math.min
There is a bug where you may lose your config comments, this will be complex to solve, for now you can check our GitHub for the configs with comments.
Version 2.1.214
Temporarily removed FakePlayerAnimationEvent (see notes)
Players can now see their own level up broadcasts
NOTES:
Spigot updated PlayerAnimationEvent with an API break between versions 1.18 and 1.19, as a temporary fix for mcMMO to be able to support both of these
Minecraft versions I have temporarily removed FakePlayerAnimationEvent. I am working on a fix to dynamically use the correct API depending on the version of MC
as many people will likely be stuck on 1.18 for a while.
FakePlayerAnimationEvent existed to circumvent false positives on anti-cheat plugins such as NoCheat, however
I am unsure if it is still needed and removing it may have no ill effects.. however I cannot be certain.
Anti-cheat plugin authors should be informed to update if you run into false positives with mcMMO after this update so they can make the appropriate changes.
Version 2.1.213
Updated various mechanics to recognize and understand the new blocks
Added 'Packed_Mud' to mining xp
Added 'Mud_Bricks' to mining xp
Added 'Reinforced_Deepslate' to mining xp
Added 'Mud' to excavation xp
Added 'Muddy Mangrove Roots' to excavation xp
Added 'Mangrove_Roots' to woodcutting xp
Added 'Stripped_Mangrove_Log' to woodcutting xp
Added 'Stripped_Crimson_Stem' to woodcutting xp
Added 'Stripped_Warped_Stem' to woodcutting xp
Added 'Allay' to combat experience
Added 'Frog' to combat experience and taming experience
Added 'Tadpole' to combat experience
Added 'Warden' to combat experience
Changes to excavation treasures (requires manual editing or regenerating the config)
Added Mud as a block which can drop various treasures (see notes)
Added Muddy_Mangrove_Roots as a block which can drop various treasures (see notes)
Added Stick as a new excavation drop, which drops from mud and muddy mangrove roots (see notes)
Added Potato as a new excavation drop, which drops from mud and dirt (see notes)
Added Feather as a new excavation drop, which drops from mud (see notes)
Added Spyglass as a new excavation drop, which drops rarely from mud and dirt (see notes)
Added Trident as a new excavation drop, which drops somewhat rarely from mud, muddy mangrove roots, and clay (see notes)
Added Heart of the Sea as a new excavation drop, which drops very rarely from mud and requires a very high excavation level to appear
NOTES:
To get the new excavation drop list, the easiest way is to delete treasures.yml and mcMMO will regenerate it with the newest version
I'll likely be tweaking the treasures list in the near future, leave feedback on discord if you have suggestions
Version 2.1.212
An herbalism exploit has been patched (thanks WhatsTheBadNews)
Added 'ExploitFix.Combat.XPCeiling.Enabled' to experience.yml
Added 'ExploitFix.Combat.XPCeiling.Damage_Limit' to experience.yml
Single instances of combat damage above 100 give are capped to give the same reward as 100 by default (100 is a lot, but you can change this in settings)
NOTES: The damage ceiling won't affect server that don't have mobs running around with abnormally high health, if your server does you'll want to adjust this limit or disable it.
Version 2.1.211
Added /mmodebug info for players hitting other players
Fixed Immortal Player bug
Removed all of Spigot's buggy and deprecated DamageModifier API, this fixes the bug where players would become immortal when using certain other plugins
Rupture is back to doing "pure" damage (due to the above change)
NOTES:
Rupture damage will be tweaked based on feedback as it is dealing "pure" damage
Version 2.1.210
Fixed a memory leak involving mob metadata
Fixed a potential null pointer exception in InventoryListener
NOTES:
If you're having issues with "immortal players" this is a known plugin incompatibility between mcMMO and another plugin, I need more info on what plugins need to be present to cause it. Please post info to GitHub issues or tag me on discord.
There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved
If you run into issues with this version of mcMMO, please post about it on GitHub If you run into issues with this version of mcMMO, please post about it on GitHub
@@ -1126,7 +1579,7 @@ Version 2.1.128
Fixed a bug where certain types of ore did not receive bonuses from Blast Mining Fixed a bug where certain types of ore did not receive bonuses from Blast Mining
Fixed a few locale errors with commands Fixed a few locale errors with commands
(API) Added ExperienceAPI::addCombatXP for adding combat XP to players, signature may change so its deprecated for now (API) Added ExperienceAPI::addCombatXP for adding combat XP to players, signature may change so its deprecated for now
mcMMO now logs whether or not its using FlatFile or SQL database on load mcMMO now logs whether its using FlatFile or SQL database on load
(1.16) Strider added to combat experience with a value of 1.2 (1.16) Strider added to combat experience with a value of 1.2
NOTES: A more thorough look at Unarmed balance will happen in the future, the intention of this nerf is to make Unarmed less rewarding until it is leveled quite a bit. NOTES: A more thorough look at Unarmed balance will happen in the future, the intention of this nerf is to make Unarmed less rewarding until it is leveled quite a bit.
@@ -1146,7 +1599,7 @@ Version 2.1.127
Version 2.1.126 Version 2.1.126
mcMMO now relies on NMS for some of its features, if NMS cannot properly be wired up when initializing mcMMO behaviours relying on NMS will either be partially supported or disabled mcMMO now relies on NMS for some of its features, if NMS cannot properly be wired up when initializing mcMMO behaviours relying on NMS will either be partially supported or disabled
mcMMO now has a compatibility mode, any features that require specific versions of Minecraft for full functionality will be disabled if your server is not running a compatible version, mcMMO will still function in compatibility mode, but either the feature will be modified or disabled depending on the version of the server software mcMMO now has a compatibility mode, any features that require specific versions of Minecraft for full functionality will be disabled if your server is not running a compatible version, mcMMO will still function in compatibility mode, but either the feature will be modified or disabled depending on the version of the server software
New command /mmocompat - Shows information about whether or not mcMMO is fully functional or if some features are disabled due to the server software not being fully supported. Can be used by players or console. New command /mmocompat - Shows information about whether mcMMO is fully functional or if some features are disabled due to the server software not being fully supported. Can be used by players or console.
New command /mmoxpbar (alias /xpbarsettings) - Players can choose to always show XP bars or to never show XP bars on a per skill basis New command /mmoxpbar (alias /xpbarsettings) - Players can choose to always show XP bars or to never show XP bars on a per skill basis
XPBars now last for 3 seconds before hiding instead of 2 seconds XPBars now last for 3 seconds before hiding instead of 2 seconds
Fixed an exploit involving fishing rods Fixed an exploit involving fishing rods
@@ -1782,7 +2235,7 @@ Version 2.1.68
Fixed a bug where consuming food in the off hand did not trigger the Diet abilities Fixed a bug where consuming food in the off hand did not trigger the Diet abilities
Version 2.1.67 Version 2.1.67
The XP bar now reflects whether or not the player is receiving the early game boost The XP bar now reflects whether the player is receiving the early game boost
Players who are receiving an early game boost will be shown "Learning a skill..." as the title of the XP bar while gaining XP Players who are receiving an early game boost will be shown "Learning a skill..." as the title of the XP bar while gaining XP
New locale string 'XPBar.Template.EarlyGameBoost' New locale string 'XPBar.Template.EarlyGameBoost'
@@ -1831,7 +2284,7 @@ Version 2.1.63
Version 2.1.62 Version 2.1.62
Added a new admin notification system, sensitive commands will print chat messages to "admins" (players with either Operator status or admin chat permission) Added a new admin notification system, sensitive commands will print chat messages to "admins" (players with either Operator status or admin chat permission)
Added a setting to disable the new admin notifications to config.yml 'General.AdminNotifications' (this will be more configurable in 2.2) Added a setting to disable the new admin notifications to config.yml 'General.AdminNotifications' (this will be more configurable in 2.2)
OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether the XP rate event messages are enabled
Updated hu_HU locale (thanks andris155) Updated hu_HU locale (thanks andris155)
Added XP for mining Magma_Block (default 30 XP - Update your config, see notes) Added XP for mining Magma_Block (default 30 XP - Update your config, see notes)
Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes) Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes)
@@ -1839,9 +2292,9 @@ Version 2.1.62
New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console
New locale string - 'Notifications.Admin.Format.Others' style formatting + prefix for admin notifications used in the other new strings below New locale string - 'Notifications.Admin.Format.Others' style formatting + prefix for admin notifications used in the other new strings below
New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations sent to the user who executed the command New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations sent to the user who executed the command
New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether messages for the event are enabled
New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued
New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether messages for the event are enabled
New locale string - 'Notifications.Admin.XPRate.End.Others' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued New locale string - 'Notifications.Admin.XPRate.End.Others' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued
NOTES: NOTES:
@@ -2112,7 +2565,7 @@ Version 2.1.26
Notes: Notes:
The new Limit Break subskills are intended to make Prot IV players less tanky and for you to feel more powerful for having high skill level. The new Limit Break subskills are intended to make Prot IV players less tanky and for you to feel more powerful for having high skill level.
Limit Break has 10 ranks, each rank gives 1 extra RAW damage, this is damage before reductions from armor and enchantments. The net result is you deal about 50% more damage with an end game skill compared to before. Limit Break has 10 ranks, each rank gives 1 extra RAW damage, this is damage before reductions from armor and enchantments. The net result is you deal about 50% more damage with an endgame skill compared to before.
With these new changes, most skills can 2 shot normal diamond armor, and it takes about 5 hits to kill someone in Prot IV Diamond Armor. With these new changes, most skills can 2 shot normal diamond armor, and it takes about 5 hits to kill someone in Prot IV Diamond Armor.
I'm not sure everyone will like these changes, the net result is players are a lot easier to kill now, whereas before you could take quite a beating before getting killed. I'm not sure everyone will like these changes, the net result is players are a lot easier to kill now, whereas before you could take quite a beating before getting killed.
I collected several sets of data before making these changes, including damage to player with and without prot 4 diamond armor, damage to those players with and without enchanted weapons, damage with and without leveling your skills, and combinations of the previously mentioned things. I collected several sets of data before making these changes, including damage to player with and without prot 4 diamond armor, damage to those players with and without enchanted weapons, damage with and without leveling your skills, and combinations of the previously mentioned things.
@@ -3813,7 +4266,7 @@ Removed performance debugging
Removed some useless settings from the config file Removed some useless settings from the config file
Version 1.0.34 Version 1.0.34
Fixed the PVP setting determining whether or not you would hurt yourself from AoE Abilities Fixed the PVP setting determining whether you would hurt yourself from AoE Abilities
Added Dutch (nl) language support Added Dutch (nl) language support
Super Breaker now gives the correct XP as determined by config.yml Super Breaker now gives the correct XP as determined by config.yml
Sand Stone XP is now configurable and no longer shares the 'stone' node Sand Stone XP is now configurable and no longer shares the 'stone' node
@@ -3823,7 +4276,7 @@ Version 1.0.33
Fixed the toggle for the Excavation drop 'Cocoa Beans' Fixed the toggle for the Excavation drop 'Cocoa Beans'
Fixed bug where Unarmed users could disarm without being bare handed Fixed bug where Unarmed users could disarm without being bare handed
Cocoa Beans now have an XP modifier in config.yml Cocoa Beans now have an XP modifier in config.yml
You can now toggle whether or not Mobspawners will give XP (in config.yml) You can now toggle whether Mobspawners will give XP (in config.yml)
MySQL version now makes requests to the MySQL server less frequently (should help performance) MySQL version now makes requests to the MySQL server less frequently (should help performance)
Fixed bug with Skull Splitter hitting the user Fixed bug with Skull Splitter hitting the user

View File

@@ -10,8 +10,29 @@ Spigot Resource: https://spigot.mcmmo.org
I plan to post links to our new wiki (its still under development), downloads, and dev blogs there. I plan to post links to our new wiki (its still under development), downloads, and dev blogs there.
## API
If you are using maven, you can add mcMMO API to your plugin by adding it to pom.xml like so...
```
<repository>
<id>neetgames</id>
<url>https://nexus.neetgames.com/repository/maven-releases/</url>
</repository>
```
```
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.004</version>
</dependency>
```
### Builds ### Builds
Currently, you can obtain our builds via the Spigot resource page: http://spigot.mcmmo.org Currently, you can obtain our builds via the Spigot or Polymart:
http://spigot.mcmmo.org
https://polymart.org/resource/mcmmo.727
### Brief Description ### Brief Description
The goal of mcMMO is to take core Minecraft game mechanics and expand them into an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update. The goal of mcMMO is to take core Minecraft game mechanics and expand them into an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
@@ -21,20 +42,14 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
#### Project Lead & Founder #### Project Lead & Founder
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50) [![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
#### mcMMO Devs #### Current mcMMO Devs
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50) [![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
[![kashike](https://secure.gravatar.com/avatar/b5e86d6d443b957fd5cdee55501f3799.png)](https://github.com/kashike)
[![electronicboy](https://secure.gravatar.com/avatar/44759c38d311ce09596de6a2d5b88036.png)](https://github.com/electronicboy)
#### Classic Maintainer
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
## Former Team Members
### Former Lead & Awesome guy
[![gmcferrin](http://www.gravatar.com/avatar/b64c52daf25d206b27650788b5813b7b.png)](https://github.com/gmcferrin)
### Former team members ### Former team members
[![gmcferrin](http://www.gravatar.com/avatar/b64c52daf25d206b27650788b5813b7b.png)](https://github.com/gmcferrin)
[![kashike](https://secure.gravatar.com/avatar/b5e86d6d443b957fd5cdee55501f3799.png)](https://github.com/kashike)
[![electronicboy](https://secure.gravatar.com/avatar/44759c38d311ce09596de6a2d5b88036.png)](https://github.com/electronicboy)
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
[![bm01](http://www.gravatar.com/avatar/ec8146f5358177f12e9a252271bbc391.png)](https://github.com/bm01) [![bm01](http://www.gravatar.com/avatar/ec8146f5358177f12e9a252271bbc391.png)](https://github.com/bm01)
[![Glitchfinder](http://www.gravatar.com/avatar/5aa4cce22f72ae9c002ecec30f061d00.png)](https://github.com/Glitchfinder) [![Glitchfinder](http://www.gravatar.com/avatar/5aa4cce22f72ae9c002ecec30f061d00.png)](https://github.com/Glitchfinder)
[![NuclearW](http://www.gravatar.com/avatar/90926bdcf1c8a75918df5ea5fa801ce6.png)](https://github.com/NuclearW) [![NuclearW](http://www.gravatar.com/avatar/90926bdcf1c8a75918df5ea5fa801ce6.png)](https://github.com/NuclearW)
@@ -43,20 +58,23 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
[![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)](https://github.com/riking) [![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)](https://github.com/riking)
[![TheYeti](https://i.imgur.com/tzFrxdo.png)](https://github.com/TheYeti) [![TheYeti](https://i.imgur.com/tzFrxdo.png)](https://github.com/TheYeti)
#### Folia Contributors
[<img src="https://github.com/HSGamer.png" width=80 alt="HSGamer">](https://github.com/HSGamer)
[<img src="https://github.com/TechnicallyCoded.png" width=80 alt="TechnicallyCoded">](https://github.com/TechnicallyCoded)
[<img src="https://github.com/Yomamaeatstoes.png" width=80 alt="Yomamaeatstoes">](https://github.com/Yomamaeatstoes)
[<img src="https://github.com/Rockyers.png" width=80 alt="Rockyers">](https://github.com/Rockyers)
## Compiling ## Compiling
mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary classes; Maven 3 is required to compile mcMMO. mcMMO uses Maven to manage dependencies, packaging, and shading of necessary classes; Maven is required to compile mcMMO. It is recommended to always use the latest version of maven.
The typical command used to build mcMMO is: `mvn clean package install` The typical command used to build mcMMO is: `mvn clean install`
Required Libraries:
* Spigot
* JUnit
* WorldGuard 7
* bStats Bukkit
https://spigot.mcmmo.org for more up to date information. https://spigot.mcmmo.org for more up to date information.
Resource Page Downloads:
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
https://polymart.org/resource/mcmmo.727

240
pom.xml Executable file → Normal file
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.210-SNAPSHOT</version> <version>2.2.015-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>
@@ -14,9 +14,9 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>16</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<java.version>16</java.version> <java.version>17</java.version>
</properties> </properties>
<issueManagement> <issueManagement>
@@ -75,16 +75,17 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version> <version>3.2.5</version>
<configuration> <configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName> <junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
<trimStackTrace>false</trimStackTrace> <trimStackTrace>false</trimStackTrace>
<excludedGroups>skip</excludedGroups>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version> <version>3.2.5</version>
<configuration> <configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName> <junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
@@ -95,14 +96,14 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version> <version>3.0.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.13.0</version>
<configuration> <configuration>
<release>16</release> <release>17</release>
<compilerArgs> <compilerArgs>
<arg>-parameters</arg> <!-- used for ACF syntax stuff --> <arg>-parameters</arg> <!-- used for ACF syntax stuff -->
</compilerArgs> </compilerArgs>
@@ -112,6 +113,7 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration> <configuration>
<descriptors> <descriptors>
<descriptor>src/main/assembly/package.xml</descriptor> <descriptor>src/main/assembly/package.xml</descriptor>
@@ -130,7 +132,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version> <version>3.5.3</version>
<configuration> <configuration>
<artifactSet> <artifactSet>
<includes> <includes>
@@ -140,30 +142,30 @@
<include>org.bstats:bstats-base</include> <include>org.bstats:bstats-base</include>
<include>org.bstats:bstats-bukkit</include> <include>org.bstats:bstats-bukkit</include>
<include>net.kyori:adventure-api</include> <include>net.kyori:adventure-api</include>
<include>net.kyori:adventure-text-serializer-gson</include>
<include>net.kyori:adventure-platform-bukkit</include>
<include>net.kyori:adventure-platform-api</include>
<include>net.kyori:adventure-platform-viaversion</include>
<include>net.kyori:adventure-platform-facet</include>
<include>net.kyori:adventure-nbt</include>
<include>net.kyori:adventure-key</include> <include>net.kyori:adventure-key</include>
<include>net.kyori:adventure-nbt</include>
<include>net.kyori:adventure-platform-api</include>
<include>net.kyori:adventure-platform-bukkit</include>
<include>net.kyori:adventure-platform-facet</include>
<include>net.kyori:adventure-platform-viaversion</include>
<include>net.kyori:adventure-text-serializer-bungeecord</include>
<include>net.kyori:adventure-text-serializer-gson</include>
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
<include>net.kyori:adventure-text-serializer-json</include>
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
<include>net.kyori:adventure-text-serializer-legacy</include>
<include>net.kyori:examination-api</include> <include>net.kyori:examination-api</include>
<include>net.kyori:examination-string</include> <include>net.kyori:examination-string</include>
<include>net.kyori:adventure-text-serializer-legacy</include> <include>net.kyori:option</include>
<include>net.kyori:adventure-text-serializer-bungeecord</include>
<include>net.kyori:adventure-text-serializer-craftbukkit</include> <include>net.kyori:adventure-text-serializer-craftbukkit</include>
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
<include>co.aikar:acf-bukkit</include> <include>co.aikar:acf-bukkit</include>
<include>com.tcoded:FoliaLib</include>
</includes> </includes>
</artifactSet> </artifactSet>
<relocations> <relocations>
<relocation> <relocation>
<pattern>net.kyori.examination</pattern> <pattern>net.kyori</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.examination</shadedPattern> <shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori.adventure</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.adventure</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>co.aikar.commands</pattern> <pattern>co.aikar.commands</pattern>
@@ -189,6 +191,10 @@
<pattern>org.bstats</pattern> <pattern>org.bstats</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.metrics.bstats</shadedPattern> <shadedPattern>com.gmail.nossr50.mcmmo.metrics.bstats</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>com.tcoded.folialib</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.folialib</shadedPattern>
</relocation>
</relocations> </relocations>
</configuration> </configuration>
<executions> <executions>
@@ -205,7 +211,7 @@
<extension> <extension>
<groupId>org.apache.maven.wagon</groupId> <groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId> <artifactId>wagon-file</artifactId>
<version>2.2</version> <version>3.5.2</version>
</extension> </extension>
</extensions> </extensions>
</build> </build>
@@ -217,6 +223,11 @@
</pluginRepositories> </pluginRepositories>
<repositories> <repositories>
<!-- Protocol Lib Repository -->
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@@ -226,8 +237,8 @@
<url>https://repo.codemc.org/repository/maven-public</url> <url>https://repo.codemc.org/repository/maven-public</url>
</repository> </repository>
<repository> <repository>
<id>sk89q-repo</id> <id>enginehub-repo</id>
<url>https://maven.sk89q.com/repo/</url> <url>https://maven.enginehub.org/repo/</url>
</repository> </repository>
<repository> <!-- for development builds --> <repository> <!-- for development builds -->
<id>sonatype-oss</id> <id>sonatype-oss</id>
@@ -237,72 +248,147 @@
<id>aikar</id> <id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url> <url>https://repo.aikar.co/content/groups/aikar/</url>
</repository> </repository>
<!-- ... --> <repository>
<!-- ... --> <id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>devmart-other</id>
<url>https://nexuslite.gcnt.net/repos/other/</url>
</repository>
<!-- MockBukkit -->
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>co.aikar</groupId> <groupId>co.aikar</groupId>
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this --> <artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
<version>0.5.0-SNAPSHOT</version> <!-- Replace this as well --> <version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-bungeecord</artifactId>
<version>4.3.2</version>
</dependency> </dependency>
<!-- adventure-api, adventure-text-serializer-gson, adventure-platform-bukkit-->
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId> <artifactId>adventure-text-serializer-gson</artifactId>
<version>4.9.3</version> <version>4.17.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.9.3</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
<version>4.9.3</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId>
<version>4.9.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId> <artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.9.3</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId> <artifactId>adventure-text-serializer-json</artifactId>
<version>4.0.1</version> <version>4.17.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
<version>4.17.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.17.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
<version>4.17.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId>
<version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId> <artifactId>adventure-platform-api</artifactId>
<version>4.0.1</version> <version>4.3.3</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-facet</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-viaversion</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>option</artifactId>
<version>1.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId> <artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.12.0</version> <version>2.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId> <artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version> <version>3.0.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version> <version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sk89q.worldguard</groupId> <groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-core</artifactId> <artifactId>worldguard-core</artifactId>
<version>7.0.4</version> <version>7.0.7</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<!-- We use jetbrains instead. Excluding this --> <!-- We use jetbrains instead. Excluding this -->
@@ -326,37 +412,67 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
<version>5.8.2</version> <version>5.11.0-M2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>4.2.0</version> <version>5.12.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId> <artifactId>mockito-inline</artifactId>
<version>4.2.0</version> <version>5.2.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.tomcat</groupId> <groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId> <artifactId>tomcat-jdbc</artifactId>
<version>10.0.14</version> <version>10.1.24</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains</groupId> <groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
<version>22.0.0</version> <version>24.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>31.0.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using --> <version>33.2.0-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.3.1</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-core</artifactId>-->
<!-- <version>2.22.1</version> &lt;!&ndash; Make sure this version matches the other log4j dependencies &ndash;&gt;-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-api</artifactId>-->
<!-- <version>2.22.1</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
<!-- <version>2.22.1</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.github.seeseemelk</groupId>-->
<!-- <artifactId>MockBukkit-v1.19</artifactId>-->
<!-- <version>LATEST</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
</dependencies> </dependencies>
</project> </project>

View File

@@ -83,8 +83,8 @@ public final class AbilityAPI {
} }
public static boolean isBleeding(LivingEntity entity) { public static boolean isBleeding(LivingEntity entity) {
if(entity.isValid()) { if (entity.isValid()) {
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) { if (entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
return true; return true;
} }
} }

View File

@@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillTools; import com.gmail.nossr50.util.skills.SkillTools;
@@ -20,7 +19,6 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
public final class ExperienceAPI { public final class ExperienceAPI {
@@ -35,13 +33,13 @@ public final class ExperienceAPI {
* @param skillType A string that may or may not be a skill * @param skillType A string that may or may not be a skill
* @return true if this is a valid mcMMO skill * @return true if this is a valid mcMMO skill
*/ */
public static boolean isValidSkillType(String skillType) { public static boolean isValidSkillType(@NotNull String skillType) {
return mcMMO.p.getSkillTools().matchSkill(skillType) != null; return mcMMO.p.getSkillTools().matchSkill(skillType) != null;
} }
/** /**
* Start the task that gives combat XP. * Start the task that gives combat XP.
* Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the XP * Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP
* *
* @param mcMMOPlayer The attacking player * @param mcMMOPlayer The attacking player
* @param target The defending entity * @param target The defending entity
@@ -56,7 +54,7 @@ public final class ExperienceAPI {
/** /**
* Start the task that gives combat XP. * Start the task that gives combat XP.
* Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the XP * Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP
* *
* @param mcMMOPlayer The attacking player * @param mcMMOPlayer The attacking player
* @param target The defending entity * @param target The defending entity
@@ -518,7 +516,7 @@ public final class ExperienceAPI {
} }
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException { public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
if(SkillTools.isChildSkill(skillType)) if (SkillTools.isChildSkill(skillType))
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType); return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
@@ -706,7 +704,7 @@ public final class ExperienceAPI {
PrimarySkillType skill = getSkillType(skillType); PrimarySkillType skill = getSkillType(skillType);
if (SkillTools.isChildSkill(skill)) { if (SkillTools.isChildSkill(skill)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);
for (PrimarySkillType parentSkill : parentSkills) { for (PrimarySkillType parentSkill : parentSkills) {
profile.addLevels(parentSkill, (levels / parentSkills.size())); profile.addLevels(parentSkill, (levels / parentSkills.size()));
@@ -737,7 +735,7 @@ public final class ExperienceAPI {
PrimarySkillType skill = getSkillType(skillType); PrimarySkillType skill = getSkillType(skillType);
if (SkillTools.isChildSkill(skill)) { if (SkillTools.isChildSkill(skill)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);
for (PrimarySkillType parentSkill : parentSkills) { for (PrimarySkillType parentSkill : parentSkills) {
profile.addLevels(parentSkill, (levels / parentSkills.size())); profile.addLevels(parentSkill, (levels / parentSkills.size()));
@@ -1145,14 +1143,10 @@ public final class ExperienceAPI {
* @param blockStates the blocks to reward XP for * @param blockStates the blocks to reward XP for
* @param mcMMOPlayer the target player * @param mcMMOPlayer the target player
*/ */
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
{ for(BlockState bs : blockStates) {
for(BlockState bs : blockStates) for(PrimarySkillType skillType : PrimarySkillType.values()) {
{ if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
for(PrimarySkillType skillType : PrimarySkillType.values())
{
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }
@@ -1165,12 +1159,9 @@ public final class ExperienceAPI {
* @param mcMMOPlayer the target player * @param mcMMOPlayer the target player
* @param skillType target primary skill * @param skillType target primary skill
*/ */
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
{ for(BlockState bs : blockStates) {
for(BlockState bs : blockStates) if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) {
{
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }
@@ -1181,12 +1172,9 @@ public final class ExperienceAPI {
* @param blockState The target blockstate * @param blockState The target blockstate
* @param mcMMOPlayer The target player * @param mcMMOPlayer The target player
*/ */
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
{ for(PrimarySkillType skillType : PrimarySkillType.values()) {
for(PrimarySkillType skillType : PrimarySkillType.values()) if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
{
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }
@@ -1198,10 +1186,8 @@ public final class ExperienceAPI {
* @param mcMMOPlayer The target player * @param mcMMOPlayer The target player
* @param skillType target primary skill * @param skillType target primary skill
*/ */
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
{ if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) {
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }

View File

@@ -0,0 +1,6 @@
package com.gmail.nossr50.api;
public enum FakeBlockBreakEventType {
FAKE,
TREE_FELLER
}

View File

@@ -3,12 +3,13 @@ package com.gmail.nossr50.api;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyLeader; import com.gmail.nossr50.datatypes.party.PartyLeader;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.util.*; import java.util.*;
@@ -24,13 +25,22 @@ public final class PartyAPI {
* @return the name of the player's party, or null if not in a party * @return the name of the player's party, or null if not in a party
*/ */
public static String getPartyName(Player player) { public static String getPartyName(Player player) {
if (!inParty(player)) { if (!mcMMO.p.getPartyConfig().isPartyEnabled() || !inParty(player)) {
return null; return null;
} }
return UserManager.getPlayer(player).getParty().getName(); return UserManager.getPlayer(player).getParty().getName();
} }
/**
* Check if the party system is enabled.
*
* @return true if the party system is enabled, false otherwise
*/
public static boolean isPartySystemEnabled() {
return mcMMO.p.getPartyConfig().isPartyEnabled();
}
/** /**
* Checks if a player is in a party. * Checks if a player is in a party.
* </br> * </br>
@@ -40,7 +50,7 @@ public final class PartyAPI {
* @return true if the player is in a party, false otherwise * @return true if the player is in a party, false otherwise
*/ */
public static boolean inParty(Player player) { public static boolean inParty(Player player) {
if(UserManager.getPlayer(player) == null) if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
return false; return false;
return UserManager.getPlayer(player).inParty(); return UserManager.getPlayer(player).inParty();
@@ -51,12 +61,15 @@ public final class PartyAPI {
* </br> * </br>
* This function is designed for API usage. * This function is designed for API usage.
* *
* @param playera The first player to check * @param playerA The first player to check
* @param playerb The second player to check * @param playerB The second player to check
* @return true if the two players are in the same party, false otherwise * @return true if the two players are in the same party, false otherwise
*/ */
public static boolean inSameParty(Player playera, Player playerb) { public static boolean inSameParty(Player playerA, Player playerB) {
return PartyManager.inSameParty(playera, playerb); if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return false;
return mcMMO.p.getPartyManager().inSameParty(playerA, playerB);
} }
/** /**
@@ -67,7 +80,7 @@ public final class PartyAPI {
* @return the list of parties. * @return the list of parties.
*/ */
public static List<Party> getParties() { public static List<Party> getParties() {
return PartyManager.getParties(); return mcMMO.p.getPartyManager().getParties();
} }
/** /**
@@ -81,23 +94,28 @@ public final class PartyAPI {
*/ */
@Deprecated @Deprecated
public static void addToParty(Player player, String partyName) { public static void addToParty(Player player, String partyName) {
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
return;
}
//Check if player profile is loaded //Check if player profile is loaded
if(UserManager.getPlayer(player) == null) final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if (mmoPlayer == null)
return; return;
Party party = PartyManager.getParty(partyName); Party party = mcMMO.p.getPartyManager().getParty(partyName);
if (party == null) { if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} else { } else {
if(PartyManager.isPartyFull(player, party)) if (mcMMO.p.getPartyManager().isPartyFull(player, party)) {
{
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString()); NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
return; return;
} }
} }
PartyManager.addToParty(UserManager.getPlayer(player), party); mcMMO.p.getPartyManager().addToParty(mmoPlayer, party);
} }
/** /**
@@ -105,8 +123,7 @@ public final class PartyAPI {
* 0 or less for no size limit * 0 or less for no size limit
* @return the max party size on this server * @return the max party size on this server
*/ */
public static int getMaxPartySize() public static int getMaxPartySize() {
{
return mcMMO.p.getGeneralConfig().getPartyMaxSize(); return mcMMO.p.getGeneralConfig().getPartyMaxSize();
} }
@@ -119,19 +136,18 @@ public final class PartyAPI {
* @param partyName The party to add the player to * @param partyName The party to add the player to
* @param bypassLimit if true bypasses party size limits * @param bypassLimit if true bypasses party size limits
*/ */
//TODO: bypasslimit not used?
public static void addToParty(Player player, String partyName, boolean bypassLimit) { public static void addToParty(Player player, String partyName, boolean bypassLimit) {
//Check if player profile is loaded //Check if player profile is loaded
if(UserManager.getPlayer(player) == null) if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
return; return;
Party party = PartyManager.getParty(partyName); Party party = mcMMO.p.getPartyManager().getParty(partyName);
if (party == null) { if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} }
PartyManager.addToParty(UserManager.getPlayer(player), party); mcMMO.p.getPartyManager().addToParty(UserManager.getPlayer(player), party);
} }
/** /**
@@ -143,10 +159,10 @@ public final class PartyAPI {
*/ */
public static void removeFromParty(Player player) { public static void removeFromParty(Player player) {
//Check if player profile is loaded //Check if player profile is loaded
if(UserManager.getPlayer(player) == null) if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
return; return;
PartyManager.removeFromParty(UserManager.getPlayer(player)); mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
} }
/** /**
@@ -157,8 +173,11 @@ public final class PartyAPI {
* @param partyName The party name * @param partyName The party name
* @return the leader of the party * @return the leader of the party
*/ */
public static String getPartyLeader(String partyName) { public static @Nullable String getPartyLeader(String partyName) {
return PartyManager.getPartyLeaderName(partyName); if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
} }
/** /**
@@ -171,7 +190,10 @@ public final class PartyAPI {
*/ */
@Deprecated @Deprecated
public static void setPartyLeader(String partyName, String playerName) { public static void setPartyLeader(String partyName, String playerName) {
PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName)); if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return;
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
} }
/** /**
@@ -184,9 +206,12 @@ public final class PartyAPI {
*/ */
@Deprecated @Deprecated
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) { public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
List<OfflinePlayer> members = new ArrayList<>(); if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
return null;
}
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) { List<OfflinePlayer> members = new ArrayList<>();
for (UUID memberUniqueId : mcMMO.p.getPartyManager().getAllMembers(player).keySet()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId); OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
members.add(member); members.add(member);
} }
@@ -203,7 +228,10 @@ public final class PartyAPI {
*/ */
@Deprecated @Deprecated
public static LinkedHashSet<String> getMembers(Player player) { public static LinkedHashSet<String> getMembers(Player player) {
return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values(); if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
} }
/** /**
@@ -215,7 +243,10 @@ public final class PartyAPI {
* @return all the player names and uuids in the player's party * @return all the player names and uuids in the player's party
*/ */
public static LinkedHashMap<UUID, String> getMembersMap(Player player) { public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
return PartyManager.getAllMembers(player); if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getAllMembers(player);
} }
/** /**
@@ -227,7 +258,10 @@ public final class PartyAPI {
* @return all online players in this party * @return all online players in this party
*/ */
public static List<Player> getOnlineMembers(String partyName) { public static List<Player> getOnlineMembers(String partyName) {
return PartyManager.getOnlineMembers(partyName); if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
} }
/** /**
@@ -239,7 +273,7 @@ public final class PartyAPI {
* @return all online players in the player's party * @return all online players in the player's party
*/ */
public static List<Player> getOnlineMembers(Player player) { public static List<Player> getOnlineMembers(Player player) {
return PartyManager.getOnlineMembers(player); return mcMMO.p.getPartyManager().getOnlineMembers(player);
} }
public static boolean hasAlly(String partyName) { public static boolean hasAlly(String partyName) {
@@ -247,7 +281,7 @@ public final class PartyAPI {
} }
public static String getAllyName(String partyName) { public static String getAllyName(String partyName) {
Party ally = PartyManager.getParty(partyName).getAlly(); Party ally = mcMMO.p.getPartyManager().getParty(partyName).getAlly();
if (ally != null) { if (ally != null) {
return ally.getName(); return ally.getName();
} }

View File

@@ -0,0 +1,12 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent {
public TreeFellerBlockBreakEvent(@NotNull Block theBlock, @NotNull Player player) {
super(theBlock, player);
}
}

View File

@@ -0,0 +1,9 @@
package com.gmail.nossr50.api.exceptions;
import org.jetbrains.annotations.NotNull;
public class ValueOutOfBoundsException extends RuntimeException {
public ValueOutOfBoundsException(@NotNull String message) {
super(message);
}
}

View File

@@ -43,7 +43,7 @@ public class ChatManager {
* *
* @param mmoPlayer target player * @param mmoPlayer target player
* @param rawMessage the raw message from the player as it was typed * @param rawMessage the raw message from the player as it was typed
* @param isAsync whether or not this is getting processed via async * @param isAsync whether this is getting processed via async
*/ */
public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) { public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) {
processPlayerMessage(mmoPlayer, mmoPlayer.getChatChannel(), rawMessage, isAsync); processPlayerMessage(mmoPlayer, mmoPlayer.getChatChannel(), rawMessage, isAsync);
@@ -69,7 +69,7 @@ public class ChatManager {
* @param mmoPlayer target player * @param mmoPlayer target player
* @param chatChannel target chat channel * @param chatChannel target chat channel
* @param rawMessage raw chat message as it was typed * @param rawMessage raw chat message as it was typed
* @param isAsync whether or not this is getting processed via async * @param isAsync whether this is getting processed via async
*/ */
private void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel chatChannel, @NotNull String rawMessage, boolean isAsync) { private void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel chatChannel, @NotNull String rawMessage, boolean isAsync) {
switch (chatChannel) { switch (chatChannel) {
@@ -125,7 +125,7 @@ public class ChatManager {
* @param targetChatChannel target chat channel * @param targetChatChannel target chat channel
*/ */
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) { public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
if(targetChatChannel == mmoPlayer.getChatChannel()) { if (targetChatChannel == mmoPlayer.getChatChannel()) {
//Disabled message //Disabled message
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString()))); mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
mmoPlayer.setChatMode(ChatChannel.NONE); mmoPlayer.setChatMode(ChatChannel.NONE);
@@ -144,7 +144,7 @@ public class ChatManager {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < args.length; i++) { for(int i = 0; i < args.length; i++) {
if(i + 1 >= args.length) { if (i + 1 >= args.length) {
stringBuilder.append(args[i]); stringBuilder.append(args[i]);
} else { } else {
stringBuilder.append(args[i]).append(" "); stringBuilder.append(args[i]).append(" ");
@@ -155,19 +155,19 @@ public class ChatManager {
} }
/** /**
* Whether or not the player is allowed to send a message to the chat channel they are targeting * Whether the player is allowed to send a message to the chat channel they are targeting
* @param mmoPlayer target player * @param mmoPlayer target player
* @return true if the player can send messages to that chat channel * @return true if the player can send messages to that chat channel
*/ */
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) { public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
switch (mmoPlayer.getChatChannel()) { switch (mmoPlayer.getChatChannel()) {
case ADMIN: case ADMIN:
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) { if (mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
return true; return true;
} }
break; break;
case PARTY: case PARTY:
if(mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) { if (mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
return true; return true;
} }
break; break;
@@ -197,7 +197,7 @@ public class ChatManager {
} }
/** /**
* Whether or not a specific chat channel is enabled * Whether a specific chat channel is enabled
* ChatChannels are enabled/disabled via user config * ChatChannels are enabled/disabled via user config
* *
* If chat is disabled, this always returns false * If chat is disabled, this always returns false
@@ -206,7 +206,7 @@ public class ChatManager {
* @return true if the chat channel is enabled * @return true if the chat channel is enabled
*/ */
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) { public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
if(!isChatEnabled) { if (!isChatEnabled) {
return false; return false;
} else { } else {
switch(chatChannel) { switch(chatChannel) {

View File

@@ -20,13 +20,12 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
@Override @Override
public boolean test(T t) { public boolean test(T t) {
//Include the console in the audience //Include the console in the audience
if(t instanceof ConsoleCommandSender) { if (t instanceof ConsoleCommandSender) {
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
} else { } else {
if(t instanceof Player) { if (t instanceof Player player) {
Player player = (Player) t;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer != null) { if (mcMMOPlayer != null) {
return mcMMOPlayer.getParty() == party; return mcMMOPlayer.getParty() == party;
} }
} }

View File

@@ -48,15 +48,15 @@ public abstract class AbstractPlayerAuthor implements Author {
*/ */
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) { protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
//Already in cache //Already in cache
if(sanitizedNameCache.containsKey(chatChannel)) { if (sanitizedNameCache.containsKey(chatChannel)) {
//Update cache //Update cache
if(useDisplayName && hasPlayerDisplayNameChanged()) { if (useDisplayName && hasPlayerDisplayNameChanged()) {
updateLastKnownDisplayName(); updateLastKnownDisplayName();
updateSanitizedNameCache(chatChannel, true); updateSanitizedNameCache(chatChannel, true);
} }
} else { } else {
//Update last known display name //Update last known display name
if(useDisplayName && hasPlayerDisplayNameChanged()) { if (useDisplayName && hasPlayerDisplayNameChanged()) {
updateLastKnownDisplayName(); updateLastKnownDisplayName();
} }
@@ -73,10 +73,10 @@ public abstract class AbstractPlayerAuthor implements Author {
* Sanitized names are associated with a {@link ChatChannel} as different chat channels have different chat name settings * Sanitized names are associated with a {@link ChatChannel} as different chat channels have different chat name settings
* *
* @param chatChannel target chat channel * @param chatChannel target chat channel
* @param useDisplayName whether or not to use this authors display name * @param useDisplayName whether to use this authors display name
*/ */
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) { private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
if(useDisplayName) { if (useDisplayName) {
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName())); sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
} else { } else {
//No need to sanitize a basic String //No need to sanitize a basic String

View File

@@ -17,14 +17,14 @@ public interface Author extends Identity {
@NotNull String getAuthoredName(@NotNull ChatChannel chatChannel); @NotNull String getAuthoredName(@NotNull ChatChannel chatChannel);
/** /**
* Whether or not this author is a {@link org.bukkit.command.ConsoleCommandSender} * Whether this author is a {@link org.bukkit.command.ConsoleCommandSender}
* *
* @return true if this author is the console * @return true if this author is the console
*/ */
boolean isConsole(); boolean isConsole();
/** /**
* Whether or not this author is a {@link org.bukkit.entity.Player} * Whether this author is a {@link org.bukkit.entity.Player}
* @return true if this author is a player * @return true if this author is a player
*/ */
boolean isPlayer(); boolean isPlayer();

View File

@@ -3,6 +3,7 @@ package com.gmail.nossr50.chat.mailer;
import com.gmail.nossr50.chat.author.Author; import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.chat.message.AdminChatMessage; import com.gmail.nossr50.chat.message.AdminChatMessage;
import com.gmail.nossr50.chat.message.ChatMessage; import com.gmail.nossr50.chat.message.ChatMessage;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent; import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOChatEvent; import com.gmail.nossr50.events.chat.McMMOChatEvent;
@@ -44,7 +45,7 @@ public class AdminChatMailer extends AbstractChatMailer {
public @NotNull Predicate<CommandSender> predicate() { public @NotNull Predicate<CommandSender> predicate() {
return (commandSender) -> commandSender.isOp() return (commandSender) -> commandSender.isOp()
|| commandSender.hasPermission(MCMMO_CHAT_ADMINCHAT_PERMISSION) || commandSender.hasPermission(MCMMO_CHAT_ADMINCHAT_PERMISSION)
|| commandSender instanceof ConsoleCommandSender; || (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.ADMIN) && commandSender instanceof ConsoleCommandSender);
} }
/** /**
@@ -56,7 +57,7 @@ public class AdminChatMailer extends AbstractChatMailer {
* @return the styled string, based on a locale entry * @return the styled string, based on a locale entry
*/ */
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) { public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
if(canColor) { if (canColor) {
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message); return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
} else { } else {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message)); return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
@@ -73,8 +74,8 @@ public class AdminChatMailer extends AbstractChatMailer {
* *
* @param author the author * @param author the author
* @param rawString the raw message as the author typed it before any styling * @param rawString the raw message as the author typed it before any styling
* @param isAsync whether or not this is being processed asynchronously * @param isAsync whether this is being processed asynchronously
* @param canColor whether or not the author can use colors in chat * @param canColor whether the author can use colors in chat
*/ */
public void processChatMessage(@NotNull Author author, @NotNull String rawString, boolean isAsync, boolean canColor) { public void processChatMessage(@NotNull Author author, @NotNull String rawString, boolean isAsync, boolean canColor) {
AdminChatMessage chatMessage = new AdminChatMessage(pluginRef, author, constructAudience(), rawString, addStyle(author, rawString, canColor)); AdminChatMessage chatMessage = new AdminChatMessage(pluginRef, author, constructAudience(), rawString, addStyle(author, rawString, canColor));
@@ -82,7 +83,7 @@ public class AdminChatMailer extends AbstractChatMailer {
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync); McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent); Bukkit.getPluginManager().callEvent(chatEvent);
if(!chatEvent.isCancelled()) { if (!chatEvent.isCancelled()) {
sendMail(chatMessage); sendMail(chatMessage);
} }
} }

View File

@@ -27,8 +27,8 @@ public class PartyChatMailer extends AbstractChatMailer {
* *
* @param author the author * @param author the author
* @param rawString the raw message as the author typed it before any styling * @param rawString the raw message as the author typed it before any styling
* @param isAsync whether or not this is being processed asynchronously * @param isAsync whether this is being processed asynchronously
* @param canColor whether or not the author can use colors in chat * @param canColor whether the author can use colors in chat
*/ */
public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor, boolean isLeader) { public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor, boolean isLeader) {
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor, isLeader), party); PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor, isLeader), party);
@@ -36,7 +36,7 @@ public class PartyChatMailer extends AbstractChatMailer {
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync); McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent); Bukkit.getPluginManager().callEvent(chatEvent);
if(!chatEvent.isCancelled()) { if (!chatEvent.isCancelled()) {
sendMail(chatMessage); sendMail(chatMessage);
} }
} }
@@ -60,14 +60,14 @@ public class PartyChatMailer extends AbstractChatMailer {
* @return the styled string, based on a locale entry * @return the styled string, based on a locale entry
*/ */
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) { public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
if(canColor) { if (canColor) {
if(isLeader) { if (isLeader) {
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message); return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
} else { } else {
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message); return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
} }
} else { } else {
if(isLeader) { if (isLeader) {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message)); return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
} else { } else {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message)); return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));

View File

@@ -1,6 +1,7 @@
package com.gmail.nossr50.chat.message; package com.gmail.nossr50.chat.message;
import com.gmail.nossr50.chat.author.Author; import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@@ -51,7 +52,8 @@ public class PartyChatMessage extends AbstractChatMessage {
messagePartyChatSpies(spyMessage); messagePartyChatSpies(spyMessage);
//Console message //Console message
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage); if (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
} }
/** /**
@@ -65,11 +67,11 @@ public class PartyChatMessage extends AbstractChatMessage {
Player player = mcMMOPlayer.getPlayer(); Player player = mcMMOPlayer.getPlayer();
//Check for toggled players //Check for toggled players
if(mcMMOPlayer.isPartyChatSpying()) { if (mcMMOPlayer.isPartyChatSpying()) {
Party adminParty = mcMMOPlayer.getParty(); Party adminParty = mcMMOPlayer.getParty();
//Only message admins not part of this party //Only message admins not part of this party
if(adminParty == null || adminParty != getParty()) { if (adminParty == null || adminParty != getParty()) {
//TODO: Hacky, rewrite later //TODO: Hacky, rewrite later
Audience audience = mcMMO.getAudiences().player(player); Audience audience = mcMMO.getAudiences().player(player);
audience.sendMessage(spyMessage); audience.sendMessage(spyMessage);

View File

@@ -5,6 +5,7 @@ import co.aikar.commands.BukkitCommandManager;
import co.aikar.commands.ConditionFailedException; import co.aikar.commands.ConditionFailedException;
import com.gmail.nossr50.commands.chat.AdminChatCommand; import com.gmail.nossr50.commands.chat.AdminChatCommand;
import com.gmail.nossr50.commands.chat.PartyChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.commands.skills.PowerLevelCommand;
import com.gmail.nossr50.config.ChatConfig; import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@@ -20,9 +21,14 @@ import org.jetbrains.annotations.NotNull;
* For now this class will only handle ACF converted commands, all other commands will be handled elsewhere * For now this class will only handle ACF converted commands, all other commands will be handled elsewhere
*/ */
public class CommandManager { public class CommandManager {
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";
//CHAT
public static final @NotNull String ADMIN_CONDITION = "adminCondition"; public static final @NotNull String ADMIN_CONDITION = "adminCondition";
public static final @NotNull String PARTY_CONDITION = "partyCondition"; public static final @NotNull String PARTY_CONDITION = "partyCondition";
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";
//SKILLS
public static final @NotNull String POWER_LEVEL_CONDITION = "powerLevelCondition";
private final @NotNull mcMMO pluginRef; private final @NotNull mcMMO pluginRef;
private final @NotNull BukkitCommandManager bukkitCommandManager; private final @NotNull BukkitCommandManager bukkitCommandManager;
@@ -36,29 +42,53 @@ public class CommandManager {
} }
private void registerCommands() { private void registerCommands() {
registerSkillCommands(); //TODO: Implement other skills not just power level
registerChatCommands(); registerChatCommands();
} }
private void registerSkillCommands() {
if (mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
}
}
/** /**
* Registers chat commands if the chat system is enabled * Registers chat commands if the chat system is enabled
*/ */
private void registerChatCommands() { private void registerChatCommands() {
if(ChatConfig.getInstance().isChatEnabled()) { if (ChatConfig.getInstance().isChatEnabled()) {
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) { if (ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef)); bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
} }
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) { if (pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef)); bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
} }
} }
} }
public void registerConditions() { public void registerConditions() {
registerChatCommandConditions(); //Chat Commands
registerSkillConditions();
}
private void registerSkillConditions() {
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer();
if (issuer.getIssuer() instanceof Player) {
validateLoadedData(issuer.getPlayer());
} else {
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
}
});
}
private void registerChatCommandConditions() {
// Method or Class based - Can only be used on methods // Method or Class based - Can only be used on methods
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> { bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer(); BukkitCommandIssuer issuer = context.getIssuer();
if(issuer.getIssuer() instanceof Player) { if (issuer.getIssuer() instanceof Player) {
validateLoadedData(issuer.getPlayer()); validateLoadedData(issuer.getPlayer());
validateAdmin(issuer.getPlayer()); validateAdmin(issuer.getPlayer());
} }
@@ -67,7 +97,7 @@ public class CommandManager {
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> { bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer(); BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
if(bukkitCommandIssuer.getIssuer() instanceof Player) { if (bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer()); validateLoadedData(bukkitCommandIssuer.getPlayer());
} }
}); });
@@ -75,29 +105,30 @@ public class CommandManager {
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> { bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer(); BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
if(bukkitCommandIssuer.getIssuer() instanceof Player) { if (bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer()); validateLoadedData(bukkitCommandIssuer.getPlayer());
validatePlayerParty(bukkitCommandIssuer.getPlayer()); validatePlayerParty(bukkitCommandIssuer.getPlayer());
//TODO: Is there even a point in validating permission? look into this later
validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer()); validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer());
} }
}); });
} }
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) { private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
if(!permissible.hasPermission(permissionNode)) { if (!permissible.hasPermission(permissionNode)) {
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission")); throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
} }
} }
public void validateAdmin(@NotNull Player player) { public void validateAdmin(@NotNull Player player) {
if(!player.isOp() && !Permissions.adminChat(player)) { if (!player.isOp() && !Permissions.adminChat(player)) {
throw new ConditionFailedException("You are lacking the correct permissions to use this command."); throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
} }
} }
public void validateLoadedData(@NotNull Player player) { public void validateLoadedData(@NotNull Player player) {
if(UserManager.getPlayer(player) == null) { if (UserManager.getPlayer(player) == null) {
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad")); throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
} }
} }
@@ -105,7 +136,7 @@ public class CommandManager {
public void validatePlayerParty(@NotNull Player player) { public void validatePlayerParty(@NotNull Player player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer.getParty() == null) { if (!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None")); throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
} }
} }

View File

@@ -200,14 +200,11 @@ public class McImportCommand implements CommandExecutor {
String skillName = "UNIDENTIFIED"; String skillName = "UNIDENTIFIED";
if (materialName.contains("ORE")) { if (materialName.contains("ORE")) {
skillName = "Mining"; skillName = "Mining";
} } else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
skillName = "Woodcutting"; skillName = "Woodcutting";
} } else if (materialName.contains("GRASS") || materialName.contains("SHORT_GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
skillName = "Herbalism"; skillName = "Herbalism";
} } else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
skillName = "Excavation"; skillName = "Excavation";
} }
@@ -222,8 +219,7 @@ public class McImportCommand implements CommandExecutor {
if (skillName.equals("Mining")) { if (skillName.equals("Mining")) {
skillContents.add(" " + " " + "Smelting_XP_Gain: 9"); skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
} } else if (skillName.equals("Woodcutting")) {
else if (skillName.equals("Woodcutting")) {
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG")); skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
} }
} }
@@ -239,20 +235,15 @@ public class McImportCommand implements CommandExecutor {
String toolType = "UNIDENTIFIED"; String toolType = "UNIDENTIFIED";
if (materialName.contains("PICKAXE")) { if (materialName.contains("PICKAXE")) {
toolType = "Pickaxes"; toolType = "Pickaxes";
} } else if (materialName.contains("AXE")) {
else if (materialName.contains("AXE")) {
toolType = "Axes"; toolType = "Axes";
} } else if (materialName.contains("BOW")) {
else if (materialName.contains("BOW")) {
toolType = "Bows"; toolType = "Bows";
} } else if (materialName.contains("HOE")) {
else if (materialName.contains("HOE")) {
toolType = "Hoes"; toolType = "Hoes";
} } else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
toolType = "Shovels"; toolType = "Shovels";
} } else if (materialName.contains("SWORD")) {
else if (materialName.contains("SWORD")) {
toolType = "Swords"; toolType = "Swords";
} }
@@ -279,14 +270,11 @@ public class McImportCommand implements CommandExecutor {
String toolType = "UNIDENTIFIED"; String toolType = "UNIDENTIFIED";
if (materialName.contains("BOOT") || materialName.contains("SHOE")) { if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
toolType = "Boots"; toolType = "Boots";
} } else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
toolType = "Chestplates"; toolType = "Chestplates";
} } else if (materialName.contains("HELM") || materialName.contains("HAT")) {
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
toolType = "Helmets"; toolType = "Helmets";
} } else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
toolType = "Leggings"; toolType = "Leggings";
} }

View File

@@ -72,7 +72,7 @@ public class McmmoCommand implements CommandExecutor {
private void displayOtherCommands(CommandSender sender) { private void displayOtherCommands(CommandSender sender) {
//Don't show them this category if they have none of the permissions //Don't show them this category if they have none of the permissions
if(!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender)) if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
return; return;
sender.sendMessage(LocaleLoader.getString("Commands.Other")); sender.sendMessage(LocaleLoader.getString("Commands.Other"));

View File

@@ -24,8 +24,10 @@ public class McnotifyCommand implements TabExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender); McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
//Not Loaded yet //Not Loaded yet
if (mcMMOPlayer == null) if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On"))); sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
mcMMOPlayer.toggleChatNotifications(); mcMMOPlayer.toggleChatNotifications();

View File

@@ -23,12 +23,12 @@ public class McscoreboardCommand implements TabExecutor {
return true; return true;
} }
if(!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) { if (!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled")); sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
return true; return true;
} }
if(!ScoreboardManager.isPlayerBoardSetup(sender.getName())) { if (!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet")); sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
return true; return true;
} }

View File

@@ -37,16 +37,14 @@ public class XprateCommand implements TabExecutor {
if (mcMMO.p.isXPEventEnabled()) { if (mcMMO.p.isXPEventEnabled()) {
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
{
NotificationManager.broadcastTitle(mcMMO.p.getServer(), NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Stop"), LocaleLoader.getString("Commands.Event.Stop"),
LocaleLoader.getString("Commands.Event.Stop.Subtitle"), LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
10, 10*20, 20); 10, 10*20, 20);
} }
if(mcMMO.p.getGeneralConfig().broadcastEventMessages()) if (mcMMO.p.getGeneralConfig().broadcastEventMessages()) {
{
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop")); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
} }
@@ -72,34 +70,29 @@ public class XprateCommand implements TabExecutor {
if (CommandUtils.shouldDisableToggle(args[1])) { if (CommandUtils.shouldDisableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(false); mcMMO.p.setXPEventEnabled(false);
} } else if (CommandUtils.shouldEnableToggle(args[1])) {
else if (CommandUtils.shouldEnableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(true); mcMMO.p.setXPEventEnabled(true);
} } else {
else {
return false; return false;
} }
int newXpRate = Integer.parseInt(args[0]); int newXpRate = Integer.parseInt(args[0]);
if(newXpRate < 0) if (newXpRate < 0) {
{
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn")); sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
return true; return true;
} }
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate); ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent()) {
{
NotificationManager.broadcastTitle(mcMMO.p.getServer(), NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Start"), LocaleLoader.getString("Commands.Event.Start"),
LocaleLoader.getString("Commands.Event.XP", newXpRate), LocaleLoader.getString("Commands.Event.XP", newXpRate),
10, 10*20, 20); 10, 10*20, 20);
} }
if(mcMMO.p.getGeneralConfig().broadcastEventMessages()) if (mcMMO.p.getGeneralConfig().broadcastEventMessages()) {
{
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
} }

View File

@@ -17,8 +17,8 @@
//public class DropTreasureCommand implements CommandExecutor { //public class DropTreasureCommand implements CommandExecutor {
// @Override // @Override
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { // public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
// if(sender instanceof Player) { // if (sender instanceof Player) {
// if(!sender.isOp()) { // if (!sender.isOp()) {
// sender.sendMessage("This command is for Operators only"); // sender.sendMessage("This command is for Operators only");
// return false; // return false;
// } // }
@@ -27,13 +27,13 @@
// Location location = player.getLocation(); // Location location = player.getLocation();
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player); // McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
// //
// if(mmoPlayer == null) { // if (mmoPlayer == null) {
// //TODO: Localize // //TODO: Localize
// player.sendMessage("Your player data is not loaded yet"); // player.sendMessage("Your player data is not loaded yet");
// return false; // return false;
// } // }
// //
// if(args.length == 0) { // if (args.length == 0) {
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString()); // mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) { // for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) { // for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {

View File

@@ -13,7 +13,7 @@ public class PlayerDebugCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(sender instanceof Player) { if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender); McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode())); NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));

View File

@@ -25,9 +25,9 @@ public class AdminChatCommand extends BaseCommand {
@Default @Conditions(CommandManager.ADMIN_CONDITION) @Default @Conditions(CommandManager.ADMIN_CONDITION)
public void processCommand(String[] args) { public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer(); BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
if(args == null || args.length == 0) { if (args == null || args.length == 0) {
//Process with no arguments //Process with no arguments
if(bukkitCommandIssuer.isPlayer()) { if (bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer()); McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN); pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
} else { } else {
@@ -35,10 +35,10 @@ public class AdminChatCommand extends BaseCommand {
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments."); mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
} }
} else { } else {
if(bukkitCommandIssuer.isPlayer()) { if (bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer()); McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
if(mmoPlayer == null) if (mmoPlayer == null)
return; return;
//Message contains the original command so it needs to be passed to this method to trim it //Message contains the original command so it needs to be passed to this method to trim it

View File

@@ -11,7 +11,6 @@ import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -31,9 +30,9 @@ public class PartyChatCommand extends BaseCommand {
public void processCommand(String[] args) { public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer(); BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
if(args == null || args.length == 0) { if (args == null || args.length == 0) {
//Process with no arguments //Process with no arguments
if(bukkitCommandIssuer.isPlayer()) { if (bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer()); McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY); pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
} else { } else {
@@ -46,7 +45,7 @@ public class PartyChatCommand extends BaseCommand {
/* /*
* Player Logic * Player Logic
*/ */
if(bukkitCommandIssuer.getIssuer() instanceof Player) { if (bukkitCommandIssuer.getIssuer() instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer()); McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
processCommandArgsPlayer(mmoPlayer, args); processCommandArgsPlayer(mmoPlayer, args);
/* /*
@@ -73,14 +72,14 @@ public class PartyChatCommand extends BaseCommand {
* @param args command arguments * @param args command arguments
*/ */
private void processCommandArgsConsole(@NotNull String[] args) { private void processCommandArgsConsole(@NotNull String[] args) {
if(args.length <= 1) { if (args.length <= 1) {
//Only specific a party and not the message //Only specific a party and not the message
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards."); mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
} else { } else {
//Grab party //Grab party
Party targetParty = PartyManager.getParty(args[0]); Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
if(targetParty != null) { if (targetParty != null) {
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty); pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
} else { } else {
mcMMO.p.getLogger().severe("A party with that name doesn't exist!"); mcMMO.p.getLogger().severe("A party with that name doesn't exist!");

View File

@@ -28,7 +28,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
} }
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel()); DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
if(oldDatabase == null) { if (oldDatabase == null) {
sender.sendMessage("Unable to load the old database! Check your log for errors."); sender.sendMessage("Unable to load the old database! Check your log for errors.");
return true; return true;
} }
@@ -64,10 +64,10 @@ public class ConvertDatabaseCommand implements CommandExecutor {
mcMMO.getDatabaseManager().saveUser(profile); mcMMO.getDatabaseManager().saveUser(profile);
} }
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
} }
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p); mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
return true; return true;
} }
return false; return false;

View File

@@ -35,7 +35,7 @@ public class AddlevelsCommand extends ExperienceCommand {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer == null) { if (mmoPlayer == null) {
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND); EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
} else { } else {
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND); EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
@@ -45,7 +45,7 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) { protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent) if (isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value)); player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
@@ -53,7 +53,7 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent) if (isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill))); player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));

View File

@@ -26,12 +26,11 @@ public class AddxpCommand extends ExperienceCommand {
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
if (player != null) { if (player != null) {
//Check if player profile is loaded //Check if player profile is loaded
if(UserManager.getPlayer(player) == null) if (UserManager.getPlayer(player) == null)
return; return;
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND); UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
} } else {
else {
profile.addXp(skill, value); profile.addXp(skill, value);
profile.scheduleAsyncSave(); profile.scheduleAsyncSave();
} }
@@ -39,7 +38,7 @@ public class AddxpCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) { protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent) if (isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value)); player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
@@ -47,7 +46,7 @@ public class AddxpCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent) if (isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill))); player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));

View File

@@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
UserManager.saveAll(); UserManager.saveAll();
UserManager.clearAll(); UserManager.clearAll();
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1); mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) { for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
} }
return true; return true;

View File

@@ -24,16 +24,16 @@ public abstract class ExperienceCommand implements TabExecutor {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill; PrimarySkillType skill;
if(args.length < 2) { if (args.length < 2) {
return false; return false;
} else { } else {
if(args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) { if (args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
return true; return true;
} }
if (!permissionsCheckSelf(sender)) { if (!permissionsCheckSelf(sender)) {
if(command.getPermissionMessage() != null) if (command.getPermissionMessage() != null)
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
sender.sendMessage("(mcMMO) No permission!"); sender.sendMessage("(mcMMO) No permission!");
return true; return true;
@@ -49,15 +49,13 @@ public abstract class ExperienceCommand implements TabExecutor {
skill = null; skill = null;
} }
if (skill != null && SkillTools.isChildSkill(skill)) if (skill != null && SkillTools.isChildSkill(skill)) {
{
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
//Profile not loaded //Profile not loaded
if(UserManager.getPlayer(sender.getName()) == null) if (UserManager.getPlayer(sender.getName()) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -65,7 +63,7 @@ public abstract class ExperienceCommand implements TabExecutor {
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args)); editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
return true; return true;
} else if((args.length == 3 && !isSilent(args)) } else if ((args.length == 3 && !isSilent(args))
|| (args.length == 4 && isSilent(args))) { || (args.length == 4 && isSilent(args))) {
if (!permissionsCheckOthers(sender)) { if (!permissionsCheckOthers(sender)) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
@@ -82,8 +80,7 @@ public abstract class ExperienceCommand implements TabExecutor {
skill = null; skill = null;
} }
if (skill != null && SkillTools.isChildSkill(skill)) if (skill != null && SkillTools.isChildSkill(skill)) {
{
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
@@ -104,14 +101,13 @@ public abstract class ExperienceCommand implements TabExecutor {
//Check loading by name //Check loading by name
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName); profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
if(CommandUtils.unloadedProfile(sender, profile)) { if (CommandUtils.unloadedProfile(sender, profile)) {
return true; return true;
} }
} }
editValues(null, profile, skill, value, isSilent(args)); editValues(null, profile, skill, value, isSilent(args));
} } else {
else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args)); editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args));
} }
@@ -126,7 +122,7 @@ public abstract class ExperienceCommand implements TabExecutor {
private boolean isSilent(String[] args) { private boolean isSilent(String[] args) {
int length = args.length; int length = args.length;
if(length == 0) if (length == 0)
return false; return false;
return args[length-1].equalsIgnoreCase("-s"); return args[length-1].equalsIgnoreCase("-s");
@@ -159,8 +155,7 @@ public abstract class ExperienceCommand implements TabExecutor {
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) { if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} } else {
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
} }
} }
@@ -174,8 +169,7 @@ public abstract class ExperienceCommand implements TabExecutor {
if (player != null) { if (player != null) {
handlePlayerMessageAll(player, value, isSilent); handlePlayerMessageAll(player, value, isSilent);
} }
} } else {
else {
handleCommand(player, profile, skill, value); handleCommand(player, profile, skill, value);
if (player != null) { if (player != null) {

View File

@@ -41,7 +41,7 @@ public class MmoeditCommand extends ExperienceCommand {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) { if (mmoPlayer != null) {
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel); EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
} else { } else {
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel); EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
@@ -51,7 +51,7 @@ public class MmoeditCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) { protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent) if (isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value)); player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
@@ -59,7 +59,7 @@ public class MmoeditCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent) if (isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value)); player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));

View File

@@ -48,8 +48,7 @@ public class SkillresetCommand implements TabExecutor {
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
skill = null; skill = null;
} } else {
else {
skill = mcMMO.p.getSkillTools().matchSkill(args[0]); skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
} }
@@ -68,8 +67,7 @@ public class SkillresetCommand implements TabExecutor {
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; skill = null;
} } else {
else {
skill = mcMMO.p.getSkillTools().matchSkill(args[1]); skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
} }
@@ -87,14 +85,13 @@ public class SkillresetCommand implements TabExecutor {
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName); profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
//Check if it was present in DB //Check if it was present in DB
if(CommandUtils.unloadedProfile(sender, profile)) { if (CommandUtils.unloadedProfile(sender, profile)) {
return true; return true;
} }
} }
editValues(null, profile, skill); editValues(null, profile, skill);
} } else {
else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill); editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
} }
@@ -156,8 +153,7 @@ public class SkillresetCommand implements TabExecutor {
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) { if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} } else {
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
} }
} }
@@ -171,8 +167,7 @@ public class SkillresetCommand implements TabExecutor {
if (player != null) { if (player != null) {
handlePlayerMessageAll(player); handlePlayerMessageAll(player);
} }
} } else {
else {
handleCommand(player, profile, skill); handleCommand(player, profile, skill);
if (player != null) { if (player != null) {

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -31,11 +31,11 @@ public class PartyAcceptCommand implements CommandExecutor {
} }
// Changing parties // Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) { if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true; return true;
} }
PartyManager.joinInvitedParty(mcMMOPlayer); mcMMO.p.getPartyManager().joinInvitedParty(mcMMOPlayer);
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@@ -31,7 +30,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
return true; return true;
} }
PartyManager.setPartyLeader(target.getUniqueId(), playerParty); mcMMO.p.getPartyManager().setPartyLeader(target.getUniqueId(), playerParty);
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));

View File

@@ -12,8 +12,7 @@ import org.jetbrains.annotations.NotNull;
public class PartyChangePasswordCommand implements CommandExecutor { public class PartyChangePasswordCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }

View File

@@ -23,11 +23,45 @@ import java.util.Collections;
import java.util.List; import java.util.List;
public class PartyCommand implements TabExecutor { public class PartyCommand implements TabExecutor {
private static final List<String> PARTY_SUBCOMMANDS; private final List<String> PARTY_SUBCOMMANDS;
private static final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal"); private final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc"); private final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
private final CommandExecutor partyJoinCommand;
private final CommandExecutor partyAcceptCommand;
private final CommandExecutor partyCreateCommand;
private final CommandExecutor partyQuitCommand;
private final CommandExecutor partyXpShareCommand;
private final CommandExecutor partyItemShareCommand;
private final CommandExecutor partyInviteCommand;
private final CommandExecutor partyKickCommand;
private final CommandExecutor partyDisbandCommand;
private final CommandExecutor partyChangeOwnerCommand;
private final CommandExecutor partyLockCommand;
private final CommandExecutor partyChangePasswordCommand;
private final CommandExecutor partyRenameCommand;
private final CommandExecutor partyInfoCommand;
private final CommandExecutor partyHelpCommand;
private final CommandExecutor partyTeleportCommand;
private final CommandExecutor partyAllianceCommand;
public PartyCommand() {
partyJoinCommand = new PartyJoinCommand();
partyAcceptCommand = new PartyAcceptCommand();
partyCreateCommand = new PartyCreateCommand();
partyQuitCommand = new PartyQuitCommand();
partyXpShareCommand = new PartyXpShareCommand();
partyItemShareCommand = new PartyItemShareCommand();
partyInviteCommand = new PartyInviteCommand();
partyKickCommand = new PartyKickCommand();
partyDisbandCommand = new PartyDisbandCommand();
partyChangeOwnerCommand = new PartyChangeOwnerCommand();
partyLockCommand = new PartyLockCommand();
partyChangePasswordCommand = new PartyChangePasswordCommand();
partyRenameCommand = new PartyRenameCommand();
partyInfoCommand = new PartyInfoCommand();
partyHelpCommand = new PartyHelpCommand();
partyTeleportCommand = new PtpCommand();
partyAllianceCommand = new PartyAllianceCommand();
static {
ArrayList<String> subcommands = new ArrayList<>(); ArrayList<String> subcommands = new ArrayList<>();
for (PartySubcommandType subcommand : PartySubcommandType.values()) { for (PartySubcommandType subcommand : PartySubcommandType.values()) {
@@ -38,24 +72,6 @@ public class PartyCommand implements TabExecutor {
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands); PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
} }
private final CommandExecutor partyJoinCommand = new PartyJoinCommand();
private final CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
private final CommandExecutor partyCreateCommand = new PartyCreateCommand();
private final CommandExecutor partyQuitCommand = new PartyQuitCommand();
private final CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
private final CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
private final CommandExecutor partyInviteCommand = new PartyInviteCommand();
private final CommandExecutor partyKickCommand = new PartyKickCommand();
private final CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
private final CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
private final CommandExecutor partyLockCommand = new PartyLockCommand();
private final CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
private final CommandExecutor partyRenameCommand = new PartyRenameCommand();
private final CommandExecutor partyInfoCommand = new PartyInfoCommand();
private final CommandExecutor partyHelpCommand = new PartyHelpCommand();
private final CommandExecutor partyTeleportCommand = new PtpCommand();
private final CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
@@ -73,13 +89,12 @@ public class PartyCommand implements TabExecutor {
return true; return true;
} }
if(UserManager.getPlayer(player) == null) McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
{ if (mcMMOPlayer == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (args.length < 1) { if (args.length < 1) {
if (!mcMMOPlayer.inParty()) { if (!mcMMOPlayer.inParty()) {
@@ -140,31 +155,18 @@ public class PartyCommand implements TabExecutor {
return true; return true;
} }
switch (subcommand) { return switch (subcommand) {
case XPSHARE: case XPSHARE -> partyXpShareCommand.onCommand(sender, command, label, args);
return partyXpShareCommand.onCommand(sender, command, label, args); case ITEMSHARE -> partyItemShareCommand.onCommand(sender, command, label, args);
case ITEMSHARE: case KICK -> partyKickCommand.onCommand(sender, command, label, args);
return partyItemShareCommand.onCommand(sender, command, label, args); case DISBAND -> partyDisbandCommand.onCommand(sender, command, label, args);
case KICK: case OWNER -> partyChangeOwnerCommand.onCommand(sender, command, label, args);
return partyKickCommand.onCommand(sender, command, label, args); case LOCK, UNLOCK -> partyLockCommand.onCommand(sender, command, label, args);
case DISBAND: case PASSWORD -> partyChangePasswordCommand.onCommand(sender, command, label, args);
return partyDisbandCommand.onCommand(sender, command, label, args); case RENAME -> partyRenameCommand.onCommand(sender, command, label, args);
case OWNER: case ALLIANCE -> partyAllianceCommand.onCommand(sender, command, label, args);
return partyChangeOwnerCommand.onCommand(sender, command, label, args); default -> true;
case LOCK: };
case UNLOCK:
return partyLockCommand.onCommand(sender, command, label, args);
case PASSWORD:
return partyChangePasswordCommand.onCommand(sender, command, label, args);
case RENAME:
return partyRenameCommand.onCommand(sender, command, label, args);
case ALLIANCE:
return partyAllianceCommand.onCommand(sender, command, label, args);
default:
break;
}
return true;
} }
@Override @Override
@@ -179,12 +181,13 @@ public class PartyCommand implements TabExecutor {
return ImmutableList.of(); return ImmutableList.of();
} }
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
switch (subcommand) { switch (subcommand) {
case JOIN: case JOIN:
case INVITE: case INVITE:
case KICK: case KICK:
case OWNER: case OWNER:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size())); return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
case XPSHARE: case XPSHARE:
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<>(XPSHARE_COMPLETIONS.size())); return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<>(XPSHARE_COMPLETIONS.size()));
@@ -198,17 +201,20 @@ public class PartyCommand implements TabExecutor {
case TELEPORT: case TELEPORT:
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<>(PtpCommand.TELEPORT_SUBCOMMANDS.size())); List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) { if (matches.isEmpty()) {
Player player = (Player) sender; Player player = (Player) sender;
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not Loaded //Not Loaded
if(UserManager.getPlayer(player) == null) if (mcMMOPlayer == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of(); return ImmutableList.of();
} }
Party party = UserManager.getPlayer(player).getParty(); if (mcMMOPlayer.getParty() == null)
return ImmutableList.of();
final Party party = mcMMOPlayer.getParty();
playerNames = party.getOnlinePlayerNames(player); playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size())); return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -19,23 +19,22 @@ public class PartyCreateCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(UserManager.getPlayer(player) == null) if (UserManager.getPlayer(player) == null) {
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
// Check to see if the party exists, and if it does cancel creating a new party // Check to see if the party exists, and if it does cancel creating a new party
if (PartyManager.checkPartyExistence(player, args[1])) { if (mcMMO.p.getPartyManager().checkPartyExistence(player, args[1])) {
return true; return true;
} }
// Changing parties // Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, args[1])) { if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, args[1])) {
return true; return true;
} }
PartyManager.createParty(mcMMOPlayer, args[1], getPassword(args)); mcMMO.p.getPartyManager().createParty(mcMMOPlayer, args[1], getPassword(args));
return true; return true;
default: default:

View File

@@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -26,14 +26,14 @@ public class PartyDisbandCommand implements CommandExecutor {
final String partyName = playerParty.getName(); final String partyName = playerParty.getName();
for (Player member : playerParty.getOnlineMembers()) { for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) { if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true; return true;
} }
member.sendMessage(LocaleLoader.getString("Party.Disband")); member.sendMessage(LocaleLoader.getString("Party.Disband"));
} }
PartyManager.disbandParty(mcMMOPlayer, playerParty); mcMMO.p.getPartyManager().disbandParty(mcMMOPlayer, playerParty);
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));

View File

@@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -24,8 +23,7 @@ public class PartyInfoCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
case 1: case 1:
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -71,8 +69,7 @@ public class PartyInfoCommand implements CommandExecutor {
if (isUnlockedFeature(party, partyFeature)) { if (isUnlockedFeature(party, partyFeature)) {
unlockedPartyFeatures.add(partyFeature.getLocaleString()); unlockedPartyFeatures.add(partyFeature.getLocaleString());
} } else {
else {
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString()); lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
} }
} }
@@ -125,7 +122,7 @@ public class PartyInfoCommand implements CommandExecutor {
* Only show members of the party that this member can see * Only show members of the party that this member can see
*/ */
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer); List<Player> nearMembers = mcMMO.p.getPartyManager().getNearVisibleMembers(mcMMOPlayer);
int membersOnline = party.getVisibleMembers(player).size(); int membersOnline = party.getVisibleMembers(player).size();
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header")); player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));

View File

@@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -40,19 +39,19 @@ public class PartyInviteCommand implements CommandExecutor {
return true; return true;
} }
if (PartyManager.inSameParty(player, target)) { if (mcMMO.p.getPartyManager().inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName)); sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true; return true;
} }
if (!PartyManager.canInvite(mcMMOPlayer)) { if (!mcMMO.p.getPartyManager().canInvite(mcMMOPlayer)) {
player.sendMessage(LocaleLoader.getString("Party.Locked")); player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true; return true;
} }
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();
if (PartyManager.isPartyFull(target, playerParty)) { if (mcMMO.p.getPartyManager().isPartyFull(target, playerParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), mcMMO.p.getGeneralConfig().getPartyMaxSize())); player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), mcMMO.p.getGeneralConfig().getPartyMaxSize()));
return true; return true;
} }

View File

@@ -20,8 +20,7 @@ import java.util.Locale;
public class PartyItemShareCommand implements CommandExecutor { public class PartyItemShareCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -50,11 +49,9 @@ public class PartyItemShareCommand implements CommandExecutor {
if (CommandUtils.shouldEnableToggle(args[2])) { if (CommandUtils.shouldEnableToggle(args[2])) {
toggle = true; toggle = true;
} } else if (CommandUtils.shouldDisableToggle(args[2])) {
else if (CommandUtils.shouldDisableToggle(args[2])) {
toggle = false; toggle = false;
} } else {
else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
return true; return true;
} }

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -34,8 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -51,25 +50,24 @@ public class PartyJoinCommand implements CommandExecutor {
String password = getPassword(args); String password = getPassword(args);
// Make sure party passwords match // Make sure party passwords match
if (!PartyManager.checkPartyPassword(player, targetParty, password)) { if (!mcMMO.p.getPartyManager().checkPartyPassword(player, targetParty, password)) {
return true; return true;
} }
String partyName = targetParty.getName(); String partyName = targetParty.getName();
// Changing parties // Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, partyName)) { if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, partyName)) {
return true; return true;
} }
if(PartyManager.isPartyFull(player, targetParty)) if (mcMMO.p.getPartyManager().isPartyFull(player, targetParty)) {
{
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString())); player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
return true; return true;
} }
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName)); player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName));
PartyManager.addToParty(mcMMOPlayer, targetParty); mcMMO.p.getPartyManager().addToParty(mcMMOPlayer, targetParty);
return true; return true;
default: default:

View File

@@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@@ -37,15 +36,15 @@ public class PartyKickCommand implements CommandExecutor {
Player onlineTarget = target.getPlayer(); Player onlineTarget = target.getPlayer();
String partyName = playerParty.getName(); String partyName = playerParty.getName();
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) { if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true; return true;
} }
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget)); mcMMO.p.getPartyManager().processPartyLeaving(UserManager.getPlayer(onlineTarget));
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName)); onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
} }
PartyManager.removeFromParty(target, playerParty); mcMMO.p.getPartyManager().removeFromParty(target, playerParty);
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));

View File

@@ -18,8 +18,7 @@ public class PartyLockCommand implements CommandExecutor {
case 1: case 1:
if (args[0].equalsIgnoreCase("lock")) { if (args[0].equalsIgnoreCase("lock")) {
togglePartyLock(sender, true); togglePartyLock(sender, true);
} } else if (args[0].equalsIgnoreCase("unlock")) {
else if (args[0].equalsIgnoreCase("unlock")) {
togglePartyLock(sender, false); togglePartyLock(sender, false);
} }
@@ -33,11 +32,9 @@ public class PartyLockCommand implements CommandExecutor {
if (CommandUtils.shouldEnableToggle(args[1])) { if (CommandUtils.shouldEnableToggle(args[1])) {
togglePartyLock(sender, true); togglePartyLock(sender, true);
} } else if (CommandUtils.shouldDisableToggle(args[1])) {
else if (CommandUtils.shouldDisableToggle(args[1])) {
togglePartyLock(sender, false); togglePartyLock(sender, false);
} } else {
else {
sendUsageStrings(sender); sendUsageStrings(sender);
} }
@@ -55,8 +52,7 @@ public class PartyLockCommand implements CommandExecutor {
} }
private void togglePartyLock(CommandSender sender, boolean lock) { private void togglePartyLock(CommandSender sender, boolean lock) {
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return; return;
} }

View File

@@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -26,11 +26,11 @@ public class PartyQuitCommand implements CommandExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) { if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
return true; return true;
} }
PartyManager.removeFromParty(mcMMOPlayer); mcMMO.p.getPartyManager().removeFromParty(mcMMOPlayer);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave")); sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
return true; return true;
} }

View File

@@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -25,7 +25,7 @@ public class PartyRenameCommand implements CommandExecutor {
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();
String oldPartyName = playerParty.getName(); String oldPartyName = playerParty.getName();
String newPartyName = args[1]; String newPartyName = args[1].replace(".", "");
// This is to prevent party leaders from spamming other players with the rename message // This is to prevent party leaders from spamming other players with the rename message
if (oldPartyName.equalsIgnoreCase(newPartyName)) { if (oldPartyName.equalsIgnoreCase(newPartyName)) {
@@ -36,14 +36,14 @@ public class PartyRenameCommand implements CommandExecutor {
Player player = mcMMOPlayer.getPlayer(); Player player = mcMMOPlayer.getPlayer();
// Check to see if the party exists, and if it does cancel renaming the party // Check to see if the party exists, and if it does cancel renaming the party
if (PartyManager.checkPartyExistence(player, newPartyName)) { if (mcMMO.p.getPartyManager().checkPartyExistence(player, newPartyName)) {
return true; return true;
} }
String leaderName = playerParty.getLeader().getPlayerName(); String leaderName = playerParty.getLeader().getPlayerName();
for (Player member : playerParty.getOnlineMembers()) { for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) { if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
return true; return true;
} }

View File

@@ -30,20 +30,15 @@ public enum PartySubcommandType {
if (commandName.equalsIgnoreCase("?")) { if (commandName.equalsIgnoreCase("?")) {
return HELP; return HELP;
} } else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
return QUIT; return QUIT;
} } else if (commandName.equalsIgnoreCase("leader")) {
else if (commandName.equalsIgnoreCase("leader")) {
return OWNER; return OWNER;
} } else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
return XPSHARE; return XPSHARE;
} } else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
return ITEMSHARE; return ITEMSHARE;
} } else if (commandName.equalsIgnoreCase("ally")) {
else if (commandName.equalsIgnoreCase("ally")) {
return ALLIANCE; return ALLIANCE;
} }

View File

@@ -17,8 +17,7 @@ import org.jetbrains.annotations.NotNull;
public class PartyXpShareCommand implements CommandExecutor { public class PartyXpShareCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -31,7 +31,7 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
return true; return true;
} }
PartyManager.acceptAllianceInvite(mcMMOPlayer); mcMMO.p.getPartyManager().acceptAllianceInvite(mcMMOPlayer);
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept"));

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@@ -38,8 +37,7 @@ public class PartyAllianceCommand implements TabExecutor {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -129,7 +127,7 @@ public class PartyAllianceCommand implements TabExecutor {
} }
private void displayMemberInfo(McMMOPlayer mcMMOPlayer) { private void displayMemberInfo(McMMOPlayer mcMMOPlayer) {
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer); List<Player> nearMembers = mcMMO.p.getPartyManager().getNearMembers(mcMMOPlayer);
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header")); player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header"));
player.sendMessage(playerParty.createMembersList(player)); player.sendMessage(playerParty.createMembersList(player));
player.sendMessage(ChatColor.DARK_GRAY + "----------------------------"); player.sendMessage(ChatColor.DARK_GRAY + "----------------------------");

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -28,7 +28,7 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
return true; return true;
} }
PartyManager.disbandAlliance(player, party, party.getAlly()); mcMMO.p.getPartyManager().disbandAlliance(player, party, party.getAlly());
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband")); sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband"));

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -44,7 +44,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
return true; return true;
} }
if (PartyManager.inSameParty(player, target)) { if (mcMMO.p.getPartyManager().inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName)); sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true; return true;
} }

View File

@@ -21,8 +21,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
if (ptpRecord.isConfirmRequired()) { if (ptpRecord.isConfirmRequired()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
} } else {
else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled")); sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
} }

View File

@@ -21,8 +21,7 @@ public class PtpAcceptCommand implements CommandExecutor {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -56,8 +55,7 @@ public class PtpAcceptCommand implements CommandExecutor {
if (!Permissions.partyTeleportWorld(target, targetWorld)) { if (!Permissions.partyTeleportWorld(target, targetWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName())); target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return true; return true;
} } else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName())); target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
return true; return true;
} }

View File

@@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.items.TeleportationWarmup; import com.gmail.nossr50.runnables.items.TeleportationWarmup;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@@ -46,22 +45,20 @@ public class PtpCommand implements TabExecutor {
Player player = (Player) sender; Player player = (Player) sender;
/* WORLD GUARD MAIN FLAG CHECK */ /* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded()) if (WorldGuardUtils.isWorldGuardLoaded()) {
{ if (!WorldGuardManager.getInstance().hasMainFlag(player))
if(!WorldGuardManager.getInstance().hasMainFlag(player))
return true; return true;
} }
/* WORLD BLACKLIST CHECK */ /* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(player.getWorld())) if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
return true; return true;
if (!UserManager.hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null) if (UserManager.getPlayer((Player) sender) == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -172,8 +169,7 @@ public class PtpCommand implements TabExecutor {
if (!Permissions.partyTeleportWorld(target, targetWorld)) { if (!Permissions.partyTeleportWorld(target, targetWorld)) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName())); player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return; return;
} } else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) {
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName())); player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return; return;
} }
@@ -210,7 +206,7 @@ public class PtpCommand implements TabExecutor {
return false; return false;
} }
if (!PartyManager.inSameParty(player, target)) { if (!mcMMO.p.getPartyManager().inSameParty(player, target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return false; return false;
} }
@@ -229,14 +225,12 @@ public class PtpCommand implements TabExecutor {
} }
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) { protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
if(UserManager.getPlayer(targetPlayer) == null) if (UserManager.getPlayer(targetPlayer) == null) {
{
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return; return;
} }
if(UserManager.getPlayer(teleportingPlayer) == null) if (UserManager.getPlayer(teleportingPlayer) == null) {
{
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return; return;
} }
@@ -250,9 +244,8 @@ public class PtpCommand implements TabExecutor {
if (warmup > 0) { if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup)); teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup); mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
} } else {
else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer); EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
} }
} }

View File

@@ -21,8 +21,7 @@ public class PtpToggleCommand implements CommandExecutor {
if (ptpRecord.isEnabled()) { if (ptpRecord.isEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
} } else {
else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled")); sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
} }

View File

@@ -9,6 +9,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.SkillTools;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -62,6 +63,12 @@ public class InspectCommand implements TabExecutor {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
// Sum power level
int powerLevel = 0;
for (PrimarySkillType skill : SkillTools.NON_CHILD_SKILLS)
powerLevel += profile.getSkillLevel(skill);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel));
} else { } else {
Player target = mcMMOPlayer.getPlayer(); Player target = mcMMOPlayer.getPlayer();
boolean isVanished = false; boolean isVanished = false;
@@ -85,10 +92,16 @@ public class InspectCommand implements TabExecutor {
} }
} }
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName())); if (isVanished) {
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
} else {
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
}
CommandUtils.printGatheringSkills(target, sender); CommandUtils.printGatheringSkills(target, sender);
CommandUtils.printCombatSkills(target, sender); CommandUtils.printCombatSkills(target, sender);
CommandUtils.printMiscSkills(target, sender); CommandUtils.printMiscSkills(target, sender);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel())); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
} }

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McRankCommandAsyncTask;
import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class McrankCommand implements TabExecutor { public class McRankCommand implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) { switch (args.length) {
@@ -85,8 +85,7 @@ public class McrankCommand implements TabExecutor {
if (sender instanceof Player) { if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName()); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if(mcMMOPlayer == null) if (mcMMOPlayer == null) {
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return; return;
} }
@@ -111,7 +110,7 @@ public class McrankCommand implements TabExecutor {
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard()); boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat(); boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); mcMMO.p.getFoliaLib().getImpl().runAsync(new McRankCommandAsyncTask(playerName, sender, useBoard, useChat));
} }
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) { private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McTopCommandAsyncTask;
import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MctopCommand implements TabExecutor { public class McTopCommand implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill = null; PrimarySkillType skill = null;
@@ -44,6 +44,12 @@ public class MctopCommand implements TabExecutor {
return true; return true;
} }
// Check if the command is for Maces but the MC version is not correct
if (skill == PrimarySkillType.MACES
&& !mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 21, 0)) {
return true;
}
display(1, skill, sender, command); display(1, skill, sender, command);
return true; return true;
@@ -58,6 +64,12 @@ public class MctopCommand implements TabExecutor {
return true; return true;
} }
// Check if the command is for Maces but the MC version is not correct
if (skill == PrimarySkillType.MACES
&& !mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 21, 0)) {
return true;
}
display(Math.abs(Integer.parseInt(args[1])), skill, sender, command); display(Math.abs(Integer.parseInt(args[1])), skill, sender, command);
return true; return true;
@@ -115,7 +127,7 @@ public class MctopCommand implements TabExecutor {
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard()); boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat(); boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); mcMMO.p.getFoliaLib().getImpl().runAsync(new McTopCommandAsyncTask(page, skill, sender, useBoard, useChat));
} }
private PrimarySkillType extractSkill(CommandSender sender, String skillName) { private PrimarySkillType extractSkill(CommandSender sender, String skillName) {

View File

@@ -24,22 +24,22 @@ public class XPBarCommand implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(sender instanceof Player) { if (sender instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender); McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
if(mmoPlayer == null) { if (mmoPlayer == null) {
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad"); NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
return false; return false;
} }
if(args.length == 0) { if (args.length == 0) {
return false; return false;
} else if(args.length < 2) { } else if (args.length < 2) {
String option = args[0]; String option = args[0];
if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) { if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null); mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
return true; return true;
} else if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) { } else if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
mmoPlayer.getExperienceBarManager().disableAllBars(); mmoPlayer.getExperienceBarManager().disableAllBars();
return true; return true;
} else { } else {
@@ -50,7 +50,7 @@ public class XPBarCommand implements TabExecutor {
} else if (args.length == 2) { } else if (args.length == 2) {
String skillName = args[1]; String skillName = args[1];
if(SkillUtils.isSkill(skillName)) { if (SkillUtils.isSkill(skillName)) {
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName); PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
@@ -58,7 +58,7 @@ public class XPBarCommand implements TabExecutor {
String option = args[0].toLowerCase(); String option = args[0].toLowerCase();
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option); ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
if(settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) { if (settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
//Change setting //Change setting
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill); mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
return true; return true;
@@ -103,7 +103,7 @@ public class XPBarCommand implements TabExecutor {
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length)); return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
case 2: case 2:
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) if (!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();

View File

@@ -5,9 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.random.RandomChanceSkill; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -30,7 +29,7 @@ public class AcrobaticsCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// ACROBATICS_DODGE // ACROBATICS_DODGE
if (canDodge) { if (canDodge) {
String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE); final String[] dodgeStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_DODGE);
dodgeChance = dodgeStrings[0]; dodgeChance = dodgeStrings[0];
dodgeChanceLucky = dodgeStrings[1]; dodgeChanceLucky = dodgeStrings[1];
} }
@@ -38,8 +37,8 @@ public class AcrobaticsCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE); canDodge = Permissions.canUseSubSkill(player, SubSkillType.ACROBATICS_DODGE);
canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL); canRoll = Permissions.canUseSubSkill(player, SubSkillType.ACROBATICS_ROLL);
} }
@Override @Override
@@ -55,27 +54,8 @@ public class AcrobaticsCommand extends SkillCommand {
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll"); AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
if(abstractSubSkill != null) if (abstractSubSkill != null) {
{ String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
double rollChance, graceChance;
//Chance to roll at half
RandomChanceSkill roll_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
//Chance to graceful roll
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
//Chance Stat Calculations
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
//damageThreshold = mcMMO.p.getAdvancedConfig().getRollDamageThreshold();
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
//Format
double rollChanceLucky = rollChance * 1.333D;
double graceChanceLucky = graceChance * 1.333D;
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0]) messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : "")); + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.alchemy.AlchemyManager; import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@@ -30,14 +29,7 @@ public class AlchemyCommand extends SkillCommand {
} }
protected String[] calculateAbilityDisplayValues(Player player) { protected String[] calculateAbilityDisplayValues(Player player) {
//TODO: Needed? AlchemyManager alchemyManager = mmoPlayer.getAlchemyManager();
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return new String[] {"DATA NOT LOADED", "DATA NOT LOADED"};
}
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
String[] displayValues = new String[2]; String[] displayValues = new String[2];
boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY); boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY);
@@ -59,7 +51,7 @@ public class AlchemyCommand extends SkillCommand {
// ALCHEMY_CONCOCTIONS // ALCHEMY_CONCOCTIONS
if (canConcoctions) { if (canConcoctions) {
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager(); AlchemyManager alchemyManager = mmoPlayer.getAlchemyManager();
tier = alchemyManager.getTier(); tier = alchemyManager.getTier();
ingredientCount = alchemyManager.getIngredients().size(); ingredientCount = alchemyManager.getIngredients().size();
ingredientList = alchemyManager.getIngredientList(); ingredientList = alchemyManager.getIngredientList();
@@ -68,8 +60,8 @@ public class AlchemyCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS); canCatalysis = Permissions.canUseSubSkill(player, SubSkillType.ALCHEMY_CATALYSIS);
canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS); canConcoctions = Permissions.canUseSubSkill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
} }
@Override @Override

View File

@@ -4,8 +4,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -32,14 +33,14 @@ public class ArcheryCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// ARCHERY_ARROW_RETRIEVAL // ARCHERY_ARROW_RETRIEVAL
if (canRetrieve) { if (canRetrieve) {
String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); String[] retrieveStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
retrieveChance = retrieveStrings[0]; retrieveChance = retrieveStrings[0];
retrieveChanceLucky = retrieveStrings[1]; retrieveChanceLucky = retrieveStrings[1];
} }
// ARCHERY_DAZE // ARCHERY_DAZE
if (canDaze) { if (canDaze) {
String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE); String[] dazeStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ARCHERY_DAZE);
dazeChance = dazeStrings[0]; dazeChance = dazeStrings[0];
dazeChanceLucky = dazeStrings[1]; dazeChanceLucky = dazeStrings[1];
} }
@@ -52,9 +53,9 @@ public class ArcheryCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT); canSkillShot = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_SKILL_SHOT);
canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE); canDaze = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_DAZE);
canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); canRetrieve = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
} }
@Override @Override
@@ -75,7 +76,7 @@ public class ArcheryCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus)); messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
} }
if(canUseSubskill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) { if (Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000)))); String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
} }

View File

@@ -5,10 +5,9 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.skills.axes.Axes;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -38,7 +37,7 @@ public class AxesCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// ARMOR IMPACT // ARMOR IMPACT
if (canImpact) { if (canImpact) {
impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage(); impactDamage = mmoPlayer.getAxesManager().getImpactDurabilityDamage();
} }
// AXE MASTERY // AXE MASTERY
@@ -48,7 +47,7 @@ public class AxesCommand extends SkillCommand {
// CRITICAL HIT // CRITICAL HIT
if (canCritical) { if (canCritical) {
String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.AXES_CRITICAL_STRIKES); String[] criticalHitStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES);
critChance = criticalHitStrings[0]; critChance = criticalHitStrings[0];
critChanceLucky = criticalHitStrings[1]; critChanceLucky = criticalHitStrings[1];
} }
@@ -64,10 +63,10 @@ public class AxesCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER); canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES); canCritical = Permissions.canUseSubSkill(player, SubSkillType.AXES_CRITICAL_STRIKES);
canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY); canAxeMastery = Permissions.canUseSubSkill(player, SubSkillType.AXES_AXE_MASTERY);
canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT); canImpact = Permissions.canUseSubSkill(player, SubSkillType.AXES_ARMOR_IMPACT);
canGreaterImpact = canUseSubskill(player, SubSkillType.AXES_GREATER_IMPACT); canGreaterImpact = Permissions.canUseSubSkill(player, SubSkillType.AXES_GREATER_IMPACT);
} }
@Override @Override
@@ -96,7 +95,7 @@ public class AxesCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : "")); + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
} }
if(canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) { if (Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK, messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000)))); String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
} }
@@ -106,7 +105,7 @@ public class AxesCommand extends SkillCommand {
@Override @Override
protected List<Component> getTextComponents(Player player) { protected List<Component> getTextComponents(Player player) {
List<Component> textComponents = new ArrayList<>(); final List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES); TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);

View File

@@ -0,0 +1,75 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.*;
public class CrossbowsCommand extends SkillCommand {
private boolean canTrickShot;
private boolean canPoweredShot;
public CrossbowsCommand() {
super(PrimarySkillType.CROSSBOWS);
}
@Override
protected void dataCalculations(Player player, float skillValue) {
// TODO: Implement data calculations
}
@Override
protected void permissionsCheck(Player player) {
canTrickShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_TRICK_SHOT)
&& Permissions.trickShot(player);
canPoweredShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_POWERED_SHOT)
&& Permissions.poweredShot(player);
}
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>();
if (mmoPlayer == null) {
return messages;
}
if (canPoweredShot) {
messages.add(getStatMessage(CROSSBOWS_POWERED_SHOT,
percent.format(mmoPlayer.getCrossbowsManager().getDamageBonusPercent(player))));
}
if (canTrickShot) {
messages.add(getStatMessage(CROSSBOWS_TRICK_SHOT,
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
}
if (Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
}
messages.add(ChatColor.GRAY + "The Crossbows skill is a work in progress and is still being developed, feedback would be appreciated in the mcMMO discord server.");
return messages;
}
@Override
protected List<Component> getTextComponents(Player player) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.CROSSBOWS);
return textComponents;
}
}

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@@ -38,14 +37,14 @@ public class ExcavationCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER); canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY); canTreasureHunt = Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager(); ExcavationManager excavationManager = mmoPlayer.getExcavationManager();
if (canGigaDrill) { if (canGigaDrill) {
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength) messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
@@ -54,7 +53,7 @@ public class ExcavationCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : "")); //messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
} }
if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) { if (Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY, messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D))); percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY, messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,

View File

@@ -7,8 +7,9 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.fishing.FishingManager; import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.Probability;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
@@ -48,7 +49,7 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); FishingManager fishingManager = mmoPlayer.getFishingManager();
// TREASURE HUNTER // TREASURE HUNTER
if (canTreasureHunt) { if (canTreasureHunt) {
@@ -71,7 +72,7 @@ public class FishingCommand extends SkillCommand {
} }
} }
if(totalEnchantChance >= 1) if (totalEnchantChance >= 1)
magicChance = percent.format(totalEnchantChance / 100.0); magicChance = percent.format(totalEnchantChance / 100.0);
else else
magicChance = percent.format(0); magicChance = percent.format(0);
@@ -79,7 +80,8 @@ public class FishingCommand extends SkillCommand {
// FISHING_SHAKE // FISHING_SHAKE
if (canShake) { if (canShake) {
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(player, PrimarySkillType.FISHING, fishingManager.getShakeChance()); Probability shakeProbability = Probability.ofPercent(fishingManager.getShakeChance());
String[] shakeStrings = ProbabilityUtil.getRNGDisplayValues(shakeProbability);
shakeChance = shakeStrings[0]; shakeChance = shakeStrings[0];
shakeChanceLucky = shakeStrings[1]; shakeChanceLucky = shakeStrings[1];
} }
@@ -98,12 +100,12 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canTreasureHunt = canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER); canTreasureHunt = Permissions.canUseSubSkill(player, SubSkillType.FISHING_TREASURE_HUNTER);
canMagicHunt = canUseSubskill(player, SubSkillType.FISHING_MAGIC_HUNTER) && canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER); canMagicHunt = Permissions.canUseSubSkill(player, SubSkillType.FISHING_MAGIC_HUNTER) && Permissions.canUseSubSkill(player, SubSkillType.FISHING_TREASURE_HUNTER);
canShake = canUseSubskill(player, SubSkillType.FISHING_SHAKE); canShake = Permissions.canUseSubSkill(player, SubSkillType.FISHING_SHAKE);
canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET); canFishermansDiet = Permissions.canUseSubSkill(player, SubSkillType.FISHING_FISHERMANS_DIET);
canMasterAngler = mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() != null && canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER); canMasterAngler = mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() != null && Permissions.canUseSubSkill(player, SubSkillType.FISHING_MASTER_ANGLER);
canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING); canIceFish = Permissions.canUseSubSkill(player, SubSkillType.FISHING_ICE_FISHING);
} }
@Override @Override

View File

@@ -5,8 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
@@ -24,6 +24,8 @@ public class HerbalismCommand extends SkillCommand {
private int farmersDietRank; private int farmersDietRank;
private String doubleDropChance; private String doubleDropChance;
private String doubleDropChanceLucky; private String doubleDropChanceLucky;
private String tripleDropChance;
private String tripleDropChanceLucky;
private String hylianLuckChance; private String hylianLuckChance;
private String hylianLuckChanceLucky; private String hylianLuckChanceLucky;
private String shroomThumbChance; private String shroomThumbChance;
@@ -35,6 +37,7 @@ public class HerbalismCommand extends SkillCommand {
private boolean canGreenThumbBlocks; private boolean canGreenThumbBlocks;
private boolean canFarmersDiet; private boolean canFarmersDiet;
private boolean canDoubleDrop; private boolean canDoubleDrop;
private boolean canTripleDrop;
private boolean canShroomThumb; private boolean canShroomThumb;
public HerbalismCommand() { public HerbalismCommand() {
@@ -46,10 +49,16 @@ public class HerbalismCommand extends SkillCommand {
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS); String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_DOUBLE_DROPS);
doubleDropChance = doubleDropStrings[0]; doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1]; doubleDropChanceLucky = doubleDropStrings[1];
} }
if (canTripleDrop) {
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_VERDANT_BOUNTY);
tripleDropChance = tripleDropStrings[0];
tripleDropChanceLucky = tripleDropStrings[1];
}
// FARMERS DIET // FARMERS DIET
if (canFarmersDiet) { if (canFarmersDiet) {
@@ -67,21 +76,21 @@ public class HerbalismCommand extends SkillCommand {
if (canGreenThumbBlocks || canGreenThumbPlants) { if (canGreenThumbBlocks || canGreenThumbPlants) {
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB); greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB); String[] greenThumbStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB);
greenThumbChance = greenThumbStrings[0]; greenThumbChance = greenThumbStrings[0];
greenThumbChanceLucky = greenThumbStrings[1]; greenThumbChanceLucky = greenThumbStrings[1];
} }
// HYLIAN LUCK // HYLIAN LUCK
if (hasHylianLuck) { if (hasHylianLuck) {
String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK); String[] hylianLuckStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_HYLIAN_LUCK);
hylianLuckChance = hylianLuckStrings[0]; hylianLuckChance = hylianLuckStrings[0];
hylianLuckChanceLucky = hylianLuckStrings[1]; hylianLuckChanceLucky = hylianLuckStrings[1];
} }
// SHROOM THUMB // SHROOM THUMB
if (canShroomThumb) { if (canShroomThumb) {
String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB); String[] shroomThumbStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.HERBALISM_SHROOM_THUMB);
shroomThumbChance = shroomThumbStrings[0]; shroomThumbChance = shroomThumbStrings[0];
shroomThumbChanceLucky = shroomThumbStrings[1]; shroomThumbChanceLucky = shroomThumbStrings[1];
} }
@@ -89,13 +98,14 @@ public class HerbalismCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK); hasHylianLuck = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
canGreenTerra = Permissions.greenTerra(player); canGreenTerra = Permissions.greenTerra(player);
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOTS) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA)); canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOTS) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS)); canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS));
canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET); canFarmersDiet = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_FARMERS_DIET);
canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill); canDoubleDrop = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill);
canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB); canTripleDrop = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_VERDANT_BOUNTY) && !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill);
canShroomThumb = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_SHROOM_THUMB);
} }
@Override @Override
@@ -106,11 +116,16 @@ public class HerbalismCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance) messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
} }
if (canTripleDrop) {
messages.add(getStatMessage(SubSkillType.HERBALISM_VERDANT_BOUNTY, tripleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
}
if (canFarmersDiet) { if (canFarmersDiet) {
messages.add(getStatMessage(false, true, SubSkillType.HERBALISM_FARMERS_DIET, String.valueOf(farmersDietRank))); messages.add(getStatMessage(false, true, SubSkillType.HERBALISM_FARMERS_DIET, String.valueOf(farmersDietRank)));
} }
if (canGreenTerra) { if (canGreenTerra) {
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength) messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : "")); + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));

View File

@@ -0,0 +1,81 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.maces.MacesManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.MACES_CRIPPLE;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.MACES_MACES_LIMIT_BREAK;
public class MacesCommand extends SkillCommand {
public MacesCommand() {
super(PrimarySkillType.MACES);
}
String crippleChanceToApply, crippleChanceToApplyLucky, crippleLengthAgainstPlayers, crippleLengthAgainstMobs;
@Override
protected void dataCalculations(Player player, float skillValue) {
if (SkillUtils.canUseSubskill(player, MACES_CRIPPLE)) {
int crippleRank = RankUtils.getRank(player, MACES_CRIPPLE);
crippleLengthAgainstPlayers = String.valueOf(MacesManager.getCrippleTickDuration(true) / 20.0D);
crippleLengthAgainstMobs = String.valueOf(MacesManager.getCrippleTickDuration(false) / 20.0D);
crippleChanceToApply = String.valueOf(mcMMO.p.getAdvancedConfig().getCrippleChanceToApplyOnHit(crippleRank) + "%");
crippleChanceToApplyLucky = String.valueOf(mcMMO.p.getAdvancedConfig().getCrippleChanceToApplyOnHit(crippleRank) * 1.33);
}
}
@Override
protected void permissionsCheck(Player player) {}
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
final List<String> messages = new ArrayList<>();
if (SkillUtils.canUseSubskill(player, MACES_MACES_LIMIT_BREAK)) {
messages.add(getStatMessage(MACES_MACES_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player,
MACES_MACES_LIMIT_BREAK, 1000))));
}
if (SkillUtils.canUseSubskill(player, MACES_CRIPPLE)) {
messages.add(getStatMessage(MACES_CRIPPLE, crippleChanceToApply)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", crippleChanceToApplyLucky) : ""));
messages.add(getStatMessage(true, true, MACES_CRIPPLE,
crippleLengthAgainstPlayers,
crippleLengthAgainstMobs));
}
if (SkillUtils.canUseSubskill(player, SubSkillType.MACES_CRUSH)) {
messages.add(getStatMessage(SubSkillType.MACES_CRUSH,
String.valueOf(mmoPlayer.getMacesManager().getCrushDamage())));
}
messages.add(ChatColor.GRAY + "The Maces skill is a work in progress and is still being developed," +
" feedback would be appreciated in the mcMMO discord server.");
return messages;
}
@Override
protected List<Component> getTextComponents(Player player) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MACES);
return textComponents;
}
}

View File

@@ -5,9 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -18,6 +17,8 @@ import java.util.List;
public class MiningCommand extends SkillCommand { public class MiningCommand extends SkillCommand {
private String doubleDropChance; private String doubleDropChance;
private String doubleDropChanceLucky; private String doubleDropChanceLucky;
private String tripleDropChance;
private String tripleDropChanceLucky;
private String superBreakerLength; private String superBreakerLength;
private String superBreakerLengthEndurance; private String superBreakerLengthEndurance;
@@ -30,6 +31,7 @@ public class MiningCommand extends SkillCommand {
private boolean canSuperBreaker; private boolean canSuperBreaker;
private boolean canDoubleDrop; private boolean canDoubleDrop;
private boolean canTripleDrop;
private boolean canBlast; private boolean canBlast;
private boolean canBiggerBombs; private boolean canBiggerBombs;
private boolean canDemoExpert; private boolean canDemoExpert;
@@ -42,7 +44,7 @@ public class MiningCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// BLAST MINING // BLAST MINING
if (canBlast || canDemoExpert || canBiggerBombs) { if (canBlast || canDemoExpert || canBiggerBombs) {
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager(); MiningManager miningManager = mmoPlayer.getMiningManager();
blastMiningRank = miningManager.getBlastMiningTier(); blastMiningRank = miningManager.getBlastMiningTier();
bonusTNTDrops = miningManager.getDropMultiplier(); bonusTNTDrops = miningManager.getDropMultiplier();
@@ -51,10 +53,17 @@ public class MiningCommand extends SkillCommand {
blastDamageDecrease = percent.format(miningManager.getBlastDamageModifier() / 100.0D); blastDamageDecrease = percent.format(miningManager.getBlastDamageModifier() / 100.0D);
blastRadiusIncrease = miningManager.getBlastRadiusModifier(); blastRadiusIncrease = miningManager.getBlastRadiusModifier();
} }
// Mastery TRIPLE DROPS
if (canTripleDrop) {
String[] masteryTripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.MINING_MOTHER_LODE);
tripleDropChance = masteryTripleDropStrings[0];
tripleDropChanceLucky = masteryTripleDropStrings[1];
}
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.MINING_DOUBLE_DROPS); String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.MINING_DOUBLE_DROPS);
doubleDropChance = doubleDropStrings[0]; doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1]; doubleDropChanceLucky = doubleDropStrings[1];
} }
@@ -72,7 +81,8 @@ public class MiningCommand extends SkillCommand {
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player); canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player); canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player); canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
canDoubleDrop = canUseSubskill(player, SubSkillType.MINING_DOUBLE_DROPS); canDoubleDrop = Permissions.canUseSubSkill(player, SubSkillType.MINING_DOUBLE_DROPS);
canTripleDrop = Permissions.canUseSubSkill(player, SubSkillType.MINING_MOTHER_LODE);
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player); canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
} }
@@ -94,13 +104,18 @@ public class MiningCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease)); messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease));
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease)); //messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
} }
if (canDoubleDrop) { if (canDoubleDrop) {
messages.add(getStatMessage(SubSkillType.MINING_DOUBLE_DROPS, doubleDropChance) messages.add(getStatMessage(SubSkillType.MINING_DOUBLE_DROPS, doubleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); //messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
} }
if (canTripleDrop) {
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
}
if (canSuperBreaker) { if (canSuperBreaker) {
messages.add(getStatMessage(SubSkillType.MINING_SUPER_BREAKER, superBreakerLength) messages.add(getStatMessage(SubSkillType.MINING_SUPER_BREAKER, superBreakerLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : "")); + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@@ -27,32 +26,26 @@ public class MmoInfoCommand implements TabExecutor {
/* /*
* Only allow players to use this command * Only allow players to use this command
*/ */
if(commandSender instanceof Player) if (commandSender instanceof Player player) {
{ if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
if(args.length < 1)
return false; return false;
Player player = (Player) commandSender; if (Permissions.mmoinfo(player)) {
if(Permissions.mmoinfo(player)) if (args[0].equalsIgnoreCase( "???")) {
{
if(args == null || args[0] == null)
return false;
if(args[0].equalsIgnoreCase( "???"))
{
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery"));
return true; return true;
} else if(InteractionManager.getAbstractByName(args[0]) != null || mcMMO.p.getSkillTools().EXACT_SUBSKILL_NAMES.contains(args[0]))
{
displayInfo(player, args[0]);
return true;
} }
//Not a real skill final SubSkillType subSkillType = matchSubSkill(args[0]);
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.NoMatch")); if (subSkillType != null) {
displayInfo(player, subSkillType);
} else {
//Not a real skill
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.NoMatch"));
}
return true; return true;
} }
} }
@@ -60,6 +53,15 @@ public class MmoInfoCommand implements TabExecutor {
return false; return false;
} }
public SubSkillType matchSubSkill(String name) {
for(SubSkillType subSkillType : SubSkillType.values()) {
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|| subSkillType.name().equalsIgnoreCase(name))
return subSkillType;
}
return null;
}
@Override @Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) { if (args.length == 1) {
@@ -68,20 +70,12 @@ public class MmoInfoCommand implements TabExecutor {
return ImmutableList.of(); return ImmutableList.of();
} }
private void displayInfo(Player player, String subSkillName) private void displayInfo(Player player, SubSkillType subSkillType) {
{
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName)); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillType.getLocaleName()));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
for(SubSkillType subSkillType : SubSkillType.values())
{
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
subSkillName = subSkillType.getWikiName(subSkillType.toString());
}
//Send Player Wiki Link //Send Player Wiki Link
TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillName); TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillType.getLocaleName(), subSkillType);
} }
} }

View File

@@ -0,0 +1,40 @@
package com.gmail.nossr50.commands.skills;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Default;
import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@CommandPermission("mcmmo.commands.mmopower")
@CommandAlias("mmopower|mmopowerlevel|powerlevel")
public class PowerLevelCommand extends BaseCommand {
private final @NotNull mcMMO pluginRef;
public PowerLevelCommand(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Default
@Conditions(CommandManager.POWER_LEVEL_CONDITION)
public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
Player player = bukkitCommandIssuer.getPlayer();
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); //Should never be null at this point because its caught in an ACF validation
if (mmoPlayer == null) {
return;
}
int powerLevel = mmoPlayer.getPowerLevel();
mmoPlayer.getPlayer().sendMessage(ChatColor.DARK_AQUA + "Your " + ChatColor.GOLD + "[mcMMO]" + ChatColor.DARK_AQUA + " power level is: " + ChatColor.GREEN + powerLevel);
}
}

View File

@@ -10,9 +10,8 @@ import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairManager; import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
@@ -68,7 +67,7 @@ public class RepairCommand extends SkillCommand {
// SUPER REPAIR // SUPER REPAIR
if (canSuperRepair) { if (canSuperRepair) {
String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.REPAIR_SUPER_REPAIR); String[] superRepairStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.REPAIR_SUPER_REPAIR);
superRepairChance = superRepairStrings[0]; superRepairChance = superRepairStrings[0];
superRepairChanceLucky = superRepairStrings[1]; superRepairChanceLucky = superRepairStrings[1];
} }
@@ -76,9 +75,9 @@ public class RepairCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR); canSuperRepair = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_SUPER_REPAIR);
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY); canMasterRepair = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING); canArcaneForge = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_ARCANE_FORGING);
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND); canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD); canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON); canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
@@ -94,7 +93,7 @@ public class RepairCommand extends SkillCommand {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canArcaneForge) { if (canArcaneForge) {
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager(); RepairManager repairManager = mmoPlayer.getRepairManager();
messages.add(getStatMessage(false, true, messages.add(getStatMessage(false, true,
SubSkillType.REPAIR_ARCANE_FORGING, SubSkillType.REPAIR_ARCANE_FORGING,

View File

@@ -5,7 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.salvage.Salvage; import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.skills.salvage.SalvageManager; import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@@ -30,14 +30,14 @@ public class SalvageCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canScrapCollector = canUseSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR); canScrapCollector = Permissions.canUseSubSkill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE); canArcaneSalvage = Permissions.canUseSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
} }
@Override @Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager(); SalvageManager salvageManager = mmoPlayer.getSalvageManager();
if (canScrapCollector) { if (canScrapCollector) {
messages.add(getStatMessage(false, true, messages.add(getStatMessage(false, true,

View File

@@ -5,16 +5,12 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.PerksUtils; import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillTools; import com.gmail.nossr50.util.skills.SkillTools;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
@@ -32,20 +28,18 @@ import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
public abstract class SkillCommand implements TabExecutor { public abstract class SkillCommand implements TabExecutor {
protected PrimarySkillType skill; protected PrimarySkillType skill;
private final String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%"); protected DecimalFormat percent = new DecimalFormat("##0.00%");
protected DecimalFormat decimal = new DecimalFormat("##0.00"); protected DecimalFormat decimal = new DecimalFormat("##0.00");
protected McMMOPlayer mmoPlayer;
private final CommandExecutor skillGuideCommand; private final CommandExecutor skillGuideCommand;
public SkillCommand(PrimarySkillType skill) { public SkillCommand(PrimarySkillType skill) {
this.skill = skill; this.skill = skill;
skillName = mcMMO.p.getSkillTools().getLocalizedSkillName(skill);
skillGuideCommand = new SkillGuideCommand(skill); skillGuideCommand = new SkillGuideCommand(skill);
} }
@@ -60,9 +54,9 @@ public abstract class SkillCommand implements TabExecutor {
} }
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); mmoPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer == null) { if (mmoPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
@@ -70,7 +64,7 @@ public abstract class SkillCommand implements TabExecutor {
if (args.length == 0) { if (args.length == 0) {
boolean isLucky = Permissions.lucky(player, skill); boolean isLucky = Permissions.lucky(player, skill);
boolean hasEndurance = PerksUtils.handleActivationPerks(player, 0, 0) != 0; boolean hasEndurance = PerksUtils.handleActivationPerks(player, 0, 0) != 0;
float skillValue = mcMMOPlayer.getSkillLevel(skill); float skillValue = mmoPlayer.getSkillLevel(skill);
//Send the players a few blank lines to make finding the top of the skill command easier //Send the players a few blank lines to make finding the top of the skill command easier
if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines()) if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines())
@@ -81,7 +75,8 @@ public abstract class SkillCommand implements TabExecutor {
permissionsCheck(player); permissionsCheck(player);
dataCalculations(player, skillValue); dataCalculations(player, skillValue);
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue); sendSkillCommandHeader(mcMMO.p.getSkillTools().getLocalizedSkillName(skill),
player, mmoPlayer, (int) skillValue);
//Make JSON text components //Make JSON text components
List<Component> subskillTextComponents = getTextComponents(player); List<Component> subskillTextComponents = getTextComponents(player);
@@ -93,8 +88,7 @@ public abstract class SkillCommand implements TabExecutor {
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents); TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
/*for(TextComponent tc : subskillTextComponents) /*for(TextComponent tc : subskillTextComponents) {
{
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")}); player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
}*/ }*/
@@ -144,19 +138,17 @@ public abstract class SkillCommand implements TabExecutor {
} }
} }
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase(Locale.ENGLISH))); final String skillName = mcMMO.p.getSkillTools().getLocalizedSkillName(skill);
player.sendMessage(LocaleLoader.getString("Guides.Available",
skillName,
skillName.toLowerCase(Locale.ENGLISH)));
} }
private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) { private void sendSkillCommandHeader(String skillName, Player player, McMMOPlayer mcMMOPlayer, int skillValue) {
ChatColor hd1 = ChatColor.DARK_AQUA; // send header
ChatColor c1 = ChatColor.GOLD;
ChatColor c2 = ChatColor.RED;
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName)); player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
if(!SkillTools.isChildSkill(skill)) if (!SkillTools.isChildSkill(skill)) {
{
/* /*
* NON-CHILD SKILLS * NON-CHILD SKILLS
*/ */
@@ -173,7 +165,7 @@ public abstract class SkillCommand implements TabExecutor {
*/ */
Set<PrimarySkillType> parents = FamilyTree.getParents(skill); var parents = mcMMO.p.getSkillTools().getChildSkillParents(skill);
//TODO: Add JSON here //TODO: Add JSON here
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/ /*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
@@ -181,10 +173,8 @@ public abstract class SkillCommand implements TabExecutor {
StringBuilder parentMessage = new StringBuilder(); StringBuilder parentMessage = new StringBuilder();
for(int i = 0; i < parentList.size(); i++) for(int i = 0; i < parentList.size(); i++) {
{ if (i+1 < parentList.size()) {
if(i+1 < parentList.size())
{
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i)))); parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
parentMessage.append(ChatColor.GRAY).append(", "); parentMessage.append(ChatColor.GRAY).append(", ");
} else { } else {
@@ -232,9 +222,9 @@ public abstract class SkillCommand implements TabExecutor {
return Math.min((int) skillValue, maxLevel) / rankChangeLevel; return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
} }
protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) { // protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill); // return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
} // }
protected String[] calculateLengthDisplayValues(Player player, float skillValue) { protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
int maxLength = mcMMO.p.getSkillTools().getSuperAbilityMaxLength(mcMMO.p.getSkillTools().getSuperAbility(skill)); int maxLength = mcMMO.p.getSkillTools().getSuperAbilityMaxLength(mcMMO.p.getSkillTools().getSuperAbility(skill));
@@ -243,11 +233,9 @@ public abstract class SkillCommand implements TabExecutor {
int length; int length;
if(abilityLengthCap <= 0) if (abilityLengthCap <= 0) {
{
length = 2 + (int) (skillValue / abilityLengthVar); length = 2 + (int) (skillValue / abilityLengthVar);
} } else {
else {
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar); length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
} }
@@ -260,27 +248,24 @@ public abstract class SkillCommand implements TabExecutor {
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) }; return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
} }
protected String getStatMessage(SubSkillType subSkillType, String... vars) protected String getStatMessage(SubSkillType subSkillType, String... vars) {
{
return getStatMessage(false, false, subSkillType, vars); return getStatMessage(false, false, subSkillType, vars);
} }
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) {
{
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template"; String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription(); String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if(isCustom) if (isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars)); return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
else else {
{
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars); String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
return LocaleLoader.getString(templateKey, mergedList); return LocaleLoader.getString(templateKey, mergedList);
} }
} }
protected String getLimitBreakDescriptionParameter() { protected String getLimitBreakDescriptionParameter() {
if(mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) { if (mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
return "(PVP/PVE)"; return "(PVP/PVE)";
} else { } else {
return "(PVP)"; return "(PVP)";
@@ -297,14 +282,4 @@ public abstract class SkillCommand implements TabExecutor {
protected abstract List<Component> getTextComponents(Player player); protected abstract List<Component> getTextComponents(Player player);
/**
* Checks if a player can use a skill
* @param player target player
* @param subSkillType target subskill
* @return true if the player has permission and has the skill unlocked
*/
protected boolean canUseSubskill(Player player, SubSkillType subSkillType)
{
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
}
} }

View File

@@ -77,8 +77,7 @@ public class SkillGuideCommand implements CommandExecutor {
while (allStrings.size() < 9) { while (allStrings.size() < 9) {
if (pageIndexStart + allStrings.size() > guide.size()) { if (pageIndexStart + allStrings.size() > guide.size()) {
allStrings.add(""); allStrings.add("");
} } else {
else {
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1))); allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
} }
} }

View File

@@ -4,9 +4,8 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -34,19 +33,19 @@ public class SmeltingCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// FUEL EFFICIENCY // FUEL EFFICIENCY
if (canFuelEfficiency) { if (canFuelEfficiency) {
burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier()); burnTimeModifier = String.valueOf(mmoPlayer.getSmeltingManager().getFuelEfficiencyMultiplier());
} }
// FLUX MINING // FLUX MINING
/*if (canFluxMine) { /*if (canFluxMine) {
String[] fluxMiningStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_FLUX_MINING); String[] fluxMiningStrings = getRNGDisplayValues(player, SubSkillType.SMELTING_FLUX_MINING);
str_fluxMiningChance = fluxMiningStrings[0]; str_fluxMiningChance = fluxMiningStrings[0];
str_fluxMiningChanceLucky = fluxMiningStrings[1]; str_fluxMiningChanceLucky = fluxMiningStrings[1];
}*/ }*/
// SECOND SMELT // SECOND SMELT
if (canSecondSmelt) { if (canSecondSmelt) {
String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_SECOND_SMELT); String[] secondSmeltStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.SMELTING_SECOND_SMELT);
str_secondSmeltChance = secondSmeltStrings[0]; str_secondSmeltChance = secondSmeltStrings[0];
str_secondSmeltChanceLucky = secondSmeltStrings[1]; str_secondSmeltChanceLucky = secondSmeltStrings[1];
} }
@@ -54,8 +53,8 @@ public class SmeltingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY); canFuelEfficiency = Permissions.canUseSubSkill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
canSecondSmelt = canUseSubskill(player, SubSkillType.SMELTING_SECOND_SMELT); canSecondSmelt = Permissions.canUseSubSkill(player, SubSkillType.SMELTING_SECOND_SMELT);
//canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING); //canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING);
canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART); canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
} }
@@ -81,7 +80,7 @@ public class SmeltingCommand extends SkillCommand {
if (canUnderstandTheArt) { if (canUnderstandTheArt) {
messages.add(getStatMessage(false, true, SubSkillType.SMELTING_UNDERSTANDING_THE_ART, messages.add(getStatMessage(false, true, SubSkillType.SMELTING_UNDERSTANDING_THE_ART,
String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier()))); String.valueOf(mmoPlayer.getSmeltingManager().getVanillaXpMultiplier())));
} }
return messages; return messages;

View File

@@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -38,7 +38,7 @@ public class SwordsCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// SWORDS_COUNTER_ATTACK // SWORDS_COUNTER_ATTACK
if (canCounter) { if (canCounter) {
String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_COUNTER_ATTACK); String[] counterStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.SWORDS_COUNTER_ATTACK);
counterChance = counterStrings[0]; counterChance = counterStrings[0];
counterChanceLucky = counterStrings[1]; counterChanceLucky = counterStrings[1];
} }
@@ -69,8 +69,8 @@ public class SwordsCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canRupture = canUseSubskill(player, SubSkillType.SWORDS_RUPTURE); canRupture = SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
canCounter = canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK); canCounter = SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player); canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
} }
@@ -101,13 +101,12 @@ public class SwordsCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : "")); + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
} }
if(canUseSubskill(player, SubSkillType.SWORDS_STAB)) if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB)) {
{
messages.add(getStatMessage(SubSkillType.SWORDS_STAB, messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage()))); String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
} }
if(canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) { if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000)))); String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
} }

View File

@@ -5,7 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@@ -35,7 +35,7 @@ public class TamingCommand extends SkillCommand {
@Override @Override
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
if (canGore) { if (canGore) {
String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.TAMING_GORE); String[] goreStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.TAMING_GORE);
goreChance = goreStrings[0]; goreChance = goreStrings[0];
goreChanceLucky = goreStrings[1]; goreChanceLucky = goreStrings[1];
} }
@@ -43,15 +43,15 @@ public class TamingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canBeastLore = canUseSubskill(player, SubSkillType.TAMING_BEAST_LORE); canBeastLore = Permissions.canUseSubSkill(player, SubSkillType.TAMING_BEAST_LORE);
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT); canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
canEnvironmentallyAware = canUseSubskill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE); canEnvironmentallyAware = Permissions.canUseSubSkill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
canFastFood = canUseSubskill(player, SubSkillType.TAMING_FAST_FOOD_SERVICE); canFastFood = Permissions.canUseSubSkill(player, SubSkillType.TAMING_FAST_FOOD_SERVICE);
canGore = canUseSubskill(player, SubSkillType.TAMING_GORE); canGore = Permissions.canUseSubSkill(player, SubSkillType.TAMING_GORE);
canSharpenedClaws = canUseSubskill(player, SubSkillType.TAMING_SHARPENED_CLAWS); canSharpenedClaws = Permissions.canUseSubSkill(player, SubSkillType.TAMING_SHARPENED_CLAWS);
canShockProof = canUseSubskill(player, SubSkillType.TAMING_SHOCK_PROOF); canShockProof = Permissions.canUseSubSkill(player, SubSkillType.TAMING_SHOCK_PROOF);
canThickFur = canUseSubskill(player, SubSkillType.TAMING_THICK_FUR); canThickFur = Permissions.canUseSubSkill(player, SubSkillType.TAMING_THICK_FUR);
canHolyHound = canUseSubskill(player, SubSkillType.TAMING_HOLY_HOUND); canHolyHound = Permissions.canUseSubSkill(player, SubSkillType.TAMING_HOLY_HOUND);
} }
@Override @Override

View File

@@ -0,0 +1,56 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.TRIDENTS_IMPALE;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK;
public class TridentsCommand extends SkillCommand {
public TridentsCommand() {
super(PrimarySkillType.TRIDENTS);
}
@Override
protected void dataCalculations(Player player, float skillValue) {}
@Override
protected void permissionsCheck(Player player) {}
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>();
if (SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
}
if (SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
messages.add(getStatMessage(TRIDENTS_IMPALE,
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
}
messages.add(ChatColor.GRAY + "The Tridents skill is a work in progress and is still being developed, feedback would be appreciated in the mcMMO discord server.");
return messages;
}
@Override
protected List<Component> getTextComponents(Player player) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.TRIDENTS);
return textComponents;
}
}

View File

@@ -4,10 +4,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -40,7 +39,7 @@ public class UnarmedCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) { protected void dataCalculations(Player player, float skillValue) {
// UNARMED_ARROW_DEFLECT // UNARMED_ARROW_DEFLECT
if (canDeflect) { if (canDeflect) {
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT); String[] deflectStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.UNARMED_ARROW_DEFLECT);
deflectChance = deflectStrings[0]; deflectChance = deflectStrings[0];
deflectChanceLucky = deflectStrings[1]; deflectChanceLucky = deflectStrings[1];
} }
@@ -54,19 +53,19 @@ public class UnarmedCommand extends SkillCommand {
// UNARMED_DISARM // UNARMED_DISARM
if (canDisarm) { if (canDisarm) {
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM); String[] disarmStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.UNARMED_DISARM);
disarmChance = disarmStrings[0]; disarmChance = disarmStrings[0];
disarmChanceLucky = disarmStrings[1]; disarmChanceLucky = disarmStrings[1];
} }
// IRON ARM // IRON ARM
if (canIronArm) { if (canIronArm) {
ironArmBonus = UserManager.getPlayer(player).getUnarmedManager().getSteelArmStyleDamage(); ironArmBonus = mmoPlayer.getUnarmedManager().getSteelArmStyleDamage();
} }
// IRON GRIP // IRON GRIP
if (canIronGrip) { if (canIronGrip) {
String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_IRON_GRIP); String[] ironGripStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.UNARMED_IRON_GRIP);
ironGripChance = ironGripStrings[0]; ironGripChance = ironGripStrings[0];
ironGripChanceLucky = ironGripStrings[1]; ironGripChanceLucky = ironGripStrings[1];
} }
@@ -75,10 +74,10 @@ public class UnarmedCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canBerserk = RankUtils.hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player); canBerserk = RankUtils.hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player);
canIronArm = canUseSubskill(player, SubSkillType.UNARMED_STEEL_ARM_STYLE); canIronArm = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_STEEL_ARM_STYLE);
canDeflect = canUseSubskill(player, SubSkillType.UNARMED_ARROW_DEFLECT); canDeflect = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_ARROW_DEFLECT);
canDisarm = canUseSubskill(player, SubSkillType.UNARMED_DISARM); canDisarm = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_DISARM);
canIronGrip = canUseSubskill(player, SubSkillType.UNARMED_IRON_GRIP); canIronGrip = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_IRON_GRIP);
// TODO: Apparently we forgot about block cracker? // TODO: Apparently we forgot about block cracker?
} }
@@ -114,7 +113,7 @@ public class UnarmedCommand extends SkillCommand {
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : "")); //messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
} }
if(canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) { if (Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000)))); String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
} }

View File

@@ -5,8 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -18,15 +18,15 @@ public class WoodcuttingCommand extends SkillCommand {
private String treeFellerLength; private String treeFellerLength;
private String treeFellerLengthEndurance; private String treeFellerLengthEndurance;
private String doubleDropChance; private String doubleDropChance;
private String tripleDropChance;
private String doubleDropChanceLucky; private String doubleDropChanceLucky;
private String tripleDropChanceLucky;
private boolean canTreeFell; private boolean canTreeFell;
private boolean canLeafBlow; private boolean canLeafBlow;
private boolean canDoubleDrop; private boolean canDoubleDrop;
private boolean canTripleDrop;
private boolean canKnockOnWood; private boolean canKnockOnWood;
private boolean canSplinter;
private boolean canBarkSurgeon;
private boolean canNaturesBounty;
public WoodcuttingCommand() { public WoodcuttingCommand() {
super(PrimarySkillType.WOODCUTTING); super(PrimarySkillType.WOODCUTTING);
@@ -38,7 +38,14 @@ public class WoodcuttingCommand extends SkillCommand {
if (canDoubleDrop) { if (canDoubleDrop) {
setDoubleDropClassicChanceStrings(player); setDoubleDropClassicChanceStrings(player);
} }
//Clean Cuts
if (canTripleDrop) {
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_CLEAN_CUTS);
tripleDropChance = tripleDropStrings[0];
tripleDropChanceLucky = tripleDropStrings[1];
}
// TREE FELLER // TREE FELLER
if (canTreeFell) { if (canTreeFell) {
String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue); String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue);
@@ -48,7 +55,7 @@ public class WoodcuttingCommand extends SkillCommand {
} }
private void setDoubleDropClassicChanceStrings(Player player) { private void setDoubleDropClassicChanceStrings(Player player) {
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER); String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
doubleDropChance = doubleDropStrings[0]; doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1]; doubleDropChanceLucky = doubleDropStrings[1];
} }
@@ -56,14 +63,12 @@ public class WoodcuttingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player); canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) canDoubleDrop = !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill)
&& !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill) && Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
&& RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1; && RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER); canTripleDrop = !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill) && Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_CLEAN_CUTS);
canKnockOnWood = canTreeFell && canUseSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD); canLeafBlow = Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
/*canSplinter = canUseSubskill(player, SubSkillType.WOODCUTTING_SPLINTER); canKnockOnWood = canTreeFell && Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD);
canBarkSurgeon = canUseSubskill(player, SubSkillType.WOODCUTTING_BARK_SURGEON);
canNaturesBounty = canUseSubskill(player, SubSkillType.WOODCUTTING_NATURES_BOUNTY);*/
} }
@Override @Override
@@ -75,10 +80,16 @@ public class WoodcuttingCommand extends SkillCommand {
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
} }
if (canTripleDrop) {
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
}
if (canKnockOnWood) { if (canKnockOnWood) {
String lootNote; String lootNote;
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) { if (RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2"); lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
} else { } else {
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal"); lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");

View File

@@ -11,136 +11,133 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class AdvancedConfig extends BukkitConfig { public class AdvancedConfig extends BukkitConfig {
int[] defaultCrippleValues = new int[]{10, 15, 20, 25};
public AdvancedConfig(File dataFolder) { public AdvancedConfig(File dataFolder) {
super("advanced.yml", dataFolder); super("advanced.yml", dataFolder);
validate();
} }
@Override @Override
public void initDefaults() { protected boolean validateKeys() {
config.addDefault("Skills.General.StartingLevel", 0); // Validate all the settings!
}
@Override
protected void validateConfigKeys() {
//TODO: Rewrite legacy validation code
List<String> reason = new ArrayList<>(); List<String> reason = new ArrayList<>();
/* GENERAL */ /* GENERAL */
if (getAbilityLength() < 1) { if (getAbilityLength() < 1) {
mcMMO.p.getLogger().warning("Skills.General.Ability.Length.<mode>.IncreaseLevel should be at least 1!"); reason.add("Skills.General.Ability.Length.<mode>.IncreaseLevel should be at least 1!");
} }
if (getEnchantBuff() < 1) { if (getEnchantBuff() < 1) {
mcMMO.p.getLogger().warning("Skills.General.Ability.EnchantBuff should be at least 1!"); reason.add("Skills.General.Ability.EnchantBuff should be at least 1!");
} }
/* ACROBATICS */ /* ACROBATICS */
if (getMaximumProbability(SubSkillType.ACROBATICS_DODGE) < 1) { if (getMaximumProbability(SubSkillType.ACROBATICS_DODGE) < 1) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.ACROBATICS_DODGE) < 1) { if (getMaxBonusLevel(SubSkillType.ACROBATICS_DODGE) < 1) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
} }
if (getDodgeDamageModifier() <= 1) { if (getDodgeDamageModifier() <= 1) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!"); reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
} }
if (getMaximumProbability(SubSkillType.ACROBATICS_ROLL) < 1) { if (getMaximumProbability(SubSkillType.ACROBATICS_ROLL) < 1) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL) < 1) { if (getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL) < 1) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
} }
if (getRollDamageThreshold() < 0) { if (getRollDamageThreshold() < 0) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!"); reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
} }
if (getGracefulRollDamageThreshold() < 0) { if (getGracefulRollDamageThreshold() < 0) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!"); reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!");
} }
if (getCatalysisMinSpeed() <= 0) { if (getCatalysisMinSpeed() <= 0) {
mcMMO.p.getLogger().warning("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!"); reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!");
} }
if (getCatalysisMaxSpeed() < getCatalysisMinSpeed()) { if (getCatalysisMaxSpeed() < getCatalysisMinSpeed()) {
mcMMO.p.getLogger().warning("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!"); reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!");
} }
/* ARCHERY */ /* ARCHERY */
if (getSkillShotRankDamageMultiplier() <= 0) { if (getSkillShotRankDamageMultiplier() <= 0) {
mcMMO.p.getLogger().warning("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!"); reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!");
} }
if (getMaximumProbability(SubSkillType.ARCHERY_DAZE) < 1) { if (getMaximumProbability(SubSkillType.ARCHERY_DAZE) < 1) {
mcMMO.p.getLogger().warning("Skills.Archery.Daze.ChanceMax should be at least 1!"); reason.add("Skills.Archery.Daze.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.ARCHERY_DAZE) < 1) { if (getMaxBonusLevel(SubSkillType.ARCHERY_DAZE) < 1) {
mcMMO.p.getLogger().warning("Skills.Archery.Daze.MaxBonusLevel should be at least 1!"); reason.add("Skills.Archery.Daze.MaxBonusLevel should be at least 1!");
} }
if (getDazeBonusDamage() < 0) { if (getDazeBonusDamage() < 0) {
mcMMO.p.getLogger().warning("Skills.Archery.Daze.BonusDamage should be at least 0!"); reason.add("Skills.Archery.Daze.BonusDamage should be at least 0!");
} }
if (getMaximumProbability(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) { if (getMaximumProbability(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) {
mcMMO.p.getLogger().warning("Skills.Archery.Retrieve.ChanceMax should be at least 1!"); reason.add("Skills.Archery.Retrieve.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) { if (getMaxBonusLevel(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) {
mcMMO.p.getLogger().warning("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!"); reason.add("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!");
} }
if (getForceMultiplier() < 0) { if (getForceMultiplier() < 0) {
mcMMO.p.getLogger().warning("Skills.Archery.ForceMultiplier should be at least 0!"); reason.add("Skills.Archery.ForceMultiplier should be at least 0!");
} }
/* AXES */ /* AXES */
if (getAxeMasteryRankDamageMultiplier() < 0) { if (getAxeMasteryRankDamageMultiplier() < 0) {
mcMMO.p.getLogger().warning("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!"); reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
} }
if (getMaximumProbability(SubSkillType.AXES_CRITICAL_STRIKES) < 1) { if (getMaximumProbability(SubSkillType.AXES_CRITICAL_STRIKES) < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.CriticalHit.ChanceMax should be at least 1!"); reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.AXES_CRITICAL_STRIKES) < 1) { if (getMaxBonusLevel(SubSkillType.AXES_CRITICAL_STRIKES) < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!"); reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
} }
if (getCriticalStrikesPVPModifier() < 1) { if (getCriticalStrikesPVPModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!"); reason.add("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!");
} }
if (getCriticalStrikesPVPModifier() < 1) { if (getCriticalStrikesPVPModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!"); reason.add("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!");
} }
if (getGreaterImpactChance() < 1) { if (getGreaterImpactChance() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.GreaterImpact.Chance should be at least 1!"); reason.add("Skills.Axes.GreaterImpact.Chance should be at least 1!");
} }
if (getGreaterImpactModifier() < 1) { if (getGreaterImpactModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.GreaterImpact.KnockbackModifier should be at least 1!"); reason.add("Skills.Axes.GreaterImpact.KnockbackModifier should be at least 1!");
} }
if (getGreaterImpactBonusDamage() < 1) { if (getGreaterImpactBonusDamage() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.GreaterImpact.BonusDamage should be at least 1!"); reason.add("Skills.Axes.GreaterImpact.BonusDamage should be at least 1!");
} }
if (getImpactChance() < 1) { if (getImpactChance() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.ArmorImpact.Chance should be at least 1!"); reason.add("Skills.Axes.ArmorImpact.Chance should be at least 1!");
} }
if (getSkullSplitterModifier() < 1) { if (getSkullSplitterModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!"); reason.add("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!");
} }
/* FISHING */ /* FISHING */
@@ -148,261 +145,262 @@ public class AdvancedConfig extends BukkitConfig {
for (int rank : fishingTierList) { for (int rank : fishingTierList) {
if (getFishingTierLevel(tier) < 0) { if (getFishingTierLevel(tier) < 0) {
mcMMO.p.getLogger().warning("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!"); reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!");
} }
if (getShakeChance(tier) < 0) { if (getShakeChance(tier) < 0) {
mcMMO.p.getLogger().warning("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!"); reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!");
} }
if (getFishingVanillaXPModifier(tier) < 0) { if (getFishingVanillaXPModifier(tier) < 0) {
mcMMO.p.getLogger().warning("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 0!"); reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 0!");
} }
if (tier != Fishing.Tier.EIGHT) { if (tier != Fishing.Tier.EIGHT) {
Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1); Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1);
if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) { if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) {
mcMMO.p.getLogger().warning("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!"); reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!");
} }
if (getShakeChance(tier) > getShakeChance(nextTier)) { if (getShakeChance(tier) > getShakeChance(nextTier)) {
mcMMO.p.getLogger().warning("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!"); reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!");
} }
if (getFishingVanillaXPModifier(tier) > getFishingVanillaXPModifier(nextTier)) { if (getFishingVanillaXPModifier(tier) > getFishingVanillaXPModifier(nextTier)) {
mcMMO.p.getLogger().warning("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!"); reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!");
} }
} }
}*/ }*/
if (getFishermanDietRankChange() < 1) { if (getFishermanDietRankChange() < 1) {
mcMMO.p.getLogger().warning("Skills.Fishing.FishermansDiet.RankChange should be at least 1!"); reason.add("Skills.Fishing.FishermansDiet.RankChange should be at least 1!");
} }
/*if (getIceFishingUnlockLevel() < 0) { /*if (getIceFishingUnlockLevel() < 0) {
mcMMO.p.getLogger().warning("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!"); reason.add("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!");
} }
if (getMasterAnglerUnlockLevel() < 0) { if (getMasterAnglerUnlockLevel() < 0) {
mcMMO.p.getLogger().warning("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!"); reason.add("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!");
}*/ }*/
if (getMasterAnglerBoatModifier() < 1) { if (getMasterAnglerBoatModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!"); reason.add("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!");
} }
if (getMasterAnglerBiomeModifier() < 1) { if (getMasterAnglerBiomeModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Fishing.MasterAngler.BiomeModifier should be at least 1!"); reason.add("Skills.Fishing.MasterAngler.BiomeModifier should be at least 1!");
} }
/* HERBALISM */ /* HERBALISM */
if (getFarmerDietRankChange() < 1) { if (getFarmerDietRankChange() < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.FarmersDiet.RankChange should be at least 1!"); reason.add("Skills.Herbalism.FarmersDiet.RankChange should be at least 1!");
} }
if (getGreenThumbStageChange() < 1) { if (getGreenThumbStageChange() < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.GreenThumb.StageChange should be at least 1!"); reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.HERBALISM_GREEN_THUMB) < 1) { if (getMaximumProbability(SubSkillType.HERBALISM_GREEN_THUMB) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.HERBALISM_GREEN_THUMB) < 1) { if (getMaxBonusLevel(SubSkillType.HERBALISM_GREEN_THUMB) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) { if (getMaximumProbability(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) { if (getMaxBonusLevel(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) { if (getMaximumProbability(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) { if (getMaxBonusLevel(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) { if (getMaximumProbability(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) { if (getMaxBonusLevel(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) {
mcMMO.p.getLogger().warning("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
} }
/* MINING */ /* MINING */
if (getMaximumProbability(SubSkillType.MINING_DOUBLE_DROPS) < 1) { if (getMaximumProbability(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
mcMMO.p.getLogger().warning("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!"); reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.MINING_DOUBLE_DROPS) < 1) { if (getMaxBonusLevel(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
mcMMO.p.getLogger().warning("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!"); reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
} }
/* REPAIR */ /* REPAIR */
if (getRepairMasteryMaxBonus() < 1) { if (getRepairMasteryMaxBonus() < 1) {
mcMMO.p.getLogger().warning("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!"); reason.add("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!");
} }
if (getRepairMasteryMaxLevel() < 1) { if (getRepairMasteryMaxLevel() < 1) {
mcMMO.p.getLogger().warning("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!"); reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.REPAIR_SUPER_REPAIR) < 1) { if (getMaximumProbability(SubSkillType.REPAIR_SUPER_REPAIR) < 1) {
mcMMO.p.getLogger().warning("Skills.Repair.SuperRepair.ChanceMax should be at least 1!"); reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.REPAIR_SUPER_REPAIR) < 1) { if (getMaxBonusLevel(SubSkillType.REPAIR_SUPER_REPAIR) < 1) {
mcMMO.p.getLogger().warning("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!"); reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
} }
/* SMELTING */ /* SMELTING */
if (getBurnModifierMaxLevel() < 1) { if (getBurnModifierMaxLevel() < 1) {
mcMMO.p.getLogger().warning("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!"); reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.SMELTING_SECOND_SMELT) < 1) { if (getMaxBonusLevel(SubSkillType.SMELTING_SECOND_SMELT) < 1) {
mcMMO.p.getLogger().warning("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!"); reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.SMELTING_SECOND_SMELT) < 1) { if (getMaximumProbability(SubSkillType.SMELTING_SECOND_SMELT) < 1) {
mcMMO.p.getLogger().warning("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!"); reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
} }
if (getFluxMiningChance() < 1) { if (getFluxMiningChance() < 1) {
mcMMO.p.getLogger().warning("Skills.Smelting.FluxMining.Chance should be at least 1!"); reason.add("Skills.Smelting.FluxMining.Chance should be at least 1!");
} }
/* SWORDS */ /* SWORDS */
if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) { if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
mcMMO.p.getLogger().warning("Skills.Swords.CounterAttack.ChanceMax should be at least 1!"); reason.add("Skills.Swords.CounterAttack.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) { if (getMaxBonusLevel(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
mcMMO.p.getLogger().warning("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!"); reason.add("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!");
} }
if (getCounterModifier() < 1) { if (getCounterModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Swords.CounterAttack.DamageModifier should be at least 1!"); reason.add("Skills.Swords.CounterAttack.DamageModifier should be at least 1!");
} }
if (getSerratedStrikesModifier() < 1) { if (getSerratedStrikesModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Swords.SerratedStrikes.DamageModifier should be at least 1!"); reason.add("Skills.Swords.SerratedStrikes.DamageModifier should be at least 1!");
} }
if (getSerratedStrikesTicks() < 1) { if (getSerratedStrikesTicks() < 1) {
mcMMO.p.getLogger().warning("Skills.Swords.SerratedStrikes.RuptureTicks should be at least 1!"); reason.add("Skills.Swords.SerratedStrikes.RuptureTicks should be at least 1!");
} }
/* TAMING */ /* TAMING */
if (getMaximumProbability(SubSkillType.TAMING_GORE) < 1) { if (getMaximumProbability(SubSkillType.TAMING_GORE) < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.Gore.ChanceMax should be at least 1!"); reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.TAMING_GORE) < 1) { if (getMaxBonusLevel(SubSkillType.TAMING_GORE) < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.Gore.MaxBonusLevel should be at least 1!"); reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
} }
/*if (getGoreRuptureTicks() < 1) { /*if (getGoreRuptureTicks() < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.Gore.RuptureTicks should be at least 1!"); reason.add("Skills.Taming.Gore.RuptureTicks should be at least 1!");
}*/ }*/
if (getGoreModifier() < 1) { if (getGoreModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.Gore.Modifier should be at least 1!"); reason.add("Skills.Taming.Gore.Modifier should be at least 1!");
} }
/*if (getFastFoodUnlock() < 0) { /*if (getFastFoodUnlock() < 0) {
mcMMO.p.getLogger().warning("Skills.Taming.FastFood.UnlockLevel should be at least 0!"); reason.add("Skills.Taming.FastFood.UnlockLevel should be at least 0!");
}*/ }*/
if (getFastFoodChance() < 1) { if (getFastFoodChance() < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.FastFood.Chance should be at least 1!"); reason.add("Skills.Taming.FastFood.Chance should be at least 1!");
} }
/*if (getEnviromentallyAwareUnlock() < 0) { /*if (getEnviromentallyAwareUnlock() < 0) {
mcMMO.p.getLogger().warning("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!"); reason.add("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!");
}*/ }*/
/*if (getThickFurUnlock() < 0) { /*if (getThickFurUnlock() < 0) {
mcMMO.p.getLogger().warning("Skills.Taming.ThickFur.UnlockLevel should be at least 0!"); reason.add("Skills.Taming.ThickFur.UnlockLevel should be at least 0!");
}*/ }*/
if (getThickFurModifier() < 1) { if (getThickFurModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.ThickFur.Modifier should be at least 1!"); reason.add("Skills.Taming.ThickFur.Modifier should be at least 1!");
} }
/*if (getHolyHoundUnlock() < 0) { /*if (getHolyHoundUnlock() < 0) {
mcMMO.p.getLogger().warning("Skills.Taming.HolyHound.UnlockLevel should be at least 0!"); reason.add("Skills.Taming.HolyHound.UnlockLevel should be at least 0!");
} }
if (getShockProofUnlock() < 0) { if (getShockProofUnlock() < 0) {
mcMMO.p.getLogger().warning("Skills.Taming.ShockProof.UnlockLevel should be at least 0!"); reason.add("Skills.Taming.ShockProof.UnlockLevel should be at least 0!");
}*/ }*/
if (getShockProofModifier() < 1) { if (getShockProofModifier() < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.ShockProof.Modifier should be at least 1!"); reason.add("Skills.Taming.ShockProof.Modifier should be at least 1!");
} }
/*if (getSharpenedClawsUnlock() < 0) { /*if (getSharpenedClawsUnlock() < 0) {
mcMMO.p.getLogger().warning("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!"); reason.add("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!");
}*/ }*/
if (getSharpenedClawsBonus() < 1) { if (getSharpenedClawsBonus() < 1) {
mcMMO.p.getLogger().warning("Skills.Taming.SharpenedClaws.Bonus should be at least 1!"); reason.add("Skills.Taming.SharpenedClaws.Bonus should be at least 1!");
} }
if (getMaxHorseJumpStrength() < 0 || getMaxHorseJumpStrength() > 2) { if (getMaxHorseJumpStrength() < 0 || getMaxHorseJumpStrength() > 2) {
mcMMO.p.getLogger().warning("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength should be between 0 and 2!"); reason.add("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength should be between 0 and 2!");
} }
/* UNARMED */ /* UNARMED */
if (getMaximumProbability(SubSkillType.UNARMED_DISARM) < 1) { if (getMaximumProbability(SubSkillType.UNARMED_DISARM) < 1) {
mcMMO.p.getLogger().warning("Skills.Unarmed.Disarm.ChanceMax should be at least 1!"); reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.UNARMED_DISARM) < 1) { if (getMaxBonusLevel(SubSkillType.UNARMED_DISARM) < 1) {
mcMMO.p.getLogger().warning("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!"); reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) { if (getMaximumProbability(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) {
mcMMO.p.getLogger().warning("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!"); reason.add("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) { if (getMaxBonusLevel(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) {
mcMMO.p.getLogger().warning("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!"); reason.add("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!");
} }
if (getMaximumProbability(SubSkillType.UNARMED_IRON_GRIP) < 1) { if (getMaximumProbability(SubSkillType.UNARMED_IRON_GRIP) < 1) {
mcMMO.p.getLogger().warning("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!"); reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.UNARMED_IRON_GRIP) < 1) { if (getMaxBonusLevel(SubSkillType.UNARMED_IRON_GRIP) < 1) {
mcMMO.p.getLogger().warning("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!"); reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
} }
/* WOODCUTTING */ /* WOODCUTTING */
/*if (getLeafBlowUnlockLevel() < 0) { /*if (getLeafBlowUnlockLevel() < 0) {
mcMMO.p.getLogger().warning("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!"); reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
}*/ }*/
if (getMaximumProbability(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) { if (getMaximumProbability(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) {
mcMMO.p.getLogger().warning("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!"); reason.add("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) { if (getMaxBonusLevel(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) {
mcMMO.p.getLogger().warning("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!"); reason.add("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!");
} }
return noErrorsInConfig(reason);
} }
@Override @Override
@@ -425,7 +423,7 @@ public class AdvancedConfig extends BukkitConfig {
/** /**
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level. * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
* It returns a different value depending on whether or not the server is in retro mode * It returns a different value depending on whether the server is in retro mode
* *
* @return the level at which abilities stop increasing in length * @return the level at which abilities stop increasing in length
*/ */
@@ -438,7 +436,7 @@ public class AdvancedConfig extends BukkitConfig {
/** /**
* This returns the frequency at which abilities will increase in length * This returns the frequency at which abilities will increase in length
* It returns a different value depending on whether or not the server is in retro mode * It returns a different value depending on whether the server is in retro mode
* *
* @return the number of levels required per ability length increase * @return the number of levels required per ability length increase
*/ */
@@ -507,8 +505,7 @@ public class AdvancedConfig extends BukkitConfig {
*/ */
/*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix) /*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix) {
{
String keyAddress = isPrefix ? "Prefix" : "Value"; String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color"; String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
@@ -520,50 +517,41 @@ public class AdvancedConfig extends BukkitConfig {
* *
* @return the ChatColor for this element * @return the ChatColor for this element
*/ */
/*public ChatColor getJSONStatHoverDetailsColor() /*public ChatColor getJSONStatHoverDetailsColor() {
{
String keyLocation = "Style.JSON.Hover.Details.Header.Color"; String keyLocation = "Style.JSON.Hover.Details.Header.Color";
return getChatColorFromKey(keyLocation); return getChatColorFromKey(keyLocation);
} }
public boolean isJSONDetailsHeaderBold() public boolean isJSONDetailsHeaderBold() {
{
return config.getBoolean("Style.JSON.Hover.Details.Header.Bold"); return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
} }
public boolean isJSONDetailsHeaderItalic() public boolean isJSONDetailsHeaderItalic() {
{
return config.getBoolean("Style.JSON.Hover.Details.Header.Italics"); return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
} }
public boolean isJSONDetailsHeaderUnderlined() public boolean isJSONDetailsHeaderUnderlined() {
{
return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined"); return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
} }
public ChatColor getJSONStatHoverDescriptionColor() public ChatColor getJSONStatHoverDescriptionColor() {
{
String keyLocation = "Style.JSON.Hover.Details.Description.Color"; String keyLocation = "Style.JSON.Hover.Details.Description.Color";
return getChatColorFromKey(keyLocation); return getChatColorFromKey(keyLocation);
} }
public boolean isJSONDetailsDescriptionBold() public boolean isJSONDetailsDescriptionBold() {
{
return config.getBoolean("Style.JSON.Hover.Details.Description.Bold"); return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
} }
public boolean isJSONDetailsDescriptionItalic() public boolean isJSONDetailsDescriptionItalic() {
{
return config.getBoolean("Style.JSON.Hover.Details.Description.Italics"); return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
} }
public boolean isJSONDetailsDescriptionUnderlined() public boolean isJSONDetailsDescriptionUnderlined() {
{
return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined"); return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
} }
public ChatColor getJSONActionBarColor(NotificationType notificationType) public ChatColor getJSONActionBarColor(NotificationType notificationType) {
{
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color")); return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
}*/ }*/
private ChatColor getChatColorFromKey(String keyLocation) { private ChatColor getChatColorFromKey(String keyLocation) {
@@ -583,22 +571,19 @@ public class AdvancedConfig extends BukkitConfig {
return ChatColor.WHITE; return ChatColor.WHITE;
} }
/*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix) /*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix) {
{
String keyAddress = isPrefix ? "Prefix" : "Value"; String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold"; String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
return config.getBoolean(keyLocation); return config.getBoolean(keyLocation);
} }
public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix) public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix) {
{
String keyAddress = isPrefix ? "Prefix" : "Value"; String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics"; String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
return config.getBoolean(keyLocation); return config.getBoolean(keyLocation);
} }
public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix) public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix) {
{
String keyAddress = isPrefix ? "Prefix" : "Value"; String keyAddress = isPrefix ? "Prefix" : "Value";
String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline"; String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
return config.getBoolean(keyLocation); return config.getBoolean(keyLocation);
@@ -630,7 +615,11 @@ public class AdvancedConfig extends BukkitConfig {
/* ALCHEMY */ /* ALCHEMY */
public int getCatalysisMaxBonusLevel() { public int getCatalysisMaxBonusLevel() {
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); if (mcMMO.isRetroModeEnabled()) {
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.RetroMode", 1000);
} else {
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.Standard", 100);
}
} }
public double getCatalysisMinSpeed() { public double getCatalysisMinSpeed() {
@@ -696,6 +685,15 @@ public class AdvancedConfig extends BukkitConfig {
return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D);
} }
/* CROSSBOWS */
public double getPoweredShotRankDamageMultiplier() {
return config.getDouble("Skills.Crossbows.PoweredShot.RankDamageMultiplier", 10.0D);
}
public double getPoweredShotDamageMax() {
return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
}
/* EXCAVATION */ /* EXCAVATION */
//Nothing to configure, everything is already configurable in config.yml //Nothing to configure, everything is already configurable in config.yml
@@ -775,6 +773,10 @@ public class AdvancedConfig extends BukkitConfig {
return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank); return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank);
} }
public boolean isBlastMiningBonusDropsEnabled() {
return config.getBoolean("Skills.Mining.BlastMining.Bonus_Drops.Enabled", true);
}
public double getDebrisReduction(int rank) { public double getDebrisReduction(int rank) {
return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank); return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank);
} }
@@ -936,4 +938,10 @@ public class AdvancedConfig extends BukkitConfig {
public boolean isKnockOnWoodXPOrbEnabled() { public boolean isKnockOnWoodXPOrbEnabled() {
return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true); return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true);
} }
/* MACES */
public double getCrippleChanceToApplyOnHit(int rank) {
String root = "Skills.Maces.Cripple.Chance_To_Apply_On_Hit.Rank_";
return config.getDouble(root + rank, defaultCrippleValues[rank-1]);
}
} }

View File

@@ -1,6 +1,7 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -10,28 +11,28 @@ import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
public abstract class AutoUpdateConfigLoader extends ConfigLoader { public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
public AutoUpdateConfigLoader(String relativePath, String fileName, File dataFolder) { public AutoUpdateLegacyConfigLoader(String relativePath, String fileName, File dataFolder) {
super(relativePath, fileName, dataFolder); super(relativePath, fileName, dataFolder);
} }
public AutoUpdateConfigLoader(String fileName, File dataFolder) { public AutoUpdateLegacyConfigLoader(String fileName, File dataFolder) {
super(fileName, dataFolder); super(fileName, dataFolder);
} }
@Deprecated @Deprecated
public AutoUpdateConfigLoader(String relativePath, String fileName) { public AutoUpdateLegacyConfigLoader(String relativePath, String fileName) {
super(relativePath, fileName); super(relativePath, fileName);
} }
@Deprecated @Deprecated
public AutoUpdateConfigLoader(String fileName) { public AutoUpdateLegacyConfigLoader(String fileName) {
super(fileName); super(fileName);
} }
protected void saveConfig() { protected void saveConfig() {
try { try {
mcMMO.p.getLogger().info("Saving changes to config file - " + fileName); LogUtils.debug(mcMMO.p.getLogger(), "Saving changes to config file - " + fileName);
config.options().indent(2); config.options().indent(2);
config.save(configFile); config.save(configFile);
} catch (IOException e) { } catch (IOException e) {
@@ -58,9 +59,9 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
oldKeys.removeAll(internalConfigKeys); oldKeys.removeAll(internalConfigKeys);
if (!oldKeys.isEmpty()) { if (!oldKeys.isEmpty()) {
mcMMO.p.debug("old key(s) in \"" + fileName + "\""); LogUtils.debug(mcMMO.p.getLogger(), "old key(s) in \"" + fileName + "\"");
for (String key : oldKeys) { for (String key : oldKeys) {
mcMMO.p.debug(" old-key:" + key); LogUtils.debug(mcMMO.p.getLogger(), " old-key:" + key);
} }
} }
@@ -73,7 +74,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
} }
for (String key : newKeys) { for (String key : newKeys) {
mcMMO.p.debug("Adding new key: " + key + " = " + internalConfig.get(key)); LogUtils.debug(mcMMO.p.getLogger(), "Adding new key: " + key + " = " + internalConfig.get(key));
config.set(key, internalConfig.get(key)); config.set(key, internalConfig.get(key));
} }

View File

@@ -1,47 +1,49 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.*; import java.io.File;
import java.util.HashSet; import java.io.IOException;
import java.util.Set; import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
public abstract class BukkitConfig { public abstract class BukkitConfig {
protected static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:"; boolean copyDefaults = true;
protected static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2";
protected static final char COMMENT_PREFIX = '#';
protected final String fileName; protected final String fileName;
protected final File configFile; protected final File configFile;
protected YamlConfiguration defaultYamlConfig;
protected YamlConfiguration config; protected YamlConfiguration config;
protected @NotNull protected @NotNull final File dataFolder;
final File dataFolder; private boolean savedDefaults = false;
protected boolean unmodifiedConfig = true; //Used to mark when we have made a fix that needs an immediate save
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) { public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) {
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName); LogUtils.debug(mcMMO.p.getLogger(), "Initializing config: " + fileName);
this.copyDefaults = copyDefaults;
this.fileName = fileName; this.fileName = fileName;
this.dataFolder = dataFolder; this.dataFolder = dataFolder;
configFile = new File(dataFolder, fileName); configFile = new File(dataFolder, fileName);
purgeComments(true); this.defaultYamlConfig = saveDefaultConfigToDisk();
this.config = initConfig(); this.config = initConfig();
initDefaults();
updateFile(); updateFile();
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName); LogUtils.debug(mcMMO.p.getLogger(), "Config initialized: " + fileName);
validate(); }
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
this(fileName, dataFolder, true);
} }
@Deprecated
public BukkitConfig(@NotNull String fileName) { public BukkitConfig(@NotNull String fileName) {
this(fileName, mcMMO.p.getDataFolder()); this(fileName, mcMMO.p.getDataFolder());
} }
public BukkitConfig(@NotNull String fileName, boolean copyDefaults) {
/** this(fileName, mcMMO.p.getDataFolder(), copyDefaults);
* Initialize default values for the config }
*/
public void initDefaults() {}
/** /**
* Update the file on the disk by copying out any new and missing defaults * Update the file on the disk by copying out any new and missing defaults
@@ -49,18 +51,70 @@ public abstract class BukkitConfig {
public void updateFile() { public void updateFile() {
try { try {
config.save(configFile); config.save(configFile);
if (copyDefaults && !savedDefaults) {
copyMissingDefaultsFromResource();
savedDefaults = true;
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private YamlConfiguration initConfig() { /**
* Copies missing keys and values from the internal resource config within the JAR
*/
private void copyMissingDefaultsFromResource() {
boolean updated = false;
for (String key : defaultYamlConfig.getKeys(true)) {
if (!config.contains(key)) {
config.set(key, defaultYamlConfig.get(key));
updated = true;
}
}
if (updated) {
updateFile();
}
}
/**
* Copies the config from the JAR to defaults/<fileName>
*/
YamlConfiguration saveDefaultConfigToDisk() {
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
if (inputStream == null) {
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
return null;
}
//Save default file into defaults/<fileName>
File defaultsFolder = new File(dataFolder, "defaults");
if (!defaultsFolder.exists()) {
defaultsFolder.mkdir();
}
File defaultFile = new File(defaultsFolder, fileName);
Path path = defaultFile.toPath();
Files.copy(inputStream, path, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
// Load file into YAML config
YamlConfiguration defaultYamlConfig = new YamlConfiguration();
defaultYamlConfig.load(defaultFile);
return defaultYamlConfig;
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
return null;
}
YamlConfiguration initConfig() {
if (!configFile.exists()) { if (!configFile.exists()) {
mcMMO.p.getLogger().info("[config] User config file not found, copying a default config to disk: " + fileName); LogUtils.debug(mcMMO.p.getLogger(), "User config file not found, copying a default config to disk: " + fileName);
mcMMO.p.saveResource(fileName, false); mcMMO.p.saveResource(fileName, false);
} }
mcMMO.p.getLogger().info("[config] Loading config from disk: " + fileName); LogUtils.debug(mcMMO.p.getLogger(), "Loading config from disk: " + fileName);
YamlConfiguration config = new YamlConfiguration(); YamlConfiguration config = new YamlConfiguration();
config.options().indent(4); config.options().indent(4);
@@ -84,34 +138,31 @@ public abstract class BukkitConfig {
protected abstract void loadKeys(); protected abstract void loadKeys();
protected abstract void validateConfigKeys(); protected boolean validateKeys() {
return true;
protected void fixConfigKey(@NotNull String key, @NotNull String value, @NotNull String reason) {
mcMMO.p.getLogger().warning(reason);
config.set(key, value);
this.unmodifiedConfig = false; //flag to save config
} }
private void validate() { protected boolean noErrorsInConfig(List<String> issues) {
//TODO: Rewrite legacy validation code for (String issue : issues) {
validateConfigKeys(); mcMMO.p.getLogger().warning(issue);
}
if (unmodifiedConfig) { return issues.isEmpty();
mcMMO.p.debug("No errors found in " + fileName + "!"); }
protected void validate() {
if (validateKeys()) {
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
} else { } else {
mcMMO.p.getLogger().warning("Errors were found in " + fileName + ", overwriting invalid values with defaults"); mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
try { mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
config.save(configFile); mcMMO.p.noErrorsInConfigFiles = false;
unmodifiedConfig = true;
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
public void backup() { public void backup() {
mcMMO.p.getLogger().severe("You are using an old version of the " + fileName + " file."); LogUtils.debug(mcMMO.p.getLogger(), "You are using an old version of the " + fileName + " file.");
mcMMO.p.getLogger().severe("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version."); LogUtils.debug(mcMMO.p.getLogger(), "Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
configFile.renameTo(new File(configFile.getPath() + ".old")); configFile.renameTo(new File(configFile.getPath() + ".old"));
@@ -127,98 +178,4 @@ public abstract class BukkitConfig {
public File getFile() { public File getFile() {
return configFile; return configFile;
} }
/**
* Somewhere between December 2021-January 2022 Spigot updated their
* SnakeYAML dependency/API and due to our own crappy legacy code
* this introduced a very problematic bug where comments got duplicated
* <p>
* This method hotfixes the problem by just deleting any existing comments
* it's ugly, but it gets the job done
*
* @param silentFail when true mcMMO will report errors during the patch process or debug information
* the option to have it fail silently is because mcMMO wants to check files before they are parsed as a file with a zillion comments will fail to even load
*/
private void purgeComments(boolean silentFail) {
if(!configFile.exists())
return;
int dupedLines = 0, lineCount = 0, lineCountAfter = 0;
try (FileReader fileReader = new FileReader(configFile);
BufferedReader bufferedReader = new BufferedReader(fileReader)) {
StringBuilder stringBuilder = new StringBuilder();
String line;
Set<String> seenBefore = new HashSet<>();
stringBuilder.append(CURRENT_CONFIG_PATCH_VER).append(System.lineSeparator());
boolean noPatchNeeded = false;
// While not at the end of the file
while ((line = bufferedReader.readLine()) != null) {
lineCount++;
if(line.startsWith(CURRENT_CONFIG_PATCH_VER)) {
noPatchNeeded = true;
break;
}
//Older version, don't append this line
if(line.startsWith(CONFIG_PATCH_PREFIX))
continue;
if (isFirstCharAsciiCharacter(line, COMMENT_PREFIX)) {
if(seenBefore.contains(line))
dupedLines++;
else
seenBefore.add(line);
continue; //Delete the line by not appending it
}
stringBuilder
.append(line) //Convert existing files into two-spaced format
.append(System.lineSeparator());
lineCountAfter++;
}
if(noPatchNeeded)
return;
if(lineCount == 0 && !silentFail) {
mcMMO.p.getLogger().info("[config patcher] Config line count: " + lineCount);
throw new InvalidConfigurationException("[config patcher] Patching of config file resulted in an empty file, this will not be saved. Contact the mcMMO devs!");
}
if(dupedLines > 0 && !silentFail) {
mcMMO.p.getLogger().info("[config patcher] Found "+dupedLines+" duplicate comments in config file: " + configFile.getName());
mcMMO.p.getLogger().info("[config patcher] Purging the duplicate comments... (Nothing is broken, this is just info used for debugging)");
mcMMO.p.getLogger().info("[config patcher] Line count before: "+lineCount);
mcMMO.p.getLogger().info("[config patcher] Line count after: "+lineCountAfter);
}
// Write out the *patched* file
// AKA the file without any comments
try (FileWriter fileWriter = new FileWriter(configFile)) {
fileWriter.write(stringBuilder.toString());
}
} catch (IOException | InvalidConfigurationException ex) {
mcMMO.p.getLogger().severe("Failed to patch config file: " + configFile.getName());
ex.printStackTrace();
}
}
private boolean isFirstCharAsciiCharacter(String line, char character) {
if(line == null || line.isEmpty()) {
return true;
}
for(Character c : line.toCharArray()) {
if(c.equals(' '))
continue;
return c.equals(character);
}
return false;
}
} }

View File

@@ -9,6 +9,7 @@ public class ChatConfig extends BukkitConfig {
private ChatConfig() { private ChatConfig() {
super("chat.yml"); super("chat.yml");
validate();
} }
public static ChatConfig getInstance() { public static ChatConfig getInstance() {
@@ -25,8 +26,8 @@ public class ChatConfig extends BukkitConfig {
} }
@Override @Override
protected void validateConfigKeys() { protected boolean validateKeys() {
//TODO: Rewrite legacy validation code return true;
} }
public boolean isChatEnabled() { public boolean isChatEnabled() {
@@ -39,7 +40,7 @@ public class ChatConfig extends BukkitConfig {
} }
/** /**
* Whether or not to use display names for players in target {@link ChatChannel} * Whether to use display names for players in target {@link ChatChannel}
* *
* @param chatChannel target chat channel * @param chatChannel target chat channel
* *
@@ -50,6 +51,12 @@ public class ChatConfig extends BukkitConfig {
return config.getBoolean(key, true); return config.getBoolean(key, true);
} }
public boolean isConsoleIncludedInAudience(@NotNull ChatChannel chatChannel) {
String key = "Chat.Channels." + StringUtils.getCapitalized(chatChannel.toString()) + ".Send_To_Console";
return config.getBoolean(key, true);
}
public boolean isSpyingAutomatic() { public boolean isSpyingAutomatic() {
return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false); return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false);
} }

View File

@@ -9,6 +9,7 @@ public class CoreSkillsConfig extends BukkitConfig {
public CoreSkillsConfig() { public CoreSkillsConfig() {
super("coreskills.yml"); super("coreskills.yml");
validate();
} }
public static CoreSkillsConfig getInstance() { public static CoreSkillsConfig getInstance() {
@@ -24,8 +25,9 @@ public class CoreSkillsConfig extends BukkitConfig {
} }
@Override @Override
protected void validateConfigKeys() { protected boolean validateKeys() {
//TODO: Rewrite legacy validation code
return true;
} }
/* /*
@@ -33,7 +35,7 @@ public class CoreSkillsConfig extends BukkitConfig {
*/ */
/** /**
* Whether or not a skill is enabled * Whether a skill is enabled
* Defaults true * Defaults true
* *
* @param abstractSubSkill SubSkill definition to check * @param abstractSubSkill SubSkill definition to check
@@ -45,7 +47,7 @@ public class CoreSkillsConfig extends BukkitConfig {
} }
/** /**
* Whether or not this primary skill is enabled * Whether this primary skill is enabled
* *
* @param primarySkillType target primary skill * @param primarySkillType target primary skill
* *

View File

@@ -0,0 +1,23 @@
package com.gmail.nossr50.config;
import java.io.File;
public class CustomItemSupportConfig extends BukkitConfig {
public CustomItemSupportConfig(File dataFolder) {
super("custom_item_support.yml", dataFolder);
validate();
}
@Override
protected void loadKeys() {
}
public boolean isCustomRepairAllowed() {
return config.getBoolean("Custom_Item_Support.Repair.Allow_Repair_On_Items_With_Custom_Model_Data", true);
}
public boolean isCustomSalvageAllowed() {
return config.getBoolean("Custom_Item_Support.Salvage.Allow_Salvage_On_Items_With_Custom_Model_Data", true);
}
}

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
@@ -23,6 +22,7 @@ public class GeneralConfig extends BukkitConfig {
public GeneralConfig(@NotNull File dataFolder) { public GeneralConfig(@NotNull File dataFolder) {
super("config.yml", dataFolder); super("config.yml", dataFolder);
validate();
} }
@Override @Override
@@ -31,125 +31,127 @@ public class GeneralConfig extends BukkitConfig {
} }
@Override @Override
protected void validateConfigKeys() { protected boolean validateKeys() {
//TODO: Rewrite legacy validation code // Validate all the settings!
List<String> reason = new ArrayList<>(); List<String> reason = new ArrayList<>();
/* General Settings */ /* General Settings */
if (getSaveInterval() <= 0) { if (getSaveInterval() <= 0) {
mcMMO.p.getLogger().info("General.Save_Interval should be greater than 0!"); reason.add("General.Save_Interval should be greater than 0!");
} }
/* MySQL Settings */ /* MySQL Settings */
for (PoolIdentifier identifier : PoolIdentifier.values()) { for (PoolIdentifier identifier : PoolIdentifier.values()) {
if (getMySQLMaxConnections(identifier) <= 0) { if (getMySQLMaxConnections(identifier) <= 0) {
mcMMO.p.getLogger().warning("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!"); reason.add("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
} }
if (getMySQLMaxPoolSize(identifier) <= 0) { if (getMySQLMaxPoolSize(identifier) <= 0) {
mcMMO.p.getLogger().warning("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!"); reason.add("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
} }
} }
/* Mob Healthbar */ /* Mob Healthbar */
if (getMobHealthbarTime() == 0) { if (getMobHealthbarTime() == 0) {
mcMMO.p.getLogger().warning("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value."); reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
} }
/* Database Purging */ /* Database Purging */
if (getPurgeInterval() < -1) { if (getPurgeInterval() < -1) {
mcMMO.p.getLogger().warning("Database_Purging.Purge_Interval should be greater than, or equal to -1!"); reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!");
} }
if (getOldUsersCutoff() != -1 && getOldUsersCutoff() <= 0) { if (getOldUsersCutoff() != -1 && getOldUsersCutoff() <= 0) {
mcMMO.p.getLogger().warning("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!"); reason.add("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!");
} }
/* Hardcore Mode */ /* Hardcore Mode */
if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) { if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) {
mcMMO.p.getLogger().warning("Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!"); reason.add("Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!");
} }
if (getHardcoreVampirismStatLeechPercentage() < 0.01 || getHardcoreVampirismStatLeechPercentage() > 100) { if (getHardcoreVampirismStatLeechPercentage() < 0.01 || getHardcoreVampirismStatLeechPercentage() > 100) {
mcMMO.p.getLogger().warning("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!"); reason.add("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!");
} }
/* Items */ /* Items */
if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) { if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) {
mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!"); reason.add("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!");
} }
if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) { if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) {
mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!"); reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!");
} }
if (getChimaeraItem() == null) { if (getChimaeraItem() == null) {
mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Item_Name is invalid!"); reason.add("Items.Chimaera_Wing.Item_Name is invalid!");
} }
/* Particles */ /* Particles */
if (getLevelUpEffectsTier() < 1) { if (getLevelUpEffectsTier() < 1) {
mcMMO.p.getLogger().warning("Particles.LevelUp_Tier should be at least 1!"); reason.add("Particles.LevelUp_Tier should be at least 1!");
} }
/* PARTY SETTINGS */ /* PARTY SETTINGS */
if (getAutoPartyKickInterval() < -1) { if (getAutoPartyKickInterval() < -1) {
mcMMO.p.getLogger().warning("Party.AutoKick_Interval should be at least -1!"); reason.add("Party.AutoKick_Interval should be at least -1!");
} }
if (getAutoPartyKickTime() < 0) { if (getAutoPartyKickTime() < 0) {
mcMMO.p.getLogger().warning("Party.Old_Party_Member_Cutoff should be at least 0!"); reason.add("Party.Old_Party_Member_Cutoff should be at least 0!");
} }
if (getPartyShareBonusBase() <= 0) { if (getPartyShareBonusBase() <= 0) {
mcMMO.p.getLogger().warning("Party.Sharing.ExpShare_bonus_base should be greater than 0!"); reason.add("Party.Sharing.ExpShare_bonus_base should be greater than 0!");
} }
if (getPartyShareBonusIncrease() < 0) { if (getPartyShareBonusIncrease() < 0) {
mcMMO.p.getLogger().warning("Party.Sharing.ExpShare_bonus_increase should be at least 0!"); reason.add("Party.Sharing.ExpShare_bonus_increase should be at least 0!");
} }
if (getPartyShareBonusCap() <= 0) { if (getPartyShareBonusCap() <= 0) {
mcMMO.p.getLogger().warning("Party.Sharing.ExpShare_bonus_cap should be greater than 0!"); reason.add("Party.Sharing.ExpShare_bonus_cap should be greater than 0!");
} }
if (getPartyShareRange() <= 0) { if (getPartyShareRange() <= 0) {
mcMMO.p.getLogger().warning("Party.Sharing.Range should be greater than 0!"); reason.add("Party.Sharing.Range should be greater than 0!");
} }
if (getPartyXpCurveMultiplier() < 1) { if (getPartyXpCurveMultiplier() < 1) {
mcMMO.p.getLogger().warning("Party.Leveling.Xp_Curve_Modifier should be at least 1!"); reason.add("Party.Leveling.Xp_Curve_Modifier should be at least 1!");
} }
for (PartyFeature partyFeature : PartyFeature.values()) { for (PartyFeature partyFeature : PartyFeature.values()) {
if (getPartyFeatureUnlockLevel(partyFeature) < 0) { if (getPartyFeatureUnlockLevel(partyFeature) < 0) {
mcMMO.p.getLogger().warning("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!"); reason.add("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!");
} }
} }
/* Inspect command distance */ /* Inspect command distance */
if (getInspectDistance() <= 0) { if (getInspectDistance() <= 0) {
mcMMO.p.getLogger().warning("Commands.inspect.Max_Distance should be greater than 0!"); reason.add("Commands.inspect.Max_Distance should be greater than 0!");
} }
if (getTreeFellerThreshold() <= 0) { if (getTreeFellerThreshold() <= 0) {
mcMMO.p.getLogger().warning("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!"); reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
} }
if (getFishingLureModifier() < 0) { if (getFishingLureModifier() < 0) {
mcMMO.p.getLogger().warning("Abilities.Fishing.Lure_Modifier should be at least 0!"); reason.add("Abilities.Fishing.Lure_Modifier should be at least 0!");
} }
if (getRepairAnvilMaterial() == null) { if (getRepairAnvilMaterial() == null) {
mcMMO.p.getLogger().warning("Skills.Repair.Anvil_Type is invalid!!"); reason.add("Skills.Repair.Anvil_Type is invalid!!");
} }
if (getSalvageAnvilMaterial() == null) { if (getSalvageAnvilMaterial() == null) {
mcMMO.p.getLogger().warning("Skills.Repair.Salvage_Anvil_Type is invalid!"); reason.add("Skills.Repair.Salvage_Anvil_Type is invalid!");
} }
if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) { if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) {
mcMMO.p.getLogger().warning("Cannot use the same item for Repair and Salvage anvils!"); reason.add("Cannot use the same item for Repair and Salvage anvils!");
} }
return noErrorsInConfig(reason);
} }
/* /*
@@ -545,6 +547,10 @@ public class GeneralConfig extends BukkitConfig {
return config.getBoolean("Particles.Bleed", true); return config.getBoolean("Particles.Bleed", true);
} }
public boolean getCrippleEffectEnabled() {
return config.getBoolean("Particles.Cripple", true);
}
public boolean getDodgeEffectEnabled() { public boolean getDodgeEffectEnabled() {
return config.getBoolean("Particles.Dodge", true); return config.getBoolean("Particles.Dodge", true);
} }
@@ -1003,4 +1009,10 @@ public class GeneralConfig extends BukkitConfig {
public boolean isGreenThumbReplantableCrop(@NotNull Material material) { public boolean isGreenThumbReplantableCrop(@NotNull Material material) {
return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true); return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true);
} }
public boolean useVerboseLogging() {
return config.getBoolean("General.Verbose_Logging", false);
}
public boolean isMasterySystemEnabled() { return config.getBoolean( "General.PowerLevel.Skill_Mastery.Enabled"); }
} }

View File

@@ -1,34 +1,45 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.VisibleForTesting;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
public abstract class ConfigLoader { @Deprecated
protected final File configFile; public abstract class LegacyConfigLoader {
protected final @NotNull File configFile;
protected final @NotNull File dataFolder; protected final @NotNull File dataFolder;
protected String fileName; protected @NotNull String fileName;
protected YamlConfiguration config; protected YamlConfiguration config;
public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) { public LegacyConfigLoader(@NotNull String relativePath, @NotNull String fileName, @NotNull File dataFolder) {
this.fileName = fileName; this.fileName = fileName;
this.dataFolder = dataFolder; this.dataFolder = dataFolder;
configFile = new File(dataFolder, relativePath + File.separator + fileName); configFile = new File(dataFolder, relativePath + File.separator + fileName);
loadFile(); loadFile();
} }
public ConfigLoader(String fileName, @NotNull File dataFolder) { public LegacyConfigLoader(@NotNull String fileName, @NotNull File dataFolder) {
this.fileName = fileName; this.fileName = fileName;
this.dataFolder = dataFolder; this.dataFolder = dataFolder;
configFile = new File(dataFolder, fileName); configFile = new File(dataFolder, fileName);
loadFile(); loadFile();
} }
@VisibleForTesting
public LegacyConfigLoader(@NotNull File file) {
this.fileName = file.getName();
this.dataFolder = file.getParentFile();
configFile = new File(dataFolder, fileName);
loadFile();
}
@Deprecated @Deprecated
public ConfigLoader(String relativePath, String fileName) { public LegacyConfigLoader(String relativePath, String fileName) {
this.fileName = fileName; this.fileName = fileName;
configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName); configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName);
this.dataFolder = mcMMO.p.getDataFolder(); this.dataFolder = mcMMO.p.getDataFolder();
@@ -36,7 +47,7 @@ public abstract class ConfigLoader {
} }
@Deprecated @Deprecated
public ConfigLoader(String fileName) { public LegacyConfigLoader(String fileName) {
this.fileName = fileName; this.fileName = fileName;
configFile = new File(mcMMO.p.getDataFolder(), fileName); configFile = new File(mcMMO.p.getDataFolder(), fileName);
this.dataFolder = mcMMO.p.getDataFolder(); this.dataFolder = mcMMO.p.getDataFolder();
@@ -45,7 +56,7 @@ public abstract class ConfigLoader {
protected void loadFile() { protected void loadFile() {
if (!configFile.exists()) { if (!configFile.exists()) {
mcMMO.p.getLogger().info("Creating mcMMO " + fileName + " File..."); LogUtils.debug(mcMMO.p.getLogger(), "Creating mcMMO " + fileName + " File...");
try { try {
mcMMO.p.saveResource(fileName, false); // Normal files mcMMO.p.saveResource(fileName, false); // Normal files
@@ -53,7 +64,7 @@ public abstract class ConfigLoader {
mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
} }
} else { } else {
mcMMO.p.getLogger().info("Loading mcMMO " + fileName + " File..."); LogUtils.debug(mcMMO.p.getLogger(), "Loading mcMMO " + fileName + " File...");
} }
config = YamlConfiguration.loadConfiguration(configFile); config = YamlConfiguration.loadConfiguration(configFile);
@@ -75,10 +86,11 @@ public abstract class ConfigLoader {
protected void validate() { protected void validate() {
if (validateKeys()) { if (validateKeys()) {
mcMMO.p.debug("No errors found in " + fileName + "!"); LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
} else { } else {
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
mcMMO.p.noErrorsInConfigFiles = false;
} }
} }

View File

@@ -7,6 +7,7 @@ public class PersistentDataConfig extends BukkitConfig {
private PersistentDataConfig() { private PersistentDataConfig() {
super("persistent_data.yml"); super("persistent_data.yml");
validate();
} }
public static PersistentDataConfig getInstance() { public static PersistentDataConfig getInstance() {
@@ -23,8 +24,8 @@ public class PersistentDataConfig extends BukkitConfig {
} }
@Override @Override
protected void validateConfigKeys() { protected boolean validateKeys() {
//TODO: Rewrite legacy validation code return true;
} }
//Persistent Data Toggles //Persistent Data Toggles

View File

@@ -3,13 +3,14 @@ package com.gmail.nossr50.config;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
public class RankConfig extends AutoUpdateConfigLoader { public class RankConfig extends BukkitConfig {
private static RankConfig instance; private static RankConfig instance;
public RankConfig() { public RankConfig() {
@@ -66,7 +67,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
*/ */
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode) { public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode) {
String key = getRankAddressKey(subSkillType, rank, retroMode); String key = getRankAddressKey(subSkillType, rank, retroMode);
return config.getInt(key, getInternalConfig().getInt(key)); return config.getInt(key, defaultYamlConfig.getInt(key));
} }
/** /**
@@ -128,9 +129,9 @@ public class RankConfig extends AutoUpdateConfigLoader {
private void resetRankValue(@NotNull SubSkillType subSkillType, int rank, boolean retroMode) { private void resetRankValue(@NotNull SubSkillType subSkillType, int rank, boolean retroMode) {
String key = getRankAddressKey(subSkillType, rank, retroMode); String key = getRankAddressKey(subSkillType, rank, retroMode);
int defaultValue = getInternalConfig().getInt(key); int defaultValue = defaultYamlConfig.getInt(key);
config.set(key, defaultValue); config.set(key, defaultValue);
mcMMO.p.getLogger().info(key + " SET -> " + defaultValue); LogUtils.debug(mcMMO.p.getLogger(), key + " SET -> " + defaultValue);
} }
/** /**
@@ -147,10 +148,10 @@ public class RankConfig extends AutoUpdateConfigLoader {
if (badSkillSetup.isEmpty()) if (badSkillSetup.isEmpty())
return; return;
mcMMO.p.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup"); LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
for (SubSkillType subSkillType : badSkillSetup) { for (SubSkillType subSkillType : badSkillSetup) {
mcMMO.p.getLogger().info("(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString()); LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
fixBadEntries(subSkillType); fixBadEntries(subSkillType);
} }
} }
@@ -178,7 +179,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
if (prevRank > curRank) { if (prevRank > curRank) {
//We're going to allow this but we're going to warn them //We're going to allow this but we're going to warn them
mcMMO.p.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements"); LogUtils.debug(mcMMO.p.getLogger(), "(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
badSkillSetup.add(subSkillType); badSkillSetup.add(subSkillType);
} }
} }
@@ -195,6 +196,6 @@ public class RankConfig extends AutoUpdateConfigLoader {
resetRankValue(subSkillType, index, false); resetRankValue(subSkillType, index, false);
} }
saveConfig(); updateFile();
} }
} }

View File

@@ -1,6 +1,7 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.util.sounds.SoundType;
public class SoundConfig extends BukkitConfig { public class SoundConfig extends BukkitConfig {
@@ -8,6 +9,7 @@ public class SoundConfig extends BukkitConfig {
public SoundConfig() { public SoundConfig() {
super("sounds.yml"); super("sounds.yml");
validate();
instance = this; instance = this;
} }
@@ -24,24 +26,22 @@ public class SoundConfig extends BukkitConfig {
} }
@Override @Override
protected void validateConfigKeys() { protected boolean validateKeys() {
//TODO: Rewrite legacy validation code
for (SoundType soundType : SoundType.values()) { for (SoundType soundType : SoundType.values()) {
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) { if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType); LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound volume cannot be below 0 for " + soundType);
//TODO: Rewrite legacy validation code return false;
//return false;
} }
//Sounds with custom pitching don't use pitch values //Sounds with custom pitching don't use pitch values
if (!soundType.usesCustomPitch()) { if (!soundType.usesCustomPitch()) {
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) { if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType); LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound pitch cannot be below 0 for " + soundType);
//TODO: Rewrite legacy validation code return false;
//return false;
} }
} }
} }
return true;
} }
public float getMasterVolume() { public float getMasterVolume() {
@@ -50,12 +50,12 @@ public class SoundConfig extends BukkitConfig {
public float getVolume(SoundType soundType) { public float getVolume(SoundType soundType) {
String key = "Sounds." + soundType.toString() + ".Volume"; String key = "Sounds." + soundType.toString() + ".Volume";
return (float) config.getDouble(key); return (float) config.getDouble(key, 1.0);
} }
public float getPitch(SoundType soundType) { public float getPitch(SoundType soundType) {
String key = "Sounds." + soundType.toString() + ".Pitch"; String key = "Sounds." + soundType.toString() + ".Pitch";
return (float) config.getDouble(key); return (float) config.getDouble(key, 1.0);
} }
public boolean getIsEnabled(SoundType soundType) { public boolean getIsEnabled(SoundType soundType) {

View File

@@ -73,7 +73,8 @@ public class WorldBlacklist {
closeRead(fileReader); closeRead(fileReader);
} }
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist"); if (blacklist.size() > 0)
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
} }
private void closeRead(Reader reader) { private void closeRead(Reader reader) {

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.MaterialType; import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@@ -14,17 +13,16 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.boss.BarColor; import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle; import org.bukkit.boss.BarStyle;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.BiConsumer;
public class ExperienceConfig extends BukkitConfig { public class ExperienceConfig extends BukkitConfig {
private static ExperienceConfig instance; private static ExperienceConfig instance;
private ExperienceConfig() { private ExperienceConfig() {
super("experience.yml"); super("experience.yml");
validate();
} }
public static ExperienceConfig getInstance() { public static ExperienceConfig getInstance() {
@@ -35,18 +33,12 @@ public class ExperienceConfig extends BukkitConfig {
return instance; return instance;
} }
@Override
public void initDefaults() {
super.initDefaults();
}
@Override @Override
protected void loadKeys() { protected void loadKeys() {
} }
@Override @Override
protected void validateConfigKeys() { protected boolean validateKeys() {
//TODO: Rewrite legacy validation code
List<String> reason = new ArrayList<>(); List<String> reason = new ArrayList<>();
/* /*
@@ -54,48 +46,41 @@ public class ExperienceConfig extends BukkitConfig {
*/ */
/* Curve values */ /* Curve values */
final BiConsumer<String, Object> consumer = (String str, Object obj) -> config.set(str, obj); if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) {
reason.add("Experience_Formula.Exponential_Values.multiplier should be greater than 0!");
if (getMultiplier(FormulaType.LINEAR) <= 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Linear_Values.multiplier should be greater than 0!");
config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.LINEAR.toString()) + "_Values.multiplier", 0.1);
} }
if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) { if (getMultiplier(FormulaType.LINEAR) <= 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Exponential_Values.multiplier should be greater than 0!"); reason.add("Experience_Formula.Linear_Values.multiplier should be greater than 0!");
config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.EXPONENTIAL.toString()) + "_Values.multiplier", 0.1);
} }
if (getExponent(FormulaType.EXPONENTIAL) <= 0) { if (getExponent(FormulaType.EXPONENTIAL) <= 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Exponential_Values.exponent should be greater than 0!"); reason.add("Experience_Formula.Exponential_Values.exponent should be greater than 0!");
config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.EXPONENTIAL.toString()) + "_Values.exponent", 1.80);
} }
/* Global modifier */ /* Global modifier */
if (getExperienceGainsGlobalMultiplier() <= 0) { if (getExperienceGainsGlobalMultiplier() <= 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Multiplier.Global should be at least 0!"); reason.add("Experience_Formula.Multiplier.Global should be greater than 0!");
config.set("Experience_Formula.Multiplier.Global", 1.0);
} }
/* PVP modifier */ /* PVP modifier */
if (getPlayerVersusPlayerXP() < 0) { if (getPlayerVersusPlayerXP() < 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Multiplier.PVP should be at least 0!"); reason.add("Experience_Formula.Multiplier.PVP should be at least 0!");
} }
/* Spawned Mob modifier */ /* Spawned Mob modifier */
if (getSpawnedMobXpMultiplier() < 0) { if (getSpawnedMobXpMultiplier() < 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Mobspawners.Multiplier should be at least 0!"); reason.add("Experience_Formula.Mobspawners.Multiplier should be at least 0!");
} }
/* Bred Mob modifier */ /* Bred Mob modifier */
if (getBredMobXpMultiplier() < 0) { if (getBredMobXpMultiplier() < 0) {
mcMMO.p.getLogger().warning("Experience_Formula.Breeding.Multiplier should be at least 0!"); reason.add("Experience_Formula.Breeding.Multiplier should be at least 0!");
} }
/* Conversion */ /* Conversion */
if (getExpModifier() <= 0) { if (getExpModifier() <= 0) {
mcMMO.p.getLogger().warning("Conversion.Exp_Modifier should be greater than 0!"); reason.add("Conversion.Exp_Modifier should be greater than 0!");
} }
/* /*
@@ -105,52 +90,54 @@ public class ExperienceConfig extends BukkitConfig {
/* Alchemy */ /* Alchemy */
for (PotionStage potionStage : PotionStage.values()) { for (PotionStage potionStage : PotionStage.values()) {
if (getPotionXP(potionStage) < 0) { if (getPotionXP(potionStage) < 0) {
mcMMO.p.getLogger().warning("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!"); reason.add("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!");
} }
} }
/* Archery */ /* Archery */
if (getArcheryDistanceMultiplier() < 0) { if (getArcheryDistanceMultiplier() < 0) {
mcMMO.p.getLogger().warning("Experience_Values.Archery.Distance_Multiplier should be at least 0!"); reason.add("Experience_Values.Archery.Distance_Multiplier should be at least 0!");
} }
/* Combat XP Multipliers */ /* Combat XP Multipliers */
if (getAnimalsXP() < 0) { if (getAnimalsXP() < 0) {
mcMMO.p.getLogger().warning("Experience_Values.Combat.Multiplier.Animals should be at least 0!"); reason.add("Experience_Values.Combat.Multiplier.Animals should be at least 0!");
} }
if (getDodgeXPModifier() < 0) { if (getDodgeXPModifier() < 0) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!"); reason.add("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!");
} }
if (getRollXPModifier() < 0) { if (getRollXPModifier() < 0) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!"); reason.add("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!");
} }
if (getFallXPModifier() < 0) { if (getFallXPModifier() < 0) {
mcMMO.p.getLogger().warning("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!"); reason.add("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!");
} }
/* Fishing */ /* Fishing */
// TODO: Add validation for each fish type once enum is available. // TODO: Add validation for each fish type once enum is available.
if (getFishingShakeXP() <= 0) { if (getFishingShakeXP() <= 0) {
mcMMO.p.getLogger().warning("Experience_Values.Fishing.Shake should be greater than 0!"); reason.add("Experience_Values.Fishing.Shake should be greater than 0!");
} }
/* Repair */ /* Repair */
if (getRepairXPBase() <= 0) { if (getRepairXPBase() <= 0) {
mcMMO.p.getLogger().warning("Experience_Values.Repair.Base should be greater than 0!"); reason.add("Experience_Values.Repair.Base should be greater than 0!");
} }
/* Taming */ /* Taming */
if (getTamingXP(EntityType.WOLF) <= 0) { if (getTamingXP(EntityType.WOLF) <= 0) {
mcMMO.p.getLogger().warning("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!"); reason.add("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!");
} }
if (getTamingXP(EntityType.OCELOT) <= 0) { if (getTamingXP(EntityType.OCELOT) <= 0) {
mcMMO.p.getLogger().warning("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!"); reason.add("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!");
} }
return noErrorsInConfig(reason);
} }
public boolean isEarlyGameBoostEnabled() { public boolean isEarlyGameBoostEnabled() {
@@ -190,6 +177,10 @@ public class ExperienceConfig extends BukkitConfig {
return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true); return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true);
} }
public boolean isArmorStandInteractionPrevented() {
return config.getBoolean("ExploitFix.PreventArmorStandInteraction", true);
}
public boolean isFishingExploitingPrevented() { public boolean isFishingExploitingPrevented() {
return config.getBoolean("ExploitFix.Fishing", true); return config.getBoolean("ExploitFix.Fishing", true);
} }
@@ -269,7 +260,7 @@ public class ExperienceConfig extends BukkitConfig {
/* Skill modifiers */ /* Skill modifiers */
public double getFormulaSkillModifier(PrimarySkillType skill) { public double getFormulaSkillModifier(PrimarySkillType skill) {
return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); return config.getDouble("Experience_Formula.Skill_Multiplier." + StringUtils.getCapitalized(skill.toString()), 1);
} }
/* Custom XP perk */ /* Custom XP perk */
@@ -309,6 +300,10 @@ public class ExperienceConfig extends BukkitConfig {
} }
/* Combat XP Multipliers */ /* Combat XP Multipliers */
public double getCombatXP(String entity) {
return config.getDouble("Experience_Values.Combat.Multiplier." + entity);
}
public double getCombatXP(EntityType entity) { public double getCombatXP(EntityType entity) {
return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
} }
@@ -327,96 +322,73 @@ public class ExperienceConfig extends BukkitConfig {
/* Materials */ /* Materials */
public int getXp(PrimarySkillType skill, Material material) { public int getXp(PrimarySkillType skill, Material material) {
//TODO: Temporary measure to fix an exploit caused by a yet to be fixed Spigot bug (as of 7/3/2020) return getXpHelper(skill, StringUtils.getExplicitConfigMaterialString(material),
if (material.toString().equalsIgnoreCase("LILY_PAD")) StringUtils.getFriendlyConfigMaterialString(material),
return 0; StringUtils.getWildcardConfigMaterialString(material));
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(material);
if (config.contains(explicitString))
return config.getInt(explicitString);
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(material);
if (config.contains(friendlyString))
return config.getInt(friendlyString);
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(material);
if (config.contains(wildcardString))
return config.getInt(wildcardString);
return 0;
} }
/* Materials */
public int getXp(PrimarySkillType skill, BlockState blockState) { public int getXp(PrimarySkillType skill, BlockState blockState) {
Material data = blockState.getType(); Material material = blockState.getType();
return getXp(skill, material);
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
if (config.contains(explicitString))
return config.getInt(explicitString);
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
if (config.contains(friendlyString))
return config.getInt(friendlyString);
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
if (config.contains(wildcardString))
return config.getInt(wildcardString);
return 0;
} }
/* Materials */
public int getXp(PrimarySkillType skill, Block block) { public int getXp(PrimarySkillType skill, Block block) {
Material data = block.getType(); Material material = block.getType();
return getXp(skill, material);
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
if (config.contains(explicitString))
return config.getInt(explicitString);
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
if (config.contains(friendlyString))
return config.getInt(friendlyString);
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
if (config.contains(wildcardString))
return config.getInt(wildcardString);
return 0;
} }
/* Materials */
public int getXp(PrimarySkillType skill, BlockData data) { public int getXp(PrimarySkillType skill, BlockData data) {
return getXpHelper(skill, StringUtils.getExplicitConfigBlockDataString(data),
StringUtils.getFriendlyConfigBlockDataString(data),
StringUtils.getWildcardConfigBlockDataString(data));
}
private int getXpHelper(PrimarySkillType skill, String explicitString, String friendlyString, String wildcardString) {
if (explicitString.equalsIgnoreCase("LILY_PAD")) {
return 0;
}
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); String[] configStrings = {explicitString, friendlyString, wildcardString};
if (config.contains(explicitString))
return config.getInt(explicitString); for (String configString : configStrings) {
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data); String fullPath = baseString + configString;
if (config.contains(friendlyString)) if (config.contains(fullPath)) {
return config.getInt(friendlyString); return config.getInt(fullPath);
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data); }
if (config.contains(wildcardString)) }
return config.getInt(wildcardString);
return 0; return 0;
} }
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data) {
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + "."; public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material material) {
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data); return doesBlockGiveSkillXPHelper(skill, StringUtils.getExplicitConfigMaterialString(material),
if (config.contains(explicitString)) StringUtils.getFriendlyConfigMaterialString(material),
return true; StringUtils.getWildcardConfigMaterialString(material));
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
if (config.contains(friendlyString))
return true;
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
return config.contains(wildcardString);
} }
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) { public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) {
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + "."; return doesBlockGiveSkillXPHelper(skill, StringUtils.getExplicitConfigBlockDataString(data),
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); StringUtils.getFriendlyConfigBlockDataString(data),
if (config.contains(explicitString)) StringUtils.getWildcardConfigBlockDataString(data));
return true;
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
if (config.contains(friendlyString))
return true;
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
return config.contains(wildcardString);
} }
private boolean doesBlockGiveSkillXPHelper(PrimarySkillType skill, String explicitString, String friendlyString, String wildcardString) {
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String[] configStrings = {explicitString, friendlyString, wildcardString};
for (String configString : configStrings) {
String fullPath = baseString + configString;
if (config.contains(fullPath)) {
return true;
}
}
return false;
}
/* /*
* Experience Bar Stuff * Experience Bar Stuff
*/ */
@@ -436,6 +408,13 @@ public class ExperienceConfig extends BukkitConfig {
public boolean getAddExtraDetails() { public boolean getAddExtraDetails() {
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false); return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
} }
public boolean useCombatHPCeiling() {
return config.getBoolean("ExploitFix.Combat.XPCeiling.Enabled", true);
}
public int getCombatHPCeiling() {
return config.getInt("ExploitFix.Combat.XPCeiling.HP_Modifier_Limit", 100);
}
public boolean isExperienceBarsEnabled() { public boolean isExperienceBarsEnabled() {
return config.getBoolean("Experience_Bars.Enable", true); return config.getBoolean("Experience_Bars.Enable", true);
@@ -488,7 +467,7 @@ public class ExperienceConfig extends BukkitConfig {
/* Alchemy */ /* Alchemy */
public double getPotionXP(PotionStage stage) { public double getPotionXP(PotionStage stage) {
return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); return config.getDouble("Experience_Values.Alchemy.Potion_Brewing.Stage_" + stage.toNumerical(), 10D);
} }
/* Archery */ /* Archery */

View File

@@ -29,7 +29,7 @@ public class ArmorConfigManager {
continue; continue;
} }
modManager.registerCustomArmor(new CustomArmorConfig(fileName)); modManager.registerCustomArmor(new CustomArmorLegacyConfig(fileName));
} }
} }
} }

View File

@@ -29,7 +29,7 @@ public class BlockConfigManager {
continue; continue;
} }
modManager.registerCustomBlocks(new CustomBlockConfig(fileName)); modManager.registerCustomBlocks(new CustomBlockLegacyConfig(fileName));
} }
} }
} }

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