mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 01:42:32 +01:00
Compare commits
327 Commits
dev-capfan
...
l10n_maste
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a8b96a284 | ||
|
|
a413cb88d5 | ||
|
|
0f42336b81 | ||
|
|
66ab95adb9 | ||
|
|
a35e01f959 | ||
|
|
d6c17e964c | ||
|
|
1a72eb40cb | ||
|
|
1f5caa7daa | ||
|
|
3ef0ef271f | ||
|
|
47712ac36d | ||
|
|
0b23ed3780 | ||
|
|
3717e5defe | ||
|
|
5935ff5c31 | ||
|
|
90d449207a | ||
|
|
32aed9b444 | ||
|
|
6c9934fac1 | ||
|
|
98cde1be65 | ||
|
|
1b91a1b902 | ||
|
|
bc289cb878 | ||
|
|
b770599313 | ||
|
|
a78b248bcb | ||
|
|
009591937a | ||
|
|
61aa527785 | ||
|
|
d3208d9548 | ||
|
|
a220568380 | ||
|
|
dfcb3fc869 | ||
|
|
5a78e752d4 | ||
|
|
fb3de37fad | ||
|
|
d13c79cadb | ||
|
|
8ad1fd4e1a | ||
|
|
01a7aa4d12 | ||
|
|
6dc75760d0 | ||
|
|
fe90f1e7eb | ||
|
|
54cf356b71 | ||
|
|
4669e3e54d | ||
|
|
f4ead570d4 | ||
|
|
b34f3a1779 | ||
|
|
85e1f2eb7e | ||
|
|
6136e82ec6 | ||
|
|
ebec5d6f70 | ||
|
|
336e41b40c | ||
|
|
bec088c969 | ||
|
|
17f1062e96 | ||
|
|
92495ae9df | ||
|
|
b9c8743ee3 | ||
|
|
0d260a74c9 | ||
|
|
35368db05d | ||
|
|
5e6e8d7248 | ||
|
|
d50238caf1 | ||
|
|
164d429acc | ||
|
|
a316bb7bd2 | ||
|
|
55a4238030 | ||
|
|
f9f2a0d691 | ||
|
|
3831ca6b0f | ||
|
|
7a6b8e3156 | ||
|
|
93d10c0739 | ||
|
|
24e4c28355 | ||
|
|
6ec61ecb76 | ||
|
|
55a69006bf | ||
|
|
8a02230fd2 | ||
|
|
2a26b016d9 | ||
|
|
7be5b4ecbd | ||
|
|
565fb35217 | ||
|
|
d2b8c527ad | ||
|
|
2cdb17d64f | ||
|
|
96f06ca812 | ||
|
|
685f6d76a8 | ||
|
|
840cfbe94d | ||
|
|
605535ed60 | ||
|
|
71c72045b9 | ||
|
|
eb930883fa | ||
|
|
30ed18eb95 | ||
|
|
8508f5b8b8 | ||
|
|
dfab223eb2 | ||
|
|
dd82fa0791 | ||
|
|
af8d2dc2c7 | ||
|
|
9f9529debf | ||
|
|
495c4a33e5 | ||
|
|
203d3749ee | ||
|
|
1fcecbd3e7 | ||
|
|
d778616b2c | ||
|
|
4bdd97a302 | ||
|
|
ab2a031ee0 | ||
|
|
5663b71387 | ||
|
|
2a43bce849 | ||
|
|
592c3a2142 | ||
|
|
e9ca341476 | ||
|
|
76617c8a61 | ||
|
|
10ff097232 | ||
|
|
1e043d481a | ||
|
|
7f8c670dc1 | ||
|
|
0e536a2cb3 | ||
|
|
090cf82a39 | ||
|
|
6e60f39f82 | ||
|
|
b8078e4730 | ||
|
|
e08fe64db2 | ||
|
|
2b576568a7 | ||
|
|
e2edbaad34 | ||
|
|
184b98bbdc | ||
|
|
7cc604dbdb | ||
|
|
44ed35825f | ||
|
|
22833eea6c | ||
|
|
64dfc1e3d3 | ||
|
|
6619ca1d22 | ||
|
|
2f2a80e1ce | ||
|
|
fa1bbd2031 | ||
|
|
a39a77f89e | ||
|
|
7800e48f61 | ||
|
|
63378ae4c1 | ||
|
|
fecf83c79c | ||
|
|
f287b6d8a7 | ||
|
|
9082658357 | ||
|
|
4bda175328 | ||
|
|
ee324c77a9 | ||
|
|
210b418e44 | ||
|
|
b73eced36f | ||
|
|
6296a6adde | ||
|
|
99f6192965 | ||
|
|
bff454f397 | ||
|
|
8216dbe355 | ||
|
|
fbe26af2d7 | ||
|
|
0a1559511a | ||
|
|
aee60f2c09 | ||
|
|
9ce850f84f | ||
|
|
cbff8482ce | ||
|
|
0035762a71 | ||
|
|
3d515aab23 | ||
|
|
e77801f3c1 | ||
|
|
c83d011faa | ||
|
|
5aa4949baa | ||
|
|
906ead53dd | ||
|
|
cbcdedc67a | ||
|
|
c87b410823 | ||
|
|
0a447f68c6 | ||
|
|
e98d241452 | ||
|
|
421455224f | ||
|
|
29c55312a5 | ||
|
|
6c474c8838 | ||
|
|
03182ea24c | ||
|
|
2c6543da9e | ||
|
|
20bbdfc4ab | ||
|
|
5b2ebf4aa8 | ||
|
|
2b159adefd | ||
|
|
be2de1d487 | ||
|
|
6876f192de | ||
|
|
875db44afd | ||
|
|
2e120abe3a | ||
|
|
feeb17d6f0 | ||
|
|
6d2003d577 | ||
|
|
40b609ccd8 | ||
|
|
d64399df49 | ||
|
|
d4f2f0e11b | ||
|
|
916d9a7c8a | ||
|
|
6d5ab0edda | ||
|
|
307d483323 | ||
|
|
eb4960f307 | ||
|
|
9df72e61a2 | ||
|
|
fcb6391ba3 | ||
|
|
16a77f281e | ||
|
|
87ebf7023f | ||
|
|
028f87653a | ||
|
|
0e51983819 | ||
|
|
c174f2b829 | ||
|
|
8e9d393eb2 | ||
|
|
f1f02fd005 | ||
|
|
f279a979e3 | ||
|
|
e0bbe9cea4 | ||
|
|
d3cc23f6a0 | ||
|
|
4c3f3ee4e2 | ||
|
|
2d7c5d7fd6 | ||
|
|
8be68aa6df | ||
|
|
a731ad14ec | ||
|
|
05ca96aa7f | ||
|
|
60aa32d003 | ||
|
|
0e7ee41444 | ||
|
|
b5f6b1d97f | ||
|
|
f1ac5739e4 | ||
|
|
8cbb57df97 | ||
|
|
2c8d2998bb | ||
|
|
44684fcfd0 | ||
|
|
7081e03c23 | ||
|
|
246db98519 | ||
|
|
ee245d348f | ||
|
|
f718741044 | ||
|
|
c054ff851a | ||
|
|
755787f9ee | ||
|
|
24f8b2fbd5 | ||
|
|
ee02a19e9a | ||
|
|
cb5d38c11f | ||
|
|
15436b44da | ||
|
|
5c267663a2 | ||
|
|
fda625b235 | ||
|
|
2cbd8789d8 | ||
|
|
95167f44f1 | ||
|
|
789b51fd05 | ||
|
|
0911c86422 | ||
|
|
7d05c9d8e6 | ||
|
|
a43ae4178a | ||
|
|
c9c2c483fa | ||
|
|
133281faaa | ||
|
|
ef8987917d | ||
|
|
d6a00eaf00 | ||
|
|
69151f0855 | ||
|
|
bb27d753b1 | ||
|
|
37ce29a5e8 | ||
|
|
6297e1c79b | ||
|
|
4e2903e65c | ||
|
|
2e7f56eeb5 | ||
|
|
7e46d5ca08 | ||
|
|
a2bcce9ab1 | ||
|
|
2f7b1c38e1 | ||
|
|
789aaec186 | ||
|
|
f3d6c1727b | ||
|
|
c029b51c97 | ||
|
|
6c5fb5f398 | ||
|
|
4b20db47b2 | ||
|
|
e238ec8fc6 | ||
|
|
9689f55e5c | ||
|
|
ec0c7da494 | ||
|
|
5f9f3e8167 | ||
|
|
6388246418 | ||
|
|
86432eb426 | ||
|
|
a51585f5d0 | ||
|
|
9ec75fb470 | ||
|
|
c8a7f6d76f | ||
|
|
01a8a199d2 | ||
|
|
f85c54596a | ||
|
|
b3e1acc563 | ||
|
|
745ff21551 | ||
|
|
31c8cf9766 | ||
|
|
8901db4e18 | ||
|
|
b1b8c4d713 | ||
|
|
b14b37c22d | ||
|
|
e73e628051 | ||
|
|
3bb920f22c | ||
|
|
2bed26f18a | ||
|
|
fb3363661b | ||
|
|
315b713005 | ||
|
|
70de0ba00b | ||
|
|
25cad3afc6 | ||
|
|
11aa126b80 | ||
|
|
d0e8bb3174 | ||
|
|
6b03108052 | ||
|
|
34447ef874 | ||
|
|
dcd79e87e1 | ||
|
|
8822b4edae | ||
|
|
a24d6ff018 | ||
|
|
707195f237 | ||
|
|
321fcd7b84 | ||
|
|
c5970e9246 | ||
|
|
538a0c5d6c | ||
|
|
4c4df60b81 | ||
|
|
d1cf08c6ba | ||
|
|
e091a8eb55 | ||
|
|
d579c9a2af | ||
|
|
a711d3a3e3 | ||
|
|
2c197af9fd | ||
|
|
d58d621f96 | ||
|
|
0203252b63 | ||
|
|
22edd121d3 | ||
|
|
31b83becad | ||
|
|
6cce3098db | ||
|
|
fd3d60d112 | ||
|
|
9094e5feb8 | ||
|
|
60bfabb097 | ||
|
|
2d4cf76825 | ||
|
|
6a7279ea05 | ||
|
|
4cb4a6224b | ||
|
|
a6e445b7ef | ||
|
|
123a139e43 | ||
|
|
4054315c19 | ||
|
|
d942cedb8e | ||
|
|
ec774b590b | ||
|
|
988a11a5da | ||
|
|
1488946fc5 | ||
|
|
1f05967b0b | ||
|
|
4924391ae8 | ||
|
|
f2668d7dbb | ||
|
|
d26779bee9 | ||
|
|
c75715b186 | ||
|
|
a238b7029d | ||
|
|
98511136ee | ||
|
|
6723b3a4c6 | ||
|
|
40c61149cf | ||
|
|
4f9a463b9d | ||
|
|
f3a8208425 | ||
|
|
cbf2f34f93 | ||
|
|
898fad6be4 | ||
|
|
eaa1a8edca | ||
|
|
08db154791 | ||
|
|
e1cf4c0c67 | ||
|
|
529c43b0e6 | ||
|
|
376abdf49e | ||
|
|
11a744a772 | ||
|
|
47f73ba455 | ||
|
|
001b11efc6 | ||
|
|
089f3a0e71 | ||
|
|
af9a3c85c6 | ||
|
|
a534f9aac1 | ||
|
|
a08016647a | ||
|
|
a557fc7d3c | ||
|
|
2d3d11ec2d | ||
|
|
9bc97c6dd3 | ||
|
|
52f1e33052 | ||
|
|
272e99d41f | ||
|
|
77b67d5a79 | ||
|
|
8e1f464209 | ||
|
|
5f960fd80a | ||
|
|
bddca30668 | ||
|
|
28a2b9668d | ||
|
|
f52d9feef8 | ||
|
|
f77ae6ee15 | ||
|
|
88b99a3835 | ||
|
|
8d16af8770 | ||
|
|
fde9ba86a2 | ||
|
|
c9356f9ef5 | ||
|
|
6a0529f02d | ||
|
|
760178c061 | ||
|
|
0bb2642d24 | ||
|
|
635a4f7265 | ||
|
|
0e34202d4d | ||
|
|
3a9c55a9ea | ||
|
|
2dd1775d9a | ||
|
|
a0635eeb08 | ||
|
|
9677653c54 | ||
|
|
6cf7167c09 | ||
|
|
f9879be439 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
/dependency-reduced-pom.xml
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
|
||||
@@ -7,18 +7,83 @@ Key:
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 1.5.04-SNAPSHOT
|
||||
Version 2.1.0
|
||||
+ Added JSON integration to all Skill Commands
|
||||
+ Added config setting to enable or disable classic mcMMO skill scaling
|
||||
+ (Config) Added rank settings for the new Woodcutting skill
|
||||
+ (Config) Added configurable parameters for the new Tree Feller
|
||||
+ (Config) Added classic toggle for Tree Feller
|
||||
+ (Chat) Added ability for admins to spy on party chat (off unless toggled on)
|
||||
+ (Commands) Added toggle command /mcchatspy
|
||||
+ (API) Added many missing SubSkills to SubSkill class
|
||||
+ (Permissions) Added permission node mcmmo.commands.mcchatspy & mcmmo.commands.mcchatspy.others
|
||||
+ (Permissions) Added permission nodes for Harvest Lumber, Splinter, Nature's Bounty, and Bark Surgeon
|
||||
+ (Locale) Added locale strings for new Woodcutting abilities
|
||||
+ (Locale) Added locale strings for mcchatspy command
|
||||
+ (Locale) Added locale strings for JSON integration
|
||||
+ (Locale) Added locale strings for Taming's Pummel SubSkill
|
||||
+ (Locale) Added locale strings for Unarmed's Block Cracker SubSkill
|
||||
- (Locale) Removed localizations with the following codes for being almost empty: id, HR_hr, et_EE, lv, lt, no, pl_PL, pt_PT, tr_TR
|
||||
- (Config) Removed SkillShot's IncreaseLevel & IncreasePercentage (replaced by RankDamageMultiplier)
|
||||
- (Config) Removed AxeMastery's MaxBonus & MaxBonusLevel (replaced by RankDamageMultiplier)
|
||||
! (Skills) Woodcutting's Double Drop subskill is now named Harvest Lumber
|
||||
! (Skills) Archery's Skill Shot now uses a rank system
|
||||
! (Skills) Axe's Axe Mastery now uses a rank system
|
||||
! (Config) Unarmed.IronArm in advanced.yml is now Unarmed.IronArmStyle
|
||||
! (Config) Unarmed.Deflect in advanced.yml is now Unarmed.ArrowDeflect
|
||||
! (Config) Swords.Counter in advanced.yml is now Swords.CounterAttack
|
||||
! (Config) Archery.Retrieve in advanced.yml is now Archery.ArrowRetrieval
|
||||
! (Config) Axes.CriticalHit in advanced.yml is now Axes.CriticalStrikes
|
||||
! (Config) Archery's Skill Shot now uses RankDamageMultiplier for its damage bonus calculations
|
||||
! (Config) Axe's Axe mastery now uses RankDamageMultiplier for its damage bonus calculations
|
||||
! (Permissions) Replaced the old Double Drop permission node for woodcutting with a new Harvest Lumber permission node
|
||||
! (Permissions) Fast Food Service permission node renamed to mcmmo.ability.taming.fastfoodservice
|
||||
! (Permissions) Counter Attack permission node renamed to mcmmo.ability.swords.counterattack
|
||||
! (Permissions) Arrow Deflect permission node renamed to mcmmo.ability.unarmed.arrowdeflect
|
||||
! (Permissions) Iron Arm Style permission node renamed to mcmmo.ability.unarmed.ironarmstyle
|
||||
! (Locale) Removed redundant information from some skill names and descriptions en_US (other locales will need to be updated)
|
||||
! (Locale) SubSkill locale keys are now located at {ParentSkill}.SubSkill.SubSkillName
|
||||
! (Locale) Super Abilities no longer have (ABILITY) in their Skill.Effect strings
|
||||
! (API) mcMMO is now built against Spigot-API instead of Bukkit
|
||||
! (API) SkillType is now PrimarySkill
|
||||
! (API) SecondarySkill is now SubSkill
|
||||
! (API) AbilityType is now SuperAbility
|
||||
! (API) SecondaryAbilityEvent is now SubSkillEvent
|
||||
! (API) SecondarySkill ENUM is being updated to have the parent skill as a prefix and a getter method for grabbing the parent skill
|
||||
! (API) GREEN_THUMB_PLANT & GREEN_THUMB_BLOCK are replaced by GREEN_THUMB
|
||||
! Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use
|
||||
! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
|
||||
! (Code) Refactored some unreadable code relating to SecondaryAbility activation in SkillUtils
|
||||
|
||||
|
||||
Version 2.0.0
|
||||
= Fixed an interaction between Tree Feller and Stripped Wood
|
||||
! Fireworks no longer fire by default for ability activation/deactivation
|
||||
! Website has been changed and the MOTD string relating to it reflects this
|
||||
! Discord link added to mcMMO command
|
||||
! Updated misc strings relating to mcMMO
|
||||
|
||||
|
||||
Version 1.5.05-SNAPSHOT
|
||||
|
||||
Version 1.5.04
|
||||
+ Added option to config.yml to control mcMMO generated sound volume
|
||||
+ Added option to config.yml to truncate existing player skill levels that exceed the skill level cap
|
||||
+ Falling blocks persist mcMMO natural data
|
||||
= Woodcutting double drops correctly identify acacia and dark oak logs
|
||||
= Skill Reset command now correctly identifies arguments
|
||||
= Hylian Treasure config options are now actually used
|
||||
= Child skills now use parent skills configured skill caps properly
|
||||
= Auto Update config now properly works
|
||||
! Item dropped from blocks now drop from the center
|
||||
! Potions Config updated for 1.9
|
||||
! Flux mining now simulates a block break event for other plugins to act upon
|
||||
! Zombie Pigmen spawned from nether portals are now considered spawner mobs
|
||||
! Flux Pickaxe lore now appends to existing lore as opposed to replacing it
|
||||
! Party chat no longer displays colors when logged in server console
|
||||
- Treefeller no longer lowers exp for big trees
|
||||
- No longer supports 1.8 :(
|
||||
- Removed plugin metrics
|
||||
|
||||
Version 1.5.03
|
||||
= Fixed bug where absorption hearts could be attacked by allied players
|
||||
|
||||
50
README.md
50
README.md
@@ -1,39 +1,40 @@
|
||||
# mcMMO
|
||||
## The RPG lovers mod
|
||||
|
||||
## Website
|
||||
I'm working on a brand new website for mcMMO
|
||||
|
||||
You can check it out here http://www.mcmmo.org
|
||||
|
||||
I plan to post links to our new wiki (its still under development), downloads, and dev blogs there.
|
||||
|
||||
|
||||
### Builds
|
||||
Currently, you can obtain our builds via the Spigot resource page: http://www.spigotmc.org/resources/mcmmo.2445/
|
||||
Currently, you can obtain our builds via the Spigot resource page: https://www.spigotmc.org/resources/official-mcmmo.63489/
|
||||
|
||||
### Brief Description
|
||||
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
|
||||
|
||||
## About the Team
|
||||
|
||||
mcMMO is currently developed by a team of individuals from all over the world.
|
||||
|
||||
### Project Lead & Founder
|
||||
[](https://github.com/nossr50)
|
||||
|
||||
### Former Lead
|
||||
[](https://github.com/gmcferrin)
|
||||
|
||||
### Developers
|
||||
[]
|
||||
(https://github.com/gmcferrin)
|
||||
[]
|
||||
(https://github.com/bm01)
|
||||
[]
|
||||
(https://github.com/Glitchfinder)
|
||||
[]
|
||||
(https://github.com/nossr50)
|
||||
[]
|
||||
(https://github.com/NuclearW)
|
||||
[]
|
||||
(https://github.com/shatteredbeam)
|
||||
[]
|
||||
(https://github.com/TfT-02)
|
||||
[]
|
||||
(https://github.com/t00thpick1)
|
||||
[]
|
||||
(https://github.com/riking)
|
||||
[](https://github.com/bm01)
|
||||
[](https://github.com/Glitchfinder)
|
||||
[](https://github.com/NuclearW)
|
||||
[](https://github.com/shatteredbeam)
|
||||
[](https://github.com/TfT-02)
|
||||
[](https://github.com/t00thpick1)
|
||||
[](https://github.com/riking)
|
||||
|
||||
### Special thanks
|
||||
[]
|
||||
(https://github.com/EasyMFnE)
|
||||
[](https://github.com/EasyMFnE)
|
||||
Added the Alchemy skill
|
||||
|
||||
## Compiling
|
||||
@@ -43,8 +44,7 @@ mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary c
|
||||
The typical command used to build mcMMO is: `mvn clean package install`
|
||||
|
||||
Required Libraries:
|
||||
* JUnit
|
||||
* EMetrics
|
||||
* Bukkit
|
||||
* JUnit
|
||||
|
||||
http://www.spigotmc.org/resources/mcmmo.2445/ for more up to date information.
|
||||
https://www.spigotmc.org/resources/official-mcmmo.63489/ for more up to date information.
|
||||
|
||||
44
pom.xml
44
pom.xml
@@ -2,15 +2,16 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.5.04-SNAPSHOT</version>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<issueManagement>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO/issues</url>
|
||||
<system>GitHub</system>
|
||||
</issueManagement>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
<finalName>mcMMO</finalName>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
@@ -53,8 +54,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<excludes>
|
||||
</excludes>
|
||||
</configuration>
|
||||
@@ -79,21 +80,16 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.turt2live.metrics:MetricsExtension</include>
|
||||
<include>commons-logging:commons-logging</include>
|
||||
<include>org.apache.tomcat:tomcat-jdbc</include>
|
||||
<include>org.apache.tomcat:tomcat-juli</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.turt2live.metrics</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.metrics.mcstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons.logging</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.commons.logging</shadedPattern>
|
||||
@@ -129,19 +125,14 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Plugin MetricsExtension</id>
|
||||
<url>http://repo.turt2live.com</url>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -150,11 +141,6 @@
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.turt2live.metrics</groupId>
|
||||
<artifactId>MetricsExtension</artifactId>
|
||||
<version>0.0.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
@@ -162,17 +148,7 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>drtshock-releases</id>
|
||||
<url>https://ci.drtshock.net/plugin/repository/everything/com/gmail/nossr50/mcMMO/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<ciManagement>
|
||||
<system>Jenkins</system>
|
||||
<url>https://ci.drtshock.net/job/mcmmo/</url>
|
||||
</ciManagement>
|
||||
</project>
|
||||
|
||||
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: com.gmail.nossr50.mcMMO
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@@ -12,37 +12,37 @@ public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.BERSERK);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.BERSERK);
|
||||
}
|
||||
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.GREEN_TERRA);
|
||||
}
|
||||
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.SERRATED_STRIKES);
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.SKULL_SPLITTER);
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.SUPER_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(SuperAbility.TREE_FELLER);
|
||||
}
|
||||
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
for (SuperAbility ability : SuperAbility.values()) {
|
||||
if (mcMMOPlayer.getAbilityMode(ability)) {
|
||||
return true;
|
||||
}
|
||||
@@ -56,31 +56,31 @@ public final class AbilityAPI {
|
||||
}
|
||||
|
||||
public static void setBerserkCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.BERSERK, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.BERSERK, cooldown);
|
||||
}
|
||||
|
||||
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.GIGA_DRILL_BREAKER, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.GIGA_DRILL_BREAKER, cooldown);
|
||||
}
|
||||
|
||||
public static void setGreenTerraCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.GREEN_TERRA, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.GREEN_TERRA, cooldown);
|
||||
}
|
||||
|
||||
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SERRATED_STRIKES, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.SERRATED_STRIKES, cooldown);
|
||||
}
|
||||
|
||||
public static void setSkullSplitterCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SKULL_SPLITTER, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.SKULL_SPLITTER, cooldown);
|
||||
}
|
||||
|
||||
public static void setSuperBreakerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SUPER_BREAKER, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.SUPER_BREAKER, cooldown);
|
||||
}
|
||||
|
||||
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.TREE_FELLER, cooldown);
|
||||
UserManager.getPlayer(player).setAbilityDATS(SuperAbility.TREE_FELLER, cooldown);
|
||||
}
|
||||
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gmail.nossr50.api;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -16,7 +17,6 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -34,7 +34,7 @@ public final class ExperienceAPI {
|
||||
* @return true if this is a valid mcMMO skill
|
||||
*/
|
||||
public static boolean isValidSkillType(String skillType) {
|
||||
return SkillType.getSkill(skillType) != null;
|
||||
return PrimarySkill.getSkill(skillType) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ public final class ExperienceAPI {
|
||||
* @return true if this is a valid, non-child mcMMO skill
|
||||
*/
|
||||
public static boolean isNonChildSkill(String skillType) {
|
||||
SkillType skill = SkillType.getSkill(skillType);
|
||||
PrimarySkill skill = PrimarySkill.getSkill(skillType);
|
||||
|
||||
return skill != null && !skill.isChildSkill();
|
||||
}
|
||||
@@ -261,7 +261,7 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
||||
SkillType skill = getSkillType(skillType);
|
||||
PrimarySkill skill = getSkillType(skillType);
|
||||
|
||||
if (isUnshared) {
|
||||
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||
@@ -285,7 +285,7 @@ public final class ExperienceAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
|
||||
SkillType skill = getSkillType(skillType);
|
||||
PrimarySkill skill = getSkillType(skillType);
|
||||
|
||||
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||
}
|
||||
@@ -515,7 +515,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getXPRemaining(Player player, String skillType) {
|
||||
SkillType skill = getNonChildSkillType(skillType);
|
||||
PrimarySkill skill = getNonChildSkillType(skillType);
|
||||
|
||||
PlayerProfile profile = getPlayer(player).getProfile();
|
||||
|
||||
@@ -537,7 +537,7 @@ public final class ExperienceAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getOfflineXPRemaining(String playerName, String skillType) {
|
||||
SkillType skill = getNonChildSkillType(skillType);
|
||||
PrimarySkill skill = getNonChildSkillType(skillType);
|
||||
PlayerProfile profile = getOfflineProfile(playerName);
|
||||
|
||||
return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill);
|
||||
@@ -557,7 +557,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static float getOfflineXPRemaining(UUID uuid, String skillType) {
|
||||
SkillType skill = getNonChildSkillType(skillType);
|
||||
PrimarySkill skill = getNonChildSkillType(skillType);
|
||||
PlayerProfile profile = getOfflineProfile(uuid);
|
||||
|
||||
return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill);
|
||||
@@ -593,12 +593,12 @@ public final class ExperienceAPI {
|
||||
@Deprecated
|
||||
public static void addLevelOffline(String playerName, String skillType, int levels) {
|
||||
PlayerProfile profile = getOfflineProfile(playerName);
|
||||
SkillType skill = getSkillType(skillType);
|
||||
PrimarySkill skill = getSkillType(skillType);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
|
||||
Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill);
|
||||
|
||||
for (SkillType parentSkill : parentSkills) {
|
||||
for (PrimarySkill parentSkill : parentSkills) {
|
||||
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||
}
|
||||
|
||||
@@ -624,12 +624,12 @@ public final class ExperienceAPI {
|
||||
*/
|
||||
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
|
||||
PlayerProfile profile = getOfflineProfile(uuid);
|
||||
SkillType skill = getSkillType(skillType);
|
||||
PrimarySkill skill = getSkillType(skillType);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
|
||||
Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill);
|
||||
|
||||
for (SkillType parentSkill : parentSkills) {
|
||||
for (PrimarySkill parentSkill : parentSkills) {
|
||||
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ public final class ExperienceAPI {
|
||||
int powerLevel = 0;
|
||||
PlayerProfile profile = getOfflineProfile(playerName);
|
||||
|
||||
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
powerLevel += profile.getSkillLevel(type);
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ public final class ExperienceAPI {
|
||||
int powerLevel = 0;
|
||||
PlayerProfile profile = getOfflineProfile(uuid);
|
||||
|
||||
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
powerLevel += profile.getSkillLevel(type);
|
||||
}
|
||||
|
||||
@@ -1015,7 +1015,7 @@ public final class ExperienceAPI {
|
||||
}
|
||||
|
||||
// Utility methods follow.
|
||||
private static void addOfflineXP(UUID playerUniqueId, SkillType skill, int XP) {
|
||||
private static void addOfflineXP(UUID playerUniqueId, PrimarySkill skill, int XP) {
|
||||
PlayerProfile profile = getOfflineProfile(playerUniqueId);
|
||||
|
||||
profile.addXp(skill, XP);
|
||||
@@ -1023,7 +1023,7 @@ public final class ExperienceAPI {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static void addOfflineXP(String playerName, SkillType skill, int XP) {
|
||||
private static void addOfflineXP(String playerName, PrimarySkill skill, int XP) {
|
||||
PlayerProfile profile = getOfflineProfile(playerName);
|
||||
|
||||
profile.addXp(skill, XP);
|
||||
@@ -1052,8 +1052,8 @@ public final class ExperienceAPI {
|
||||
return profile;
|
||||
}
|
||||
|
||||
private static SkillType getSkillType(String skillType) throws InvalidSkillException {
|
||||
SkillType skill = SkillType.getSkill(skillType);
|
||||
private static PrimarySkill getSkillType(String skillType) throws InvalidSkillException {
|
||||
PrimarySkill skill = PrimarySkill.getSkill(skillType);
|
||||
|
||||
if (skill == null) {
|
||||
throw new InvalidSkillException();
|
||||
@@ -1062,8 +1062,8 @@ public final class ExperienceAPI {
|
||||
return skill;
|
||||
}
|
||||
|
||||
private static SkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException {
|
||||
SkillType skill = getSkillType(skillType);
|
||||
private static PrimarySkill getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException {
|
||||
PrimarySkill skill = getSkillType(skillType);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
throw new UnsupportedOperationException("Child skills do not have XP");
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
public final class SkillAPI {
|
||||
private SkillAPI() {}
|
||||
@@ -18,7 +18,7 @@ public final class SkillAPI {
|
||||
* @return a list of strings with valid skill names
|
||||
*/
|
||||
public static List<String> getSkills() {
|
||||
return getListFromEnum(Arrays.asList(SkillType.values()));
|
||||
return getListFromEnum(Arrays.asList(PrimarySkill.values()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ public final class SkillAPI {
|
||||
* @return a list of strings with valid skill names
|
||||
*/
|
||||
public static List<String> getNonChildSkills() {
|
||||
return getListFromEnum(SkillType.NON_CHILD_SKILLS);
|
||||
return getListFromEnum(PrimarySkill.NON_CHILD_SKILLS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ public final class SkillAPI {
|
||||
* @return a list of strings with valid skill names
|
||||
*/
|
||||
public static List<String> getChildSkills() {
|
||||
return getListFromEnum(SkillType.CHILD_SKILLS);
|
||||
return getListFromEnum(PrimarySkill.CHILD_SKILLS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public final class SkillAPI {
|
||||
* @return a list of strings with valid skill names
|
||||
*/
|
||||
public static List<String> getCombatSkills() {
|
||||
return getListFromEnum(SkillType.COMBAT_SKILLS);
|
||||
return getListFromEnum(PrimarySkill.COMBAT_SKILLS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public final class SkillAPI {
|
||||
* @return a list of strings with valid skill names
|
||||
*/
|
||||
public static List<String> getGatheringSkills() {
|
||||
return getListFromEnum(SkillType.GATHERING_SKILLS);
|
||||
return getListFromEnum(PrimarySkill.GATHERING_SKILLS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,14 +78,14 @@ public final class SkillAPI {
|
||||
* @return a list of strings with valid skill names
|
||||
*/
|
||||
public static List<String> getMiscSkills() {
|
||||
return getListFromEnum(SkillType.MISC_SKILLS);
|
||||
return getListFromEnum(PrimarySkill.MISC_SKILLS);
|
||||
}
|
||||
|
||||
private static List<String> getListFromEnum(List<SkillType> skillsTypes) {
|
||||
private static List<String> getListFromEnum(List<PrimarySkill> skillsTypes) {
|
||||
List<String> skills = new ArrayList<String>();
|
||||
|
||||
for (SkillType skillType : skillsTypes) {
|
||||
skills.add(skillType.name());
|
||||
for (PrimarySkill primarySkill : skillsTypes) {
|
||||
skills.add(primarySkill.name());
|
||||
}
|
||||
|
||||
return skills;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.gmail.nossr50.chat;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -33,6 +37,36 @@ public abstract class ChatManager {
|
||||
message = LocaleLoader.formatString(chatPrefix, displayName) + " " + event.getMessage();
|
||||
|
||||
sendMessage();
|
||||
|
||||
/*
|
||||
* Party Chat Spying
|
||||
* Party messages will be copied to people with the mcmmo.admin.chatspy permission node
|
||||
*/
|
||||
if(event instanceof McMMOPartyChatEvent)
|
||||
{
|
||||
//We need to grab the party chat name
|
||||
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
|
||||
|
||||
//Find the people with permissions
|
||||
for(Player player : event.getPlugin().getServer().getOnlinePlayers())
|
||||
{
|
||||
//Check for toggled players
|
||||
if(UserManager.getPlayer(player).isPartyChatSpying())
|
||||
{
|
||||
Party adminParty = UserManager.getPlayer(player).getParty();
|
||||
|
||||
//Only message admins not part of this party
|
||||
if(adminParty != null)
|
||||
{
|
||||
//TODO: Incorporate JSON
|
||||
if(!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
|
||||
player.sendMessage(ChatColor.GOLD+"[SPY: "+ChatColor.GREEN+partyChatEvent.getParty()+ChatColor.GOLD+"] "+message);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GOLD+"[SPY: "+ChatColor.GREEN+partyChatEvent.getParty()+ChatColor.GOLD+"] "+message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleChat(String senderName, String message) {
|
||||
|
||||
46
src/main/java/com/gmail/nossr50/commands/MHDCommand.java
Normal file
46
src/main/java/com/gmail/nossr50/commands/MHDCommand.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.FlatfileDatabaseManager;
|
||||
import com.gmail.nossr50.database.SQLDatabaseManager;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class MHDCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
|
||||
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
||||
m.resetMobHealthSettings();
|
||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
||||
}
|
||||
sender.sendMessage("Mob health reset");
|
||||
return true;
|
||||
}
|
||||
if (mcMMO.getDatabaseManager() instanceof FlatfileDatabaseManager) {
|
||||
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager();
|
||||
m.resetMobHealthSettings();
|
||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
||||
}
|
||||
sender.sendMessage("Mob health reset");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "tft_02@hotmail.com" + ChatColor.GOLD + " Paypal");
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
|
||||
if (Permissions.showversion(sender)) {
|
||||
|
||||
30
src/main/java/com/gmail/nossr50/commands/chat/McChatSpy.java
Normal file
30
src/main/java/com/gmail/nossr50/commands/chat/McChatSpy.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import com.gmail.nossr50.commands.ToggleCommand;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class McChatSpy extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.adminChatSpyOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(CommandSender sender) {
|
||||
return Permissions.adminChatSpy(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
|
||||
mcMMOPlayer.togglePartyChatSpying();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Toggle", playerName));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
@@ -22,7 +22,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value) {
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
profile.addLevels(skill, value);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -22,7 +22,7 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value) {
|
||||
if (player != null) {
|
||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -14,7 +15,6 @@ import org.bukkit.util.StringUtil;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList;
|
||||
public abstract class ExperienceCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
SkillType skill;
|
||||
PrimarySkill skill;
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
@@ -40,12 +40,18 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
skill = PrimarySkill.getSkill(args[0]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
}
|
||||
|
||||
if (skill != null && skill.isChildSkill())
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||
return true;
|
||||
}
|
||||
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]));
|
||||
return true;
|
||||
|
||||
@@ -59,12 +65,18 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skill = PrimarySkill.getSkill(args[1]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
}
|
||||
|
||||
if (skill != null && skill.isChildSkill())
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||
return true;
|
||||
}
|
||||
|
||||
int value = Integer.parseInt(args[2]);
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
@@ -104,7 +116,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkill.SKILL_NAMES, new ArrayList<String>(PrimarySkill.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@@ -112,15 +124,15 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
|
||||
protected abstract boolean permissionsCheckSelf(CommandSender sender);
|
||||
protected abstract boolean permissionsCheckOthers(CommandSender sender);
|
||||
protected abstract void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value);
|
||||
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value);
|
||||
protected abstract void handlePlayerMessageAll(Player player, int value);
|
||||
protected abstract void handlePlayerMessageSkill(Player player, int value, SkillType skill);
|
||||
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill);
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
|
||||
}
|
||||
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
@@ -129,10 +141,10 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkill skill, int value) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, skillType, value);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, primarySkill, value);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
@@ -22,7 +22,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value) {
|
||||
int skillLevel = profile.getSkillLevel(skill);
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -14,7 +15,6 @@ import org.bukkit.util.StringUtil;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
@@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableList;
|
||||
public class SkillresetCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
SkillType skill;
|
||||
PrimarySkill skill;
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
@@ -50,7 +50,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
skill = null;
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skill = PrimarySkill.getSkill(args[1]);
|
||||
}
|
||||
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill);
|
||||
@@ -70,7 +70,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
skill = null;
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skill = PrimarySkill.getSkill(args[1]);
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
@@ -110,13 +110,13 @@ public class SkillresetCommand implements TabExecutor {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkill.SKILL_NAMES, new ArrayList<String>(PrimarySkill.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill) {
|
||||
int levelsRemoved = profile.getSkillLevel(skill);
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
}
|
||||
|
||||
protected void handlePlayerMessageSkill(Player player, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, PrimarySkill skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
|
||||
}
|
||||
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
@@ -159,10 +159,10 @@ public class SkillresetCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, skillType);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, primarySkill);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
@@ -20,10 +20,10 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkEnabled(SkillType skill) {
|
||||
protected boolean checkEnabled(PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (!skillType.getHardcoreStatLossEnabled()) {
|
||||
for (PrimarySkill primarySkill : PrimarySkill.values()) {
|
||||
if (!primarySkill.getHardcoreStatLossEnabled()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -35,12 +35,12 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enable(SkillType skill) {
|
||||
protected void enable(PrimarySkill skill) {
|
||||
toggle(true, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disable(SkillType skill) {
|
||||
protected void disable(PrimarySkill skill) {
|
||||
toggle(false, skill);
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||
}
|
||||
|
||||
private void toggle(boolean enable, SkillType skill) {
|
||||
private void toggle(boolean enable, PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skillType.setHardcoreStatLossEnabled(enable);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
primarySkill.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -4,12 +4,12 @@ import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
@@ -76,7 +76,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
PrimarySkill skill = PrimarySkill.getSkill(args[0]);
|
||||
|
||||
if (!CommandUtils.isChildSkill(sender, skill)) {
|
||||
return true;
|
||||
@@ -125,8 +125,8 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
|
||||
protected abstract boolean checkTogglePermissions(CommandSender sender);
|
||||
protected abstract boolean checkModifyPermissions(CommandSender sender);
|
||||
protected abstract boolean checkEnabled(SkillType skill);
|
||||
protected abstract void enable(SkillType skill);
|
||||
protected abstract void disable(SkillType skill);
|
||||
protected abstract boolean checkEnabled(PrimarySkill skill);
|
||||
protected abstract void enable(PrimarySkill skill);
|
||||
protected abstract void disable(PrimarySkill skill);
|
||||
protected abstract void modify(CommandSender sender, double newPercentage);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
@@ -20,10 +20,10 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkEnabled(SkillType skill) {
|
||||
protected boolean checkEnabled(PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (!skillType.getHardcoreVampirismEnabled()) {
|
||||
for (PrimarySkill primarySkill : PrimarySkill.values()) {
|
||||
if (!primarySkill.getHardcoreVampirismEnabled()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -35,12 +35,12 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enable(SkillType skill) {
|
||||
protected void enable(PrimarySkill skill) {
|
||||
toggle(true, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disable(SkillType skill) {
|
||||
protected void disable(PrimarySkill skill) {
|
||||
toggle(false, skill);
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||
}
|
||||
|
||||
private void toggle(boolean enable, SkillType skill) {
|
||||
private void toggle(boolean enable, PrimarySkill skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skillType.setHardcoreVampirismEnabled(enable);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
primarySkill.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@@ -13,7 +14,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
@@ -53,17 +53,17 @@ public class InspectCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
for (SkillType skill : SkillType.GATHERING_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.GATHERING_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
for (SkillType skill : SkillType.COMBAT_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.COMBAT_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
for (SkillType skill : SkillType.MISC_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.MISC_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@@ -9,7 +10,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -45,7 +45,7 @@ public class MccooldownCommand implements TabExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
for (SuperAbility ability : SuperAbility.values()) {
|
||||
if (!ability.getPermissions(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@@ -10,22 +18,13 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MctopCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
SkillType skill = null;
|
||||
PrimarySkill skill = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
@@ -70,13 +69,13 @@ public class MctopCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[0], PrimarySkill.SKILL_NAMES, new ArrayList<String>(PrimarySkill.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
private void display(int page, SkillType skill, CommandSender sender, Command command) {
|
||||
private void display(int page, PrimarySkill skill, CommandSender sender, Command command) {
|
||||
if (skill != null && !Permissions.mctop(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
@@ -91,7 +90,12 @@ public class MctopCommand implements TabExecutor {
|
||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000;
|
||||
if (seconds < 1) {
|
||||
seconds = 1;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.formatString(LocaleLoader.getString("Commands.Database.Cooldown"), seconds));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,19 +112,19 @@ public class MctopCommand implements TabExecutor {
|
||||
display(page, skill, sender);
|
||||
}
|
||||
|
||||
private void display(int page, SkillType skill, CommandSender sender) {
|
||||
private void display(int page, PrimarySkill skill, CommandSender sender) {
|
||||
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
|
||||
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
||||
|
||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
||||
private SkillType extractSkill(CommandSender sender, String skillName) {
|
||||
private PrimarySkill extractSkill(CommandSender sender, String skillName) {
|
||||
if (CommandUtils.isInvalidSkill(sender, skillName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(skillName);
|
||||
PrimarySkill skill = PrimarySkill.getSkill(skillName);
|
||||
|
||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gmail.nossr50.commands.server;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
* This command facilitates switching the skill system scale between classic and modern scale
|
||||
*/
|
||||
public class Mcmmoupgrade implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
@@ -23,28 +25,28 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
private boolean canGracefulRoll;
|
||||
|
||||
public AcrobaticsCommand() {
|
||||
super(SkillType.ACROBATICS);
|
||||
super(PrimarySkill.ACROBATICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||
// DODGE
|
||||
// ACROBATICS_DODGE
|
||||
if (canDodge) {
|
||||
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DODGE, isLucky);
|
||||
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ACROBATICS_DODGE, isLucky);
|
||||
dodgeChance = dodgeStrings[0];
|
||||
dodgeChanceLucky = dodgeStrings[1];
|
||||
}
|
||||
|
||||
// ROLL
|
||||
// ACROBATICS_ROLL
|
||||
if (canRoll) {
|
||||
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.ROLL, isLucky);
|
||||
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ACROBATICS_ROLL, isLucky);
|
||||
rollChance = rollStrings[0];
|
||||
rollChanceLucky = rollStrings[1];
|
||||
}
|
||||
|
||||
// GRACEFUL ROLL
|
||||
// GRACEFUL ACROBATICS_ROLL
|
||||
if (canGracefulRoll) {
|
||||
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GRACEFUL_ROLL, isLucky);
|
||||
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ACROBATICS_GRACEFUL_ROLL, isLucky);
|
||||
gracefulRollChance = gracefulRollStrings[0];
|
||||
gracefulRollChanceLucky = gracefulRollStrings[1];
|
||||
}
|
||||
@@ -52,9 +54,9 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canDodge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DODGE);
|
||||
canRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ROLL);
|
||||
canGracefulRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL);
|
||||
canDodge = Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_DODGE);
|
||||
canRoll = Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_ROLL);
|
||||
canGracefulRoll = Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_GRACEFUL_ROLL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,4 +96,13 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ACROBATICS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy.Tier;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
||||
@@ -26,7 +28,7 @@ public class AlchemyCommand extends SkillCommand {
|
||||
private boolean canConcoctions;
|
||||
|
||||
public AlchemyCommand() {
|
||||
super(SkillType.ALCHEMY);
|
||||
super(PrimarySkill.ALCHEMY);
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {
|
||||
@@ -41,14 +43,14 @@ public class AlchemyCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||
// CATALYSIS
|
||||
// ALCHEMY_CATALYSIS
|
||||
if (canCatalysis) {
|
||||
String[] catalysisStrings = calculateAbilityDisplayValues(player, isLucky);
|
||||
brewSpeed = catalysisStrings[0];
|
||||
brewSpeedLucky = catalysisStrings[1];
|
||||
}
|
||||
|
||||
// CONCOCTIONS
|
||||
// ALCHEMY_CONCOCTIONS
|
||||
if (canConcoctions) {
|
||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||
tier = alchemyManager.getTier();
|
||||
@@ -59,8 +61,8 @@ public class AlchemyCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canCatalysis = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS);
|
||||
canConcoctions = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CONCOCTIONS);
|
||||
canCatalysis = Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CATALYSIS);
|
||||
canConcoctions = Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CONCOCTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,4 +102,13 @@ public class AlchemyCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ALCHEMY);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.archery.Archery;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -23,7 +25,7 @@ public class ArcheryCommand extends SkillCommand {
|
||||
private boolean canRetrieve;
|
||||
|
||||
public ArcheryCommand() {
|
||||
super(SkillType.ARCHERY);
|
||||
super(PrimarySkill.ARCHERY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,19 +33,19 @@ public class ArcheryCommand extends SkillCommand {
|
||||
// SKILL SHOT
|
||||
if (canSkillShot) {
|
||||
double bonus = (skillValue / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage;
|
||||
skillShotBonus = percent.format(Math.min(bonus, Archery.skillShotMaxBonusPercentage));
|
||||
skillShotBonus = percent.format(Archery.getSkillShotBonusDamage(player, 0));
|
||||
}
|
||||
|
||||
// DAZE
|
||||
// ARCHERY_DAZE
|
||||
if (canDaze) {
|
||||
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DAZE, isLucky);
|
||||
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ARCHERY_DAZE, isLucky);
|
||||
dazeChance = dazeStrings[0];
|
||||
dazeChanceLucky = dazeStrings[1];
|
||||
}
|
||||
|
||||
// RETRIEVE
|
||||
// ARCHERY_ARROW_RETRIEVAL
|
||||
if (canRetrieve) {
|
||||
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.RETRIEVE, isLucky);
|
||||
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ARCHERY_ARROW_RETRIEVAL, isLucky);
|
||||
retrieveChance = retrieveStrings[0];
|
||||
retrieveChanceLucky = retrieveStrings[1];
|
||||
}
|
||||
@@ -51,9 +53,9 @@ public class ArcheryCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkillShot = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SKILL_SHOT);
|
||||
canDaze = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DAZE);
|
||||
canRetrieve = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.RETRIEVE);
|
||||
canSkillShot = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_SKILL_SHOT);
|
||||
canDaze = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_DAZE);
|
||||
canRetrieve = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_ARROW_RETRIEVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,4 +95,13 @@ public class ArcheryCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ARCHERY);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.axes.Axes;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -26,7 +28,7 @@ public class AxesCommand extends SkillCommand {
|
||||
private boolean canGreaterImpact;
|
||||
|
||||
public AxesCommand() {
|
||||
super(SkillType.AXES);
|
||||
super(PrimarySkill.AXES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,24 +47,24 @@ public class AxesCommand extends SkillCommand {
|
||||
|
||||
// CRITICAL HIT
|
||||
if (canCritical) {
|
||||
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.CRITICAL_HIT, isLucky);
|
||||
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SubSkill.AXES_CRITICAL_STRIKES, isLucky);
|
||||
critChance = criticalHitStrings[0];
|
||||
critChanceLucky = criticalHitStrings[1];
|
||||
}
|
||||
|
||||
// AXE MASTERY
|
||||
if (canAxeMastery) {
|
||||
axeMasteryDamage = Math.min(skillValue / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
|
||||
axeMasteryDamage = Axes.getAxeMasteryBonusDamage(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkullSplitter = Permissions.skullSplitter(player);
|
||||
canCritical = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CRITICAL_HIT);
|
||||
canAxeMastery = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.AXE_MASTERY);
|
||||
canImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARMOR_IMPACT);
|
||||
canGreaterImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GREATER_IMPACT);
|
||||
canCritical = Permissions.isSubSkillEnabled(player, SubSkill.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = Permissions.isSubSkillEnabled(player, SubSkill.AXES_AXE_MASTERY);
|
||||
canImpact = Permissions.isSubSkillEnabled(player, SubSkill.AXES_ARMOR_IMPACT);
|
||||
canGreaterImpact = Permissions.isSubSkillEnabled(player, SubSkill.AXES_GREATER_IMPACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,4 +120,13 @@ public class AxesCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.AXES);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
@@ -18,7 +20,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
private boolean canTreasureHunt;
|
||||
|
||||
public ExcavationCommand() {
|
||||
super(SkillType.EXCAVATION);
|
||||
super(PrimarySkill.EXCAVATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,7 +36,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player);
|
||||
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER);
|
||||
canTreasureHunt = Permissions.isSubSkillEnabled(player, SubSkill.EXCAVATION_TREASURE_HUNTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,4 +64,13 @@ public class ExcavationCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.EXCAVATION);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
@@ -44,7 +46,7 @@ public class FishingCommand extends SkillCommand {
|
||||
private boolean canIceFish;
|
||||
|
||||
public FishingCommand() {
|
||||
super(SkillType.FISHING);
|
||||
super(PrimarySkill.FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +78,7 @@ public class FishingCommand extends SkillCommand {
|
||||
magicChance = percent.format(totalEnchantChance / 100.0);
|
||||
}
|
||||
|
||||
// SHAKE
|
||||
// FISHING_SHAKE
|
||||
if (canShake) {
|
||||
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability(), isLucky);
|
||||
shakeChance = shakeStrings[0];
|
||||
@@ -111,12 +113,12 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER);
|
||||
canShake = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHAKE);
|
||||
canFishermansDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET);
|
||||
canMasterAngler = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MASTER_ANGLER);
|
||||
canIceFish = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ICE_FISHING);
|
||||
canTreasureHunt = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_MAGIC_HUNTER);
|
||||
canShake = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_SHAKE);
|
||||
canFishermansDiet = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_FISHERMANS_DIET);
|
||||
canMasterAngler = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_MASTER_ANGLER);
|
||||
canIceFish = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_ICE_FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,4 +204,13 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.FISHING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HerbalismCommand extends SkillCommand {
|
||||
private String greenTerraLength;
|
||||
@@ -35,7 +36,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
private boolean canShroomThumb;
|
||||
|
||||
public HerbalismCommand() {
|
||||
super(SkillType.HERBALISM);
|
||||
super(PrimarySkill.HERBALISM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,28 +57,28 @@ public class HerbalismCommand extends SkillCommand {
|
||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
|
||||
|
||||
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GREEN_THUMB_PLANT, isLucky);
|
||||
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_GREEN_THUMB, isLucky);
|
||||
greenThumbChance = greenThumbStrings[0];
|
||||
greenThumbChanceLucky = greenThumbStrings[1];
|
||||
}
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HERBALISM_DOUBLE_DROPS, isLucky);
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_DOUBLE_DROPS, isLucky);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
// HYLIAN LUCK
|
||||
if (hasHylianLuck) {
|
||||
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HYLIAN_LUCK, isLucky);
|
||||
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_HYLIAN_LUCK, isLucky);
|
||||
hylianLuckChance = hylianLuckStrings[0];
|
||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||
}
|
||||
|
||||
// SHROOM THUMB
|
||||
if (canShroomThumb) {
|
||||
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SHROOM_THUMB, isLucky);
|
||||
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_SHROOM_THUMB, isLucky);
|
||||
shroomThumbChance = shroomThumbStrings[0];
|
||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||
}
|
||||
@@ -85,13 +86,13 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
|
||||
hasHylianLuck = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_HYLIAN_LUCK);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
|
||||
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
|
||||
canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
|
||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
||||
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA);
|
||||
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS);
|
||||
canFarmersDiet = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canShroomThumb = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,4 +164,13 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.HERBALISM);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
||||
@@ -35,7 +37,7 @@ public class MiningCommand extends SkillCommand {
|
||||
private boolean canDemoExpert;
|
||||
|
||||
public MiningCommand() {
|
||||
super(SkillType.MINING);
|
||||
super(PrimarySkill.MINING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +51,7 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.MINING_DOUBLE_DROPS, isLucky);
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkill.MINING_DOUBLE_DROPS, isLucky);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
@@ -72,7 +74,7 @@ public class MiningCommand extends SkillCommand {
|
||||
canBiggerBombs = Permissions.biggerBombs(player);
|
||||
canBlast = Permissions.remoteDetonation(player);
|
||||
canDemoExpert = Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkill.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canSuperBreaker = Permissions.superBreaker(player);
|
||||
}
|
||||
|
||||
@@ -150,4 +152,13 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.MINING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RepairCommand extends SkillCommand {
|
||||
private String repairMasteryBonus;
|
||||
@@ -42,14 +43,14 @@ public class RepairCommand extends SkillCommand {
|
||||
private int stoneLevel;
|
||||
|
||||
public RepairCommand() {
|
||||
super(SkillType.REPAIR);
|
||||
super(PrimarySkill.REPAIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||
// We're using pickaxes here, not the best but it works
|
||||
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE);
|
||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
|
||||
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
||||
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
||||
|
||||
@@ -66,7 +67,7 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
// SUPER REPAIR
|
||||
if (canSuperRepair) {
|
||||
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SUPER_REPAIR, isLucky);
|
||||
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SubSkill.REPAIR_SUPER_REPAIR, isLucky);
|
||||
superRepairChance = superRepairStrings[0];
|
||||
superRepairChanceLucky = superRepairStrings[1];
|
||||
}
|
||||
@@ -74,9 +75,9 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
|
||||
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
|
||||
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
|
||||
canSuperRepair = Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_ARCANE_FORGING);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||
@@ -156,4 +157,13 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.REPAIR);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
@@ -18,7 +20,7 @@ public class SalvageCommand extends SkillCommand {
|
||||
private boolean canArcaneSalvage;
|
||||
|
||||
public SalvageCommand() {
|
||||
super(SkillType.SALVAGE);
|
||||
super(PrimarySkill.SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,8 +31,8 @@ public class SalvageCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canAdvancedSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ADVANCED_SALVAGE);
|
||||
canArcaneSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_SALVAGE);
|
||||
canAdvancedSalvage = Permissions.isSubSkillEnabled(player, SubSkill.SALVAGE_ADVANCED_SALVAGE);
|
||||
canArcaneSalvage = Permissions.isSubSkillEnabled(player, SubSkill.SALVAGE_ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,4 +78,13 @@ public class SalvageCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SALVAGE);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,13 @@ import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Motd;
|
||||
@@ -26,9 +22,16 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class SkillCommand implements TabExecutor {
|
||||
protected SkillType skill;
|
||||
protected PrimarySkill skill;
|
||||
private String skillName;
|
||||
|
||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
@@ -36,7 +39,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
private CommandExecutor skillGuideCommand;
|
||||
|
||||
public SkillCommand(SkillType skill) {
|
||||
public SkillCommand(PrimarySkill skill) {
|
||||
this.skill = skill;
|
||||
skillName = skill.getName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill);
|
||||
@@ -68,49 +71,24 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||
}
|
||||
|
||||
if (!skill.isChildSkill()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName + " " + LocaleLoader.getString("Skills.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child", (int) skillValue));
|
||||
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||
Set<SkillType> parents = FamilyTree.getParents(skill);
|
||||
//Make JSON text components
|
||||
List<TextComponent> subskillTextComponents = getTextComponents(player);
|
||||
|
||||
for (SkillType parent : parents) {
|
||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
}
|
||||
|
||||
//Subskills Header
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.SubSkills")));
|
||||
|
||||
//Send JSON text components
|
||||
for(TextComponent tc : subskillTextComponents)
|
||||
{
|
||||
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
|
||||
}
|
||||
|
||||
List<String> effectMessages = effectsDisplay();
|
||||
//Stats
|
||||
getStatMessages(player, isLucky, hasEndurance, skillValue);
|
||||
|
||||
if (!effectMessages.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
|
||||
|
||||
if (isLucky) {
|
||||
player.sendMessage(Motd.PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc", skillName)));
|
||||
}
|
||||
|
||||
for (String message : effectMessages) {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
|
||||
|
||||
if (!statsMessages.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
|
||||
|
||||
for (String message : statsMessages) {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase()));
|
||||
return true;
|
||||
|
||||
default:
|
||||
@@ -118,6 +96,60 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private void getStatMessages(Player player, boolean isLucky, boolean hasEndurance, float skillValue) {
|
||||
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
|
||||
|
||||
if (!statsMessages.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
|
||||
|
||||
for (String message : statsMessages) {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase()));
|
||||
}
|
||||
|
||||
private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) {
|
||||
if (!skill.isChildSkill()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName + " " + LocaleLoader.getString("Skills.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child", skillValue));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||
Set<PrimarySkill> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (PrimarySkill parent : parents) {
|
||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayOldSkillCommand(Player player, McMMOPlayer mcMMOPlayer, boolean isLucky, boolean hasEndurance, float skillValue) {
|
||||
//Send headers
|
||||
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
|
||||
|
||||
List<String> effectMessages = effectsDisplay();
|
||||
|
||||
if (!effectMessages.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
|
||||
|
||||
if (isLucky) {
|
||||
player.sendMessage(Motd.PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc", skillName)));
|
||||
}
|
||||
|
||||
for (String message : effectMessages) {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
getStatMessages(player, isLucky, hasEndurance, skillValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
@@ -141,10 +173,10 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return displayValues;
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(float skillValue, SecondaryAbility skillAbility, boolean isLucky) {
|
||||
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility);
|
||||
protected String[] calculateAbilityDisplayValues(float skillValue, SubSkill subSkill, boolean isLucky) {
|
||||
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(subSkill);
|
||||
|
||||
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(skillAbility) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
||||
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(subSkill) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
||||
}
|
||||
|
||||
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||
@@ -166,4 +198,6 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
protected abstract List<String> effectsDisplay();
|
||||
|
||||
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
|
||||
|
||||
protected abstract List<TextComponent> getTextComponents(Player player);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
|
||||
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||
|
||||
public SkillGuideCommand(SkillType skill) {
|
||||
public SkillGuideCommand(PrimarySkill skill) {
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
||||
guide = getGuide(skill);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
return allStrings;
|
||||
}
|
||||
|
||||
private ArrayList<String> getGuide(SkillType skill) {
|
||||
private ArrayList<String> getGuide(PrimarySkill skill) {
|
||||
ArrayList<String> guide = new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
||||
@@ -27,7 +29,7 @@ public class SmeltingCommand extends SkillCommand {
|
||||
private boolean canVanillaXPBoost;
|
||||
|
||||
public SmeltingCommand() {
|
||||
super(SkillType.SMELTING);
|
||||
super(PrimarySkill.SMELTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +41,7 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
// SECOND SMELT
|
||||
if (canSecondSmelt) {
|
||||
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SECOND_SMELT, isLucky);
|
||||
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SMELTING_SECOND_SMELT, isLucky);
|
||||
secondSmeltChance = secondSmeltStrings[0];
|
||||
secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||
}
|
||||
@@ -54,9 +56,9 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canFuelEfficiency = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY);
|
||||
canSecondSmelt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SECOND_SMELT);
|
||||
canFluxMine = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FLUX_MINING);
|
||||
canFuelEfficiency = Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_SECOND_SMELT);
|
||||
canFluxMine = Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_FLUX_MINING);
|
||||
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
||||
}
|
||||
|
||||
@@ -117,4 +119,13 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.swords.Swords;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -26,7 +28,7 @@ public class SwordsCommand extends SkillCommand {
|
||||
private boolean canBleed;
|
||||
|
||||
public SwordsCommand() {
|
||||
super(SkillType.SWORDS);
|
||||
super(PrimarySkill.SWORDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,18 +40,18 @@ public class SwordsCommand extends SkillCommand {
|
||||
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
|
||||
}
|
||||
|
||||
// BLEED
|
||||
// SWORDS_BLEED
|
||||
if (canBleed) {
|
||||
bleedLength = (skillValue >= AdvancedConfig.getInstance().getMaxBonusLevel(SecondaryAbility.BLEED)) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks;
|
||||
bleedLength = (skillValue >= AdvancedConfig.getInstance().getMaxBonusLevel(SubSkill.SWORDS_BLEED)) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks;
|
||||
|
||||
String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.BLEED, isLucky);
|
||||
String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SWORDS_BLEED, isLucky);
|
||||
bleedChance = bleedStrings[0];
|
||||
bleedChanceLucky = bleedStrings[1];
|
||||
}
|
||||
|
||||
// COUNTER
|
||||
// SWORDS_COUNTER_ATTACK
|
||||
if (canCounter) {
|
||||
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.COUNTER, isLucky);
|
||||
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SWORDS_COUNTER_ATTACK, isLucky);
|
||||
counterChance = counterStrings[0];
|
||||
counterChanceLucky = counterStrings[1];
|
||||
}
|
||||
@@ -57,8 +59,8 @@ public class SwordsCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBleed = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BLEED);
|
||||
canCounter = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.COUNTER);
|
||||
canBleed = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_BLEED);
|
||||
canCounter = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_COUNTER_ATTACK);
|
||||
canSerratedStrike = Permissions.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@@ -102,4 +104,13 @@ public class SwordsCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -29,13 +31,13 @@ public class TamingCommand extends SkillCommand {
|
||||
private boolean canHolyHound;
|
||||
|
||||
public TamingCommand() {
|
||||
super(SkillType.TAMING);
|
||||
super(PrimarySkill.TAMING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||
if (canGore) {
|
||||
String[] goreStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GORE, isLucky);
|
||||
String[] goreStrings = calculateAbilityDisplayValues(skillValue, SubSkill.TAMING_GORE, isLucky);
|
||||
goreChance = goreStrings[0];
|
||||
goreChanceLucky = goreStrings[1];
|
||||
}
|
||||
@@ -43,15 +45,15 @@ public class TamingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBeastLore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BEAST_LORE);
|
||||
canBeastLore = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_BEAST_LORE);
|
||||
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
||||
canEnvironmentallyAware = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ENVIROMENTALLY_AWARE);
|
||||
canFastFood = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FAST_FOOD);
|
||||
canGore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GORE);
|
||||
canSharpenedClaws = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHARPENED_CLAWS);
|
||||
canShockProof = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHOCK_PROOF);
|
||||
canThickFur = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.THICK_FUR);
|
||||
canHolyHound = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HOLY_HOUND);
|
||||
canEnvironmentallyAware = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
canFastFood = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_FAST_FOOD_SERVICE);
|
||||
canGore = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_GORE);
|
||||
canSharpenedClaws = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_SHARPENED_CLAWS);
|
||||
canShockProof = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_SHOCK_PROOF);
|
||||
canThickFur = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_THICK_FUR);
|
||||
canHolyHound = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_HOLY_HOUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,4 +170,13 @@ public class TamingCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.TAMING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -29,7 +31,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
private boolean canIronGrip;
|
||||
|
||||
public UnarmedCommand() {
|
||||
super(SkillType.UNARMED);
|
||||
super(PrimarySkill.UNARMED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,16 +43,16 @@ public class UnarmedCommand extends SkillCommand {
|
||||
berserkLengthEndurance = berserkStrings[1];
|
||||
}
|
||||
|
||||
// DISARM
|
||||
// UNARMED_DISARM
|
||||
if (canDisarm) {
|
||||
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DISARM, isLucky);
|
||||
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_DISARM, isLucky);
|
||||
disarmChance = disarmStrings[0];
|
||||
disarmChanceLucky = disarmStrings[1];
|
||||
}
|
||||
|
||||
// DEFLECT
|
||||
// UNARMED_ARROW_DEFLECT
|
||||
if (canDeflect) {
|
||||
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DEFLECT, isLucky);
|
||||
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_ARROW_DEFLECT, isLucky);
|
||||
deflectChance = deflectStrings[0];
|
||||
deflectChanceLucky = deflectStrings[1];
|
||||
}
|
||||
@@ -62,7 +64,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
|
||||
// IRON GRIP
|
||||
if (canIronGrip) {
|
||||
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.IRON_GRIP, isLucky);
|
||||
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_IRON_GRIP, isLucky);
|
||||
ironGripChance = ironGripStrings[0];
|
||||
ironGripChanceLucky = ironGripStrings[1];
|
||||
}
|
||||
@@ -71,10 +73,10 @@ public class UnarmedCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBerserk = Permissions.berserk(player);
|
||||
canIronArm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_ARM);
|
||||
canDeflect = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DEFLECT);
|
||||
canDisarm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DISARM);
|
||||
canIronGrip = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_GRIP);
|
||||
canIronArm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_ARM_STYLE);
|
||||
canDeflect = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_DISARM);
|
||||
canIronGrip = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_GRIP);
|
||||
// TODO: Apparently we forgot about block cracker?
|
||||
}
|
||||
|
||||
@@ -132,4 +134,13 @@ public class UnarmedCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.UNARMED);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.gmail.nossr50.commands.skills;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.SkillTextComponentFactory;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
@@ -20,9 +22,12 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
private boolean canTreeFell;
|
||||
private boolean canLeafBlow;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canSplinter;
|
||||
private boolean canBarkSurgeon;
|
||||
private boolean canNaturesBounty;
|
||||
|
||||
public WoodcuttingCommand() {
|
||||
super(SkillType.WOODCUTTING);
|
||||
super(PrimarySkill.WOODCUTTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,17 +41,29 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS, isLucky);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
if(AdvancedConfig.getInstance().isSubSkillClassic(SubSkill.WOODCUTTING_HARVEST_LUMBER))
|
||||
setDoubleDropClassicChanceStrings(skillValue, isLucky);
|
||||
else
|
||||
{
|
||||
//TODO: Set up datastrings for new harvest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDoubleDropClassicChanceStrings(float skillValue, boolean isLucky) {
|
||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkill.WOODCUTTING_HARVEST_LUMBER, isLucky);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreeFell = Permissions.treeFeller(player);
|
||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canLeafBlow = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.LEAF_BLOWER);
|
||||
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_HARVEST_LUMBER) && !skill.getDoubleDropsDisabled();
|
||||
canLeafBlow = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_LEAF_BLOWER);
|
||||
canSplinter = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_SPLINTER);
|
||||
canBarkSurgeon = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_BARK_SURGEON);
|
||||
canNaturesBounty = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_NATURES_BOUNTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +82,20 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.4"), LocaleLoader.getString("Woodcutting.Effect.5")));
|
||||
}
|
||||
|
||||
if (canSplinter) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.6"), LocaleLoader.getString("Woodcutting.Effect.7")));
|
||||
}
|
||||
|
||||
if(canBarkSurgeon) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.8"), LocaleLoader.getString("Woodcutting.Effect.9")));
|
||||
}
|
||||
|
||||
if(canNaturesBounty) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.10"), LocaleLoader.getString("Woodcutting.Effect.11")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@@ -93,4 +124,15 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.WOODCUTTING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
private static AdvancedConfig instance;
|
||||
@@ -35,6 +34,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
/*
|
||||
* In the future this method will check keys for all skills, but for now it only checks overhauled skills
|
||||
*/
|
||||
checkKeys(reason);
|
||||
|
||||
/* GENERAL */
|
||||
if (getAbilityLength() < 1) {
|
||||
reason.add("Skills.General.Ability.IncreaseLevel should be at least 1!");
|
||||
@@ -45,11 +49,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* ACROBATICS */
|
||||
if (getMaxChance(SecondaryAbility.DODGE) < 1) {
|
||||
if (getMaxChance(SubSkill.ACROBATICS_DODGE) < 1) {
|
||||
reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.DODGE) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.ACROBATICS_DODGE) < 1) {
|
||||
reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -57,11 +61,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.ROLL) < 1) {
|
||||
if (getMaxChance(SubSkill.ACROBATICS_ROLL) < 1) {
|
||||
reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.ROLL) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.ACROBATICS_ROLL) < 1) {
|
||||
reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -69,11 +73,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.GRACEFUL_ROLL) < 1) {
|
||||
if (getMaxChance(SubSkill.ACROBATICS_GRACEFUL_ROLL) < 1) {
|
||||
reason.add("Skills.Acrobatics.GracefulRoll.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.GRACEFUL_ROLL) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.ACROBATICS_GRACEFUL_ROLL) < 1) {
|
||||
reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -114,65 +118,55 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* ARCHERY */
|
||||
if (getSkillShotIncreaseLevel() < 1) {
|
||||
reason.add("Skills.Archery.SkillShot.IncreaseLevel should be at least 1!");
|
||||
|
||||
if (getSkillShotRankDamageMultiplier() <= 0) {
|
||||
reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!");
|
||||
}
|
||||
|
||||
if (getSkillShotIncreasePercentage() <= 0) {
|
||||
reason.add("Skills.Archery.SkillShot.IncreasePercentage should be greater than 0!");
|
||||
if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) {
|
||||
reason.add("Skills.Archery.Daze.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getSkillShotBonusMax() < 0) {
|
||||
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.DAZE) < 1) {
|
||||
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.DAZE) < 1) {
|
||||
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
|
||||
if (getMaxBonusLevel(SubSkill.ARCHERY_DAZE) < 1) {
|
||||
reason.add("Skills.Archery.Daze.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getDazeBonusDamage() < 0) {
|
||||
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
||||
reason.add("Skills.Archery.Daze.BonusDamage should be at least 0!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.RETRIEVE) < 1) {
|
||||
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
|
||||
if (getMaxChance(SubSkill.ARCHERY_ARROW_RETRIEVAL) < 1) {
|
||||
reason.add("Skills.Archery.Retrieve.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.RETRIEVE) < 1) {
|
||||
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
|
||||
if (getMaxBonusLevel(SubSkill.ARCHERY_ARROW_RETRIEVAL) < 1) {
|
||||
reason.add("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getForceMultiplier() < 0) {
|
||||
reason.add("Skills.Acrobatics.ForceMultiplier should be at least 0!");
|
||||
reason.add("Skills.Archery.ForceMultiplier should be at least 0!");
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
if (getAxeMasteryBonusMax() < 1) {
|
||||
reason.add("Skills.Axes.AxeMastery.MaxBonus should be at least 1!");
|
||||
if(getAxeMasteryRankDamageMultiplier() < 0)
|
||||
{
|
||||
reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
|
||||
}
|
||||
|
||||
if (getAxeMasteryMaxBonusLevel() < 1) {
|
||||
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.CRITICAL_HIT) < 1) {
|
||||
if (getMaxChance(SubSkill.AXES_CRITICAL_STRIKES) < 1) {
|
||||
reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.CRITICAL_HIT) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.AXES_CRITICAL_STRIKES) < 1) {
|
||||
reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getCriticalHitPVPModifier() < 1) {
|
||||
reason.add("Skills.Axes.CriticalHit.PVP_Modifier should be at least 1!");
|
||||
if (getCriticalStrikesPVPModifier() < 1) {
|
||||
reason.add("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!");
|
||||
}
|
||||
|
||||
if (getCriticalHitPVEModifier() < 1) {
|
||||
reason.add("Skills.Axes.CriticalHit.PVE_Modifier should be at least 1!");
|
||||
if (getCriticalStrikesPVPModifier() < 1) {
|
||||
reason.add("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!");
|
||||
}
|
||||
|
||||
if (getGreaterImpactChance() < 1) {
|
||||
@@ -265,44 +259,44 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
|
||||
if (getMaxChance(SubSkill.HERBALISM_GREEN_THUMB) < 1) {
|
||||
reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.HERBALISM_GREEN_THUMB) < 1) {
|
||||
reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
|
||||
if (getMaxChance(SubSkill.HERBALISM_DOUBLE_DROPS) < 1) {
|
||||
reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.HERBALISM_DOUBLE_DROPS) < 1) {
|
||||
reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.HYLIAN_LUCK) < 1) {
|
||||
if (getMaxChance(SubSkill.HERBALISM_HYLIAN_LUCK) < 1) {
|
||||
reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.HYLIAN_LUCK) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.HERBALISM_HYLIAN_LUCK) < 1) {
|
||||
reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.SHROOM_THUMB) < 1) {
|
||||
if (getMaxChance(SubSkill.HERBALISM_SHROOM_THUMB) < 1) {
|
||||
reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.SHROOM_THUMB) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.HERBALISM_SHROOM_THUMB) < 1) {
|
||||
reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
if (getMaxChance(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
|
||||
if (getMaxChance(SubSkill.MINING_DOUBLE_DROPS) < 1) {
|
||||
reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.MINING_DOUBLE_DROPS) < 1) {
|
||||
reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -371,11 +365,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.SUPER_REPAIR) < 1) {
|
||||
if (getMaxChance(SubSkill.REPAIR_SUPER_REPAIR) < 1) {
|
||||
reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.SUPER_REPAIR) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.REPAIR_SUPER_REPAIR) < 1) {
|
||||
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -465,11 +459,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.SECOND_SMELT) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.SMELTING_SECOND_SMELT) < 1) {
|
||||
reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.SECOND_SMELT) < 1) {
|
||||
if (getMaxChance(SubSkill.SMELTING_SECOND_SMELT) < 1) {
|
||||
reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -506,11 +500,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* SWORDS */
|
||||
if (getMaxChance(SecondaryAbility.BLEED) < 1) {
|
||||
if (getMaxChance(SubSkill.SWORDS_BLEED) < 1) {
|
||||
reason.add("Skills.Swords.Bleed.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.BLEED) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.SWORDS_BLEED) < 1) {
|
||||
reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -526,16 +520,16 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.COUNTER) < 1) {
|
||||
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
|
||||
if (getMaxChance(SubSkill.SWORDS_COUNTER_ATTACK) < 1) {
|
||||
reason.add("Skills.Swords.CounterAttack.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.COUNTER) < 1) {
|
||||
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
|
||||
if (getMaxBonusLevel(SubSkill.SWORDS_COUNTER_ATTACK) < 1) {
|
||||
reason.add("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getCounterModifier() < 1) {
|
||||
reason.add("Skills.Swords.Counter.DamageModifier should be at least 1!");
|
||||
reason.add("Skills.Swords.CounterAttack.DamageModifier should be at least 1!");
|
||||
}
|
||||
|
||||
if (getSerratedStrikesModifier() < 1) {
|
||||
@@ -548,11 +542,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/* TAMING */
|
||||
|
||||
if (getMaxChance(SecondaryAbility.GORE) < 1) {
|
||||
if (getMaxChance(SubSkill.TAMING_GORE) < 1) {
|
||||
reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.GORE) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.TAMING_GORE) < 1) {
|
||||
reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
@@ -609,57 +603,58 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* UNARMED */
|
||||
if (getMaxChance(SecondaryAbility.DISARM) < 1) {
|
||||
if (getMaxChance(SubSkill.UNARMED_DISARM) < 1) {
|
||||
reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.DISARM) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.UNARMED_DISARM) < 1) {
|
||||
reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.DEFLECT) < 1) {
|
||||
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
|
||||
if (getMaxChance(SubSkill.UNARMED_ARROW_DEFLECT) < 1) {
|
||||
reason.add("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.DEFLECT) < 1) {
|
||||
reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!");
|
||||
if (getMaxBonusLevel(SubSkill.UNARMED_ARROW_DEFLECT) < 1) {
|
||||
reason.add("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.IRON_GRIP) < 1) {
|
||||
if (getMaxChance(SubSkill.UNARMED_IRON_GRIP) < 1) {
|
||||
reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.IRON_GRIP) < 1) {
|
||||
if (getMaxBonusLevel(SubSkill.UNARMED_IRON_GRIP) < 1) {
|
||||
reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getIronArmMinBonus() < 0) {
|
||||
reason.add("Skills.Unarmed.IronArm.BonusMin should be at least 0!");
|
||||
reason.add("Skills.Unarmed.IronArmStyle.BonusMin should be at least 0!");
|
||||
}
|
||||
|
||||
if (getIronArmMaxBonus() < 0) {
|
||||
reason.add("Skills.Unarmed.IronArm.BonusMax should be at least 0!");
|
||||
reason.add("Skills.Unarmed.IronArmStyle.BonusMax should be at least 0!");
|
||||
}
|
||||
|
||||
if (getIronArmMaxBonus() < getIronArmMinBonus()) {
|
||||
reason.add("Skills.Unarmed.IronArm.BonusMax should be greater than or equal to Skills.Unarmed.IronArm.BonusMin!");
|
||||
reason.add("Skills.Unarmed.IronArmStyle.BonusMax should be greater than or equal to Skills.Unarmed.IronArm.BonusMin!");
|
||||
}
|
||||
|
||||
if (getIronArmIncreaseLevel() < 1) {
|
||||
reason.add("Skills.Unarmed.IronArm.IncreaseLevel should be at least 1!");
|
||||
reason.add("Skills.Unarmed.IronArmStyle.IncreaseLevel should be at least 1!");
|
||||
}
|
||||
|
||||
/* WOODCUTTING */
|
||||
|
||||
if (getLeafBlowUnlockLevel() < 0) {
|
||||
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
|
||||
}
|
||||
|
||||
if (getMaxChance(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) < 1) {
|
||||
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
|
||||
if (getMaxChance(SubSkill.WOODCUTTING_HARVEST_LUMBER) < 1) {
|
||||
reason.add("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) < 1) {
|
||||
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||
if (getMaxBonusLevel(SubSkill.WOODCUTTING_HARVEST_LUMBER) < 1) {
|
||||
reason.add("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
/* KRAKEN */
|
||||
@@ -689,8 +684,43 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
|
||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
||||
|
||||
public int getMaxBonusLevel(SecondaryAbility skillAbility) { return config.getInt("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".MaxBonusLevel"); }
|
||||
public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".ChanceMax", 100.0D); }
|
||||
public int getMaxBonusLevel(SubSkill subSkill) { return config.getInt(subSkill.getAdvConfigAddress() + ".MaxBonusLevel"); }
|
||||
public double getMaxChance(SubSkill subSkill) { return config.getDouble(subSkill.getAdvConfigAddress() + ".ChanceMax", 100.0D);}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the level required to unlock a subskill at a given rank
|
||||
* @param subSkill The subskill
|
||||
* @param rank The rank of the skill
|
||||
* @return The level required to use this rank of the subskill
|
||||
* @deprecated Right now mcMMO is an overhaul process, this will only work for skills I have overhauled. I will be removing the deprecated tag when that is true.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getSubSkillUnlockLevel(SubSkill subSkill, int rank)
|
||||
{
|
||||
/*
|
||||
* This is a bit messy but
|
||||
*
|
||||
* Some skills have per-rank settings as child nodes for Rank_x nodes
|
||||
* If they do, we have to grab the child node named LevelReq from Rank_x for that skill
|
||||
*
|
||||
* Other skills which do not have complex per-rank settings will instead find their Level Requirement returned at Rank_x
|
||||
*/
|
||||
if(config.get(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank+".LevelReq") != null)
|
||||
return config.getInt(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank+".LevelReq");
|
||||
else
|
||||
return config.getInt(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+rank);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some SubSkills have the ability to retain classic functionality
|
||||
* @param subSkill SubSkill with classic functionality
|
||||
* @return true if the subskill is in classic mode
|
||||
*/
|
||||
public boolean isSubSkillClassic(SubSkill subSkill)
|
||||
{
|
||||
return config.getBoolean(subSkill.getAdvConfigAddress()+".Classic");
|
||||
}
|
||||
|
||||
/* ACROBATICS */
|
||||
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
||||
@@ -710,8 +740,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/* ARCHERY */
|
||||
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot.IncreaseLevel", 50); }
|
||||
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot.IncreasePercentage", 0.1D); }
|
||||
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.MaxBonus", 2.0D); }
|
||||
public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
|
||||
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
||||
|
||||
public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
||||
@@ -719,11 +748,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
|
||||
|
||||
/* AXES */
|
||||
public double getAxeMasteryBonusMax() { return config.getDouble("Skills.Axes.AxeMastery.MaxBonus", 4.0D); }
|
||||
public int getAxeMasteryMaxBonusLevel() { return config.getInt("Skills.Axes.AxeMastery.MaxBonusLevel", 200); }
|
||||
public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
|
||||
|
||||
public double getCriticalHitPVPModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVP_Modifier", 1.5D); }
|
||||
public double getCriticalHitPVEModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVE_Modifier", 2.0D); }
|
||||
public double getCriticalStrikesPVPModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D); }
|
||||
public double getCriticalStrikesPVEModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D); }
|
||||
|
||||
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
|
||||
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
|
||||
@@ -808,8 +836,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed.MaxTicks", 3); }
|
||||
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed.BaseTicks", 2); }
|
||||
|
||||
public boolean getCounterRequiresBlock() { return config.getBoolean("Skills.Swords.Counter.RequiresBlock"); }
|
||||
public double getCounterModifier() { return config.getDouble("Skills.Swords.Counter.DamageModifier", 2.0D); }
|
||||
public boolean getCounterRequiresBlock() { return config.getBoolean("Skills.Swords.CounterAttack.RequiresBlock"); }
|
||||
public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); }
|
||||
|
||||
public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
|
||||
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.BleedTicks", 5); }
|
||||
@@ -838,9 +866,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
||||
|
||||
/* UNARMED */
|
||||
public double getIronArmMinBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMin", 3.0D); }
|
||||
public double getIronArmMaxBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMax", 8.0D); }
|
||||
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm.IncreaseLevel", 50); }
|
||||
public double getIronArmMinBonus() { return config.getDouble("Skills.Unarmed.IronArmStyle.BonusMin", 3.0D); }
|
||||
public double getIronArmMaxBonus() { return config.getDouble("Skills.Unarmed.IronArmStyle.BonusMax", 8.0D); }
|
||||
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArmStyle.IncreaseLevel", 50); }
|
||||
public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); }
|
||||
|
||||
/* WOODCUTTING */
|
||||
@@ -859,4 +887,39 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public String getPlayerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Player", ""); }
|
||||
public String getPlayerDefeatMessage() { return config.getString("Kraken.Defeated_Message.Killed", ""); }
|
||||
public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", ""); }
|
||||
|
||||
/**
|
||||
* Checks for valid keys in the advanced.yml file for subskill ranks
|
||||
*/
|
||||
private void checkKeys(List<String> reasons)
|
||||
{
|
||||
//For now we will only check ranks of stuff I've overhauled
|
||||
for(SubSkill subSkill : SubSkill.values())
|
||||
{
|
||||
if(subSkill.getParentSkill() == PrimarySkill.WOODCUTTING)
|
||||
{
|
||||
//Keeping track of the rank requirements and making sure there are no logical errors
|
||||
int curRank = 0;
|
||||
int prevRank = 0;
|
||||
|
||||
for(int x = 0; x < subSkill.getNumRanks(); x++)
|
||||
{
|
||||
if(curRank > 0)
|
||||
prevRank = curRank;
|
||||
|
||||
curRank = getSubSkillUnlockLevel(subSkill, x);
|
||||
|
||||
//Do we really care if its below 0? Probably not
|
||||
if(curRank < 0)
|
||||
reasons.add(subSkill.getAdvConfigAddress() + ".Rank_Levels.Rank_"+curRank+".LevelReq should be above or equal to 0!");
|
||||
|
||||
if(prevRank > curRank)
|
||||
{
|
||||
//We're going to allow this but we're going to warn them
|
||||
plugin.getLogger().info("You have the ranks for the subskill "+subSkill.toString()+" set up poorly, sequential ranks should have ascending requirements");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,13 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.metrics.MetricsManager;
|
||||
|
||||
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName) {
|
||||
super(relativePath, fileName);
|
||||
@@ -26,7 +25,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
@Override
|
||||
protected void loadFile() {
|
||||
super.loadFile();
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResource(fileName));
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResourceAsReader(fileName));
|
||||
|
||||
Set<String> configKeys = config.getKeys(true);
|
||||
Set<String> internalConfigKeys = internalConfig.getKeys(true);
|
||||
@@ -46,8 +45,8 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
}
|
||||
|
||||
for (String key : oldKeys) {
|
||||
plugin.debug("Removing unused key: " + key);
|
||||
config.set(key, null);
|
||||
plugin.debug("Detected potentially unused key: " + key);
|
||||
//config.set(key, null);
|
||||
}
|
||||
|
||||
for (String key : newKeys) {
|
||||
@@ -71,7 +70,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
try {
|
||||
// Read internal
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource(fileName)));
|
||||
HashMap<String, String> comments = new HashMap<String, String>();
|
||||
LinkedHashMap<String, String> comments = new LinkedHashMap<String, String>();
|
||||
String temp = "";
|
||||
|
||||
String line;
|
||||
@@ -82,6 +81,15 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if (!temp.isEmpty()) {
|
||||
if(comments.containsKey(line)) {
|
||||
int index = 0;
|
||||
while(comments.containsKey(line + index)) {
|
||||
index++;
|
||||
}
|
||||
|
||||
line = line + index;
|
||||
}
|
||||
|
||||
comments.put(line, temp);
|
||||
temp = "";
|
||||
}
|
||||
@@ -89,9 +97,20 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
}
|
||||
|
||||
// Dump to the new one
|
||||
HashMap<String, Integer> indexed = new HashMap<String, Integer>();
|
||||
for (String key : comments.keySet()) {
|
||||
if (output.contains(key)) {
|
||||
output = output.substring(0, output.indexOf(key)) + comments.get(key) + output.substring(output.indexOf(key));
|
||||
String actualkey = key.substring(0, key.indexOf(":") + 1);
|
||||
|
||||
int index = 0;
|
||||
if(indexed.containsKey(actualkey)) {
|
||||
index = indexed.get(actualkey);
|
||||
}
|
||||
boolean isAtTop = !output.contains("\n" + actualkey);
|
||||
index = output.indexOf((isAtTop ? "" : "\n") + actualkey, index);
|
||||
|
||||
if (index >= 0) {
|
||||
output = output.substring(0, index) + "\n" + comments.get(key) + output.substring(isAtTop ? index : index + 1);
|
||||
indexed.put(actualkey, index + comments.get(key).length() + actualkey.length() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,13 +135,5 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (String key : configKeys) {
|
||||
if (!config.isConfigurationSection(key) && !config.get(key).equals(internalConfig.get(key))) {
|
||||
MetricsManager.customConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier;
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Config extends AutoUpdateConfigLoader {
|
||||
private static Config instance;
|
||||
@@ -178,6 +177,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
|
||||
}
|
||||
|
||||
if (getFishingLureModifier() < 0) {
|
||||
reason.add("Abilities.Fishing.Lure_Modifier should be at least 0!");
|
||||
}
|
||||
|
||||
if (getDetonatorItem() == null) {
|
||||
reason.add("Skills.Mining.Detonator_Item is invalid!");
|
||||
}
|
||||
@@ -241,6 +244,16 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
|
||||
//Classic mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install)
|
||||
public boolean getClassicMode() { return config.getBoolean("General.Classic_Mode", true); }
|
||||
|
||||
//XP needed to level is multiplied by this when using classic mode
|
||||
public int getClassicModeXPFormulaFactor() { return config.getInt("General.Skill_Scaling.Classic_XP_Formula_Factor", 1); }
|
||||
|
||||
//Level requirements for subskills is multiplied by this when using classic mode
|
||||
public int getClassicModeLevelReqFactor() { return config.getInt("General.Skill_Scaling.Classic_LevelReq_Factor", 10); }
|
||||
|
||||
public String getLocale() { return config.getString("General.Locale", "en_us"); }
|
||||
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
|
||||
public boolean getShowProfileLoadedMessage() { return config.getBoolean("General.Show_Profile_Loaded", true); }
|
||||
@@ -265,6 +278,8 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
|
||||
public boolean getRefreshChunksEnabled() { return config.getBoolean("General.Refresh_Chunks", false); }
|
||||
|
||||
public boolean getMobHealthbarEnabled() { return config.getBoolean("Mob_Healthbar.Enabled", true); }
|
||||
|
||||
/* Mob Healthbar */
|
||||
public MobHealthbarType getMobHealthbarDefault() {
|
||||
try {
|
||||
@@ -345,16 +360,16 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Hardcore Mode */
|
||||
public boolean getHardcoreStatLossEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
||||
public void setHardcoreStatLossEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
||||
public boolean getHardcoreStatLossEnabled(PrimarySkill primarySkill) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), false); }
|
||||
public void setHardcoreStatLossEnabled(PrimarySkill primarySkill, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), enabled); }
|
||||
|
||||
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); }
|
||||
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); }
|
||||
|
||||
public int getHardcoreDeathStatPenaltyLevelThreshold() { return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0); }
|
||||
|
||||
public boolean getHardcoreVampirismEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
||||
public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
||||
public boolean getHardcoreVampirismEnabled(PrimarySkill primarySkill) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), false); }
|
||||
public void setHardcoreVampirismEnabled(PrimarySkill primarySkill, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), enabled); }
|
||||
|
||||
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); }
|
||||
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
|
||||
@@ -433,9 +448,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); }
|
||||
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
||||
public boolean getAbilitiesGateEnabled() { return config.getBoolean("Abilities.Activation.Level_Gate_Abilities"); }
|
||||
|
||||
public int getCooldown(AbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||
public int getMaxLength(AbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||
public int getCooldown(SuperAbility ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||
public int getMaxLength(SuperAbility ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||
|
||||
/* Durability Settings */
|
||||
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 1); }
|
||||
@@ -446,11 +462,13 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
/*
|
||||
* SKILL SETTINGS
|
||||
*/
|
||||
public boolean getDoubleDropsEnabled(SkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
public boolean getDoubleDropsEnabled(PrimarySkill skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
|
||||
public boolean getDoubleDropsDisabled(SkillType skill) {
|
||||
public boolean getDoubleDropsDisabled(PrimarySkill skill) {
|
||||
String skillName = StringUtils.getCapitalized(skill.toString());
|
||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
|
||||
if (section == null)
|
||||
return false;
|
||||
Set<String> keys = section.getKeys(false);
|
||||
boolean disabled = true;
|
||||
|
||||
@@ -464,6 +482,9 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
/* Axes */
|
||||
public int getAxesGate() { return config.getInt("Skills.Axes.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Acrobatics */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
public int getXPAfterTeleportCooldown() { return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5); }
|
||||
@@ -477,9 +498,14 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
public boolean getFishingOverrideTreasures() { return config.getBoolean("Skills.Fishing.Override_Vanilla_Treasures", true); }
|
||||
public boolean getFishingExtraFish() { return config.getBoolean("Skills.Fishing.Extra_Fish", true); }
|
||||
public double getFishingLureModifier() { return config.getDouble("Skills.Fishing.Lure_Modifier", 4.0D); }
|
||||
|
||||
/* Mining */
|
||||
public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
|
||||
public int getMiningGate() { return config.getInt("Skills.Mining.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Excavation */
|
||||
public int getExcavationGate() { return config.getInt("Skills.Excavation.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Repair */
|
||||
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
||||
@@ -499,6 +525,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
public boolean getUnarmedItemPickupDisabled() { return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true); }
|
||||
public boolean getUnarmedItemsAsUnarmed() { return config.getBoolean("Skills.Unarmed.Items_As_Unarmed", false); }
|
||||
public int getUnarmedGate() { return config.getInt("Skills.Unarmed.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Swords */
|
||||
public int getSwordsGate() { return config.getInt("Skills.Swords.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Taming */
|
||||
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
||||
@@ -509,8 +539,9 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
|
||||
|
||||
/* Woodcutting */
|
||||
public boolean getWoodcuttingDoubleDropsEnabled(TreeSpecies species) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
|
||||
public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material)); }
|
||||
public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
|
||||
public int getWoodcuttingGate() { return config.getInt("Skills.Woodcutting.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* AFK Leveling */
|
||||
public boolean getAcrobaticsPreventAFK() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
|
||||
@@ -523,14 +554,20 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
public int getLevelCap(SkillType skill) {
|
||||
public int getLevelCap(PrimarySkill skill) {
|
||||
int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
public int getSkillAbilityGate(PrimarySkill skill) {
|
||||
return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
|
||||
}
|
||||
|
||||
public boolean getTruncateSkills() { return config.getBoolean("General.TruncateSkills", false); }
|
||||
|
||||
/* PVP & PVE Settings */
|
||||
public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
|
||||
public boolean getPVEEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
|
||||
public boolean getPVPEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
|
||||
public boolean getPVEEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
|
||||
|
||||
public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -29,8 +31,9 @@ public class HiddenConfig {
|
||||
}
|
||||
|
||||
public void load() {
|
||||
if (mcMMO.p.getResource(fileName) != null) {
|
||||
config = YamlConfiguration.loadConfiguration(mcMMO.p.getResource(fileName));
|
||||
InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName);
|
||||
if (reader != null) {
|
||||
config = YamlConfiguration.loadConfiguration(reader);
|
||||
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
||||
conversionRate = config.getInt("Options.ConversionRate", 1);
|
||||
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
package com.gmail.nossr50.config.experience;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.GrassSpecies;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.material.LongGrass;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
private static ExperienceConfig instance;
|
||||
@@ -103,10 +99,6 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Experience.Combat.Multiplier.Animals should be at least 0!");
|
||||
}
|
||||
|
||||
if (getWitherSkeletonXP() < 0) {
|
||||
reason.add("Experience.Combat.Multiplier.Wither_Skeleton should be at least 0!");
|
||||
}
|
||||
|
||||
if (getDodgeXPModifier() < 0) {
|
||||
reason.add("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!");
|
||||
}
|
||||
@@ -132,31 +124,14 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Taming */
|
||||
if (getTamingXPWolf() <= 0) {
|
||||
if (getTamingXP(EntityType.WOLF) <= 0) {
|
||||
reason.add("Experience.Taming.Animal_Taming.Wolf should be greater than 0!");
|
||||
}
|
||||
|
||||
if (getTamingXPOcelot() <= 0) {
|
||||
if (getTamingXP(EntityType.OCELOT) <= 0) {
|
||||
reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
||||
}
|
||||
|
||||
/* Woodcutting */
|
||||
for (TreeSpecies species : TreeSpecies.values()) {
|
||||
String key = "Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_");
|
||||
|
||||
if (config.getInt(key) <= 0) {
|
||||
reason.add(key + " should be greater than 0!");
|
||||
}
|
||||
}
|
||||
|
||||
if (getWoodcuttingXPHugeBrownMushroom() <= 0) {
|
||||
reason.add("Experience.Woodcutting.Huge_Mushroom_Brown should be greater than 0!");
|
||||
}
|
||||
|
||||
if (getWoodcuttingXPHugeRedMushroom() <= 0) {
|
||||
reason.add("Experience.Woodcutting.Huge_Mushroom_Red should be greater than 0!");
|
||||
}
|
||||
|
||||
return noErrorsInConfig(reason);
|
||||
}
|
||||
|
||||
@@ -185,14 +160,14 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
||||
|
||||
/* Skill modifiers */
|
||||
public double getFormulaSkillModifier(SkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
public double getFormulaSkillModifier(PrimarySkill skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
|
||||
/* Custom XP perk */
|
||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||
|
||||
/* Diminished Returns */
|
||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||
public int getDiminishedReturnsThreshold(SkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsThreshold(PrimarySkill skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||
|
||||
/* Conversion */
|
||||
@@ -207,12 +182,67 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
|
||||
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
|
||||
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
|
||||
public double getElderGuardianXP() { return config.getDouble("Experience.Combat.Multiplier.Elder_Guardian", 4.0); }
|
||||
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
|
||||
/* Materials */
|
||||
public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
public int getXp(PrimarySkill skill, Material data)
|
||||
{
|
||||
String baseString = "Experience." + 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(PrimarySkill skill, BlockData data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
return config.getInt(explicitString);
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return config.getInt(friendlyString);
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||
if (config.contains(wildcardString))
|
||||
return config.getInt(wildcardString);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isSkillBlock(PrimarySkill skill, Material data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
return true;
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return true;
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
public boolean isSkillBlock(PrimarySkill skill, BlockData data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
return true;
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return true;
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public int getDodgeXPModifier() { return config.getInt("Experience.Acrobatics.Dodge", 120); }
|
||||
@@ -227,161 +257,15 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
/* Archery */
|
||||
public double getArcheryDistanceMultiplier() { return config.getDouble("Experience.Archery.Distance_Multiplier", 0.025); }
|
||||
|
||||
/* Excavation */
|
||||
public int getDirtAndSandXp(MaterialData data) {
|
||||
Material type = data.getItemType();
|
||||
|
||||
if (type == Material.DIRT) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Excavation.Dirt", 40);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Excavation.Coarse_Dirt", 40);
|
||||
|
||||
case 0x2:
|
||||
return config.getInt("Experience.Excavation.Podzol", 40);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (type == Material.SAND) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Excavation.Sand", 40);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Excavation.Red_Sand", 40);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Fishing */
|
||||
public int getFishXp(MaterialData data) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Fishing.Raw_Fish", 800);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Fishing.Raw_Salmon", 800);
|
||||
|
||||
case 0x2:
|
||||
return config.getInt("Experience.Fishing.Clownfish", 800);
|
||||
|
||||
case 0x3:
|
||||
return config.getInt("Experience.Fishing.Pufferfish", 800);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); }
|
||||
|
||||
/* Herbalism */
|
||||
public int getFlowerAndGrassXp(MaterialData data) {
|
||||
Material type = data.getItemType();
|
||||
|
||||
if (type == Material.RED_ROSE) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Herbalism.Poppy", 100);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Herbalism.Blue_Orchid", 150);
|
||||
|
||||
case 0x2:
|
||||
return config.getInt("Experience.Herbalism.Allium", 300);
|
||||
|
||||
case 0x3:
|
||||
return config.getInt("Experience.Herbalism.Azure_Bluet", 150);
|
||||
|
||||
case 0x4:
|
||||
return config.getInt("Experience.Herbalism.Red_Tulip", 150);
|
||||
|
||||
case 0x5:
|
||||
return config.getInt("Experience.Herbalism.Orange_Tulip", 150);
|
||||
|
||||
case 0x6:
|
||||
return config.getInt("Experience.Herbalism.White_Tulip", 150);
|
||||
|
||||
case 0x7:
|
||||
return config.getInt("Experience.Herbalism.Pink_Tulip", 150);
|
||||
|
||||
case 0x8:
|
||||
return config.getInt("Experience.Herbalism.Oxeye_Daisy", 150);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
else if (type == Material.LONG_GRASS) {
|
||||
GrassSpecies species = ((LongGrass) data).getSpecies();
|
||||
if (species == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (species) {
|
||||
case DEAD:
|
||||
return config.getInt("Experience.Herbalism.Dead_Bush", 30);
|
||||
|
||||
case FERN_LIKE:
|
||||
return config.getInt("Experience.Herbalism.Small_Fern", 10);
|
||||
|
||||
case NORMAL:
|
||||
return config.getInt("Experience.Herbalism.Small_Grass", 10);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (type == Material.DOUBLE_PLANT) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Herbalism.Sunflower", 50);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Herbalism.Lilac", 50);
|
||||
|
||||
case 0x2:
|
||||
return config.getInt("Experience.Herbalism.Tall_Grass", 50);
|
||||
|
||||
case 0x3:
|
||||
return config.getInt("Experience.Herbalism.Tall_Fern", 50);
|
||||
|
||||
case 0x4:
|
||||
return config.getInt("Experience.Herbalism.Rose_Bush", 50);
|
||||
|
||||
case 0x5:
|
||||
return config.getInt("Experience.Herbalism.Peony", 50);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Repair */
|
||||
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
|
||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXPHorse() { return config.getInt("Experience.Taming.Animal_Taming.Horse", 1000); }
|
||||
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
|
||||
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
|
||||
|
||||
/* Woodcutting */
|
||||
public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
|
||||
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
|
||||
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
|
||||
|
||||
public int getTamingXP(EntityType type)
|
||||
{
|
||||
return config.getInt("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customOres = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customLogs = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customLeaves = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
|
||||
public HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@@ -44,7 +42,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBlocks(String skillType, List<MaterialData> blockList) {
|
||||
private void loadBlocks(String skillType, List<Material> blockList) {
|
||||
if (needsUpdate) {
|
||||
return;
|
||||
}
|
||||
@@ -58,7 +56,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
Set<String> skillConfigSet = skillSection.getKeys(false);
|
||||
|
||||
for (String blockName : skillConfigSet) {
|
||||
if (config.contains(skillType + "." + blockName + "." + ".Drop_Item")) {
|
||||
if (config.contains(skillType + "." + blockName + ".Drop_Item")) {
|
||||
needsUpdate = true;
|
||||
return;
|
||||
}
|
||||
@@ -72,11 +70,8 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
continue;
|
||||
}
|
||||
|
||||
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
|
||||
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
||||
|
||||
if (blockList != null) {
|
||||
blockList.add(blockMaterialData);
|
||||
blockList.add(blockMaterial);
|
||||
}
|
||||
|
||||
if (skillType.equals("Ability_Blocks")) {
|
||||
@@ -87,20 +82,20 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
int smeltingXp = 0;
|
||||
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockMaterialData);
|
||||
customOres.add(blockMaterial);
|
||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockMaterialData);
|
||||
customLogs.add(blockMaterial);
|
||||
}
|
||||
else {
|
||||
customLeaves.add(blockMaterialData);
|
||||
customLeaves.add(blockMaterial);
|
||||
xp = 0; // Leaves don't grant XP
|
||||
}
|
||||
}
|
||||
|
||||
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||
customBlockMap.put(blockMaterial, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gmail.nossr50.config.mods;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
@@ -54,7 +54,7 @@ public class CustomEntityConfig extends ConfigLoader {
|
||||
canBeSummoned = false;
|
||||
}
|
||||
|
||||
CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new MaterialData(callOfTheWildMaterial, callOfTheWildData).toItemStack(1) : null), callOfTheWildAmount);
|
||||
CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new ItemStack(callOfTheWildMaterial) : null), callOfTheWildAmount);
|
||||
|
||||
customEntityTypeMap.put(entityTypeName, entity);
|
||||
customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity);
|
||||
|
||||
@@ -6,11 +6,15 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
@@ -28,7 +32,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
private List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
|
||||
private List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<ItemStack>();
|
||||
|
||||
private Map<Short, AlchemyPotion> potionMap = new HashMap<Short, AlchemyPotion>();
|
||||
private Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
|
||||
|
||||
private PotionConfig() {
|
||||
super("potions.yml");
|
||||
@@ -90,11 +94,11 @@ public class PotionConfig extends ConfigLoader {
|
||||
int pass = 0;
|
||||
int fail = 0;
|
||||
|
||||
for (String dataValue : potionSection.getKeys(false)) {
|
||||
AlchemyPotion potion = loadPotion(potionSection.getConfigurationSection(dataValue));
|
||||
for (String potionName : potionSection.getKeys(false)) {
|
||||
AlchemyPotion potion = loadPotion(potionSection.getConfigurationSection(potionName));
|
||||
|
||||
if (potion != null) {
|
||||
potionMap.put(potion.getDataValue(), potion);
|
||||
potionMap.put(potionName, potion);
|
||||
pass++;
|
||||
}
|
||||
else {
|
||||
@@ -115,12 +119,28 @@ public class PotionConfig extends ConfigLoader {
|
||||
*/
|
||||
private AlchemyPotion loadPotion(ConfigurationSection potion_section) {
|
||||
try {
|
||||
short dataValue = Short.parseShort(potion_section.getName());
|
||||
|
||||
|
||||
String name = potion_section.getString("Name");
|
||||
if (name != null) {
|
||||
name = ChatColor.translateAlternateColorCodes('&', name);
|
||||
}
|
||||
|
||||
PotionData data;
|
||||
if (!potion_section.contains("PotionData")) { // Backwards config compatability
|
||||
short dataValue = Short.parseShort(potion_section.getName());
|
||||
Potion potion = Potion.fromDamage(dataValue);
|
||||
data = new PotionData(potion.getType(), potion.hasExtendedDuration(), potion.getLevel() == 2);
|
||||
} else {
|
||||
ConfigurationSection potionData = potion_section.getConfigurationSection("PotionData");
|
||||
data = new PotionData(PotionType.valueOf(potionData.getString("PotionType", "WATER")), potionData.getBoolean("Extended", false), potionData.getBoolean("Upgraded", false));
|
||||
}
|
||||
|
||||
Material material = Material.POTION;
|
||||
String mat = potion_section.getString("Material", null);
|
||||
if (mat != null) {
|
||||
material = Material.valueOf(mat);
|
||||
}
|
||||
|
||||
List<String> lore = new ArrayList<String>();
|
||||
if (potion_section.contains("Lore")) {
|
||||
@@ -146,13 +166,21 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Color color = null;
|
||||
if (potion_section.contains("Color")) {
|
||||
color = Color.fromRGB(potion_section.getInt("Color"));
|
||||
}
|
||||
else {
|
||||
color = this.generateColor(effects);
|
||||
}
|
||||
|
||||
Map<ItemStack, Short> children = new HashMap<ItemStack, Short>();
|
||||
Map<ItemStack, String> children = new HashMap<ItemStack, String>();
|
||||
if (potion_section.contains("Children")) {
|
||||
for (String child : potion_section.getConfigurationSection("Children").getKeys(false)) {
|
||||
ItemStack ingredient = loadIngredient(child);
|
||||
if (ingredient != null) {
|
||||
children.put(ingredient, Short.parseShort(potion_section.getConfigurationSection("Children").getString(child)));
|
||||
children.put(ingredient, potion_section.getConfigurationSection("Children").getString(child));
|
||||
}
|
||||
else {
|
||||
mcMMO.p.getLogger().warning("Failed to parse child for potion " + name + ": " + child);
|
||||
@@ -160,7 +188,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
return new AlchemyPotion(dataValue, name, lore, effects, children);
|
||||
return new AlchemyPotion(material, data, name, lore, effects, color, children);
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcMMO.p.getLogger().warning("Failed to load Alchemy potion: " + potion_section.getName());
|
||||
@@ -182,13 +210,10 @@ public class PotionConfig extends ConfigLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] parts = ingredient.split(":");
|
||||
|
||||
Material material = parts.length > 0 ? Material.getMaterial(parts[0]) : null;
|
||||
short data = parts.length > 1 ? Short.parseShort(parts[1]) : 0;
|
||||
Material material = Material.getMaterial(ingredient);
|
||||
|
||||
if (material != null) {
|
||||
return new ItemStack(material, 1, data);
|
||||
return new ItemStack(material, 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -217,10 +242,51 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
public boolean isValidPotion(ItemStack item) {
|
||||
return potionMap.containsKey(item.getDurability());
|
||||
return getPotion(item) != null;
|
||||
}
|
||||
|
||||
public AlchemyPotion getPotion(short durability) {
|
||||
return potionMap.get(durability);
|
||||
public AlchemyPotion getPotion(String name) {
|
||||
return potionMap.get(name);
|
||||
}
|
||||
|
||||
public AlchemyPotion getPotion(ItemStack item) {
|
||||
for (AlchemyPotion potion : potionMap.values()) {
|
||||
if (potion.isSimilar(item)) {
|
||||
return potion;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Color generateColor(List<PotionEffect> effects) {
|
||||
if (effects != null && !effects.isEmpty()) {
|
||||
List<Color> colors = new ArrayList<Color>();
|
||||
for (PotionEffect effect : effects) {
|
||||
if (effect.getType().getColor() != null) {
|
||||
colors.add(effect.getType().getColor());
|
||||
}
|
||||
}
|
||||
if (!colors.isEmpty()) {
|
||||
if (colors.size() > 1) {
|
||||
return calculateAverageColor(colors);
|
||||
}
|
||||
return colors.get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Color calculateAverageColor(List<Color> colors) {
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
int blue = 0;
|
||||
for (Color color : colors) {
|
||||
red += color.getRed();
|
||||
green += color.getGreen();
|
||||
blue += color.getBlue();
|
||||
}
|
||||
Color color = Color.fromRGB(red/colors.size(), green/colors.size(), blue/colors.size());
|
||||
return color;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
345
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java
Normal file → Executable file
345
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java
Normal file → Executable file
@@ -1,72 +1,36 @@
|
||||
package com.gmail.nossr50.config.treasure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.treasure.*;
|
||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.Dye;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
private static TreasureConfig instance;
|
||||
|
||||
public List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromSnow = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromRedSand = new ArrayList<ExcavationTreasure>();
|
||||
public List<ExcavationTreasure> excavationFromPodzol = new ArrayList<ExcavationTreasure>();
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
||||
|
||||
public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>();
|
||||
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
|
||||
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
|
||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||
|
||||
public List<ShakeTreasure> shakeFromBlaze = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromCaveSpider = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromSpider = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromChicken = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromCow = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromHorse = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromPig = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromPigZombie = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromPlayer = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromSheep = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromSkeleton = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromSlime = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromSnowman = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromSquid = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromWitch = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromZombie = new ArrayList<ShakeTreasure>();
|
||||
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
||||
|
||||
private TreasureConfig() {
|
||||
@@ -87,7 +51,6 @@ public class TreasureConfig extends ConfigLoader {
|
||||
protected boolean validateKeys() {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) {
|
||||
double totalEnchantDropRate = 0;
|
||||
double totalItemDropRate = 0;
|
||||
@@ -127,19 +90,19 @@ public class TreasureConfig extends ConfigLoader {
|
||||
return;
|
||||
}
|
||||
|
||||
loadTreaures("Fishing");
|
||||
loadTreaures("Excavation");
|
||||
loadTreaures("Hylian_Luck");
|
||||
loadTreasures("Fishing");
|
||||
loadTreasures("Excavation");
|
||||
loadTreasures("Hylian_Luck");
|
||||
loadEnchantments();
|
||||
|
||||
for (EntityType entity : EntityType.values()) {
|
||||
if (entity.isAlive()) {
|
||||
loadTreaures("Shake." + entity.toString());
|
||||
loadTreasures("Shake." + entity.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadTreaures(String type) {
|
||||
private void loadTreasures(String type) {
|
||||
boolean isFishing = type.equals("Fishing");
|
||||
boolean isShake = type.contains("Shake");
|
||||
boolean isExcavation = type.equals("Excavation");
|
||||
@@ -170,18 +133,13 @@ public class TreasureConfig extends ConfigLoader {
|
||||
*/
|
||||
Material material;
|
||||
|
||||
if (materialName.contains("POTION")) {
|
||||
material = Material.POTION;
|
||||
}
|
||||
else if (materialName.contains("INK_SACK")) {
|
||||
material = Material.INK_SACK;
|
||||
}
|
||||
else if (materialName.contains("INVENTORY")) {
|
||||
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||
shakeFromPlayer.add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
||||
if (materialName.contains("INVENTORY")) {
|
||||
// Use magic material BEDROCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||
if (!shakeMap.containsKey(EntityType.PLAYER))
|
||||
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
||||
shakeMap.get(EntityType.PLAYER).add(new ShakeTreasure(new ItemStack(Material.BEDROCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
material = Material.matchMaterial(materialName);
|
||||
}
|
||||
|
||||
@@ -239,61 +197,37 @@ public class TreasureConfig extends ConfigLoader {
|
||||
ItemStack item = null;
|
||||
|
||||
if (materialName.contains("POTION")) {
|
||||
String potionType = materialName.substring(7);
|
||||
Material mat = Material.matchMaterial(materialName);
|
||||
if (mat == null) {
|
||||
reason.add("Potion format for Treasures.yml has changed");
|
||||
} else {
|
||||
item = new ItemStack(mat, amount, data);
|
||||
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
||||
|
||||
try {
|
||||
item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
||||
PotionType potionType = null;
|
||||
try {
|
||||
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||
}
|
||||
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
||||
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<String>();
|
||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||
}
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add("Invalid Potion_Type: " + potionType);
|
||||
}
|
||||
}
|
||||
else if (materialName.contains("INK_SACK")) {
|
||||
String color = materialName.substring(9);
|
||||
|
||||
try {
|
||||
Dye dye = new Dye();
|
||||
dye.setColor(DyeColor.valueOf(color.toUpperCase().trim()));
|
||||
|
||||
item = dye.toItemStack(amount);
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<String>();
|
||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||
}
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add("Invalid Dye_Color: " + color);
|
||||
}
|
||||
}
|
||||
else if (material != null) {
|
||||
} else if (material != null) {
|
||||
item = new ItemStack(material, amount, data);
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||
@@ -316,141 +250,66 @@ public class TreasureConfig extends ConfigLoader {
|
||||
if (noErrorsInConfig(reason)) {
|
||||
if (isFishing) {
|
||||
fishingRewards.get(rarity).add(new FishingTreasure(item, xp));
|
||||
}
|
||||
else if (isShake) {
|
||||
} else if (isShake) {
|
||||
ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
|
||||
|
||||
if (type.equals("Shake.BLAZE")) {
|
||||
shakeFromBlaze.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.CAVE_SPIDER")) {
|
||||
shakeFromCaveSpider.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.CHICKEN")) {
|
||||
shakeFromChicken.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.COW")) {
|
||||
shakeFromCow.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.CREEPER")) {
|
||||
shakeFromCreeper.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.ENDERMAN")) {
|
||||
shakeFromEnderman.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.GHAST")) {
|
||||
shakeFromGhast.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.HORSE")) {
|
||||
shakeFromHorse.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.IRON_GOLEM")) {
|
||||
shakeFromIronGolem.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.MAGMA_CUBE")) {
|
||||
shakeFromMagmaCube.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.MUSHROOM_COW")) {
|
||||
shakeFromMushroomCow.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.PIG")) {
|
||||
shakeFromPig.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.PIG_ZOMBIE")) {
|
||||
shakeFromPigZombie.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.PLAYER")) {
|
||||
shakeFromPlayer.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SHEEP")) {
|
||||
shakeFromSheep.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SKELETON")) {
|
||||
shakeFromSkeleton.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SLIME")) {
|
||||
shakeFromSlime.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SPIDER")) {
|
||||
shakeFromSpider.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SNOWMAN")) {
|
||||
shakeFromSnowman.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SQUID")) {
|
||||
shakeFromSquid.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.WITCH")) {
|
||||
shakeFromWitch.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.ZOMBIE")) {
|
||||
shakeFromZombie.add(shakeTreasure);
|
||||
}
|
||||
}
|
||||
else if (isExcavation) {
|
||||
EntityType entityType = EntityType.valueOf(type.substring(6));
|
||||
if (!shakeMap.containsKey(entityType))
|
||||
shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
|
||||
shakeMap.get(entityType).add(shakeTreasure);
|
||||
} else if (isExcavation) {
|
||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||
|
||||
if (dropList.contains("Dirt")) {
|
||||
excavationFromDirt.add(excavationTreasure);
|
||||
for (String blockType : dropList) {
|
||||
if (!excavationMap.containsKey(blockType))
|
||||
excavationMap.put(blockType, new ArrayList<ExcavationTreasure>());
|
||||
excavationMap.get(blockType).add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Grass")) {
|
||||
excavationFromGrass.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Sand")) {
|
||||
excavationFromSand.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Gravel")) {
|
||||
excavationFromGravel.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Clay")) {
|
||||
excavationFromClay.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Mycelium")) {
|
||||
excavationFromMycel.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Soul_Sand")) {
|
||||
excavationFromSoulSand.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Snow")) {
|
||||
excavationFromSnow.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Red_Sand")) {
|
||||
excavationFromRedSand.add(excavationTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Podzol")) {
|
||||
excavationFromPodzol.add(excavationTreasure);
|
||||
}
|
||||
}
|
||||
else if (isHylian) {
|
||||
} else if (isHylian) {
|
||||
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||
|
||||
if (dropList.contains("Bushes")) {
|
||||
hylianFromBushes.add(hylianTreasure);
|
||||
}
|
||||
for (String dropper : dropList) {
|
||||
if (dropper.equals("Bushes")) {
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure);
|
||||
for (Material species : Tag.SAPLINGS.getValues())
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);
|
||||
|
||||
if (dropList.contains("Flowers")) {
|
||||
hylianFromFlowers.add(hylianTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Pots")) {
|
||||
hylianFromPots.add(hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DEAD_BUSH), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
if (dropper.equals("Flowers")) {
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.POPPY), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DANDELION), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.BLUE_ORCHID), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ALLIUM), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.AZURE_BLUET), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ORANGE_TULIP), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.PINK_TULIP), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.RED_TULIP), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.WHITE_TULIP), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
if (dropper.equals("Pots")) {
|
||||
for (Material species : Tag.FLOWER_POTS.getValues())
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
AddHylianTreasure(dropper, hylianTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||
if (!hylianMap.containsKey(dropper))
|
||||
hylianMap.put(dropper, new ArrayList<HylianTreasure>());
|
||||
hylianMap.get(dropper).add(treasure);
|
||||
}
|
||||
|
||||
private void loadEnchantments() {
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
if (rarity == Rarity.TRAP || rarity == Rarity.RECORD) {
|
||||
@@ -481,11 +340,27 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getInventoryStealEnabled() { return config.contains("Shake.PLAYER.INVENTORY"); }
|
||||
public boolean getInventoryStealStacks() { return config.getBoolean("Shake.PLAYER.INVENTORY.Whole_Stacks"); }
|
||||
public double getInventoryStealDropChance() { return config.getDouble("Shake.PLAYER.INVENTORY.Drop_Chance"); }
|
||||
public int getInventoryStealDropLevel() { return config.getInt("Shake.PLAYER.INVENTORY.Drop_Level"); }
|
||||
public boolean getInventoryStealEnabled() {
|
||||
return config.contains("Shake.PLAYER.INVENTORY");
|
||||
}
|
||||
|
||||
public double getItemDropRate(int tier, Rarity rarity) { return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString()); }
|
||||
public double getEnchantmentDropRate(int tier, Rarity rarity) { return config.getDouble("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity.toString()); }
|
||||
public boolean getInventoryStealStacks() {
|
||||
return config.getBoolean("Shake.PLAYER.INVENTORY.Whole_Stacks");
|
||||
}
|
||||
|
||||
public double getInventoryStealDropChance() {
|
||||
return config.getDouble("Shake.PLAYER.INVENTORY.Drop_Chance");
|
||||
}
|
||||
|
||||
public int getInventoryStealDropLevel() {
|
||||
return config.getInt("Shake.PLAYER.INVENTORY.Drop_Level");
|
||||
}
|
||||
|
||||
public double getItemDropRate(int tier, Rarity rarity) {
|
||||
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||
}
|
||||
|
||||
public double getEnchantmentDropRate(int tier, Rarity rarity) {
|
||||
return config.getDouble("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
public interface DatabaseManager {
|
||||
// One month in milliseconds
|
||||
@@ -50,10 +50,10 @@ public interface DatabaseManager {
|
||||
* @param statsPerPage The number of stats per page
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage);
|
||||
public List<PlayerStat> readLeaderboard(PrimarySkill skill, int pageNumber, int statsPerPage);
|
||||
|
||||
/**
|
||||
* Retrieve rank info into a HashMap from SkillType to the rank.
|
||||
* Retrieve rank info into a HashMap from PrimarySkill to the rank.
|
||||
* <p>
|
||||
* The special value <code>null</code> is used to represent the Power
|
||||
* Level rank (the combination of all skill levels).
|
||||
@@ -61,7 +61,7 @@ public interface DatabaseManager {
|
||||
* @param playerName The name of the user to retrieve the rankings for
|
||||
* @return the requested rank information
|
||||
*/
|
||||
public Map<SkillType, Integer> readRank(String playerName);
|
||||
public Map<PrimarySkill, Integer> readRank(String playerName);
|
||||
|
||||
/**
|
||||
* Add a new user to the database.
|
||||
|
||||
@@ -17,6 +17,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -26,16 +28,12 @@ import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||
private final HashMap<PrimarySkill, List<PlayerStat>> playerStatHash = new HashMap<PrimarySkill, List<PlayerStat>>();
|
||||
private final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
||||
private long lastUpdate = 0;
|
||||
|
||||
@@ -71,7 +69,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] character = line.split(":");
|
||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character);
|
||||
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character);
|
||||
|
||||
boolean powerless = true;
|
||||
for (int skill : skills.values()) {
|
||||
@@ -279,47 +277,47 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
else {
|
||||
// Otherwise write the new player information
|
||||
writer.append(playerName).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.MINING)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.MINING)).append(":");
|
||||
writer.append(":");
|
||||
writer.append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.MINING)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.WOODCUTTING)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.WOODCUTTING)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.REPAIR)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.UNARMED)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.HERBALISM)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.EXCAVATION)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.ARCHERY)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.SWORDS)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.AXES)).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.ACROBATICS)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.REPAIR)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.UNARMED)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.HERBALISM)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.EXCAVATION)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.ARCHERY)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.SWORDS)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.AXES)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.ACROBATICS)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.MINING)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.WOODCUTTING)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.WOODCUTTING)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.REPAIR)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.UNARMED)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.HERBALISM)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.EXCAVATION)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.ARCHERY)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.SWORDS)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.AXES)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.ACROBATICS)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.REPAIR)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.UNARMED)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.HERBALISM)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.EXCAVATION)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.ARCHERY)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.SWORDS)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.AXES)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.ACROBATICS)).append(":");
|
||||
writer.append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.TAMING)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.TAMING)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.BERSERK)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.GIGA_DRILL_BREAKER)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.TREE_FELLER)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.GREEN_TERRA)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.TAMING)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.TAMING)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.BERSERK)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.GIGA_DRILL_BREAKER)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.TREE_FELLER)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.GREEN_TERRA)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.SERRATED_STRIKES)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.SKULL_SPLITTER)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.SUPER_BREAKER)).append(":");
|
||||
writer.append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.FISHING)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.FISHING)).append(":");
|
||||
writer.append((int) profile.getAbilityDATS(SuperAbility.BLAST_MINING)).append(":");
|
||||
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
||||
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
|
||||
writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":");
|
||||
writer.append(profile.getSkillLevel(SkillType.ALCHEMY)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(SkillType.ALCHEMY)).append(":");
|
||||
writer.append(profile.getSkillLevel(PrimarySkill.ALCHEMY)).append(":");
|
||||
writer.append(profile.getSkillXpLevel(PrimarySkill.ALCHEMY)).append(":");
|
||||
writer.append(uuid != null ? uuid.toString() : "NULL").append(":");
|
||||
writer.append(profile.getScoreboardTipsShown()).append(":");
|
||||
writer.append("\r\n");
|
||||
@@ -356,7 +354,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage) {
|
||||
public List<PlayerStat> readLeaderboard(PrimarySkill skill, int pageNumber, int statsPerPage) {
|
||||
updateLeaderboards();
|
||||
List<PlayerStat> statsList = skill == null ? powerLevels : playerStatHash.get(skill);
|
||||
int fromIndex = (Math.max(pageNumber, 1) - 1) * statsPerPage;
|
||||
@@ -364,12 +362,12 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return statsList.subList(Math.min(fromIndex, statsList.size()), Math.min(fromIndex + statsPerPage, statsList.size()));
|
||||
}
|
||||
|
||||
public Map<SkillType, Integer> readRank(String playerName) {
|
||||
public Map<PrimarySkill, Integer> readRank(String playerName) {
|
||||
updateLeaderboards();
|
||||
|
||||
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
||||
Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>();
|
||||
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
||||
}
|
||||
|
||||
@@ -764,21 +762,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
playerName = data[USERNAME];
|
||||
int powerLevel = 0;
|
||||
|
||||
Map<SkillType, Integer> skills = getSkillMapFromLine(data);
|
||||
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(data);
|
||||
|
||||
powerLevel += putStat(acrobatics, playerName, skills.get(SkillType.ACROBATICS));
|
||||
powerLevel += putStat(alchemy, playerName, skills.get(SkillType.ALCHEMY));
|
||||
powerLevel += putStat(archery, playerName, skills.get(SkillType.ARCHERY));
|
||||
powerLevel += putStat(axes, playerName, skills.get(SkillType.AXES));
|
||||
powerLevel += putStat(excavation, playerName, skills.get(SkillType.EXCAVATION));
|
||||
powerLevel += putStat(fishing, playerName, skills.get(SkillType.FISHING));
|
||||
powerLevel += putStat(herbalism, playerName, skills.get(SkillType.HERBALISM));
|
||||
powerLevel += putStat(mining, playerName, skills.get(SkillType.MINING));
|
||||
powerLevel += putStat(repair, playerName, skills.get(SkillType.REPAIR));
|
||||
powerLevel += putStat(swords, playerName, skills.get(SkillType.SWORDS));
|
||||
powerLevel += putStat(taming, playerName, skills.get(SkillType.TAMING));
|
||||
powerLevel += putStat(unarmed, playerName, skills.get(SkillType.UNARMED));
|
||||
powerLevel += putStat(woodcutting, playerName, skills.get(SkillType.WOODCUTTING));
|
||||
powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkill.ACROBATICS));
|
||||
powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkill.ALCHEMY));
|
||||
powerLevel += putStat(archery, playerName, skills.get(PrimarySkill.ARCHERY));
|
||||
powerLevel += putStat(axes, playerName, skills.get(PrimarySkill.AXES));
|
||||
powerLevel += putStat(excavation, playerName, skills.get(PrimarySkill.EXCAVATION));
|
||||
powerLevel += putStat(fishing, playerName, skills.get(PrimarySkill.FISHING));
|
||||
powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkill.HERBALISM));
|
||||
powerLevel += putStat(mining, playerName, skills.get(PrimarySkill.MINING));
|
||||
powerLevel += putStat(repair, playerName, skills.get(PrimarySkill.REPAIR));
|
||||
powerLevel += putStat(swords, playerName, skills.get(PrimarySkill.SWORDS));
|
||||
powerLevel += putStat(taming, playerName, skills.get(PrimarySkill.TAMING));
|
||||
powerLevel += putStat(unarmed, playerName, skills.get(PrimarySkill.UNARMED));
|
||||
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkill.WOODCUTTING));
|
||||
|
||||
putStat(powerLevels, playerName, powerLevel);
|
||||
}
|
||||
@@ -815,19 +813,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
Collections.sort(alchemy, c);
|
||||
Collections.sort(powerLevels, c);
|
||||
|
||||
playerStatHash.put(SkillType.MINING, mining);
|
||||
playerStatHash.put(SkillType.WOODCUTTING, woodcutting);
|
||||
playerStatHash.put(SkillType.REPAIR, repair);
|
||||
playerStatHash.put(SkillType.UNARMED, unarmed);
|
||||
playerStatHash.put(SkillType.HERBALISM, herbalism);
|
||||
playerStatHash.put(SkillType.EXCAVATION, excavation);
|
||||
playerStatHash.put(SkillType.ARCHERY, archery);
|
||||
playerStatHash.put(SkillType.SWORDS, swords);
|
||||
playerStatHash.put(SkillType.AXES, axes);
|
||||
playerStatHash.put(SkillType.ACROBATICS, acrobatics);
|
||||
playerStatHash.put(SkillType.TAMING, taming);
|
||||
playerStatHash.put(SkillType.FISHING, fishing);
|
||||
playerStatHash.put(SkillType.ALCHEMY, alchemy);
|
||||
playerStatHash.put(PrimarySkill.MINING, mining);
|
||||
playerStatHash.put(PrimarySkill.WOODCUTTING, woodcutting);
|
||||
playerStatHash.put(PrimarySkill.REPAIR, repair);
|
||||
playerStatHash.put(PrimarySkill.UNARMED, unarmed);
|
||||
playerStatHash.put(PrimarySkill.HERBALISM, herbalism);
|
||||
playerStatHash.put(PrimarySkill.EXCAVATION, excavation);
|
||||
playerStatHash.put(PrimarySkill.ARCHERY, archery);
|
||||
playerStatHash.put(PrimarySkill.SWORDS, swords);
|
||||
playerStatHash.put(PrimarySkill.AXES, axes);
|
||||
playerStatHash.put(PrimarySkill.ACROBATICS, acrobatics);
|
||||
playerStatHash.put(PrimarySkill.TAMING, taming);
|
||||
playerStatHash.put(PrimarySkill.FISHING, fishing);
|
||||
playerStatHash.put(PrimarySkill.ALCHEMY, alchemy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -894,7 +892,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getTruncateSkills()) {
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
int index = getSkillIndex(skill);
|
||||
if (index >= character.length) {
|
||||
continue;
|
||||
@@ -1034,8 +1032,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
updated |= oldVersion != null;
|
||||
|
||||
if (Config.getInstance().getTruncateSkills()) {
|
||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character);
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character);
|
||||
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
int cap = Config.getInstance().getLevelCap(skill);
|
||||
if (skills.get(skill) > cap) {
|
||||
updated = true;
|
||||
@@ -1129,40 +1127,40 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
private PlayerProfile loadFromLine(String[] character) {
|
||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP
|
||||
Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
|
||||
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||
Map<PrimarySkill, Float> skillsXp = new EnumMap<PrimarySkill, Float>(PrimarySkill.class); // Skill & XP
|
||||
Map<SuperAbility, Integer> skillsDATS = new EnumMap<SuperAbility, Integer>(SuperAbility.class); // Ability & Cooldown
|
||||
MobHealthbarType mobHealthbarType;
|
||||
int scoreboardTipsShown;
|
||||
|
||||
// TODO on updates, put new values in a try{} ?
|
||||
|
||||
skillsXp.put(SkillType.TAMING, (float) Integer.valueOf(character[EXP_TAMING]));
|
||||
skillsXp.put(SkillType.MINING, (float) Integer.valueOf(character[EXP_MINING]));
|
||||
skillsXp.put(SkillType.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR]));
|
||||
skillsXp.put(SkillType.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING]));
|
||||
skillsXp.put(SkillType.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED]));
|
||||
skillsXp.put(SkillType.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM]));
|
||||
skillsXp.put(SkillType.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION]));
|
||||
skillsXp.put(SkillType.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY]));
|
||||
skillsXp.put(SkillType.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS]));
|
||||
skillsXp.put(SkillType.AXES, (float) Integer.valueOf(character[EXP_AXES]));
|
||||
skillsXp.put(SkillType.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS]));
|
||||
skillsXp.put(SkillType.FISHING, (float) Integer.valueOf(character[EXP_FISHING]));
|
||||
skillsXp.put(SkillType.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY]));
|
||||
skillsXp.put(PrimarySkill.TAMING, (float) Integer.valueOf(character[EXP_TAMING]));
|
||||
skillsXp.put(PrimarySkill.MINING, (float) Integer.valueOf(character[EXP_MINING]));
|
||||
skillsXp.put(PrimarySkill.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR]));
|
||||
skillsXp.put(PrimarySkill.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING]));
|
||||
skillsXp.put(PrimarySkill.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED]));
|
||||
skillsXp.put(PrimarySkill.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM]));
|
||||
skillsXp.put(PrimarySkill.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION]));
|
||||
skillsXp.put(PrimarySkill.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY]));
|
||||
skillsXp.put(PrimarySkill.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS]));
|
||||
skillsXp.put(PrimarySkill.AXES, (float) Integer.valueOf(character[EXP_AXES]));
|
||||
skillsXp.put(PrimarySkill.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS]));
|
||||
skillsXp.put(PrimarySkill.FISHING, (float) Integer.valueOf(character[EXP_FISHING]));
|
||||
skillsXp.put(PrimarySkill.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY]));
|
||||
|
||||
// Taming - Unused
|
||||
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER]));
|
||||
skillsDATS.put(SuperAbility.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER]));
|
||||
// Repair - Unused
|
||||
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(character[COOLDOWN_TREE_FELLER]));
|
||||
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(character[COOLDOWN_BERSERK]));
|
||||
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(character[COOLDOWN_GREEN_TERRA]));
|
||||
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(character[COOLDOWN_GIGA_DRILL_BREAKER]));
|
||||
skillsDATS.put(SuperAbility.TREE_FELLER, Integer.valueOf(character[COOLDOWN_TREE_FELLER]));
|
||||
skillsDATS.put(SuperAbility.BERSERK, Integer.valueOf(character[COOLDOWN_BERSERK]));
|
||||
skillsDATS.put(SuperAbility.GREEN_TERRA, Integer.valueOf(character[COOLDOWN_GREEN_TERRA]));
|
||||
skillsDATS.put(SuperAbility.GIGA_DRILL_BREAKER, Integer.valueOf(character[COOLDOWN_GIGA_DRILL_BREAKER]));
|
||||
// Archery - Unused
|
||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[COOLDOWN_SERRATED_STRIKES]));
|
||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(character[COOLDOWN_SKULL_SPLITTER]));
|
||||
skillsDATS.put(SuperAbility.SERRATED_STRIKES, Integer.valueOf(character[COOLDOWN_SERRATED_STRIKES]));
|
||||
skillsDATS.put(SuperAbility.SKULL_SPLITTER, Integer.valueOf(character[COOLDOWN_SKULL_SPLITTER]));
|
||||
// Acrobatics - Unused
|
||||
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(character[COOLDOWN_BLAST_MINING]));
|
||||
skillsDATS.put(SuperAbility.BLAST_MINING, Integer.valueOf(character[COOLDOWN_BLAST_MINING]));
|
||||
|
||||
try {
|
||||
mobHealthbarType = MobHealthbarType.valueOf(character[HEALTHBAR]);
|
||||
@@ -1189,22 +1187,22 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return new PlayerProfile(character[USERNAME], uuid, skills, skillsXp, skillsDATS, mobHealthbarType, scoreboardTipsShown);
|
||||
}
|
||||
|
||||
private Map<SkillType, Integer> getSkillMapFromLine(String[] character) {
|
||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level
|
||||
private Map<PrimarySkill, Integer> getSkillMapFromLine(String[] character) {
|
||||
Map<PrimarySkill, Integer> skills = new EnumMap<PrimarySkill, Integer>(PrimarySkill.class); // Skill & Level
|
||||
|
||||
skills.put(SkillType.TAMING, Integer.valueOf(character[SKILLS_TAMING]));
|
||||
skills.put(SkillType.MINING, Integer.valueOf(character[SKILLS_MINING]));
|
||||
skills.put(SkillType.REPAIR, Integer.valueOf(character[SKILLS_REPAIR]));
|
||||
skills.put(SkillType.WOODCUTTING, Integer.valueOf(character[SKILLS_WOODCUTTING]));
|
||||
skills.put(SkillType.UNARMED, Integer.valueOf(character[SKILLS_UNARMED]));
|
||||
skills.put(SkillType.HERBALISM, Integer.valueOf(character[SKILLS_HERBALISM]));
|
||||
skills.put(SkillType.EXCAVATION, Integer.valueOf(character[SKILLS_EXCAVATION]));
|
||||
skills.put(SkillType.ARCHERY, Integer.valueOf(character[SKILLS_ARCHERY]));
|
||||
skills.put(SkillType.SWORDS, Integer.valueOf(character[SKILLS_SWORDS]));
|
||||
skills.put(SkillType.AXES, Integer.valueOf(character[SKILLS_AXES]));
|
||||
skills.put(SkillType.ACROBATICS, Integer.valueOf(character[SKILLS_ACROBATICS]));
|
||||
skills.put(SkillType.FISHING, Integer.valueOf(character[SKILLS_FISHING]));
|
||||
skills.put(SkillType.ALCHEMY, Integer.valueOf(character[SKILLS_ALCHEMY]));
|
||||
skills.put(PrimarySkill.TAMING, Integer.valueOf(character[SKILLS_TAMING]));
|
||||
skills.put(PrimarySkill.MINING, Integer.valueOf(character[SKILLS_MINING]));
|
||||
skills.put(PrimarySkill.REPAIR, Integer.valueOf(character[SKILLS_REPAIR]));
|
||||
skills.put(PrimarySkill.WOODCUTTING, Integer.valueOf(character[SKILLS_WOODCUTTING]));
|
||||
skills.put(PrimarySkill.UNARMED, Integer.valueOf(character[SKILLS_UNARMED]));
|
||||
skills.put(PrimarySkill.HERBALISM, Integer.valueOf(character[SKILLS_HERBALISM]));
|
||||
skills.put(PrimarySkill.EXCAVATION, Integer.valueOf(character[SKILLS_EXCAVATION]));
|
||||
skills.put(PrimarySkill.ARCHERY, Integer.valueOf(character[SKILLS_ARCHERY]));
|
||||
skills.put(PrimarySkill.SWORDS, Integer.valueOf(character[SKILLS_SWORDS]));
|
||||
skills.put(PrimarySkill.AXES, Integer.valueOf(character[SKILLS_AXES]));
|
||||
skills.put(PrimarySkill.ACROBATICS, Integer.valueOf(character[SKILLS_ACROBATICS]));
|
||||
skills.put(PrimarySkill.FISHING, Integer.valueOf(character[SKILLS_FISHING]));
|
||||
skills.put(PrimarySkill.ALCHEMY, Integer.valueOf(character[SKILLS_ALCHEMY]));
|
||||
|
||||
return skills;
|
||||
}
|
||||
@@ -1216,7 +1214,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
@Override
|
||||
public void onDisable() { }
|
||||
|
||||
private int getSkillIndex(SkillType skill) {
|
||||
private int getSkillIndex(PrimarySkill skill) {
|
||||
switch (skill) {
|
||||
case ACROBATICS:
|
||||
return SKILLS_ACROBATICS;
|
||||
@@ -1289,4 +1287,57 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
public static int EXP_ALCHEMY = 40;
|
||||
public static int UUID_INDEX = 41;
|
||||
public static int SCOREBOARD_TIPS = 42;
|
||||
|
||||
public void resetMobHealthSettings() {
|
||||
BufferedReader in = null;
|
||||
FileWriter out = null;
|
||||
String usersFilePath = mcMMO.getUsersFilePath();
|
||||
|
||||
synchronized (fileWritingLock) {
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(usersFilePath));
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
// Remove empty lines from the file
|
||||
if (line.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String[] character = line.split(":");
|
||||
|
||||
character[HEALTHBAR] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||
|
||||
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
|
||||
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
|
||||
// Write the new file
|
||||
out = new FileWriter(usersFilePath);
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,26 @@
|
||||
package com.gmail.nossr50.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
import org.apache.tomcat.jdbc.pool.DataSource;
|
||||
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
|
||||
private static final String ALL_QUERY_VERSION = "total";
|
||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
|
||||
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
|
||||
@@ -237,21 +225,25 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
|
||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||
+ ", fishing = ?, alchemy = ? WHERE user_id = ?");
|
||||
statement.setInt(1, profile.getSkillLevel(SkillType.TAMING));
|
||||
statement.setInt(2, profile.getSkillLevel(SkillType.MINING));
|
||||
statement.setInt(3, profile.getSkillLevel(SkillType.REPAIR));
|
||||
statement.setInt(4, profile.getSkillLevel(SkillType.WOODCUTTING));
|
||||
statement.setInt(5, profile.getSkillLevel(SkillType.UNARMED));
|
||||
statement.setInt(6, profile.getSkillLevel(SkillType.HERBALISM));
|
||||
statement.setInt(7, profile.getSkillLevel(SkillType.EXCAVATION));
|
||||
statement.setInt(8, profile.getSkillLevel(SkillType.ARCHERY));
|
||||
statement.setInt(9, profile.getSkillLevel(SkillType.SWORDS));
|
||||
statement.setInt(10, profile.getSkillLevel(SkillType.AXES));
|
||||
statement.setInt(11, profile.getSkillLevel(SkillType.ACROBATICS));
|
||||
statement.setInt(12, profile.getSkillLevel(SkillType.FISHING));
|
||||
statement.setInt(13, profile.getSkillLevel(SkillType.ALCHEMY));
|
||||
statement.setInt(14, id);
|
||||
+ ", fishing = ?, alchemy = ?, total = ? WHERE user_id = ?");
|
||||
statement.setInt(1, profile.getSkillLevel(PrimarySkill.TAMING));
|
||||
statement.setInt(2, profile.getSkillLevel(PrimarySkill.MINING));
|
||||
statement.setInt(3, profile.getSkillLevel(PrimarySkill.REPAIR));
|
||||
statement.setInt(4, profile.getSkillLevel(PrimarySkill.WOODCUTTING));
|
||||
statement.setInt(5, profile.getSkillLevel(PrimarySkill.UNARMED));
|
||||
statement.setInt(6, profile.getSkillLevel(PrimarySkill.HERBALISM));
|
||||
statement.setInt(7, profile.getSkillLevel(PrimarySkill.EXCAVATION));
|
||||
statement.setInt(8, profile.getSkillLevel(PrimarySkill.ARCHERY));
|
||||
statement.setInt(9, profile.getSkillLevel(PrimarySkill.SWORDS));
|
||||
statement.setInt(10, profile.getSkillLevel(PrimarySkill.AXES));
|
||||
statement.setInt(11, profile.getSkillLevel(PrimarySkill.ACROBATICS));
|
||||
statement.setInt(12, profile.getSkillLevel(PrimarySkill.FISHING));
|
||||
statement.setInt(13, profile.getSkillLevel(PrimarySkill.ALCHEMY));
|
||||
int total = 0;
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS)
|
||||
total += profile.getSkillLevel(primarySkill);
|
||||
statement.setInt(14, total);
|
||||
statement.setInt(15, id);
|
||||
success &= (statement.executeUpdate() != 0);
|
||||
statement.close();
|
||||
if (!success) {
|
||||
@@ -264,19 +256,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||
+ ", fishing = ?, alchemy = ? WHERE user_id = ?");
|
||||
statement.setInt(1, profile.getSkillXpLevel(SkillType.TAMING));
|
||||
statement.setInt(2, profile.getSkillXpLevel(SkillType.MINING));
|
||||
statement.setInt(3, profile.getSkillXpLevel(SkillType.REPAIR));
|
||||
statement.setInt(4, profile.getSkillXpLevel(SkillType.WOODCUTTING));
|
||||
statement.setInt(5, profile.getSkillXpLevel(SkillType.UNARMED));
|
||||
statement.setInt(6, profile.getSkillXpLevel(SkillType.HERBALISM));
|
||||
statement.setInt(7, profile.getSkillXpLevel(SkillType.EXCAVATION));
|
||||
statement.setInt(8, profile.getSkillXpLevel(SkillType.ARCHERY));
|
||||
statement.setInt(9, profile.getSkillXpLevel(SkillType.SWORDS));
|
||||
statement.setInt(10, profile.getSkillXpLevel(SkillType.AXES));
|
||||
statement.setInt(11, profile.getSkillXpLevel(SkillType.ACROBATICS));
|
||||
statement.setInt(12, profile.getSkillXpLevel(SkillType.FISHING));
|
||||
statement.setInt(13, profile.getSkillXpLevel(SkillType.ALCHEMY));
|
||||
statement.setInt(1, profile.getSkillXpLevel(PrimarySkill.TAMING));
|
||||
statement.setInt(2, profile.getSkillXpLevel(PrimarySkill.MINING));
|
||||
statement.setInt(3, profile.getSkillXpLevel(PrimarySkill.REPAIR));
|
||||
statement.setInt(4, profile.getSkillXpLevel(PrimarySkill.WOODCUTTING));
|
||||
statement.setInt(5, profile.getSkillXpLevel(PrimarySkill.UNARMED));
|
||||
statement.setInt(6, profile.getSkillXpLevel(PrimarySkill.HERBALISM));
|
||||
statement.setInt(7, profile.getSkillXpLevel(PrimarySkill.EXCAVATION));
|
||||
statement.setInt(8, profile.getSkillXpLevel(PrimarySkill.ARCHERY));
|
||||
statement.setInt(9, profile.getSkillXpLevel(PrimarySkill.SWORDS));
|
||||
statement.setInt(10, profile.getSkillXpLevel(PrimarySkill.AXES));
|
||||
statement.setInt(11, profile.getSkillXpLevel(PrimarySkill.ACROBATICS));
|
||||
statement.setInt(12, profile.getSkillXpLevel(PrimarySkill.FISHING));
|
||||
statement.setInt(13, profile.getSkillXpLevel(PrimarySkill.ALCHEMY));
|
||||
statement.setInt(14, id);
|
||||
success &= (statement.executeUpdate() != 0);
|
||||
statement.close();
|
||||
@@ -289,14 +281,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ " mining = ?, woodcutting = ?, unarmed = ?"
|
||||
+ ", herbalism = ?, excavation = ?, swords = ?"
|
||||
+ ", axes = ?, blast_mining = ? WHERE user_id = ?");
|
||||
statement.setLong(1, profile.getAbilityDATS(AbilityType.SUPER_BREAKER));
|
||||
statement.setLong(2, profile.getAbilityDATS(AbilityType.TREE_FELLER));
|
||||
statement.setLong(3, profile.getAbilityDATS(AbilityType.BERSERK));
|
||||
statement.setLong(4, profile.getAbilityDATS(AbilityType.GREEN_TERRA));
|
||||
statement.setLong(5, profile.getAbilityDATS(AbilityType.GIGA_DRILL_BREAKER));
|
||||
statement.setLong(6, profile.getAbilityDATS(AbilityType.SERRATED_STRIKES));
|
||||
statement.setLong(7, profile.getAbilityDATS(AbilityType.SKULL_SPLITTER));
|
||||
statement.setLong(8, profile.getAbilityDATS(AbilityType.BLAST_MINING));
|
||||
statement.setLong(1, profile.getAbilityDATS(SuperAbility.SUPER_BREAKER));
|
||||
statement.setLong(2, profile.getAbilityDATS(SuperAbility.TREE_FELLER));
|
||||
statement.setLong(3, profile.getAbilityDATS(SuperAbility.BERSERK));
|
||||
statement.setLong(4, profile.getAbilityDATS(SuperAbility.GREEN_TERRA));
|
||||
statement.setLong(5, profile.getAbilityDATS(SuperAbility.GIGA_DRILL_BREAKER));
|
||||
statement.setLong(6, profile.getAbilityDATS(SuperAbility.SERRATED_STRIKES));
|
||||
statement.setLong(7, profile.getAbilityDATS(SuperAbility.SKULL_SPLITTER));
|
||||
statement.setLong(8, profile.getAbilityDATS(SuperAbility.BLAST_MINING));
|
||||
statement.setInt(9, id);
|
||||
success = (statement.executeUpdate() != 0);
|
||||
statement.close();
|
||||
@@ -327,7 +319,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
return success;
|
||||
}
|
||||
|
||||
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage) {
|
||||
public List<PlayerStat> readLeaderboard(PrimarySkill skill, int pageNumber, int statsPerPage) {
|
||||
List<PlayerStat> stats = new ArrayList<PlayerStat>();
|
||||
|
||||
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase();
|
||||
@@ -337,7 +329,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 AND NOT user = '\\_INVALID\\_OLD\\_USERNAME\\_' ORDER BY " + query + " DESC, user LIMIT ?, ?");
|
||||
statement = connection.prepareStatement("SELECT " + query + ", user FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 AND NOT user = '\\_INVALID\\_OLD\\_USERNAME\\_' ORDER BY " + query + " DESC, user LIMIT ?, ?");
|
||||
statement.setInt(1, (pageNumber * statsPerPage) - statsPerPage);
|
||||
statement.setInt(2, statsPerPage);
|
||||
resultSet = statement.executeQuery();
|
||||
@@ -364,8 +356,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
return stats;
|
||||
}
|
||||
|
||||
public Map<SkillType, Integer> readRank(String playerName) {
|
||||
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
||||
public Map<PrimarySkill, Integer> readRank(String playerName) {
|
||||
Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>();
|
||||
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
@@ -373,8 +365,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
String skillName = skillType.name().toLowerCase();
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
String skillName = primarySkill.name().toLowerCase();
|
||||
// Get count of all users with higher skill level than player
|
||||
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
||||
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
|
||||
@@ -401,7 +393,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
while (resultSet.next()) {
|
||||
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
|
||||
skills.put(skillType, rank + resultSet.getRow());
|
||||
skills.put(primarySkill, rank + resultSet.getRow());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -850,6 +842,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`total` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
tryClose(createStatement);
|
||||
@@ -887,7 +880,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getTruncateSkills()) {
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
int cap = Config.getInstance().getLevelCap(skill);
|
||||
if (cap != Integer.MAX_VALUE) {
|
||||
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase() + "` = " + cap + " WHERE `" + skill.name().toLowerCase() + "` > " + cap);
|
||||
@@ -992,6 +985,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
checkNameUniqueness(statement);
|
||||
return;
|
||||
|
||||
case ADD_SKILL_TOTAL:
|
||||
checkUpgradeSkillTotal(connection);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1042,9 +1039,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level
|
||||
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP
|
||||
Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
|
||||
Map<PrimarySkill, Integer> skills = new EnumMap<PrimarySkill, Integer>(PrimarySkill.class); // Skill & Level
|
||||
Map<PrimarySkill, Float> skillsXp = new EnumMap<PrimarySkill, Float>(PrimarySkill.class); // Skill & XP
|
||||
Map<SuperAbility, Integer> skillsDATS = new EnumMap<SuperAbility, Integer>(SuperAbility.class); // Ability & Cooldown
|
||||
MobHealthbarType mobHealthbarType;
|
||||
UUID uuid;
|
||||
int scoreboardTipsShown;
|
||||
@@ -1055,46 +1052,46 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
final int OFFSET_DATS = 26;
|
||||
final int OFFSET_OTHER = 38;
|
||||
|
||||
skills.put(SkillType.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
||||
skills.put(SkillType.MINING, result.getInt(OFFSET_SKILLS + 2));
|
||||
skills.put(SkillType.REPAIR, result.getInt(OFFSET_SKILLS + 3));
|
||||
skills.put(SkillType.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
|
||||
skills.put(SkillType.UNARMED, result.getInt(OFFSET_SKILLS + 5));
|
||||
skills.put(SkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
|
||||
skills.put(SkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
|
||||
skills.put(SkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
|
||||
skills.put(SkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9));
|
||||
skills.put(SkillType.AXES, result.getInt(OFFSET_SKILLS + 10));
|
||||
skills.put(SkillType.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
|
||||
skills.put(SkillType.FISHING, result.getInt(OFFSET_SKILLS + 12));
|
||||
skills.put(SkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
||||
skills.put(PrimarySkill.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
||||
skills.put(PrimarySkill.MINING, result.getInt(OFFSET_SKILLS + 2));
|
||||
skills.put(PrimarySkill.REPAIR, result.getInt(OFFSET_SKILLS + 3));
|
||||
skills.put(PrimarySkill.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
|
||||
skills.put(PrimarySkill.UNARMED, result.getInt(OFFSET_SKILLS + 5));
|
||||
skills.put(PrimarySkill.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
|
||||
skills.put(PrimarySkill.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
|
||||
skills.put(PrimarySkill.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
|
||||
skills.put(PrimarySkill.SWORDS, result.getInt(OFFSET_SKILLS + 9));
|
||||
skills.put(PrimarySkill.AXES, result.getInt(OFFSET_SKILLS + 10));
|
||||
skills.put(PrimarySkill.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
|
||||
skills.put(PrimarySkill.FISHING, result.getInt(OFFSET_SKILLS + 12));
|
||||
skills.put(PrimarySkill.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
||||
|
||||
skillsXp.put(SkillType.TAMING, result.getFloat(OFFSET_XP + 1));
|
||||
skillsXp.put(SkillType.MINING, result.getFloat(OFFSET_XP + 2));
|
||||
skillsXp.put(SkillType.REPAIR, result.getFloat(OFFSET_XP + 3));
|
||||
skillsXp.put(SkillType.WOODCUTTING, result.getFloat(OFFSET_XP + 4));
|
||||
skillsXp.put(SkillType.UNARMED, result.getFloat(OFFSET_XP + 5));
|
||||
skillsXp.put(SkillType.HERBALISM, result.getFloat(OFFSET_XP + 6));
|
||||
skillsXp.put(SkillType.EXCAVATION, result.getFloat(OFFSET_XP + 7));
|
||||
skillsXp.put(SkillType.ARCHERY, result.getFloat(OFFSET_XP + 8));
|
||||
skillsXp.put(SkillType.SWORDS, result.getFloat(OFFSET_XP + 9));
|
||||
skillsXp.put(SkillType.AXES, result.getFloat(OFFSET_XP + 10));
|
||||
skillsXp.put(SkillType.ACROBATICS, result.getFloat(OFFSET_XP + 11));
|
||||
skillsXp.put(SkillType.FISHING, result.getFloat(OFFSET_XP + 12));
|
||||
skillsXp.put(SkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13));
|
||||
skillsXp.put(PrimarySkill.TAMING, result.getFloat(OFFSET_XP + 1));
|
||||
skillsXp.put(PrimarySkill.MINING, result.getFloat(OFFSET_XP + 2));
|
||||
skillsXp.put(PrimarySkill.REPAIR, result.getFloat(OFFSET_XP + 3));
|
||||
skillsXp.put(PrimarySkill.WOODCUTTING, result.getFloat(OFFSET_XP + 4));
|
||||
skillsXp.put(PrimarySkill.UNARMED, result.getFloat(OFFSET_XP + 5));
|
||||
skillsXp.put(PrimarySkill.HERBALISM, result.getFloat(OFFSET_XP + 6));
|
||||
skillsXp.put(PrimarySkill.EXCAVATION, result.getFloat(OFFSET_XP + 7));
|
||||
skillsXp.put(PrimarySkill.ARCHERY, result.getFloat(OFFSET_XP + 8));
|
||||
skillsXp.put(PrimarySkill.SWORDS, result.getFloat(OFFSET_XP + 9));
|
||||
skillsXp.put(PrimarySkill.AXES, result.getFloat(OFFSET_XP + 10));
|
||||
skillsXp.put(PrimarySkill.ACROBATICS, result.getFloat(OFFSET_XP + 11));
|
||||
skillsXp.put(PrimarySkill.FISHING, result.getFloat(OFFSET_XP + 12));
|
||||
skillsXp.put(PrimarySkill.ALCHEMY, result.getFloat(OFFSET_XP + 13));
|
||||
|
||||
// Taming - Unused - result.getInt(OFFSET_DATS + 1)
|
||||
skillsDATS.put(AbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2));
|
||||
skillsDATS.put(SuperAbility.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2));
|
||||
// Repair - Unused - result.getInt(OFFSET_DATS + 3)
|
||||
skillsDATS.put(AbilityType.TREE_FELLER, result.getInt(OFFSET_DATS + 4));
|
||||
skillsDATS.put(AbilityType.BERSERK, result.getInt(OFFSET_DATS + 5));
|
||||
skillsDATS.put(AbilityType.GREEN_TERRA, result.getInt(OFFSET_DATS + 6));
|
||||
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, result.getInt(OFFSET_DATS + 7));
|
||||
skillsDATS.put(SuperAbility.TREE_FELLER, result.getInt(OFFSET_DATS + 4));
|
||||
skillsDATS.put(SuperAbility.BERSERK, result.getInt(OFFSET_DATS + 5));
|
||||
skillsDATS.put(SuperAbility.GREEN_TERRA, result.getInt(OFFSET_DATS + 6));
|
||||
skillsDATS.put(SuperAbility.GIGA_DRILL_BREAKER, result.getInt(OFFSET_DATS + 7));
|
||||
// Archery - Unused - result.getInt(OFFSET_DATS + 8)
|
||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, result.getInt(OFFSET_DATS + 9));
|
||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, result.getInt(OFFSET_DATS + 10));
|
||||
skillsDATS.put(SuperAbility.SERRATED_STRIKES, result.getInt(OFFSET_DATS + 9));
|
||||
skillsDATS.put(SuperAbility.SKULL_SPLITTER, result.getInt(OFFSET_DATS + 10));
|
||||
// Acrobatics - Unused - result.getInt(OFFSET_DATS + 11)
|
||||
skillsDATS.put(AbilityType.BLAST_MINING, result.getInt(OFFSET_DATS + 12));
|
||||
skillsDATS.put(SuperAbility.BLAST_MINING, result.getInt(OFFSET_DATS + 12));
|
||||
|
||||
try {
|
||||
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 1));
|
||||
@@ -1132,7 +1129,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
return DatabaseType.SQL;
|
||||
}
|
||||
|
||||
private void checkNameUniqueness(final Statement statement) throws SQLException {
|
||||
private void checkNameUniqueness(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
resultSet = statement.executeQuery("SHOW INDEXES "
|
||||
@@ -1205,17 +1202,17 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeAddSQLIndexes(final Statement statement) throws SQLException {
|
||||
private void checkUpgradeAddSQLIndexes(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
|
||||
resultSet.last();
|
||||
|
||||
if (resultSet.getRow() != SkillType.NON_CHILD_SKILLS.size()) {
|
||||
if (resultSet.getRow() != PrimarySkill.NON_CHILD_SKILLS.size()) {
|
||||
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
|
||||
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
String skill_name = skill.name().toLowerCase();
|
||||
|
||||
try {
|
||||
@@ -1292,7 +1289,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
if (!names.isEmpty()) {
|
||||
new UUIDUpdateAsyncTask(mcMMO.p, names).run();;
|
||||
new UUIDUpdateAsyncTask(mcMMO.p, names).run();
|
||||
}
|
||||
} finally {
|
||||
massUpdateLock.unlock();
|
||||
@@ -1329,6 +1326,43 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeSkillTotal(final Connection connection) throws SQLException {
|
||||
ResultSet resultSet = null;
|
||||
Statement statement = null;
|
||||
|
||||
try {
|
||||
connection.setAutoCommit(false);
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "skills` LIMIT 1");
|
||||
|
||||
ResultSetMetaData rsmeta = resultSet.getMetaData();
|
||||
boolean column_exists = false;
|
||||
|
||||
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
|
||||
if (rsmeta.getColumnName(i).equalsIgnoreCase("total")) {
|
||||
column_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!column_exists) {
|
||||
mcMMO.p.getLogger().info("Adding skill total column to skills table...");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD COLUMN `total` int NOT NULL DEFAULT '0'");
|
||||
statement.executeUpdate("UPDATE `" + tablePrefix + "skills` SET `total` = (taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy)");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_total` (`total`) USING BTREE");
|
||||
connection.commit();
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
connection.setAutoCommit(true);
|
||||
tryClose(resultSet);
|
||||
tryClose(statement);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpgradeDropSpout(final Statement statement) {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
@@ -1415,6 +1449,25 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
public enum PoolIdentifier {
|
||||
MISC,
|
||||
LOAD,
|
||||
SAVE;
|
||||
SAVE
|
||||
}
|
||||
|
||||
public void resetMobHealthSettings() {
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?");
|
||||
statement.setString(1, Config.getInstance().getMobHealthbarDefault().toString());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
tryClose(statement);
|
||||
tryClose(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,6 @@ public enum UpgradeType {
|
||||
ADD_UUIDS,
|
||||
ADD_UUIDS_PARTY,
|
||||
ADD_SCOREBOARD_TIPS,
|
||||
DROP_NAME_UNIQUENESS;
|
||||
DROP_NAME_UNIQUENESS,
|
||||
ADD_SKILL_TOTAL,
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@ import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
public class SkillXpGain implements Delayed {
|
||||
private final long expiryTime;
|
||||
private final float xp;
|
||||
private final SkillType type;
|
||||
private final PrimarySkill type;
|
||||
|
||||
public SkillXpGain(SkillType type, float xp) {
|
||||
public SkillXpGain(PrimarySkill type, float xp) {
|
||||
this.expiryTime = System.currentTimeMillis() + getDuration();
|
||||
this.xp = xp;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public SkillType getSkill() {
|
||||
public PrimarySkill getSkill() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
package com.gmail.nossr50.datatypes.party;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -7,20 +20,6 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class Party {
|
||||
private final LinkedHashMap<UUID, String> members = new LinkedHashMap<UUID, String>();
|
||||
private final List<Player> onlineMembers = new ArrayList<Player>();
|
||||
@@ -227,7 +226,7 @@ public class Party {
|
||||
leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
|
||||
|
||||
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
||||
leader.playSound(leader.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||
leader.playSound(leader.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -337,7 +336,7 @@ public class Party {
|
||||
}
|
||||
|
||||
if (!nearMembers.contains(member) && !playerName.equalsIgnoreCase(memberName)) {
|
||||
memberList.append(ChatColor.ITALIC).append("");
|
||||
memberList.append(ChatColor.ITALIC);
|
||||
}
|
||||
|
||||
memberList.append(memberName).append(ChatColor.RESET).append(" ");
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
@@ -23,14 +7,16 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.runnables.skills.AbilityDisableTask;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.runnables.skills.ToolLowerTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
@@ -53,17 +39,29 @@ import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class McMMOPlayer {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
|
||||
private final Map<SkillType, SkillManager> skillManagers = new HashMap<SkillType, SkillManager>();
|
||||
private final Map<PrimarySkill, SkillManager> skillManagers = new HashMap<PrimarySkill, SkillManager>();
|
||||
|
||||
private Party party;
|
||||
private Party invite;
|
||||
@@ -78,9 +76,10 @@ public class McMMOPlayer {
|
||||
|
||||
private boolean abilityUse = true;
|
||||
private boolean godMode;
|
||||
private boolean chatSpy = false; //Off by default
|
||||
|
||||
private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
||||
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
||||
private final Map<SuperAbility, Boolean> abilityMode = new HashMap<SuperAbility, Boolean>();
|
||||
private final Map<SuperAbility, Boolean> abilityInformed = new HashMap<SuperAbility, Boolean>();
|
||||
|
||||
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||
|
||||
@@ -109,11 +108,11 @@ public class McMMOPlayer {
|
||||
/*
|
||||
* I'm using this method because it makes code shorter and safer (we don't have to add all SkillTypes manually),
|
||||
* but I actually have no idea about the performance impact, if there is any.
|
||||
* If in the future someone wants to remove this, don't forget to also remove what is in the SkillType enum. - bm01
|
||||
* If in the future someone wants to remove this, don't forget to also remove what is in the PrimarySkill enum. - bm01
|
||||
*/
|
||||
try {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
skillManagers.put(skillType, skillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
||||
for (PrimarySkill primarySkill : PrimarySkill.values()) {
|
||||
skillManagers.put(primarySkill, primarySkill.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -121,9 +120,9 @@ public class McMMOPlayer {
|
||||
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
||||
}
|
||||
|
||||
for (AbilityType abilityType : AbilityType.values()) {
|
||||
abilityMode.put(abilityType, false);
|
||||
abilityInformed.put(abilityType, true); // This is intended
|
||||
for (SuperAbility superAbility : SuperAbility.values()) {
|
||||
abilityMode.put(superAbility, false);
|
||||
abilityInformed.put(superAbility, true); // This is intended
|
||||
}
|
||||
|
||||
for (ToolType toolType : ToolType.values()) {
|
||||
@@ -132,63 +131,63 @@ public class McMMOPlayer {
|
||||
}
|
||||
|
||||
public AcrobaticsManager getAcrobaticsManager() {
|
||||
return (AcrobaticsManager) skillManagers.get(SkillType.ACROBATICS);
|
||||
return (AcrobaticsManager) skillManagers.get(PrimarySkill.ACROBATICS);
|
||||
}
|
||||
|
||||
public AlchemyManager getAlchemyManager() {
|
||||
return (AlchemyManager) skillManagers.get(SkillType.ALCHEMY);
|
||||
return (AlchemyManager) skillManagers.get(PrimarySkill.ALCHEMY);
|
||||
}
|
||||
|
||||
public ArcheryManager getArcheryManager() {
|
||||
return (ArcheryManager) skillManagers.get(SkillType.ARCHERY);
|
||||
return (ArcheryManager) skillManagers.get(PrimarySkill.ARCHERY);
|
||||
}
|
||||
|
||||
public AxesManager getAxesManager() {
|
||||
return (AxesManager) skillManagers.get(SkillType.AXES);
|
||||
return (AxesManager) skillManagers.get(PrimarySkill.AXES);
|
||||
}
|
||||
|
||||
public ExcavationManager getExcavationManager() {
|
||||
return (ExcavationManager) skillManagers.get(SkillType.EXCAVATION);
|
||||
return (ExcavationManager) skillManagers.get(PrimarySkill.EXCAVATION);
|
||||
}
|
||||
|
||||
public FishingManager getFishingManager() {
|
||||
return (FishingManager) skillManagers.get(SkillType.FISHING);
|
||||
return (FishingManager) skillManagers.get(PrimarySkill.FISHING);
|
||||
}
|
||||
|
||||
public HerbalismManager getHerbalismManager() {
|
||||
return (HerbalismManager) skillManagers.get(SkillType.HERBALISM);
|
||||
return (HerbalismManager) skillManagers.get(PrimarySkill.HERBALISM);
|
||||
}
|
||||
|
||||
public MiningManager getMiningManager() {
|
||||
return (MiningManager) skillManagers.get(SkillType.MINING);
|
||||
return (MiningManager) skillManagers.get(PrimarySkill.MINING);
|
||||
}
|
||||
|
||||
public RepairManager getRepairManager() {
|
||||
return (RepairManager) skillManagers.get(SkillType.REPAIR);
|
||||
return (RepairManager) skillManagers.get(PrimarySkill.REPAIR);
|
||||
}
|
||||
|
||||
public SalvageManager getSalvageManager() {
|
||||
return (SalvageManager) skillManagers.get(SkillType.SALVAGE);
|
||||
return (SalvageManager) skillManagers.get(PrimarySkill.SALVAGE);
|
||||
}
|
||||
|
||||
public SmeltingManager getSmeltingManager() {
|
||||
return (SmeltingManager) skillManagers.get(SkillType.SMELTING);
|
||||
return (SmeltingManager) skillManagers.get(PrimarySkill.SMELTING);
|
||||
}
|
||||
|
||||
public SwordsManager getSwordsManager() {
|
||||
return (SwordsManager) skillManagers.get(SkillType.SWORDS);
|
||||
return (SwordsManager) skillManagers.get(PrimarySkill.SWORDS);
|
||||
}
|
||||
|
||||
public TamingManager getTamingManager() {
|
||||
return (TamingManager) skillManagers.get(SkillType.TAMING);
|
||||
return (TamingManager) skillManagers.get(PrimarySkill.TAMING);
|
||||
}
|
||||
|
||||
public UnarmedManager getUnarmedManager() {
|
||||
return (UnarmedManager) skillManagers.get(SkillType.UNARMED);
|
||||
return (UnarmedManager) skillManagers.get(PrimarySkill.UNARMED);
|
||||
}
|
||||
|
||||
public WoodcuttingManager getWoodcuttingManager() {
|
||||
return (WoodcuttingManager) skillManagers.get(SkillType.WOODCUTTING);
|
||||
return (WoodcuttingManager) skillManagers.get(PrimarySkill.WOODCUTTING);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -199,7 +198,7 @@ public class McMMOPlayer {
|
||||
* Reset the mode of all abilities.
|
||||
*/
|
||||
public void resetAbilityMode() {
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
for (SuperAbility ability : SuperAbility.values()) {
|
||||
// Correctly disable and handle any special deactivate code
|
||||
new AbilityDisableTask(this, ability).run();
|
||||
}
|
||||
@@ -211,7 +210,7 @@ public class McMMOPlayer {
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability is enabled, false otherwise
|
||||
*/
|
||||
public boolean getAbilityMode(AbilityType ability) {
|
||||
public boolean getAbilityMode(SuperAbility ability) {
|
||||
return abilityMode.get(ability);
|
||||
}
|
||||
|
||||
@@ -221,7 +220,7 @@ public class McMMOPlayer {
|
||||
* @param ability The ability to check
|
||||
* @param isActive True if the ability is active, false otherwise
|
||||
*/
|
||||
public void setAbilityMode(AbilityType ability, boolean isActive) {
|
||||
public void setAbilityMode(SuperAbility ability, boolean isActive) {
|
||||
abilityMode.put(ability, isActive);
|
||||
}
|
||||
|
||||
@@ -231,7 +230,7 @@ public class McMMOPlayer {
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability is informed, false otherwise
|
||||
*/
|
||||
public boolean getAbilityInformed(AbilityType ability) {
|
||||
public boolean getAbilityInformed(SuperAbility ability) {
|
||||
return abilityInformed.get(ability);
|
||||
}
|
||||
|
||||
@@ -241,7 +240,7 @@ public class McMMOPlayer {
|
||||
* @param ability The ability to check
|
||||
* @param isInformed True if the ability is informed, false otherwise
|
||||
*/
|
||||
public void setAbilityInformed(AbilityType ability, boolean isInformed) {
|
||||
public void setAbilityInformed(SuperAbility ability, boolean isInformed) {
|
||||
abilityInformed.put(ability, isInformed);
|
||||
}
|
||||
|
||||
@@ -366,6 +365,14 @@ public class McMMOPlayer {
|
||||
godMode = !godMode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Party Chat Spy
|
||||
*/
|
||||
|
||||
public boolean isPartyChatSpying() { return chatSpy; }
|
||||
|
||||
public void togglePartyChatSpying() { chatSpy = !chatSpy;}
|
||||
|
||||
/*
|
||||
* Skill notifications
|
||||
*/
|
||||
@@ -386,7 +393,7 @@ public class McMMOPlayer {
|
||||
public int getPowerLevel() {
|
||||
int powerLevel = 0;
|
||||
|
||||
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
if (type.getPermissions(player)) {
|
||||
powerLevel += getSkillLevel(type);
|
||||
}
|
||||
@@ -401,7 +408,7 @@ public class McMMOPlayer {
|
||||
* @param skill Skill being used
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginXpGain(SkillType skill, float xp, XPGainReason xpGainReason) {
|
||||
public void beginXpGain(PrimarySkill skill, float xp, XPGainReason xpGainReason) {
|
||||
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
|
||||
|
||||
if (xp <= 0.0) {
|
||||
@@ -409,10 +416,10 @@ public class McMMOPlayer {
|
||||
}
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
|
||||
Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill);
|
||||
float splitXp = xp / parentSkills.size();
|
||||
|
||||
for (SkillType parentSkill : parentSkills) {
|
||||
for (PrimarySkill parentSkill : parentSkills) {
|
||||
if (parentSkill.getPermissions(player)) {
|
||||
beginXpGain(parentSkill, splitXp, xpGainReason);
|
||||
}
|
||||
@@ -435,7 +442,7 @@ public class McMMOPlayer {
|
||||
* @param skill Skill being used
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginUnsharedXpGain(SkillType skill, float xp, XPGainReason xpGainReason) {
|
||||
public void beginUnsharedXpGain(PrimarySkill skill, float xp, XPGainReason xpGainReason) {
|
||||
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason);
|
||||
|
||||
if (party == null) {
|
||||
@@ -450,64 +457,64 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Applies an experience gain
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param primarySkill Skill being used
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void applyXpGain(SkillType skillType, float xp, XPGainReason xpGainReason) {
|
||||
if (!skillType.getPermissions(player)) {
|
||||
public void applyXpGain(PrimarySkill primarySkill, float xp, XPGainReason xpGainReason) {
|
||||
if (!primarySkill.getPermissions(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skillType.isChildSkill()) {
|
||||
Set<SkillType> parentSkills = FamilyTree.getParents(skillType);
|
||||
if (primarySkill.isChildSkill()) {
|
||||
Set<PrimarySkill> parentSkills = FamilyTree.getParents(primarySkill);
|
||||
|
||||
for (SkillType parentSkill : parentSkills) {
|
||||
for (PrimarySkill parentSkill : parentSkills) {
|
||||
applyXpGain(parentSkill, xp / parentSkills.size(), xpGainReason);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EventUtils.handleXpGainEvent(player, skillType, xp, xpGainReason)) {
|
||||
if (!EventUtils.handleXpGainEvent(player, primarySkill, xp, xpGainReason)) {
|
||||
return;
|
||||
}
|
||||
|
||||
isUsingUnarmed = (skillType == SkillType.UNARMED);
|
||||
checkXp(skillType, xpGainReason);
|
||||
isUsingUnarmed = (primarySkill == PrimarySkill.UNARMED);
|
||||
checkXp(primarySkill, xpGainReason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the XP of a skill.
|
||||
*
|
||||
* @param skillType The skill to check
|
||||
* @param primarySkill The skill to check
|
||||
*/
|
||||
private void checkXp(SkillType skillType, XPGainReason xpGainReason) {
|
||||
if (getSkillXpLevelRaw(skillType) < getXpToLevel(skillType)) {
|
||||
private void checkXp(PrimarySkill primarySkill, XPGainReason xpGainReason) {
|
||||
if (getSkillXpLevelRaw(primarySkill) < getXpToLevel(primarySkill)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int levelsGained = 0;
|
||||
float xpRemoved = 0;
|
||||
|
||||
while (getSkillXpLevelRaw(skillType) >= getXpToLevel(skillType)) {
|
||||
if (hasReachedLevelCap(skillType)) {
|
||||
setSkillXpLevel(skillType, 0);
|
||||
while (getSkillXpLevelRaw(primarySkill) >= getXpToLevel(primarySkill)) {
|
||||
if (hasReachedLevelCap(primarySkill)) {
|
||||
setSkillXpLevel(primarySkill, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
xpRemoved += profile.levelUp(skillType);
|
||||
xpRemoved += profile.levelUp(primarySkill);
|
||||
levelsGained++;
|
||||
}
|
||||
|
||||
if (!EventUtils.handleLevelChangeEvent(player, skillType, levelsGained, xpRemoved, true, xpGainReason)) {
|
||||
if (!EventUtils.handleLevelChangeEvent(player, primarySkill, levelsGained, xpRemoved, true, xpGainReason)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
|
||||
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(primarySkill.toString()) + ".Skillup", levelsGained, getSkillLevel(primarySkill)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -677,26 +684,26 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Modifies an experience gain using skill modifiers, global rate and perks
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param primarySkill Skill being used
|
||||
* @param xp Experience amount to process
|
||||
* @return Modified experience
|
||||
*/
|
||||
private float modifyXpGain(SkillType skillType, float xp) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE || (skillType.getMaxLevel() <= getSkillLevel(skillType)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
||||
private float modifyXpGain(PrimarySkill primarySkill, float xp) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE || (primarySkill.getMaxLevel() <= getSkillLevel(primarySkill)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
xp = (float) (xp / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
xp = (float) (xp / primarySkill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
|
||||
if (Config.getInstance().getToolModsEnabled()) {
|
||||
CustomTool tool = mcMMO.getModManager().getTool(player.getItemInHand());
|
||||
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
||||
|
||||
if (tool != null) {
|
||||
xp *= tool.getXpMultiplier();
|
||||
}
|
||||
}
|
||||
|
||||
return PerksUtils.handleXpPerks(player, xp, skillType);
|
||||
return PerksUtils.handleXpPerks(player, xp, primarySkill);
|
||||
}
|
||||
|
||||
public void checkGodMode() {
|
||||
@@ -718,9 +725,9 @@ public class McMMOPlayer {
|
||||
*
|
||||
* @param skill The skill the ability is based on
|
||||
*/
|
||||
public void checkAbilityActivation(SkillType skill) {
|
||||
public void checkAbilityActivation(PrimarySkill skill) {
|
||||
ToolType tool = skill.getTool();
|
||||
AbilityType ability = skill.getAbility();
|
||||
SuperAbility ability = skill.getAbility();
|
||||
|
||||
setToolPreparationMode(tool, false);
|
||||
|
||||
@@ -728,6 +735,19 @@ public class McMMOPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the player has passed the gate requirement
|
||||
*/
|
||||
if(Config.getInstance().getAbilitiesGateEnabled())
|
||||
{
|
||||
if(getSkillLevel(skill) < skill.getSkillAbilityGate())
|
||||
{
|
||||
//Inform the player they are not yet skilled enough
|
||||
player.sendMessage(LocaleLoader.getString("Skills.AbilityGateRequirementFail"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int timeRemaining = calculateTimeRemaining(ability);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
@@ -735,7 +755,7 @@ public class McMMOPlayer {
|
||||
* Axes and Woodcutting are odd because they share the same tool.
|
||||
* We show them the too tired message when they take action.
|
||||
*/
|
||||
if (skill == SkillType.WOODCUTTING || skill == SkillType.AXES) {
|
||||
if (skill == PrimarySkill.WOODCUTTING || skill == PrimarySkill.AXES) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||
}
|
||||
|
||||
@@ -761,19 +781,19 @@ public class McMMOPlayer {
|
||||
profile.setAbilityDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||
setAbilityMode(ability, true);
|
||||
|
||||
if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) {
|
||||
if (ability == SuperAbility.SUPER_BREAKER || ability == SuperAbility.GIGA_DRILL_BREAKER) {
|
||||
SkillUtils.handleAbilitySpeedIncrease(player);
|
||||
}
|
||||
|
||||
new AbilityDisableTask(this, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
public void processAbilityActivation(SkillType skill) {
|
||||
public void processAbilityActivation(PrimarySkill skill) {
|
||||
if (Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
ItemStack inHand = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (mcMMO.getModManager().isCustomTool(inHand) && !mcMMO.getModManager().getTool(inHand).isAbilityEnabled()) {
|
||||
return;
|
||||
@@ -783,13 +803,13 @@ public class McMMOPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbilityType abilityType : AbilityType.values()) {
|
||||
if (getAbilityMode(abilityType)) {
|
||||
for (SuperAbility superAbility : SuperAbility.values()) {
|
||||
if (getAbilityMode(superAbility)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AbilityType ability = skill.getAbility();
|
||||
SuperAbility ability = skill.getAbility();
|
||||
ToolType tool = skill.getTool();
|
||||
|
||||
/*
|
||||
@@ -797,7 +817,7 @@ public class McMMOPlayer {
|
||||
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
|
||||
*/
|
||||
if (ability.getPermissions(player) && tool.inHand(inHand) && !getToolPreparationMode(tool)) {
|
||||
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
|
||||
if (skill != PrimarySkill.WOODCUTTING && skill != PrimarySkill.AXES) {
|
||||
int timeRemaining = calculateTimeRemaining(ability);
|
||||
|
||||
if (!getAbilityMode(ability) && timeRemaining > 0) {
|
||||
@@ -818,59 +838,59 @@ public class McMMOPlayer {
|
||||
/**
|
||||
* Calculate the time remaining until the ability's cooldown expires.
|
||||
*
|
||||
* @param ability AbilityType whose cooldown to check
|
||||
* @param ability SuperAbility whose cooldown to check
|
||||
*
|
||||
* @return the number of seconds remaining before the cooldown expires
|
||||
*/
|
||||
public int calculateTimeRemaining(AbilityType ability) {
|
||||
public int calculateTimeRemaining(SuperAbility ability) {
|
||||
long deactivatedTimestamp = profile.getAbilityDATS(ability) * Misc.TIME_CONVERSION_FACTOR;
|
||||
return (int) (((deactivatedTimestamp + (PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
private boolean hasReachedLevelCap(SkillType skill) {
|
||||
private boolean hasReachedLevelCap(PrimarySkill skill) {
|
||||
return (skill.getMaxLevel() < getSkillLevel(skill) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions are wrapped from PlayerProfile so that we don't always have to store it alongside the McMMOPlayer object.
|
||||
*/
|
||||
public int getSkillLevel(SkillType skill) {
|
||||
public int getSkillLevel(PrimarySkill skill) {
|
||||
return profile.getSkillLevel(skill);
|
||||
}
|
||||
|
||||
public float getSkillXpLevelRaw(SkillType skill) {
|
||||
public float getSkillXpLevelRaw(PrimarySkill skill) {
|
||||
return profile.getSkillXpLevelRaw(skill);
|
||||
}
|
||||
|
||||
public int getSkillXpLevel(SkillType skill) {
|
||||
public int getSkillXpLevel(PrimarySkill skill) {
|
||||
return profile.getSkillXpLevel(skill);
|
||||
}
|
||||
|
||||
public void setSkillXpLevel(SkillType skill, float xpLevel) {
|
||||
public void setSkillXpLevel(PrimarySkill skill, float xpLevel) {
|
||||
profile.setSkillXpLevel(skill, xpLevel);
|
||||
}
|
||||
|
||||
public int getXpToLevel(SkillType skill) {
|
||||
public int getXpToLevel(PrimarySkill skill) {
|
||||
return profile.getXpToLevel(skill);
|
||||
}
|
||||
|
||||
public void removeXp(SkillType skill, int xp) {
|
||||
public void removeXp(PrimarySkill skill, int xp) {
|
||||
profile.removeXp(skill, xp);
|
||||
}
|
||||
|
||||
public void modifySkill(SkillType skill, int level) {
|
||||
public void modifySkill(PrimarySkill skill, int level) {
|
||||
profile.modifySkill(skill, level);
|
||||
}
|
||||
|
||||
public void addLevels(SkillType skill, int levels) {
|
||||
public void addLevels(PrimarySkill skill, int levels) {
|
||||
profile.addLevels(skill, levels);
|
||||
}
|
||||
|
||||
public void addXp(SkillType skill, float xp) {
|
||||
public void addXp(PrimarySkill skill, float xp) {
|
||||
profile.addXp(skill, xp);
|
||||
}
|
||||
|
||||
public void setAbilityDATS(AbilityType ability, long DATS) {
|
||||
public void setAbilityDATS(SuperAbility ability, long DATS) {
|
||||
profile.setAbilityDATS(ability, DATS);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.experience.SkillXpGain;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -31,13 +31,13 @@ public class PlayerProfile {
|
||||
private int scoreboardTipsShown;
|
||||
|
||||
/* Skill Data */
|
||||
private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
|
||||
private final Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
|
||||
private final Map<AbilityType, Integer> abilityDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
|
||||
private final Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>(); // Skill & Level
|
||||
private final Map<PrimarySkill, Float> skillsXp = new HashMap<PrimarySkill, Float>(); // Skill & XP
|
||||
private final Map<SuperAbility, Integer> abilityDATS = new HashMap<SuperAbility, Integer>(); // Ability & Cooldown
|
||||
|
||||
// Store previous XP gains for deminished returns
|
||||
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
|
||||
private HashMap<SkillType, Float> rollingSkillsXp = new HashMap<SkillType, Float>();
|
||||
private HashMap<PrimarySkill, Float> rollingSkillsXp = new HashMap<PrimarySkill, Float>();
|
||||
|
||||
@Deprecated
|
||||
public PlayerProfile(String playerName) {
|
||||
@@ -51,13 +51,13 @@ public class PlayerProfile {
|
||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||
scoreboardTipsShown = 0;
|
||||
|
||||
for (AbilityType abilityType : AbilityType.values()) {
|
||||
abilityDATS.put(abilityType, 0);
|
||||
for (SuperAbility superAbility : SuperAbility.values()) {
|
||||
abilityDATS.put(superAbility, 0);
|
||||
}
|
||||
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skills.put(skillType, 0);
|
||||
skillsXp.put(skillType, 0F);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
skills.put(primarySkill, 0);
|
||||
skillsXp.put(primarySkill, 0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PlayerProfile {
|
||||
this.loaded = isLoaded;
|
||||
}
|
||||
|
||||
public PlayerProfile(String playerName, UUID uuid, Map<SkillType, Integer> levelData, Map<SkillType, Float> xpData, Map<AbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown) {
|
||||
public PlayerProfile(String playerName, UUID uuid, Map<PrimarySkill, Integer> levelData, Map<PrimarySkill, Float> xpData, Map<SuperAbility, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown) {
|
||||
this.playerName = playerName;
|
||||
this.uuid = uuid;
|
||||
this.mobHealthbarType = mobHealthbarType;
|
||||
@@ -156,20 +156,20 @@ public class PlayerProfile {
|
||||
/**
|
||||
* Get the current deactivation timestamp of an ability.
|
||||
*
|
||||
* @param ability The {@link AbilityType} to get the DATS for
|
||||
* @param ability The {@link SuperAbility} to get the DATS for
|
||||
* @return the deactivation timestamp for the ability
|
||||
*/
|
||||
public long getAbilityDATS(AbilityType ability) {
|
||||
public long getAbilityDATS(SuperAbility ability) {
|
||||
return abilityDATS.get(ability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current deactivation timestamp of an ability.
|
||||
*
|
||||
* @param ability The {@link AbilityType} to set the DATS for
|
||||
* @param ability The {@link SuperAbility} to set the DATS for
|
||||
* @param DATS the DATS of the ability
|
||||
*/
|
||||
protected void setAbilityDATS(AbilityType ability, long DATS) {
|
||||
protected void setAbilityDATS(SuperAbility ability, long DATS) {
|
||||
changed = true;
|
||||
|
||||
abilityDATS.put(ability, (int) (DATS * .001D));
|
||||
@@ -181,7 +181,7 @@ public class PlayerProfile {
|
||||
protected void resetCooldowns() {
|
||||
changed = true;
|
||||
|
||||
for (AbilityType ability : abilityDATS.keySet()) {
|
||||
for (SuperAbility ability : abilityDATS.keySet()) {
|
||||
abilityDATS.put(ability, 0);
|
||||
}
|
||||
}
|
||||
@@ -190,19 +190,19 @@ public class PlayerProfile {
|
||||
* Xp Functions
|
||||
*/
|
||||
|
||||
public int getSkillLevel(SkillType skill) {
|
||||
public int getSkillLevel(PrimarySkill skill) {
|
||||
return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill);
|
||||
}
|
||||
|
||||
public float getSkillXpLevelRaw(SkillType skill) {
|
||||
public float getSkillXpLevelRaw(PrimarySkill skill) {
|
||||
return skillsXp.get(skill);
|
||||
}
|
||||
|
||||
public int getSkillXpLevel(SkillType skill) {
|
||||
public int getSkillXpLevel(PrimarySkill skill) {
|
||||
return (int) Math.floor(getSkillXpLevelRaw(skill));
|
||||
}
|
||||
|
||||
public void setSkillXpLevel(SkillType skill, float xpLevel) {
|
||||
public void setSkillXpLevel(PrimarySkill skill, float xpLevel) {
|
||||
if (skill.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public class PlayerProfile {
|
||||
skillsXp.put(skill, xpLevel);
|
||||
}
|
||||
|
||||
protected float levelUp(SkillType skill) {
|
||||
protected float levelUp(PrimarySkill skill) {
|
||||
float xpRemoved = getXpToLevel(skill);
|
||||
|
||||
changed = true;
|
||||
@@ -229,7 +229,7 @@ public class PlayerProfile {
|
||||
* @param skill Type of skill to modify
|
||||
* @param xp Amount of xp to remove
|
||||
*/
|
||||
public void removeXp(SkillType skill, int xp) {
|
||||
public void removeXp(PrimarySkill skill, int xp) {
|
||||
if (skill.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public class PlayerProfile {
|
||||
skillsXp.put(skill, skillsXp.get(skill) - xp);
|
||||
}
|
||||
|
||||
public void removeXp(SkillType skill, float xp) {
|
||||
public void removeXp(PrimarySkill skill, float xp) {
|
||||
if (skill.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ public class PlayerProfile {
|
||||
* @param skill Type of skill to modify
|
||||
* @param level New level value for the skill
|
||||
*/
|
||||
public void modifySkill(SkillType skill, int level) {
|
||||
public void modifySkill(PrimarySkill skill, int level) {
|
||||
if (skill.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class PlayerProfile {
|
||||
* @param skill Type of skill to add levels to
|
||||
* @param levels Number of levels to add
|
||||
*/
|
||||
public void addLevels(SkillType skill, int levels) {
|
||||
public void addLevels(PrimarySkill skill, int levels) {
|
||||
modifySkill(skill, skills.get(skill) + levels);
|
||||
}
|
||||
|
||||
@@ -282,14 +282,14 @@ public class PlayerProfile {
|
||||
* @param skill Type of skill to add experience to
|
||||
* @param xp Number of experience to add
|
||||
*/
|
||||
public void addXp(SkillType skill, float xp) {
|
||||
public void addXp(PrimarySkill skill, float xp) {
|
||||
changed = true;
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
|
||||
Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill);
|
||||
float dividedXP = (xp / parentSkills.size());
|
||||
|
||||
for (SkillType parentSkill : parentSkills) {
|
||||
for (PrimarySkill parentSkill : parentSkills) {
|
||||
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
||||
}
|
||||
}
|
||||
@@ -304,11 +304,11 @@ public class PlayerProfile {
|
||||
*
|
||||
* @return xp Experience amount registered
|
||||
*/
|
||||
public float getRegisteredXpGain(SkillType skillType) {
|
||||
public float getRegisteredXpGain(PrimarySkill primarySkill) {
|
||||
float xp = 0F;
|
||||
|
||||
if (rollingSkillsXp.get(skillType) != null) {
|
||||
xp = rollingSkillsXp.get(skillType);
|
||||
if (rollingSkillsXp.get(primarySkill) != null) {
|
||||
xp = rollingSkillsXp.get(primarySkill);
|
||||
}
|
||||
|
||||
return xp;
|
||||
@@ -318,12 +318,12 @@ public class PlayerProfile {
|
||||
* Register an experience gain
|
||||
* This is used for diminished XP returns
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param primarySkill Skill being used
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void registerXpGain(SkillType skillType, float xp) {
|
||||
gainedSkillsXp.add(new SkillXpGain(skillType, xp));
|
||||
rollingSkillsXp.put(skillType, getRegisteredXpGain(skillType) + xp);
|
||||
public void registerXpGain(PrimarySkill primarySkill, float xp) {
|
||||
gainedSkillsXp.add(new SkillXpGain(primarySkill, xp));
|
||||
rollingSkillsXp.put(primarySkill, getRegisteredXpGain(primarySkill) + xp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,21 +340,21 @@ public class PlayerProfile {
|
||||
/**
|
||||
* Get the amount of Xp remaining before the next level.
|
||||
*
|
||||
* @param skillType Type of skill to check
|
||||
* @param primarySkill Type of skill to check
|
||||
* @return the total amount of Xp until next level
|
||||
*/
|
||||
public int getXpToLevel(SkillType skillType) {
|
||||
int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(skillType);
|
||||
public int getXpToLevel(PrimarySkill primarySkill) {
|
||||
int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkill);
|
||||
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
||||
|
||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType);
|
||||
}
|
||||
|
||||
private int getChildSkillLevel(SkillType skillType) {
|
||||
Set<SkillType> parents = FamilyTree.getParents(skillType);
|
||||
private int getChildSkillLevel(PrimarySkill primarySkill) {
|
||||
Set<PrimarySkill> parents = FamilyTree.getParents(primarySkill);
|
||||
int sum = 0;
|
||||
|
||||
for (SkillType parent : parents) {
|
||||
for (PrimarySkill parent : parents) {
|
||||
sum += Math.min(getSkillLevel(parent), parent.getMaxLevel());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public enum MaterialType {
|
||||
return Material.LEATHER;
|
||||
|
||||
case WOOD:
|
||||
return Material.WOOD;
|
||||
return Material.OAK_PLANKS;
|
||||
|
||||
case STONE:
|
||||
return Material.COBBLESTONE;
|
||||
|
||||
@@ -35,44 +35,44 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public enum SkillType {
|
||||
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SecondaryAbility.DODGE, SecondaryAbility.GRACEFUL_ROLL, SecondaryAbility.ROLL)),
|
||||
ALCHEMY(AlchemyManager.class, Color.FUCHSIA, ImmutableList.of(SecondaryAbility.CATALYSIS, SecondaryAbility.CONCOCTIONS)),
|
||||
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SecondaryAbility.DAZE, SecondaryAbility.RETRIEVE, SecondaryAbility.SKILL_SHOT)),
|
||||
AXES(AxesManager.class, Color.AQUA, AbilityType.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SecondaryAbility.ARMOR_IMPACT, SecondaryAbility.AXE_MASTERY, SecondaryAbility.CRITICAL_HIT, SecondaryAbility.GREATER_IMPACT)),
|
||||
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbility.EXCAVATION_TREASURE_HUNTER)),
|
||||
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
|
||||
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
|
||||
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
|
||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SUPER_REPAIR)),
|
||||
SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SecondaryAbility.ADVANCED_SALVAGE, SecondaryAbility.ARCANE_SALVAGE)),
|
||||
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
|
||||
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
|
||||
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR, SecondaryAbility.PUMMEL)),
|
||||
UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP)),
|
||||
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.LEAF_BLOWER, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS));
|
||||
public enum PrimarySkill {
|
||||
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SubSkill.ACROBATICS_DODGE, SubSkill.ACROBATICS_GRACEFUL_ROLL, SubSkill.ACROBATICS_ROLL)),
|
||||
ALCHEMY(AlchemyManager.class, Color.FUCHSIA, ImmutableList.of(SubSkill.ALCHEMY_CATALYSIS, SubSkill.ALCHEMY_CONCOCTIONS)),
|
||||
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SubSkill.ARCHERY_DAZE, SubSkill.ARCHERY_ARROW_RETRIEVAL, SubSkill.ARCHERY_SKILL_SHOT)),
|
||||
AXES(AxesManager.class, Color.AQUA, SuperAbility.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SubSkill.AXES_SKULL_SPLITTER, SubSkill.AXES_ARMOR_IMPACT, SubSkill.AXES_AXE_MASTERY, SubSkill.AXES_CRITICAL_STRIKES, SubSkill.AXES_GREATER_IMPACT)),
|
||||
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), SuperAbility.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SubSkill.EXCAVATION_GIGA_DRILL_BREAKER, SubSkill.EXCAVATION_TREASURE_HUNTER)),
|
||||
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SubSkill.FISHING_FISHERMANS_DIET, SubSkill.FISHING_TREASURE_HUNTER, SubSkill.FISHING_ICE_FISHING, SubSkill.FISHING_MAGIC_HUNTER, SubSkill.FISHING_MASTER_ANGLER, SubSkill.FISHING_SHAKE)),
|
||||
HERBALISM(HerbalismManager.class, Color.GREEN, SuperAbility.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SubSkill.HERBALISM_FARMERS_DIET, SubSkill.HERBALISM_GREEN_THUMB, SubSkill.HERBALISM_DOUBLE_DROPS, SubSkill.HERBALISM_HYLIAN_LUCK, SubSkill.HERBALISM_SHROOM_THUMB)),
|
||||
MINING(MiningManager.class, Color.GRAY, SuperAbility.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SubSkill.MINING_SUPER_BREAKER, SubSkill.MINING_DEMOLITIONS_EXPERTISE, SubSkill.MINING_BIGGER_BOMBS, SubSkill.MINING_BLAST_MINING, SubSkill.MINING_DOUBLE_DROPS)),
|
||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SubSkill.REPAIR_ARCANE_FORGING, SubSkill.REPAIR_REPAIR_MASTERY, SubSkill.REPAIR_SUPER_REPAIR)),
|
||||
SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SubSkill.SALVAGE_ADVANCED_SALVAGE, SubSkill.SALVAGE_ARCANE_SALVAGE)),
|
||||
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SubSkill.SMELTING_FLUX_MINING, SubSkill.SMELTING_FUEL_EFFICIENCY, SubSkill.SMELTING_SECOND_SMELT)),
|
||||
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbility.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SubSkill.SWORDS_SERRATED_STRIKES, SubSkill.SWORDS_BLEED, SubSkill.SWORDS_COUNTER_ATTACK)),
|
||||
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SubSkill.TAMING_BEAST_LORE, SubSkill.TAMING_CALL_OF_THE_WILD, SubSkill.TAMING_ENVIRONMENTALLY_AWARE, SubSkill.TAMING_FAST_FOOD_SERVICE, SubSkill.TAMING_GORE, SubSkill.TAMING_HOLY_HOUND, SubSkill.TAMING_SHARPENED_CLAWS, SubSkill.TAMING_SHOCK_PROOF, SubSkill.TAMING_THICK_FUR, SubSkill.TAMING_PUMMEL)),
|
||||
UNARMED(UnarmedManager.class, Color.BLACK, SuperAbility.BERSERK, ToolType.FISTS, ImmutableList.of(SubSkill.UNARMED_BERSERK, SubSkill.UNARMED_BLOCK_CRACKER, SubSkill.UNARMED_ARROW_DEFLECT, SubSkill.UNARMED_DISARM, SubSkill.UNARMED_IRON_ARM_STYLE, SubSkill.UNARMED_IRON_GRIP)),
|
||||
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbility.TREE_FELLER, ToolType.AXE, ImmutableList.of(SubSkill.WOODCUTTING_LEAF_BLOWER, SubSkill.WOODCUTTING_BARK_SURGEON, SubSkill.WOODCUTTING_SPLINTER, SubSkill.WOODCUTTING_NATURES_BOUNTY, SubSkill.WOODCUTTING_TREE_FELLER, SubSkill.WOODCUTTING_HARVEST_LUMBER));
|
||||
|
||||
private Class<? extends SkillManager> managerClass;
|
||||
private Color runescapeColor;
|
||||
private AbilityType ability;
|
||||
private SuperAbility ability;
|
||||
private ToolType tool;
|
||||
private List<SecondaryAbility> secondaryAbilities;
|
||||
private List<SubSkill> subSkills;
|
||||
|
||||
public static final List<String> SKILL_NAMES;
|
||||
|
||||
public static final List<SkillType> CHILD_SKILLS;
|
||||
public static final List<SkillType> NON_CHILD_SKILLS;
|
||||
public static final List<PrimarySkill> CHILD_SKILLS;
|
||||
public static final List<PrimarySkill> NON_CHILD_SKILLS;
|
||||
|
||||
public static final List<SkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED);
|
||||
public static final List<SkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
|
||||
public static final List<SkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||
public static final List<PrimarySkill> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED);
|
||||
public static final List<PrimarySkill> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
|
||||
public static final List<PrimarySkill> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||
|
||||
static {
|
||||
List<SkillType> childSkills = new ArrayList<SkillType>();
|
||||
List<SkillType> nonChildSkills = new ArrayList<SkillType>();
|
||||
List<PrimarySkill> childSkills = new ArrayList<PrimarySkill>();
|
||||
List<PrimarySkill> nonChildSkills = new ArrayList<PrimarySkill>();
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
|
||||
for (SkillType skill : values()) {
|
||||
for (PrimarySkill skill : values()) {
|
||||
if (skill.isChildSkill()) {
|
||||
childSkills.add(skill);
|
||||
}
|
||||
@@ -90,23 +90,23 @@ public enum SkillType {
|
||||
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
||||
}
|
||||
|
||||
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SecondaryAbility> secondaryAbilities) {
|
||||
this(managerClass, runescapeColor, null, null, secondaryAbilities);
|
||||
private PrimarySkill(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkill> subSkills) {
|
||||
this(managerClass, runescapeColor, null, null, subSkills);
|
||||
}
|
||||
|
||||
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, AbilityType ability, ToolType tool, List<SecondaryAbility> secondaryAbilities) {
|
||||
private PrimarySkill(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbility ability, ToolType tool, List<SubSkill> subSkills) {
|
||||
this.managerClass = managerClass;
|
||||
this.runescapeColor = runescapeColor;
|
||||
this.ability = ability;
|
||||
this.tool = tool;
|
||||
this.secondaryAbilities = secondaryAbilities;
|
||||
this.subSkills = subSkills;
|
||||
}
|
||||
|
||||
public Class<? extends SkillManager> getManagerClass() {
|
||||
return managerClass;
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
public SuperAbility getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
@@ -119,6 +119,8 @@ public enum SkillType {
|
||||
return Config.getInstance().getLevelCap(this);
|
||||
}
|
||||
|
||||
public int getSkillAbilityGate() { return Config.getInstance().getSkillAbilityGate(this); }
|
||||
|
||||
public boolean getPVPEnabled() {
|
||||
return Config.getInstance().getPVPEnabled(this);
|
||||
}
|
||||
@@ -151,24 +153,24 @@ public enum SkillType {
|
||||
return tool;
|
||||
}
|
||||
|
||||
public List<SecondaryAbility> getSkillAbilities() {
|
||||
return secondaryAbilities;
|
||||
public List<SubSkill> getSkillAbilities() {
|
||||
return subSkills;
|
||||
}
|
||||
|
||||
public double getXpModifier() {
|
||||
return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
|
||||
}
|
||||
|
||||
public static SkillType getSkill(String skillName) {
|
||||
public static PrimarySkill getSkill(String skillName) {
|
||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||
for (SkillType type : values()) {
|
||||
for (PrimarySkill type : values()) {
|
||||
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (SkillType type : values()) {
|
||||
for (PrimarySkill type : values()) {
|
||||
if (type.name().equalsIgnoreCase(skillName)) {
|
||||
return type;
|
||||
}
|
||||
@@ -193,17 +195,17 @@ public enum SkillType {
|
||||
}
|
||||
}
|
||||
|
||||
public static SkillType bySecondaryAbility(SecondaryAbility skillAbility) {
|
||||
for (SkillType type : values()) {
|
||||
if (type.getSkillAbilities().contains(skillAbility)) {
|
||||
public static PrimarySkill bySecondaryAbility(SubSkill subSkill) {
|
||||
for (PrimarySkill type : values()) {
|
||||
if (type.getSkillAbilities().contains(subSkill)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SkillType byAbility(AbilityType ability) {
|
||||
for (SkillType type : values()) {
|
||||
public static PrimarySkill byAbility(SuperAbility ability) {
|
||||
for (PrimarySkill type : values()) {
|
||||
if (type.getAbility() == ability) {
|
||||
return type;
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
public enum SecondaryAbility {
|
||||
/* ACROBATICS */
|
||||
DODGE,
|
||||
GRACEFUL_ROLL,
|
||||
ROLL,
|
||||
|
||||
/* ALCHEMY */
|
||||
CATALYSIS,
|
||||
CONCOCTIONS,
|
||||
|
||||
/* ARCHERY */
|
||||
DAZE,
|
||||
RETRIEVE,
|
||||
SKILL_SHOT,
|
||||
|
||||
/* Axes */
|
||||
ARMOR_IMPACT,
|
||||
AXE_MASTERY,
|
||||
CRITICAL_HIT,
|
||||
GREATER_IMPACT,
|
||||
|
||||
/* Excavation */
|
||||
EXCAVATION_TREASURE_HUNTER,
|
||||
|
||||
/* Fishing */
|
||||
FISHERMANS_DIET,
|
||||
FISHING_TREASURE_HUNTER,
|
||||
ICE_FISHING,
|
||||
MAGIC_HUNTER,
|
||||
MASTER_ANGLER,
|
||||
SHAKE,
|
||||
|
||||
/* Herbalism */
|
||||
FARMERS_DIET,
|
||||
GREEN_THUMB_PLANT,
|
||||
GREEN_THUMB_BLOCK,
|
||||
HERBALISM_DOUBLE_DROPS,
|
||||
HYLIAN_LUCK,
|
||||
SHROOM_THUMB,
|
||||
|
||||
/* Mining */
|
||||
MINING_DOUBLE_DROPS,
|
||||
|
||||
/* Repair */
|
||||
ARCANE_FORGING,
|
||||
REPAIR_MASTERY,
|
||||
SUPER_REPAIR,
|
||||
|
||||
/* Salvage */
|
||||
ADVANCED_SALVAGE,
|
||||
ARCANE_SALVAGE,
|
||||
|
||||
/* Smelting */
|
||||
FLUX_MINING,
|
||||
FUEL_EFFICIENCY,
|
||||
SECOND_SMELT,
|
||||
|
||||
/* Swords */
|
||||
BLEED,
|
||||
COUNTER,
|
||||
|
||||
/* Taming */
|
||||
BEAST_LORE,
|
||||
CALL_OF_THE_WILD,
|
||||
ENVIROMENTALLY_AWARE,
|
||||
FAST_FOOD,
|
||||
GORE,
|
||||
HOLY_HOUND,
|
||||
SHARPENED_CLAWS,
|
||||
SHOCK_PROOF,
|
||||
THICK_FUR,
|
||||
PUMMEL,
|
||||
|
||||
/* Unarmed */
|
||||
BLOCK_CRACKER,
|
||||
DEFLECT,
|
||||
DISARM,
|
||||
IRON_ARM,
|
||||
IRON_GRIP,
|
||||
|
||||
/* Woodcutting */
|
||||
LEAF_BLOWER,
|
||||
WOODCUTTING_DOUBLE_DROPS;
|
||||
}
|
||||
253
src/main/java/com/gmail/nossr50/datatypes/skills/SubSkill.java
Normal file
253
src/main/java/com/gmail/nossr50/datatypes/skills/SubSkill.java
Normal file
@@ -0,0 +1,253 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.ACTIVE;
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.SUPERABILITY;
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.RNG;
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.PVP;
|
||||
|
||||
|
||||
public enum SubSkill {
|
||||
/* !! Warning -- Do not let subskills share a name with any existing PrimarySkill as it will clash with the static import !! */
|
||||
|
||||
/* ACROBATICS */
|
||||
ACROBATICS_DODGE(0, RNG),
|
||||
ACROBATICS_GRACEFUL_ROLL(0, ACTIVE | RNG),
|
||||
ACROBATICS_ROLL(0, RNG),
|
||||
|
||||
/* ALCHEMY */
|
||||
ALCHEMY_CATALYSIS,
|
||||
ALCHEMY_CONCOCTIONS(8),
|
||||
|
||||
/* ARCHERY */
|
||||
ARCHERY_DAZE(0, PVP),
|
||||
ARCHERY_ARROW_RETRIEVAL,
|
||||
ARCHERY_SKILL_SHOT(20),
|
||||
|
||||
/* Axes */
|
||||
AXES_ARMOR_IMPACT,
|
||||
AXES_AXE_MASTERY(4),
|
||||
AXES_CRITICAL_STRIKES,
|
||||
AXES_GREATER_IMPACT,
|
||||
AXES_SKULL_SPLITTER(0, ACTIVE | SUPERABILITY),
|
||||
|
||||
/* Excavation */
|
||||
EXCAVATION_TREASURE_HUNTER,
|
||||
EXCAVATION_GIGA_DRILL_BREAKER(0, SUPERABILITY | ACTIVE),
|
||||
|
||||
/* Fishing */
|
||||
FISHING_FISHERMANS_DIET,
|
||||
FISHING_TREASURE_HUNTER,
|
||||
FISHING_ICE_FISHING,
|
||||
FISHING_MAGIC_HUNTER,
|
||||
FISHING_MASTER_ANGLER,
|
||||
FISHING_SHAKE,
|
||||
|
||||
/* Herbalism */
|
||||
HERBALISM_FARMERS_DIET,
|
||||
HERBALISM_GREEN_THUMB,
|
||||
HERBALISM_DOUBLE_DROPS,
|
||||
HERBALISM_HYLIAN_LUCK,
|
||||
HERBALISM_SHROOM_THUMB,
|
||||
|
||||
/* Mining */
|
||||
MINING_DOUBLE_DROPS,
|
||||
MINING_SUPER_BREAKER(0, SUPERABILITY | ACTIVE),
|
||||
MINING_BLAST_MINING,
|
||||
MINING_BIGGER_BOMBS,
|
||||
MINING_DEMOLITIONS_EXPERTISE,
|
||||
|
||||
/* Repair */
|
||||
REPAIR_ARCANE_FORGING,
|
||||
REPAIR_REPAIR_MASTERY,
|
||||
REPAIR_SUPER_REPAIR,
|
||||
|
||||
/* Salvage */
|
||||
SALVAGE_ADVANCED_SALVAGE,
|
||||
SALVAGE_ARCANE_SALVAGE,
|
||||
|
||||
/* Smelting */
|
||||
SMELTING_FLUX_MINING,
|
||||
SMELTING_FUEL_EFFICIENCY,
|
||||
SMELTING_SECOND_SMELT,
|
||||
|
||||
/* Swords */
|
||||
SWORDS_BLEED,
|
||||
SWORDS_COUNTER_ATTACK,
|
||||
SWORDS_SERRATED_STRIKES,
|
||||
|
||||
/* Taming */
|
||||
TAMING_BEAST_LORE,
|
||||
TAMING_CALL_OF_THE_WILD,
|
||||
TAMING_ENVIRONMENTALLY_AWARE,
|
||||
TAMING_FAST_FOOD_SERVICE,
|
||||
TAMING_GORE,
|
||||
TAMING_HOLY_HOUND,
|
||||
TAMING_SHARPENED_CLAWS,
|
||||
TAMING_SHOCK_PROOF,
|
||||
TAMING_THICK_FUR,
|
||||
TAMING_PUMMEL,
|
||||
|
||||
/* Unarmed */
|
||||
UNARMED_BLOCK_CRACKER,
|
||||
UNARMED_ARROW_DEFLECT,
|
||||
UNARMED_DISARM,
|
||||
UNARMED_IRON_ARM_STYLE,
|
||||
UNARMED_IRON_GRIP,
|
||||
UNARMED_BERSERK(0, ACTIVE | SUPERABILITY),
|
||||
|
||||
/* Woodcutting */
|
||||
WOODCUTTING_TREE_FELLER(5, ACTIVE | SUPERABILITY),
|
||||
WOODCUTTING_LEAF_BLOWER(3),
|
||||
WOODCUTTING_BARK_SURGEON(3, ACTIVE),
|
||||
WOODCUTTING_NATURES_BOUNTY(3),
|
||||
WOODCUTTING_SPLINTER(3),
|
||||
WOODCUTTING_HARVEST_LUMBER(3, RNG);
|
||||
|
||||
private final int numRanks;
|
||||
//TODO: SuperAbility should also contain flags for active by default? Not sure if it should work that way.
|
||||
private final int flags;
|
||||
|
||||
/**
|
||||
* If our SubSkill has more than 1 rank define it
|
||||
* @param numRanks The number of ranks our SubSkill has
|
||||
*/
|
||||
SubSkill(int numRanks, int flags)
|
||||
{
|
||||
this.numRanks = numRanks;
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
SubSkill(int numRanks)
|
||||
{
|
||||
this.numRanks = numRanks;
|
||||
this.flags = 0x00;
|
||||
}
|
||||
|
||||
SubSkill()
|
||||
{
|
||||
this.numRanks = 0;
|
||||
this.flags = 0x00;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bit flags for this subskill
|
||||
* @return The bit flags for this subskill
|
||||
*/
|
||||
public final int getFlags() { return flags; }
|
||||
|
||||
public int getNumRanks()
|
||||
{
|
||||
return numRanks;
|
||||
}
|
||||
|
||||
/**
|
||||
* !!! This relies on the immutable lists in PrimarySkill being populated !!!
|
||||
* If we add skills, those immutable lists need to be updated
|
||||
* @return
|
||||
*/
|
||||
public PrimarySkill getParentSkill() { return PrimarySkill.bySecondaryAbility(this); }
|
||||
|
||||
/**
|
||||
* Returns the permission root address for the advanced.yml for this subskill
|
||||
* @return permission root address in advanced.yml for this subskill
|
||||
*/
|
||||
public String getAdvConfigAddress() {
|
||||
return "Skills." + StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the permission node for this subskill
|
||||
* @return the permission node for this subskill
|
||||
*/
|
||||
public String getPermissionNodeAddress()
|
||||
{
|
||||
//TODO: This could be optimized
|
||||
return "mcmmo.ability." + getParentSkill().toString().toLowerCase() + "." + getConfigName(toString()).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the skill as it is used in advanced.yml and other config files
|
||||
* @return the yaml identifier for this skill
|
||||
*/
|
||||
private String getConfigName(String subSkillName) {
|
||||
/*
|
||||
* Our ENUM constants name is something like PREFIX_SUB_SKILL_NAME
|
||||
* We need to remove the prefix and then format the subskill to follow the naming conventions of our yaml configs
|
||||
*
|
||||
* So this method uses this kind of formatting
|
||||
* "PARENTSKILL_COOL_SUBSKILL_ULTRA" -> "Cool Subskill Ultra" - > "CoolSubskillUltra"
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Find where to begin our substring (after the prefix)
|
||||
*/
|
||||
String endResult = "";
|
||||
int subStringIndex = getSubStringIndex(subSkillName);
|
||||
|
||||
/*
|
||||
* Split the string up so we can capitalize each part
|
||||
*/
|
||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||
if(subskillNameWithoutPrefix.contains("_"))
|
||||
{
|
||||
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
||||
|
||||
for(String string : splitStrings)
|
||||
{
|
||||
endResult += StringUtils.getCapitalized(string);
|
||||
}
|
||||
} else {
|
||||
endResult += StringUtils.getCapitalized(subskillNameWithoutPrefix);
|
||||
}
|
||||
|
||||
return endResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the parent skill from the Locale file
|
||||
* @return The parent skill as defined in the locale
|
||||
*/
|
||||
public String getParentNiceNameLocale()
|
||||
{
|
||||
return LocaleLoader.getString(StringUtils.getCapitalized(getParentSkill().toString())+".SkillName");
|
||||
}
|
||||
|
||||
/**
|
||||
* This finds the substring index for our SubSkill's name after its parent name prefix
|
||||
* @param subSkillName The name to process
|
||||
* @return The value of the substring index after our parent's prefix
|
||||
*/
|
||||
private int getSubStringIndex(String subSkillName) {
|
||||
char[] enumNameCharArray = subSkillName.toCharArray();
|
||||
int subStringIndex = 0;
|
||||
|
||||
//Find where to start our substring for this constants name
|
||||
for (int i = 0; i < enumNameCharArray.length; i++) {
|
||||
if (enumNameCharArray[i] == '_') {
|
||||
subStringIndex = i + 1; //Start the substring after this char
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return subStringIndex;
|
||||
}
|
||||
|
||||
public String getLocaleKeyRoot()
|
||||
{
|
||||
return StringUtils.getCapitalized(getParentSkill().toString())+".SubSkill."+getConfigName(toString());
|
||||
}
|
||||
|
||||
public String getLocaleName()
|
||||
{
|
||||
return LocaleLoader.getString(getLocaleKeyRoot()+".Name");
|
||||
}
|
||||
|
||||
public String getLocaleDescription()
|
||||
{
|
||||
return LocaleLoader.getString(getLocaleKeyRoot()+".Description");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
public class SubSkillFlags {
|
||||
/*
|
||||
* Bitwise Flags
|
||||
* These are so I can establish properties of each subskill quite easily
|
||||
*/
|
||||
public static final byte ACTIVE = 0x01; //Active subskills are ones that aren't passive
|
||||
public static final byte SUPERABILITY = 0x02; //If the subskill is a super ability
|
||||
public static final byte RNG = 0x04; //If the subskill makes use of RNG
|
||||
public static final byte PVP = 0x08; //If the subskill is PVP specific
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public enum AbilityType {
|
||||
public enum SuperAbility {
|
||||
BERSERK(
|
||||
"Unarmed.Skills.Berserk.On",
|
||||
"Unarmed.Skills.Berserk.Off",
|
||||
@@ -77,7 +77,7 @@ public enum AbilityType {
|
||||
private String abilityRefresh;
|
||||
private String abilityPlayerOff;
|
||||
|
||||
private AbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
private SuperAbility(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.abilityOn = abilityOn;
|
||||
this.abilityOff = abilityOff;
|
||||
this.abilityPlayer = abilityPlayer;
|
||||
@@ -4,35 +4,44 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||
|
||||
public class AlchemyPotion {
|
||||
private short dataValue;
|
||||
private Material material;
|
||||
private PotionData data;
|
||||
private String name;
|
||||
private List<String> lore;
|
||||
private List<PotionEffect> effects;
|
||||
private Map<ItemStack, Short> children;
|
||||
private Color color;
|
||||
private Map<ItemStack, String> children;
|
||||
|
||||
public AlchemyPotion(short dataValue, String name, List<String> lore, List<PotionEffect> effects, Map<ItemStack, Short> children) {
|
||||
this.dataValue = dataValue;
|
||||
public AlchemyPotion(Material material, PotionData data, String name, List<String> lore, List<PotionEffect> effects, Color color, Map<ItemStack, String> children) {
|
||||
this.material = material;
|
||||
this.data = data;
|
||||
this.lore = lore;
|
||||
this.name = name;
|
||||
this.effects = effects;
|
||||
this.children = children;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "AlchemyPotion{" + dataValue + ", " + name + ", Effects[" + effects.size() + "], Children[" + children.size() + "]}";
|
||||
return "AlchemyPotion{" + data + ", " + name + ", Effects[" + effects.size() + "], Children[" + children.size() + "]}";
|
||||
}
|
||||
|
||||
public ItemStack toItemStack(int amount) {
|
||||
ItemStack potion = new ItemStack(Material.POTION, amount, this.getDataValue());
|
||||
ItemStack potion = new ItemStack(material, amount);
|
||||
PotionMeta meta = (PotionMeta) potion.getItemMeta();
|
||||
|
||||
meta.setBasePotionData(data);
|
||||
if (this.getName() != null) {
|
||||
meta.setDisplayName(this.getName());
|
||||
}
|
||||
@@ -46,21 +55,29 @@ public class AlchemyPotion {
|
||||
meta.addCustomEffect(effect, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getColor() != null) {
|
||||
meta.setColor(this.getColor());
|
||||
}
|
||||
|
||||
potion.setItemMeta(meta);
|
||||
return potion;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public Potion toPotion(int amount) {
|
||||
return Potion.fromItemStack(this.toItemStack(amount));
|
||||
}
|
||||
|
||||
public short getDataValue() {
|
||||
return dataValue;
|
||||
public PotionData getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setDataValue(short data_value) {
|
||||
this.dataValue = data_value;
|
||||
public void setData(PotionData data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -87,22 +104,65 @@ public class AlchemyPotion {
|
||||
this.effects = effects;
|
||||
}
|
||||
|
||||
public Map<ItemStack, Short> getChildren() {
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public Map<ItemStack, String> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(Map<ItemStack, Short> children) {
|
||||
public void setChildren(Map<ItemStack, String> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public Short getChildDataValue(ItemStack ingredient) {
|
||||
public AlchemyPotion getChild(ItemStack ingredient) {
|
||||
if (!children.isEmpty()) {
|
||||
for (Entry<ItemStack, Short> child : children.entrySet()) {
|
||||
for (Entry<ItemStack, String> child : children.entrySet()) {
|
||||
if (ingredient.isSimilar(child.getKey())) {
|
||||
return child.getValue();
|
||||
return PotionConfig.getInstance().getPotion(child.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isSimilar(ItemStack item) {
|
||||
if (item.getType() != material) {
|
||||
return false;
|
||||
}
|
||||
if (!item.hasItemMeta()) {
|
||||
return false;
|
||||
}
|
||||
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
||||
PotionData that = meta.getBasePotionData();
|
||||
if (data.getType() != that.getType()) {
|
||||
return false;
|
||||
}
|
||||
if (data.isExtended() != that.isExtended()) {
|
||||
return false;
|
||||
}
|
||||
if (data.isUpgraded() != that.isUpgraded()) {
|
||||
return false;
|
||||
}
|
||||
for (PotionEffect effect : effects) {
|
||||
if (!meta.hasCustomEffect(effect.getType())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!meta.hasLore() && !lore.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (!(lore.isEmpty() && !meta.hasLore()) && !meta.getLore().equals(lore)) {
|
||||
return false;
|
||||
}
|
||||
if (!meta.hasDisplayName() && name != null) {
|
||||
return false;
|
||||
}
|
||||
return (name == null && !meta.hasDisplayName()) || meta.getDisplayName().equals(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.gmail.nossr50.datatypes.skills.alchemy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
public enum PotionStage {
|
||||
FIVE(5),
|
||||
@@ -42,26 +45,25 @@ public enum PotionStage {
|
||||
}
|
||||
|
||||
private static boolean isWaterBottle(AlchemyPotion input) {
|
||||
return input.getDataValue() == 0;
|
||||
return input.getData().getType() == PotionType.WATER;
|
||||
}
|
||||
|
||||
public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) {
|
||||
Potion potion = alchemyPotion.toPotion(1);
|
||||
PotionData data = alchemyPotion.getData();
|
||||
List<PotionEffect> effects = alchemyPotion.getEffects();
|
||||
|
||||
int stage = 1;
|
||||
|
||||
// Check if potion isn't awkward or mundane
|
||||
// Check for custom effects added by mcMMO
|
||||
if (potion.getType() != null || !effects.isEmpty()) {
|
||||
// Check if potion has an effect of any sort
|
||||
if (data.getType().getEffectType() != null || !effects.isEmpty()) {
|
||||
stage++;
|
||||
}
|
||||
|
||||
// Check if potion has a glowstone dust amplifier
|
||||
// Else check if the potion has a custom effect with an amplifier added by mcMMO
|
||||
if (potion.getLevel() > 1) {
|
||||
if (data.isUpgraded()) {
|
||||
stage++;
|
||||
}else if(!effects.isEmpty()){
|
||||
} else if(!effects.isEmpty()) {
|
||||
for (PotionEffect effect : effects){
|
||||
if(effect.getAmplifier() > 0){
|
||||
stage++;
|
||||
@@ -71,12 +73,12 @@ public enum PotionStage {
|
||||
}
|
||||
|
||||
// Check if potion has a redstone dust amplifier
|
||||
if (potion.hasExtendedDuration()) {
|
||||
if (data.isExtended()) {
|
||||
stage++;
|
||||
}
|
||||
|
||||
// Check if potion has a gunpowder amplifier
|
||||
if (potion.isSplash()) {
|
||||
if (alchemyPotion.getMaterial() == Material.SPLASH_POTION || alchemyPotion.getMaterial() == Material.LINGERING_POTION) {
|
||||
stage++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.gmail.nossr50.events.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@@ -14,19 +14,19 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
*/
|
||||
public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
protected SkillType skill;
|
||||
protected PrimarySkill skill;
|
||||
protected int skillLevel;
|
||||
protected XPGainReason xpGainReason;
|
||||
|
||||
@Deprecated
|
||||
protected McMMOPlayerExperienceEvent(Player player, SkillType skill) {
|
||||
protected McMMOPlayerExperienceEvent(Player player, PrimarySkill skill) {
|
||||
super(player);
|
||||
this.skill = skill;
|
||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||
this.xpGainReason = XPGainReason.UNKNOWN;
|
||||
}
|
||||
|
||||
protected McMMOPlayerExperienceEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
||||
protected McMMOPlayerExperienceEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||
super(player);
|
||||
this.skill = skill;
|
||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||
@@ -36,7 +36,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
||||
/**
|
||||
* @return The skill involved in this event
|
||||
*/
|
||||
public SkillType getSkill() {
|
||||
public PrimarySkill getSkill() {
|
||||
return skill;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.gmail.nossr50.events.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
@@ -10,11 +10,11 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
*/
|
||||
public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent {
|
||||
@Deprecated
|
||||
public McMMOPlayerLevelChangeEvent(Player player, SkillType skill) {
|
||||
public McMMOPlayerLevelChangeEvent(Player player, PrimarySkill skill) {
|
||||
super(player, skill, XPGainReason.UNKNOWN);
|
||||
}
|
||||
|
||||
public McMMOPlayerLevelChangeEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
||||
public McMMOPlayerLevelChangeEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||
super(player, skill, xpGainReason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.gmail.nossr50.events.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
@@ -12,23 +13,23 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
|
||||
private int levelsLost;
|
||||
|
||||
@Deprecated
|
||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill) {
|
||||
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill) {
|
||||
super(player, skill, XPGainReason.UNKNOWN);
|
||||
this.levelsLost = 1;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill, int levelsLost) {
|
||||
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, int levelsLost) {
|
||||
super(player, skill, XPGainReason.UNKNOWN);
|
||||
this.levelsLost = levelsLost;
|
||||
}
|
||||
|
||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
||||
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||
super(player, skill, xpGainReason);
|
||||
this.levelsLost = 1;
|
||||
}
|
||||
|
||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill, int levelsLost, XPGainReason xpGainReason) {
|
||||
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, int levelsLost, XPGainReason xpGainReason) {
|
||||
super(player, skill, xpGainReason);
|
||||
this.levelsLost = levelsLost;
|
||||
}
|
||||
@@ -46,4 +47,15 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
|
||||
public int getLevelsLost() {
|
||||
return levelsLost;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.gmail.nossr50.events.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
@@ -12,23 +13,23 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
|
||||
private int levelsGained;
|
||||
|
||||
@Deprecated
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill) {
|
||||
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill) {
|
||||
super(player, skill, XPGainReason.UNKNOWN);
|
||||
this.levelsGained = 1;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, int levelsGained) {
|
||||
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, int levelsGained) {
|
||||
super(player, skill, XPGainReason.UNKNOWN);
|
||||
this.levelsGained = levelsGained;
|
||||
}
|
||||
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
||||
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||
super(player, skill, xpGainReason);
|
||||
this.levelsGained = 1;
|
||||
}
|
||||
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, int levelsGained, XPGainReason xpGainReason) {
|
||||
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, int levelsGained, XPGainReason xpGainReason) {
|
||||
super(player, skill, xpGainReason);
|
||||
this.levelsGained = levelsGained;
|
||||
}
|
||||
@@ -46,4 +47,15 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
|
||||
public int getLevelsGained() {
|
||||
return levelsGained;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.gmail.nossr50.events.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
@@ -12,12 +13,12 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
private float xpGained;
|
||||
|
||||
@Deprecated
|
||||
public McMMOPlayerXpGainEvent(Player player, SkillType skill, float xpGained) {
|
||||
public McMMOPlayerXpGainEvent(Player player, PrimarySkill skill, float xpGained) {
|
||||
super(player, skill, XPGainReason.UNKNOWN);
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
public McMMOPlayerXpGainEvent(Player player, SkillType skill, float xpGained, XPGainReason xpGainReason) {
|
||||
public McMMOPlayerXpGainEvent(Player player, PrimarySkill skill, float xpGained, XPGainReason xpGainReason) {
|
||||
super(player, skill, xpGainReason);
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
@@ -51,4 +52,15 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
public void setXpGained(int xpGained) {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.event.inventory.BrewEvent;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
|
||||
public class FakeBrewEvent extends BrewEvent {
|
||||
public FakeBrewEvent(Block brewer, BrewerInventory contents) {
|
||||
super(brewer, contents);
|
||||
public FakeBrewEvent(Block brewer, BrewerInventory contents, int fuelLevel) {
|
||||
super(brewer, contents, fuelLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.gmail.nossr50.events.fake;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
|
||||
public class FakePlayerFishEvent extends PlayerFishEvent {
|
||||
public FakePlayerFishEvent(Player player, Entity entity, Fish hookEntity, State state) {
|
||||
public FakePlayerFishEvent(Player player, Entity entity, FishHook hookEntity, State state) {
|
||||
super(player, entity, hookEntity, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.gmail.nossr50.events.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
/**
|
||||
* Generic event for mcMMO skill handling.
|
||||
*/
|
||||
public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
||||
protected SkillType skill;
|
||||
protected PrimarySkill skill;
|
||||
protected int skillLevel;
|
||||
|
||||
protected McMMOPlayerSkillEvent(Player player, SkillType skill) {
|
||||
protected McMMOPlayerSkillEvent(Player player, PrimarySkill skill) {
|
||||
super(player);
|
||||
this.skill = skill;
|
||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||
@@ -23,7 +23,7 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
||||
/**
|
||||
* @return The skill involved in this event
|
||||
*/
|
||||
public SkillType getSkill() {
|
||||
public PrimarySkill getSkill() {
|
||||
return skill;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.gmail.nossr50.events.skills.abilities;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerAbilityActivateEvent(Player player, SkillType skill) {
|
||||
public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkill skill) {
|
||||
super(player, skill);
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.gmail.nossr50.events.skills.abilities;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
|
||||
public McMMOPlayerAbilityDeactivateEvent(Player player, SkillType skill) {
|
||||
public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkill skill) {
|
||||
super(player, skill);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@ package com.gmail.nossr50.events.skills.abilities;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent {
|
||||
private AbilityType ability;
|
||||
private SuperAbility ability;
|
||||
|
||||
protected McMMOPlayerAbilityEvent(Player player, SkillType skill) {
|
||||
protected McMMOPlayerAbilityEvent(Player player, PrimarySkill skill) {
|
||||
super(player, skill);
|
||||
ability = skill.getAbility();
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
public SuperAbility getAbility() {
|
||||
return ability;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.gmail.nossr50.events.skills.alchemy;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
@@ -15,7 +15,7 @@ public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cance
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) {
|
||||
super(player, SkillType.ALCHEMY);
|
||||
super(player, PrimarySkill.ALCHEMY);
|
||||
this.brewingStand = brewingStand;
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gmail.nossr50.events.skills.alchemy;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
@@ -12,7 +12,7 @@ public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerCatalysisEvent(Player player, double speed) {
|
||||
super(player, SkillType.ALCHEMY);
|
||||
super(player, PrimarySkill.ALCHEMY);
|
||||
this.speed = speed;
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.gmail.nossr50.events.skills.fishing;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerFishingEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
protected McMMOPlayerFishingEvent(Player player) {
|
||||
super(player, SkillType.FISHING);
|
||||
super(player, PrimarySkill.FISHING);
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.events.skills.repair;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implement
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) {
|
||||
super(player, SkillType.REPAIR);
|
||||
super(player, PrimarySkill.REPAIR);
|
||||
this.repairAmount = repairAmount;
|
||||
this.repairMaterial = repairMaterial;
|
||||
this.repairedObject = repairedObject;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gmail.nossr50.events.skills.salvage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
/**
|
||||
* Called just before a player salvages an item with mcMMO.
|
||||
*/
|
||||
public class McMMOPlayerSalvageCheckEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private ItemStack salvageItem;
|
||||
private ItemStack salvageResults;
|
||||
private ItemStack enchantedBook;
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerSalvageCheckEvent(Player player, ItemStack salvageItem, ItemStack salvageResults, ItemStack enchantedBook) {
|
||||
super(player, PrimarySkill.SALVAGE);
|
||||
this.salvageItem = salvageItem;
|
||||
this.salvageResults = salvageResults;
|
||||
this.enchantedBook = enchantedBook;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The item that should get salvaged.
|
||||
*/
|
||||
public ItemStack getSalvageItem() {
|
||||
return salvageItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The results that should be dropped after salvaging.
|
||||
*/
|
||||
public ItemStack getSalvageResults() {
|
||||
return salvageResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The enchanted book that should drop after salvaging or null if no book should be dropped.
|
||||
*/
|
||||
public ItemStack getEnchantedBook() {
|
||||
return enchantedBook;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class SecondaryAbilityEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private SecondaryAbility secondaryAbility;
|
||||
private boolean cancelled;
|
||||
|
||||
public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
|
||||
super(player, SkillType.bySecondaryAbility(secondaryAbility));
|
||||
this.secondaryAbility = secondaryAbility;
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SecondaryAbility involved in the event
|
||||
* @return the SecondaryAbility
|
||||
*/
|
||||
public SecondaryAbility getSecondaryAbility() {
|
||||
return secondaryAbility;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean newValue) {
|
||||
this.cancelled = newValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private SubSkill subSkill;
|
||||
private boolean cancelled;
|
||||
|
||||
public SubSkillEvent(Player player, SubSkill subSkill) {
|
||||
super(player, PrimarySkill.bySecondaryAbility(subSkill));
|
||||
this.subSkill = subSkill;
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SubSkill involved in the event
|
||||
* @return the SubSkill
|
||||
*/
|
||||
public SubSkill getSubSkill() {
|
||||
return subSkill;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean newValue) {
|
||||
this.cancelled = newValue;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
|
||||
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
|
||||
public class SubSkillWeightedActivationCheckEvent extends SubSkillEvent {
|
||||
private double chance;
|
||||
|
||||
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, double chance) {
|
||||
public SubSkillWeightedActivationCheckEvent(Player player, SubSkill ability, double chance) {
|
||||
super(player, ability);
|
||||
this.chance = chance;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.gmail.nossr50.events.skills.unarmed;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
@@ -11,7 +11,7 @@ public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Can
|
||||
private Player defender;
|
||||
|
||||
public McMMOPlayerDisarmEvent(Player defender) {
|
||||
super(defender, SkillType.UNARMED);
|
||||
super(defender, PrimarySkill.UNARMED);
|
||||
this.defender = defender;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -16,44 +32,14 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.runnables.PistonTrackerTask;
|
||||
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
@@ -69,24 +55,15 @@ public class BlockListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
BlockFace direction = event.getDirection();
|
||||
Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished
|
||||
Block movedBlock = event.getBlock();
|
||||
movedBlock = movedBlock.getRelative(direction, 2);
|
||||
|
||||
if (futureEmptyBlock.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Block> blocks = event.getBlocks();
|
||||
|
||||
for (Block b : blocks) {
|
||||
for (Block b : event.getBlocks()) {
|
||||
if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) {
|
||||
Block nextBlock = b.getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(nextBlock);
|
||||
//b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue);
|
||||
movedBlock = b.getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
}
|
||||
}
|
||||
|
||||
// Needed because blocks sometimes don't move when two pistons push towards each other
|
||||
//new PistonTrackerTask(blocks, direction, futureEmptyBlock).runTaskLater(plugin, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,36 +73,15 @@ public class BlockListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
// event.isSticky() always returns false
|
||||
// if (!event.isSticky()){
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Sticky piston return PISTON_MOVING_PIECE and normal piston PISTON_BASE
|
||||
if (event.getBlock().getType() != Material.PISTON_MOVING_PIECE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get opposite direction so we get correct block
|
||||
BlockFace direction = event.getDirection().getOppositeFace();
|
||||
BlockFace direction = event.getDirection();
|
||||
Block movedBlock = event.getBlock().getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
|
||||
// If we're pulling a slime block, it might have something attached to it!
|
||||
if (movedBlock.getRelative(direction).getState().getType() == Material.SLIME_BLOCK) {
|
||||
for (Block block : event.getBlocks()) {
|
||||
movedBlock = block.getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
// // Treat the slime blocks as if it is the sticky piston itself, because pulling
|
||||
// // a slime block with a sticky piston is effectively the same as moving a sticky piston.
|
||||
// new StickyPistonTrackerTask(direction, event.getBlock(), block).runTaskLater(plugin, 2);
|
||||
}
|
||||
|
||||
return;
|
||||
for (Block block : event.getBlocks()) {
|
||||
movedBlock = block.getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
}
|
||||
|
||||
// Needed only because under some circumstances Minecraft doesn't move the block
|
||||
//new StickyPistonTrackerTask(direction, event.getBlock(), movedBlock).runTaskLater(plugin, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,20 +128,34 @@ public class BlockListener implements Listener {
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
if (BlockUtils.shouldBeWatched(blockState) && blockState.getType() != Material.CHORUS_FLOWER) {
|
||||
// Don't count de-barking wood
|
||||
if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) {
|
||||
if (blockState.getType() == Repair.anvilMaterial && PrimarySkill.REPAIR.getPermissions(player)) {
|
||||
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
||||
}
|
||||
else if (blockState.getType() == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player)) {
|
||||
else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkill.SALVAGE.getPermissions(player)) {
|
||||
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockGrow(BlockGrowEvent event)
|
||||
{
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
if (!BlockUtils.shouldBeWatched(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockBreak events.
|
||||
*
|
||||
@@ -216,7 +186,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
/* HERBALISM */
|
||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
||||
@@ -224,28 +194,27 @@ public class BlockListener implements Listener {
|
||||
|
||||
/* Green Terra */
|
||||
if (herbalismManager.canActivateAbility()) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkill.HERBALISM);
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't check the block store here because herbalism has too many unusual edge cases.
|
||||
* Instead, we check it inside the drops handler.
|
||||
*/
|
||||
if (SkillType.HERBALISM.getPermissions(player)) {
|
||||
if (PrimarySkill.HERBALISM.getPermissions(player)) {
|
||||
herbalismManager.herbalismBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && SkillType.MINING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && PrimarySkill.MINING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && PrimarySkill.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||
|
||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||
woodcuttingManager.processTreeFeller(blockState);
|
||||
}
|
||||
@@ -255,11 +224,11 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && SkillType.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && PrimarySkill.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||
excavationManager.excavationBlockCheck(blockState);
|
||||
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbility.GIGA_DRILL_BREAKER)) {
|
||||
excavationManager.gigaDrillBreaker(blockState);
|
||||
}
|
||||
}
|
||||
@@ -286,7 +255,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (Herbalism.isRecentlyRegrown(blockState)) {
|
||||
event.setCancelled(true);
|
||||
@@ -346,33 +315,33 @@ public class BlockListener implements Listener {
|
||||
* We check permissions here before processing activation.
|
||||
*/
|
||||
if (BlockUtils.canActivateAbilities(blockState)) {
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbility.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbility.GIGA_DRILL_BREAKER))) {
|
||||
SkillUtils.removeAbilityBuff(heldItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
if ((mcMMOPlayer.getAbilityMode(SuperAbility.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getAbilityMode(SuperAbility.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkill.HERBALISM);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.WOODCUTTING);
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkill.WOODCUTTING);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.MINING);
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkill.MINING);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.EXCAVATION);
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkill.EXCAVATION);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED);
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkill.UNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,8 +350,8 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
|
||||
player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbility.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
|
||||
player.playSound(blockState.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, Misc.FIZZ_VOLUME, Misc.getFizzPitch());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +373,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
Block block = event.getBlock();
|
||||
BlockState blockState = block.getState();
|
||||
|
||||
@@ -413,15 +382,15 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState)) {
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbility.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState)) {
|
||||
if (mcMMOPlayer.getHerbalismManager().processGreenTerra(blockState)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
|
||||
if (AbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
else if (mcMMOPlayer.getAbilityMode(SuperAbility.BERSERK) && heldItem.getType() == Material.AIR) {
|
||||
if (SuperAbility.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
player.playSound(block.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
}
|
||||
else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||
@@ -431,7 +400,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
player.playSound(blockState.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
player.playSound(blockState.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,13 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
@@ -64,6 +24,23 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public class EntityListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
@@ -131,8 +108,7 @@ public class EntityListener implements Listener {
|
||||
else if (isTracked) {
|
||||
mcMMO.getPlaceStore().setTrue(block);
|
||||
}
|
||||
}
|
||||
else if ((block.getType() == Material.REDSTONE_ORE || block.getType() == Material.GLOWING_REDSTONE_ORE) && (event.getTo() == Material.REDSTONE_ORE || event.getTo() == Material.GLOWING_REDSTONE_ORE)) {
|
||||
} else if ((block.getType() == Material.REDSTONE_ORE)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -154,6 +130,16 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getEntity() instanceof ArmorStand) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getDamager().hasMetadata(mcMMO.funfettiMetadataKey))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
double damage = event.getFinalDamage();
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
@@ -409,6 +395,10 @@ public class EntityListener implements Listener {
|
||||
entity.setCustomNameVisible(entity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
||||
entity.removeMetadata(mcMMO.customVisibleKey, plugin);
|
||||
}
|
||||
|
||||
if (entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
entity.removeMetadata(mcMMO.entityMetadataKey, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,13 +560,14 @@ public class EntityListener implements Listener {
|
||||
* is based on how 'common' the item is We can adjust this quite easily
|
||||
* if we find something is giving too much of a bonus
|
||||
*/
|
||||
switch (player.getItemInHand().getType()) {
|
||||
switch (player.getInventory().getItemInMainHand().getType()) {
|
||||
case BAKED_POTATO: /*
|
||||
* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
case BEETROOT:
|
||||
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
case CARROT_ITEM: /*
|
||||
case CARROT: /*
|
||||
* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
@@ -584,7 +575,7 @@ public class EntityListener implements Listener {
|
||||
* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
case MUSHROOM_SOUP: /*
|
||||
case MUSHROOM_STEW: /*
|
||||
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
@@ -592,34 +583,34 @@ public class EntityListener implements Listener {
|
||||
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_FARMERS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case COOKIE: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case MELON_SLICE: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POISONOUS_POTATO: /*
|
||||
* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER
|
||||
* @ 1000
|
||||
*/
|
||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
||||
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_FARMERS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case COOKED_FISH: /*
|
||||
case COOKED_SALMON: /*
|
||||
* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkill.FISHING_FISHERMANS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
||||
case SALMON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkill.FISHING_FISHERMANS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
@@ -702,4 +693,11 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPigZapEvent(PigZapEvent event) {
|
||||
if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.gmail.nossr50.listeners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.events.fake.FakeBrewEvent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -12,18 +16,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.event.inventory.FurnaceExtractEvent;
|
||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@@ -33,8 +26,6 @@ import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||
@@ -96,7 +87,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_FUEL_EFFICIENCY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +105,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.SMELTING.getPermissions(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,20 +115,19 @@ public class InventoryListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
||||
Block furnaceBlock = event.getBlock();
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
ItemStack result = furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory().getResult() : null;
|
||||
|
||||
if (!ItemUtils.isSmelted(result)) {
|
||||
if (!ItemUtils.isSmelted(new ItemStack(event.getItemType(), event.getItemAmount()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkill.SMELTING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setExpToDrop(UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop()));
|
||||
int exp = UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop());
|
||||
event.setExpToDrop(exp);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@@ -156,7 +146,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
HumanEntity whoClicked = event.getWhoClicked();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkill.ALCHEMY_CONCOCTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,7 +155,7 @@ public class InventoryListener implements Listener {
|
||||
ItemStack clicked = event.getCurrentItem();
|
||||
ItemStack cursor = event.getCursor();
|
||||
|
||||
if ((clicked != null && clicked.getType() == Material.POTION) || (cursor != null && cursor.getType() == Material.POTION)) {
|
||||
if ((clicked != null && (clicked.getType() == Material.POTION || clicked.getType() == Material.SPLASH_POTION || clicked.getType() == Material.LINGERING_POTION)) || (cursor != null && (cursor.getType() == Material.POTION || cursor.getType() == Material.SPLASH_POTION || cursor.getType() == Material.LINGERING_POTION))) {
|
||||
AlchemyPotionBrewer.scheduleCheck(player, stand);
|
||||
return;
|
||||
}
|
||||
@@ -255,7 +245,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
HumanEntity whoClicked = event.getWhoClicked();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkill.ALCHEMY_CONCOCTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -280,6 +270,19 @@ public class InventoryListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
// Apparently sometimes vanilla brewing beats our task listener to the actual brew. We handle this by cancelling the vanilla event and finishing our brew ourselves.
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBrew(BrewEvent event)
|
||||
{
|
||||
if (event instanceof FakeBrewEvent)
|
||||
return;
|
||||
Location location = event.getBlock().getLocation();
|
||||
if (Alchemy.brewingStandMap.containsKey(location)) {
|
||||
Alchemy.brewingStandMap.get(location).finishImmediately();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
|
||||
Inventory inventory = event.getDestination();
|
||||
@@ -296,12 +299,12 @@ public class InventoryListener implements Listener {
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION) {
|
||||
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION && item.getType() != Material.SPLASH_POTION && item.getType() != Material.LINGERING_POTION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getPreventHopperTransferBottles() && item.getType() == Material.POTION) {
|
||||
if (Config.getInstance().getPreventHopperTransferBottles() && (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@@ -321,7 +324,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryOpenEvent(InventoryOpenEvent event) {
|
||||
SkillUtils.removeAbilityBuff(event.getPlayer().getItemInHand());
|
||||
SkillUtils.removeAbilityBuff(event.getPlayer().getInventory().getItemInMainHand());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
|
||||
@@ -1,36 +1,5 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.chat.ChatManagerFactory;
|
||||
import com.gmail.nossr50.chat.PartyChatManager;
|
||||
@@ -39,9 +8,10 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
@@ -53,17 +23,22 @@ import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.HardcoreManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.MobHealthbarUtils;
|
||||
import com.gmail.nossr50.util.Motd;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
@@ -211,7 +186,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerFishHighest(PlayerFishEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.FISHING.getPermissions(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -223,22 +198,25 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(fishingManager.exploitPrevention());
|
||||
}
|
||||
return;
|
||||
|
||||
case CAUGHT_FISH:
|
||||
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
|
||||
Item fishingCatch = (Item) event.getCaught();
|
||||
|
||||
if (Config.getInstance().getFishingOverrideTreasures() && fishingCatch.getItemStack().getType() != Material.RAW_FISH) {
|
||||
fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
|
||||
if (Config.getInstance().getFishingOverrideTreasures() &&
|
||||
fishingCatch.getItemStack().getType() != Material.SALMON &&
|
||||
fishingCatch.getItemStack().getType() != Material.COD &&
|
||||
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
|
||||
fishingCatch.getItemStack().getType() != Material.PUFFERFISH) {
|
||||
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1));
|
||||
}
|
||||
|
||||
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
|
||||
if (Permissions.vanillaXpBoost(player, PrimarySkill.FISHING)) {
|
||||
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
|
||||
}
|
||||
return;
|
||||
|
||||
case IN_GROUND:
|
||||
Block block = player.getTargetBlock((HashSet<Byte>) null, 100);
|
||||
Block block = player.getTargetBlock(null, 100);
|
||||
|
||||
if (fishingManager.canIceFish(block)) {
|
||||
event.setCancelled(true);
|
||||
@@ -263,7 +241,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.FISHING.getPermissions(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,18 +303,18 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
||||
|
||||
if (event.isCancelled()) {
|
||||
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack)) || mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) {
|
||||
if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack) && !Config.getInstance().getUnarmedItemsAsUnarmed()) || mcMMOPlayer.getAbilityMode(SuperAbility.BERSERK)) {
|
||||
boolean pickupSuccess = Unarmed.handleItemPickup(player.getInventory(), drop);
|
||||
boolean cancel = Config.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
|
||||
event.setCancelled(cancel);
|
||||
|
||||
if (pickupSuccess) {
|
||||
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
player.updateInventory();
|
||||
return;
|
||||
}
|
||||
@@ -390,11 +368,6 @@ public class PlayerListener implements Listener {
|
||||
if (plugin.isXPEventEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||
}
|
||||
|
||||
if (Permissions.updateNotifications(player) && plugin.isUpdateAvailable()) {
|
||||
player.sendMessage(LocaleLoader.getString("UpdateChecker.Outdated"));
|
||||
player.sendMessage(LocaleLoader.getString("UpdateChecker.NewAvailable"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,14 +399,14 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
@@ -441,7 +414,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||
/* REPAIR CHECKS */
|
||||
if (type == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
if (type == Repair.anvilMaterial && PrimarySkill.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||
event.setCancelled(true);
|
||||
|
||||
@@ -452,7 +425,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
/* SALVAGE CHECKS */
|
||||
else if (type == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
|
||||
else if (type == Salvage.anvilMaterial && PrimarySkill.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
|
||||
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||
event.setCancelled(true);
|
||||
|
||||
@@ -479,9 +452,9 @@ public class PlayerListener implements Listener {
|
||||
case LEFT_CLICK_BLOCK:
|
||||
type = block.getType();
|
||||
|
||||
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
|
||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||
/* REPAIR CHECKS */
|
||||
if (type == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
if (type == Repair.anvilMaterial && PrimarySkill.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||
|
||||
// Cancel repairing an enchanted item
|
||||
@@ -491,7 +464,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
/* SALVAGE CHECKS */
|
||||
else if (type == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
|
||||
else if (type == Salvage.anvilMaterial && PrimarySkill.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
|
||||
SalvageManager salvageManager = mcMMOPlayer.getSalvageManager();
|
||||
|
||||
// Cancel salvaging an enchanted item
|
||||
@@ -518,15 +491,19 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
BlockState blockState = block.getState();
|
||||
|
||||
@@ -534,15 +511,15 @@ public class PlayerListener implements Listener {
|
||||
if (BlockUtils.canActivateAbilities(blockState)) {
|
||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
||||
if (BlockUtils.canActivateHerbalism(blockState)) {
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.HERBALISM);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.HERBALISM);
|
||||
}
|
||||
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.AXES);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.EXCAVATION);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.MINING);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.SWORDS);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.UNARMED);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.WOODCUTTING);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.AXES);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.EXCAVATION);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.MINING);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.SWORDS);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.UNARMED);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.WOODCUTTING);
|
||||
}
|
||||
|
||||
ChimaeraWing.activationCheck(player);
|
||||
@@ -551,8 +528,20 @@ public class PlayerListener implements Listener {
|
||||
/* GREEN THUMB CHECK */
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
if (heldItem.getType() == Material.BONE_MEAL) {
|
||||
switch (blockState.getType()) {
|
||||
case BEETROOTS:
|
||||
case CARROT:
|
||||
case COCOA:
|
||||
case WHEAT:
|
||||
case NETHER_WART_BLOCK:
|
||||
case POTATO:
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, heldItem.getAmount() - 1));
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.WHEAT_SEEDS, heldItem.getAmount() - 1));
|
||||
|
||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
blockState.update(true);
|
||||
@@ -561,6 +550,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/* SHROOM THUMB CHECK */
|
||||
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
||||
event.setCancelled(true);
|
||||
if (herbalismManager.processShroomThumb(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
@@ -568,16 +558,19 @@ public class PlayerListener implements Listener {
|
||||
break;
|
||||
|
||||
case RIGHT_CLICK_AIR:
|
||||
|
||||
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* ACTIVATION CHECKS */
|
||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.AXES);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.EXCAVATION);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.HERBALISM);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.MINING);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.SWORDS);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.UNARMED);
|
||||
mcMMOPlayer.processAbilityActivation(SkillType.WOODCUTTING);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.AXES);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.EXCAVATION);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.HERBALISM);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.MINING);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.SWORDS);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.UNARMED);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkill.WOODCUTTING);
|
||||
}
|
||||
|
||||
/* ITEM CHECKS */
|
||||
@@ -677,7 +670,7 @@ public class PlayerListener implements Listener {
|
||||
String lowerCaseCommand = command.toLowerCase();
|
||||
|
||||
// Do these ACTUALLY have to be lower case to work properly?
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
for (PrimarySkill skill : PrimarySkill.values()) {
|
||||
String skillName = skill.toString().toLowerCase();
|
||||
String localizedName = skill.getName().toLowerCase();
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -8,7 +10,6 @@ import org.bukkit.event.Listener;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
@@ -19,7 +20,7 @@ public class SelfListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
SkillType skill = event.getSkill();
|
||||
PrimarySkill skill = event.getSkill();
|
||||
|
||||
ScoreboardManager.handleLevelUp(player, skill);
|
||||
|
||||
@@ -44,9 +45,10 @@ public class SelfListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
SkillType skillType = event.getSkill();
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType);
|
||||
|
||||
if (event.getXpGainReason() == XPGainReason.COMMAND)
|
||||
return;
|
||||
PrimarySkill primarySkill = event.getSkill();
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkill);
|
||||
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||
// Diminished returns is turned off
|
||||
return;
|
||||
@@ -61,15 +63,15 @@ public class SelfListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (skillType.isChildSkill()) {
|
||||
if (primarySkill.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float modifiedThreshold = (float) (threshold / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(skillType) - modifiedThreshold) / modifiedThreshold;
|
||||
float modifiedThreshold = (float) (threshold / primarySkill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkill) - modifiedThreshold) / modifiedThreshold;
|
||||
|
||||
if (difference > 0) {
|
||||
// System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(skillType) + " / Threshold value: " + threshold);
|
||||
// System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkill) + " / Threshold value: " + threshold);
|
||||
// System.out.println(difference * 100 + "% over the threshold!");
|
||||
// System.out.println("Previous: " + event.getRawXpGained());
|
||||
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
@@ -26,17 +14,10 @@ import com.gmail.nossr50.config.skills.salvage.SalvageConfigManager;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.listeners.BlockListener;
|
||||
import com.gmail.nossr50.listeners.EntityListener;
|
||||
import com.gmail.nossr50.listeners.InventoryListener;
|
||||
import com.gmail.nossr50.listeners.PlayerListener;
|
||||
import com.gmail.nossr50.listeners.SelfListener;
|
||||
import com.gmail.nossr50.listeners.WorldListener;
|
||||
import com.gmail.nossr50.metrics.MetricsManager;
|
||||
import com.gmail.nossr50.listeners.*;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.CheckDateTask;
|
||||
import com.gmail.nossr50.runnables.SaveTimerTask;
|
||||
import com.gmail.nossr50.runnables.UpdaterResultAsyncTask;
|
||||
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
||||
import com.gmail.nossr50.runnables.database.UserPurgeTask;
|
||||
import com.gmail.nossr50.runnables.party.PartyAutoKickTask;
|
||||
@@ -53,12 +34,7 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.HolidayManager;
|
||||
import com.gmail.nossr50.util.LogFilter;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
|
||||
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
|
||||
@@ -66,8 +42,21 @@ import com.gmail.nossr50.util.experience.FormulaManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
/* Managers */
|
||||
@@ -91,9 +80,6 @@ public class mcMMO extends JavaPlugin {
|
||||
// Jar Stuff
|
||||
public static File mcmmo;
|
||||
|
||||
// Update Check
|
||||
private boolean updateAvailable;
|
||||
|
||||
/* Plugin Checks */
|
||||
private static boolean healthBarPluginEnabled;
|
||||
|
||||
@@ -103,11 +89,14 @@ public class mcMMO extends JavaPlugin {
|
||||
// XP Event Check
|
||||
private boolean xpEventEnabled;
|
||||
|
||||
private boolean classicModeEnabled;
|
||||
|
||||
/* Metadata Values */
|
||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
|
||||
public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace";
|
||||
public final static String tntMetadataKey = "mcMMO: Tracked TNT";
|
||||
public final static String funfettiMetadataKey = "mcMMO: Funfetti";
|
||||
public final static String tntsafeMetadataKey = "mcMMO: Safe TNT";
|
||||
public final static String customNameKey = "mcMMO: Custom Name";
|
||||
public final static String customVisibleKey = "mcMMO: Name Visibility";
|
||||
@@ -181,12 +170,8 @@ public class mcMMO extends JavaPlugin {
|
||||
scheduleTasks();
|
||||
CommandRegistrationManager.registerCommands();
|
||||
|
||||
MetricsManager.setup();
|
||||
|
||||
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
||||
Permissions.generateWorldTeleportPermissions();
|
||||
}
|
||||
@@ -267,14 +252,6 @@ public class mcMMO extends JavaPlugin {
|
||||
return modDirectory;
|
||||
}
|
||||
|
||||
public boolean isUpdateAvailable() {
|
||||
return updateAvailable;
|
||||
}
|
||||
|
||||
public void setUpdateAvailable(boolean available) {
|
||||
this.updateAvailable = available;
|
||||
}
|
||||
|
||||
public boolean isXPEventEnabled() {
|
||||
return xpEventEnabled;
|
||||
}
|
||||
@@ -393,14 +370,6 @@ public class mcMMO extends JavaPlugin {
|
||||
currentFlatfilePath.mkdirs();
|
||||
}
|
||||
|
||||
private void checkForUpdates() {
|
||||
if (!Config.getInstance().getUpdateCheckEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
new UpdaterResultAsyncTask(this).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
||||
private void loadConfigFiles() {
|
||||
// Force the loading of config files
|
||||
TreasureConfig.getInstance();
|
||||
@@ -454,17 +423,19 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void registerCustomRecipes() {
|
||||
if (Config.getInstance().getChimaeraEnabled()) {
|
||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||
}
|
||||
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
|
||||
if (Config.getInstance().getChimaeraEnabled()) {
|
||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||
}
|
||||
|
||||
if (Config.getInstance().getFluxPickaxeEnabled()) {
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.DIAMOND_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.GOLD_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.IRON_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.STONE_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.WOOD_PICKAXE));
|
||||
}
|
||||
if (Config.getInstance().getFluxPickaxeEnabled()) {
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.DIAMOND_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.GOLDEN_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.IRON_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.STONE_PICKAXE));
|
||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.WOODEN_PICKAXE));
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
|
||||
private void scheduleTasks() {
|
||||
@@ -532,4 +503,9 @@ public class mcMMO extends JavaPlugin {
|
||||
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
|
||||
}
|
||||
}
|
||||
|
||||
public InputStreamReader getResourceAsReader(String fileName) {
|
||||
InputStream in = getResource(fileName);
|
||||
return in == null ? null : new InputStreamReader(in, Charsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,353 +0,0 @@
|
||||
package com.gmail.nossr50.metrics;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
import com.turt2live.metrics.EMetrics;
|
||||
import com.turt2live.metrics.Metrics;
|
||||
import com.turt2live.metrics.Metrics.Graph;
|
||||
import com.turt2live.metrics.data.DataEvent;
|
||||
import com.turt2live.metrics.data.DataTracker;
|
||||
import com.turt2live.metrics.tracker.Tracker;
|
||||
|
||||
public class MetricsManager {
|
||||
private static boolean setup = false;
|
||||
|
||||
private static Tracker chimeraUseTracker;
|
||||
private static Tracker chimeraServerUseTracker;
|
||||
|
||||
private static boolean customConfig = false;
|
||||
|
||||
private static DataTracker tracker;
|
||||
private static EMetrics emetrics;
|
||||
|
||||
public static void setup() {
|
||||
if (setup) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getStatsTrackingEnabled()) {
|
||||
try {
|
||||
emetrics = new EMetrics(mcMMO.p);
|
||||
Metrics metrics = emetrics.getMetrics();
|
||||
|
||||
// Timings Graph
|
||||
Graph timingsGraph = metrics.createGraph("Percentage of servers using timings");
|
||||
|
||||
if (mcMMO.p.getServer().getPluginManager().useTimings()) {
|
||||
timingsGraph.addPlotter(new Metrics.Plotter("Enabled") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
timingsGraph.addPlotter(new Metrics.Plotter("Disabled") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Donut Version Graph
|
||||
Graph versionDonutGraph = metrics.createGraph("Donut Version");
|
||||
|
||||
boolean haveVersionInformation = false;
|
||||
boolean isOfficialBuild = false;
|
||||
String officialKey = "e14cfacdd442a953343ebd8529138680";
|
||||
|
||||
String version = mcMMO.p.getDescription().getVersion();
|
||||
|
||||
InputStreamReader isr = new InputStreamReader(mcMMO.p.getResource(".jenkins"));
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
char[] key = new char[32];
|
||||
br.read(key);
|
||||
if (officialKey.equals(String.valueOf(key))) {
|
||||
isOfficialBuild = true;
|
||||
}
|
||||
|
||||
if (version.contains("-")) {
|
||||
String majorVersion = version.substring(0, version.indexOf("-"));
|
||||
String subVersion;
|
||||
|
||||
if (isOfficialBuild) {
|
||||
int startIndex = version.indexOf("-");
|
||||
if (version.substring(startIndex + 1).contains("-")) {
|
||||
subVersion = version.substring(startIndex, version.indexOf("-", startIndex + 1));
|
||||
}
|
||||
else {
|
||||
subVersion = "-release";
|
||||
}
|
||||
}
|
||||
else {
|
||||
subVersion = "-custom";
|
||||
}
|
||||
|
||||
version = majorVersion + "~=~" + subVersion;
|
||||
haveVersionInformation = true;
|
||||
}
|
||||
|
||||
if (haveVersionInformation) {
|
||||
versionDonutGraph.addPlotter(new Metrics.Plotter(version) {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Official v Custom build Graph
|
||||
Graph officialGraph = metrics.createGraph("Built by official ci");
|
||||
|
||||
if (isOfficialBuild) {
|
||||
officialGraph.addPlotter(new Metrics.Plotter("Yes") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
officialGraph.addPlotter(new Metrics.Plotter("No") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Chunkmeta enabled Graph
|
||||
Graph chunkmetaGraph = metrics.createGraph("Uses Chunkmeta");
|
||||
|
||||
if (HiddenConfig.getInstance().getChunkletsEnabled()) {
|
||||
chunkmetaGraph.addPlotter(new Metrics.Plotter("Yes") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
chunkmetaGraph.addPlotter(new Metrics.Plotter("No") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Storage method Graph
|
||||
Graph storageGraph = metrics.createGraph("Storage method");
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
storageGraph.addPlotter(new Metrics.Plotter("SQL") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
storageGraph.addPlotter(new Metrics.Plotter("Flatfile") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Locale Graph
|
||||
Graph localeGraph = metrics.createGraph("Locale");
|
||||
|
||||
localeGraph.addPlotter(new Metrics.Plotter(LocaleLoader.getCurrentLocale().getDisplayLanguage(Locale.US)) {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
// ExperienceFormulaShape Graph
|
||||
Graph experienceFormulaShapeGraph = metrics.createGraph("Experience Formula Shape Graph");
|
||||
|
||||
experienceFormulaShapeGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getFormulaType().toString()) {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
// GlobalMultiplier Graph
|
||||
Graph globalMultiplierGraph = metrics.createGraph("Global Multiplier Graph");
|
||||
|
||||
globalMultiplierGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() + "") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
// GlobalCurveModifier Graph
|
||||
Graph globalCurveModifierGraph = metrics.createGraph("Global Curve Modifier Graph");
|
||||
|
||||
globalCurveModifierGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getMultiplier(FormulaType.LINEAR) + "") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
// GlobalMultiplierGraph Fuzzy Logic Numbers
|
||||
Graph globalMultiplierGraphFuzzy = metrics.createGraph("Global Multiplier Fuzz");
|
||||
|
||||
if (ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() > 1.0) {
|
||||
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Higher") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() < 1.0) {
|
||||
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Lower") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Default") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// GlobalCurveModifier Fuzzy Logic Numbers
|
||||
Graph globalCurveMultiplierGraphFuzzy = metrics.createGraph("Global Curve Multiplier Fuzz");
|
||||
|
||||
if (ExperienceConfig.getInstance().getMultiplier(FormulaType.LINEAR) > 20.0) {
|
||||
globalCurveMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Higher") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (ExperienceConfig.getInstance().getMultiplier(FormulaType.LINEAR) < 20.0) {
|
||||
globalCurveMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Lower") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
globalCurveMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Default") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Chimera Wing Usage Trackers
|
||||
final String chimeraGraphName = "Chimera Wing Usage";
|
||||
|
||||
chimeraUseTracker = EMetrics.createBasicTracker(chimeraGraphName, "Player use");
|
||||
chimeraServerUseTracker = EMetrics.createEnabledTracker(chimeraGraphName, "Server use");
|
||||
|
||||
emetrics.addTracker(chimeraUseTracker);
|
||||
emetrics.addTracker(chimeraServerUseTracker);
|
||||
|
||||
// Chimera Wing Enabled Graph
|
||||
Graph chimeraGraph = metrics.createGraph("Chimera Wing");
|
||||
|
||||
if (Config.getInstance().getChimaeraEnabled()) {
|
||||
chimeraGraph.addPlotter(new Metrics.Plotter("Enabled") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
chimeraGraph.addPlotter(new Metrics.Plotter("Disabled") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Vanilla v Modified config graph
|
||||
Graph customConfigGraph = metrics.createGraph("Modified Configs");
|
||||
|
||||
if (customConfig) {
|
||||
customConfigGraph.addPlotter(new Metrics.Plotter("Edited") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
customConfigGraph.addPlotter(new Metrics.Plotter("Vanilla") {
|
||||
@Override
|
||||
public int getValue() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Debug stuff
|
||||
* tracker = emetrics.getDataTracker();
|
||||
* tracker.enable();
|
||||
* tracker.setFilter(new DataEvent.DataType [] { DataEvent.DataType.SEND_DATA });
|
||||
*/
|
||||
|
||||
emetrics.startMetrics();
|
||||
}
|
||||
catch (IOException e) {
|
||||
mcMMO.p.getLogger().warning("Failed to submit stats.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void chimeraWingUsed() {
|
||||
chimeraUseTracker.increment();
|
||||
chimeraServerUseTracker.increment();
|
||||
}
|
||||
|
||||
public static void customConfig() {
|
||||
customConfig = true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static void debug() {
|
||||
emetrics.getMetrics().flush();
|
||||
|
||||
for (DataEvent event : tracker.getEvents()) {
|
||||
String graphName = event.getGraphName();
|
||||
String colName = event.getTrackerName();
|
||||
int value = event.getValueSent();
|
||||
|
||||
System.out.println("Graph: " + graphName + ", Column: " + colName + ", Value: " + value);
|
||||
}
|
||||
|
||||
tracker.resetEvents();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,5 @@
|
||||
package com.gmail.nossr50.party;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
@@ -26,8 +13,20 @@ import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class PartyManager {
|
||||
private static String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||
@@ -71,9 +70,7 @@ public final class PartyManager {
|
||||
|
||||
removeFromParty(mcMMOPlayer);
|
||||
}
|
||||
else if (!handlePartyChangeEvent(player, null, newPartyName, EventReason.JOINED_PARTY)) {
|
||||
return false;
|
||||
}
|
||||
else return handlePartyChangeEvent(player, null, newPartyName, EventReason.JOINED_PARTY);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -729,7 +726,7 @@ public final class PartyManager {
|
||||
member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level));
|
||||
|
||||
if (levelUpSoundsEnabled) {
|
||||
member.playSound(member.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||
member.playSound(member.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gmail.nossr50.party;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -12,7 +13,6 @@ import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -25,10 +25,10 @@ public final class ShareHandler {
|
||||
*
|
||||
* @param xp Xp without party sharing
|
||||
* @param mcMMOPlayer Player initiating the Xp gain
|
||||
* @param skillType Skill being used
|
||||
* @param primarySkill Skill being used
|
||||
* @return True is the xp has been shared
|
||||
*/
|
||||
public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, SkillType skillType, XPGainReason xpGainReason) {
|
||||
public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, PrimarySkill primarySkill, XPGainReason xpGainReason) {
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
||||
if (party.getXpShareMode() != ShareMode.EQUAL) {
|
||||
@@ -48,7 +48,7 @@ public final class ShareHandler {
|
||||
float splitXp = (float) (xp / partySize * shareBonus);
|
||||
|
||||
for (Player member : nearMembers) {
|
||||
UserManager.getPlayer(member).beginUnsharedXpGain(skillType, splitXp, xpGainReason);
|
||||
UserManager.getPlayer(member).beginUnsharedXpGain(primarySkill, splitXp, xpGainReason);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -157,7 +157,7 @@ public final class ShareHandler {
|
||||
|
||||
private static void awardDrop(Player winningPlayer, ItemStack drop) {
|
||||
if (winningPlayer.getInventory().addItem(drop).size() != 0) {
|
||||
winningPlayer.getWorld().dropItemNaturally(winningPlayer.getLocation(), drop);
|
||||
winningPlayer.getWorld().dropItem(winningPlayer.getLocation(), drop);
|
||||
}
|
||||
|
||||
winningPlayer.updateInventory();
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
import net.gravitydevelopment.updater.mcmmo.Updater;
|
||||
|
||||
public class UpdaterResultAsyncTask extends BukkitRunnable {
|
||||
private mcMMO plugin;
|
||||
|
||||
public UpdaterResultAsyncTask(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Updater updater = new Updater(plugin, 31030, plugin.mcmmo, Updater.UpdateType.NO_DOWNLOAD, false);
|
||||
|
||||
if (updater.getResult() != Updater.UpdateResult.UPDATE_AVAILABLE) {
|
||||
plugin.setUpdateAvailable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (updater.getLatestType().equals("beta") && !Config.getInstance().getPreferBeta()) {
|
||||
plugin.setUpdateAvailable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.setUpdateAvailable(true);
|
||||
plugin.getLogger().info(LocaleLoader.getString("UpdateChecker.Outdated"));
|
||||
plugin.getLogger().info(LocaleLoader.getString("UpdateChecker.NewAvailable"));
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class McrankCommandAsyncTask extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Map<SkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
||||
Map<PrimarySkill, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
||||
|
||||
new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat).runTaskLater(mcMMO.p, 1);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.gmail.nossr50.runnables.commands;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
@@ -15,12 +15,12 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
* Display the results of McrankCommandAsyncTask to the sender.
|
||||
*/
|
||||
public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
private final Map<SkillType, Integer> skills;
|
||||
private final Map<PrimarySkill, Integer> skills;
|
||||
private final CommandSender sender;
|
||||
private final String playerName;
|
||||
private final boolean useBoard, useChat;
|
||||
|
||||
McrankCommandDisplayTask(Map<SkillType, Integer> skills, CommandSender sender, String playerName, boolean useBoard, boolean useChat) {
|
||||
McrankCommandDisplayTask(Map<PrimarySkill, Integer> skills, CommandSender sender, String playerName, boolean useBoard, boolean useChat) {
|
||||
this.skills = skills;
|
||||
this.sender = sender;
|
||||
this.playerName = playerName;
|
||||
@@ -47,7 +47,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
|
||||
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
if (!skill.getPermissions(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -8,17 +8,17 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
public class MctopCommandAsyncTask extends BukkitRunnable {
|
||||
private final CommandSender sender;
|
||||
private final SkillType skill;
|
||||
private final PrimarySkill skill;
|
||||
private final int page;
|
||||
private final boolean useBoard, useChat;
|
||||
|
||||
public MctopCommandAsyncTask(int page, SkillType skill, CommandSender sender, boolean useBoard, boolean useChat) {
|
||||
public MctopCommandAsyncTask(int page, PrimarySkill skill, CommandSender sender, boolean useBoard, boolean useChat) {
|
||||
Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off");
|
||||
Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient");
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user