mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 01:42:32 +01:00
Compare commits
56 Commits
2.0.0
...
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 |
@@ -7,12 +7,61 @@ Key:
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 2.0.00
|
||||
= 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 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
|
||||
|
||||
11
README.md
11
README.md
@@ -1,16 +1,21 @@
|
||||
# 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: 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
|
||||
|
||||
17
pom.xml
17
pom.xml
@@ -2,15 +2,16 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.0.0-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>
|
||||
@@ -121,11 +122,17 @@
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13.1-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
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,7 +40,7 @@ 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;
|
||||
@@ -65,7 +65,7 @@ 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;
|
||||
@@ -116,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();
|
||||
}
|
||||
@@ -124,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));
|
||||
}
|
||||
@@ -141,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;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
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;
|
||||
@@ -24,7 +24,7 @@ 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:
|
||||
@@ -69,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;
|
||||
@@ -112,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,10 +1,12 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
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;
|
||||
|
||||
@@ -34,7 +36,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
private boolean canShroomThumb;
|
||||
|
||||
public HerbalismCommand() {
|
||||
super(SkillType.HERBALISM);
|
||||
super(PrimarySkill.HERBALISM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,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];
|
||||
}
|
||||
@@ -84,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.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.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
|
||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
||||
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
|
||||
@@ -162,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,8 +1,8 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
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;
|
||||
@@ -11,7 +11,9 @@ 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;
|
||||
|
||||
@@ -41,7 +43,7 @@ public class RepairCommand extends SkillCommand {
|
||||
private int stoneLevel;
|
||||
|
||||
public RepairCommand() {
|
||||
super(SkillType.REPAIR);
|
||||
super(PrimarySkill.REPAIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,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];
|
||||
}
|
||||
@@ -73,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);
|
||||
@@ -155,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.ENVIRONMENTALLY_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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.gmail.nossr50.config;
|
||||
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;
|
||||
@@ -244,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); }
|
||||
@@ -350,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); }
|
||||
@@ -438,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); }
|
||||
@@ -451,9 +462,9 @@ 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)
|
||||
@@ -471,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); }
|
||||
@@ -488,6 +502,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
|
||||
/* 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); }
|
||||
@@ -507,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")); }
|
||||
@@ -519,6 +541,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
/* Woodcutting */
|
||||
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); }
|
||||
@@ -531,16 +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); }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gmail.nossr50.config.experience;
|
||||
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;
|
||||
@@ -160,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 */
|
||||
@@ -187,7 +187,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
|
||||
/* Materials */
|
||||
public int getXp(SkillType skill, Material data)
|
||||
public int getXp(PrimarySkill skill, Material data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
@@ -203,7 +203,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(SkillType skill, BlockData data)
|
||||
public int getXp(PrimarySkill skill, BlockData data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
@@ -218,7 +218,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isSkillBlock(SkillType skill, Material data)
|
||||
public boolean isSkillBlock(PrimarySkill skill, Material data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
@@ -231,7 +231,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
public boolean isSkillBlock(SkillType skill, BlockData data)
|
||||
public boolean isSkillBlock(PrimarySkill skill, BlockData data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,8 +6,8 @@ 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;
|
||||
@@ -226,22 +226,22 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||
+ ", fishing = ?, alchemy = ?, total = ? 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(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 (SkillType skillType : SkillType.NON_CHILD_SKILLS)
|
||||
total += profile.getSkillLevel(skillType);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS)
|
||||
total += profile.getSkillLevel(primarySkill);
|
||||
statement.setInt(14, total);
|
||||
statement.setInt(15, id);
|
||||
success &= (statement.executeUpdate() != 0);
|
||||
@@ -256,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();
|
||||
@@ -281,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();
|
||||
@@ -319,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();
|
||||
@@ -356,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;
|
||||
@@ -365,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 " +
|
||||
@@ -393,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;
|
||||
}
|
||||
}
|
||||
@@ -880,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);
|
||||
@@ -1039,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;
|
||||
@@ -1052,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));
|
||||
@@ -1209,10 +1209,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ 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;
|
||||
@@ -61,7 +61,7 @@ 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;
|
||||
@@ -76,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>();
|
||||
|
||||
@@ -107,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) {
|
||||
@@ -119,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()) {
|
||||
@@ -130,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);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -197,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();
|
||||
}
|
||||
@@ -209,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);
|
||||
}
|
||||
|
||||
@@ -219,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);
|
||||
}
|
||||
|
||||
@@ -229,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);
|
||||
}
|
||||
|
||||
@@ -239,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);
|
||||
}
|
||||
|
||||
@@ -364,6 +365,14 @@ public class McMMOPlayer {
|
||||
godMode = !godMode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Party Chat Spy
|
||||
*/
|
||||
|
||||
public boolean isPartyChatSpying() { return chatSpy; }
|
||||
|
||||
public void togglePartyChatSpying() { chatSpy = !chatSpy;}
|
||||
|
||||
/*
|
||||
* Skill notifications
|
||||
*/
|
||||
@@ -384,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);
|
||||
}
|
||||
@@ -399,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) {
|
||||
@@ -407,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);
|
||||
}
|
||||
@@ -433,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) {
|
||||
@@ -448,56 +457,56 @@ 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;
|
||||
}
|
||||
|
||||
@@ -505,7 +514,7 @@ public class McMMOPlayer {
|
||||
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)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -675,16 +684,16 @@ 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.getInventory().getItemInMainHand());
|
||||
@@ -694,7 +703,7 @@ public class McMMOPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
return PerksUtils.handleXpPerks(player, xp, skillType);
|
||||
return PerksUtils.handleXpPerks(player, xp, primarySkill);
|
||||
}
|
||||
|
||||
public void checkGodMode() {
|
||||
@@ -716,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);
|
||||
|
||||
@@ -726,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) {
|
||||
@@ -733,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));
|
||||
}
|
||||
|
||||
@@ -759,14 +781,14 @@ 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;
|
||||
}
|
||||
@@ -781,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();
|
||||
|
||||
/*
|
||||
@@ -795,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) {
|
||||
@@ -816,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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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.ENVIRONMENTALLY_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,
|
||||
ENVIRONMENTALLY_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;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,9 +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;
|
||||
|
||||
/**
|
||||
@@ -13,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;
|
||||
}
|
||||
|
||||
@@ -1,9 +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;
|
||||
|
||||
/**
|
||||
@@ -13,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;
|
||||
}
|
||||
|
||||
@@ -1,9 +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;
|
||||
|
||||
/**
|
||||
@@ -13,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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,7 +4,7 @@ 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.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ public class McMMOPlayerSalvageCheckEvent extends McMMOPlayerSkillEvent implemen
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerSalvageCheckEvent(Player player, ItemStack salvageItem, ItemStack salvageResults, ItemStack enchantedBook) {
|
||||
super(player, SkillType.SALVAGE);
|
||||
super(player, PrimarySkill.SALVAGE);
|
||||
this.salvageItem = salvageItem;
|
||||
this.salvageResults = salvageResults;
|
||||
this.enchantedBook = enchantedBook;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.gmail.nossr50.listeners;
|
||||
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.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;
|
||||
@@ -136,10 +136,10 @@ public class BlockListener implements Listener {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -194,26 +194,26 @@ 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);
|
||||
@@ -224,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);
|
||||
}
|
||||
}
|
||||
@@ -318,30 +318,30 @@ public class BlockListener implements Listener {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ 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()) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -382,13 +382,13 @@ 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.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gmail.nossr50.listeners;
|
||||
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;
|
||||
@@ -583,7 +583,7 @@ 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;
|
||||
@@ -595,7 +595,7 @@ public class EntityListener implements Listener {
|
||||
* @ 1000
|
||||
*/
|
||||
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 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.farmersDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
@@ -604,13 +604,13 @@ public class EntityListener implements Listener {
|
||||
* 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 SALMON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 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.fishermansDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -2,8 +2,9 @@ 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 com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -25,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;
|
||||
@@ -88,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;
|
||||
}
|
||||
|
||||
@@ -106,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;
|
||||
}
|
||||
|
||||
@@ -123,7 +122,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkill.SMELTING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,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;
|
||||
}
|
||||
|
||||
@@ -246,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ 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;
|
||||
@@ -186,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;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public class PlayerListener implements Listener {
|
||||
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;
|
||||
@@ -241,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;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack) && !Config.getInstance().getUnarmedItemsAsUnarmed()) || 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);
|
||||
@@ -414,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);
|
||||
|
||||
@@ -425,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);
|
||||
|
||||
@@ -454,7 +454,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();
|
||||
|
||||
// Cancel repairing an enchanted item
|
||||
@@ -464,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
|
||||
@@ -511,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);
|
||||
@@ -564,13 +564,13 @@ public class PlayerListener implements Listener {
|
||||
|
||||
/* 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 */
|
||||
@@ -670,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,6 @@
|
||||
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;
|
||||
@@ -9,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;
|
||||
@@ -20,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);
|
||||
|
||||
@@ -47,8 +47,8 @@ public class SelfListener implements Listener {
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
if (event.getXpGainReason() == XPGainReason.COMMAND)
|
||||
return;
|
||||
SkillType skillType = event.getSkill();
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType);
|
||||
PrimarySkill primarySkill = event.getSkill();
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkill);
|
||||
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||
// Diminished returns is turned off
|
||||
return;
|
||||
@@ -63,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)));
|
||||
|
||||
@@ -47,7 +47,6 @@ import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -90,6 +89,8 @@ 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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.runnables.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
@@ -18,11 +18,11 @@ import java.util.List;
|
||||
public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
private final List<PlayerStat> userStats;
|
||||
private final CommandSender sender;
|
||||
private final SkillType skill;
|
||||
private final PrimarySkill skill;
|
||||
private final int page;
|
||||
private final boolean useBoard, useChat;
|
||||
|
||||
MctopCommandDisplayTask(List<PlayerStat> userStats, int page, SkillType skill, CommandSender sender, boolean useBoard, boolean useChat) {
|
||||
MctopCommandDisplayTask(List<PlayerStat> userStats, int page, PrimarySkill skill, CommandSender sender, boolean useBoard, boolean useChat) {
|
||||
this.userStats = userStats;
|
||||
this.page = page;
|
||||
this.skill = skill;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.runnables.database;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@@ -9,7 +10,6 @@ import com.gmail.nossr50.database.DatabaseManager;
|
||||
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.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -59,20 +59,20 @@ public class FormulaConversionTask extends BukkitRunnable {
|
||||
private void editValues(PlayerProfile profile) {
|
||||
mcMMO.p.debug("========================================================================");
|
||||
mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":");
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
int oldLevel = profile.getSkillLevel(skillType);
|
||||
int oldXPLevel = profile.getSkillXpLevel(skillType);
|
||||
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||
int oldLevel = profile.getSkillLevel(primarySkill);
|
||||
int oldXPLevel = profile.getSkillXpLevel(primarySkill);
|
||||
int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel);
|
||||
|
||||
if (totalOldXP == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int[] newExperienceValues = mcMMO.getFormulaManager().calculateNewLevel(skillType, (int) Math.floor(totalOldXP / ExperienceConfig.getInstance().getExpModifier()), formulaType);
|
||||
int[] newExperienceValues = mcMMO.getFormulaManager().calculateNewLevel(primarySkill, (int) Math.floor(totalOldXP / ExperienceConfig.getInstance().getExpModifier()), formulaType);
|
||||
int newLevel = newExperienceValues[0];
|
||||
int newXPlevel = newExperienceValues[1];
|
||||
|
||||
mcMMO.p.debug(" Skill: " + skillType.toString());
|
||||
mcMMO.p.debug(" Skill: " + primarySkill.toString());
|
||||
|
||||
mcMMO.p.debug(" OLD:");
|
||||
mcMMO.p.debug(" Level: " + oldLevel);
|
||||
@@ -84,8 +84,8 @@ public class FormulaConversionTask extends BukkitRunnable {
|
||||
mcMMO.p.debug(" XP " + newXPlevel);
|
||||
mcMMO.p.debug("------------------------------------------------------------------------");
|
||||
|
||||
profile.modifySkill(skillType, newLevel);
|
||||
profile.setSkillXpLevel(skillType, newXPlevel);
|
||||
profile.modifySkill(primarySkill, newLevel);
|
||||
profile.setSkillXpLevel(primarySkill, newXPlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
|
||||
public class AbilityCooldownTask extends BukkitRunnable {
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private AbilityType ability;
|
||||
private SuperAbility ability;
|
||||
|
||||
public AbilityCooldownTask(McMMOPlayer mcMMOPlayer, AbilityType ability) {
|
||||
public AbilityCooldownTask(McMMOPlayer mcMMOPlayer, SuperAbility ability) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -8,7 +9,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
@@ -17,9 +17,9 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class AbilityDisableTask extends BukkitRunnable {
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private AbilityType ability;
|
||||
private SuperAbility ability;
|
||||
|
||||
public AbilityDisableTask(McMMOPlayer mcMMOPlayer, AbilityType ability) {
|
||||
public AbilityDisableTask(McMMOPlayer mcMMOPlayer, SuperAbility ability) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
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.events.skills.alchemy.McMMOPlayerBrewEvent;
|
||||
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
@@ -38,8 +38,8 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
brewSpeed = DEFAULT_BREW_SPEED;
|
||||
brewTimer = DEFAULT_BREW_TICKS;
|
||||
|
||||
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
|
||||
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.ALCHEMY));
|
||||
if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CATALYSIS)) {
|
||||
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkill.ALCHEMY));
|
||||
|
||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
public class AwardCombatXpTask extends BukkitRunnable {
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private double baseXp;
|
||||
private SkillType skillType;
|
||||
private PrimarySkill primarySkill;
|
||||
private LivingEntity target;
|
||||
private XPGainReason xpGainReason;
|
||||
private double baseHealth;
|
||||
|
||||
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target, XPGainReason xpGainReason) {
|
||||
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, PrimarySkill primarySkill, double baseXp, LivingEntity target, XPGainReason xpGainReason) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.skillType = skillType;
|
||||
this.primarySkill = primarySkill;
|
||||
this.baseXp = baseXp;
|
||||
this.target = target;
|
||||
this.xpGainReason = xpGainReason;
|
||||
@@ -39,6 +39,6 @@ public class AwardCombatXpTask extends BukkitRunnable {
|
||||
damage += health;
|
||||
}
|
||||
|
||||
mcMMOPlayer.beginXpGain(skillType, (int) (damage * baseXp), xpGainReason);
|
||||
mcMMOPlayer.beginXpGain(primarySkill, (int) (damage * baseXp), xpGainReason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.skills.PerksUtils;
|
||||
|
||||
public abstract class SkillManager {
|
||||
protected McMMOPlayer mcMMOPlayer;
|
||||
protected int activationChance;
|
||||
protected SkillType skill;
|
||||
protected PrimarySkill skill;
|
||||
|
||||
public SkillManager(McMMOPlayer mcMMOPlayer, SkillType skill) {
|
||||
public SkillManager(McMMOPlayer mcMMOPlayer, PrimarySkill skill) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.activationChance = PerksUtils.handleLuckyPerks(mcMMOPlayer.getPlayer(), skill);
|
||||
this.skill = skill;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.skills.acrobatics;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@@ -10,8 +12,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
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.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
@@ -25,15 +26,15 @@ public class AcrobaticsManager extends SkillManager {
|
||||
Location lastFallLocation;
|
||||
|
||||
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.ACROBATICS);
|
||||
super(mcMMOPlayer, PrimarySkill.ACROBATICS);
|
||||
}
|
||||
|
||||
public boolean canRoll() {
|
||||
return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ROLL);
|
||||
return !exploitPrevention() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ACROBATICS_ROLL);
|
||||
}
|
||||
|
||||
public boolean canDodge(Entity damager) {
|
||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DODGE)) {
|
||||
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ACROBATICS_DODGE)) {
|
||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
||||
return false;
|
||||
}
|
||||
@@ -54,7 +55,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
||||
Player player = getPlayer();
|
||||
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.DODGE, player, getSkillLevel(), activationChance)) {
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ACROBATICS_DODGE, player, this.skill, getSkillLevel(), activationChance)) {
|
||||
ParticleEffectUtils.playDodgeEffect(player);
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
@@ -81,13 +82,13 @@ public class AcrobaticsManager extends SkillManager {
|
||||
public double rollCheck(double damage) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (player.isSneaking() && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL)) {
|
||||
if (player.isSneaking() && Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_GRACEFUL_ROLL)) {
|
||||
return gracefulRollCheck(damage);
|
||||
}
|
||||
|
||||
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
|
||||
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.ROLL, player, getSkillLevel(), activationChance)) {
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ACROBATICS_ROLL, player, this.skill, getSkillLevel(), activationChance)) {
|
||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
||||
applyXpGain(calculateRollXP(damage, true), XPGainReason.PVE);
|
||||
|
||||
@@ -111,7 +112,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
private double gracefulRollCheck(double damage) {
|
||||
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
|
||||
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.GRACEFUL_ROLL, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ACROBATICS_GRACEFUL_ROLL, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
|
||||
applyXpGain(calculateRollXP(damage, true), XPGainReason.PVE);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
@@ -17,7 +17,7 @@ public class AlchemyManager extends SkillManager {
|
||||
private final double LUCKY_MODIFIER = 4.0 / 3.0;
|
||||
|
||||
public AlchemyManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.ALCHEMY);
|
||||
super(mcMMOPlayer, PrimarySkill.ALCHEMY);
|
||||
}
|
||||
|
||||
public int getTier() {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||
import com.gmail.nossr50.events.fake.FakeBrewEvent;
|
||||
@@ -94,7 +94,7 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
private static List<ItemStack> getValidIngredients(Player player) {
|
||||
return PotionConfig.getInstance().getIngredients((player == null || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
|
||||
return PotionConfig.getInstance().getIngredients((player == null || !Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
|
||||
}
|
||||
|
||||
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
||||
|
||||
@@ -4,8 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
@@ -16,8 +19,7 @@ public class Archery {
|
||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
||||
|
||||
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
|
||||
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage();
|
||||
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
|
||||
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier();
|
||||
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||
|
||||
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
||||
@@ -62,4 +64,19 @@ public class Archery {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Every rank we increase Skill Shot's bonus damage % by the IncreaseDamage percentage value from advanced.yml
|
||||
* Divide end result by 100.0D to get proper scale
|
||||
* Damage is capped in advanced.yml by Archery.SkillShot.MaxDamage
|
||||
*
|
||||
* @param player The target player
|
||||
* @param oldDamage The raw damage of the arrow before we add bonus damage
|
||||
* @return The damage that the arrow will deal after we've added bonus damage, damage is capped by Archery.SkillShot.MaxDamage
|
||||
*/
|
||||
public static double getSkillShotBonusDamage(Player player, double oldDamage)
|
||||
{
|
||||
double damageBonusPercent = ((RankUtils.getRank(player, SubSkill.ARCHERY_SKILL_SHOT)) * Archery.skillShotIncreasePercentage) / 100.0D;
|
||||
return Math.min(oldDamage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.skills.archery;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@@ -9,8 +11,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
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.PrimarySkill;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
@@ -20,19 +21,19 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class ArcheryManager extends SkillManager {
|
||||
public ArcheryManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.ARCHERY);
|
||||
super(mcMMOPlayer, PrimarySkill.ARCHERY);
|
||||
}
|
||||
|
||||
public boolean canDaze(LivingEntity target) {
|
||||
return target instanceof Player && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DAZE);
|
||||
return target instanceof Player && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ARCHERY_DAZE);
|
||||
}
|
||||
|
||||
public boolean canSkillShot() {
|
||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SKILL_SHOT);
|
||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ARCHERY_SKILL_SHOT);
|
||||
}
|
||||
|
||||
public boolean canRetrieveArrows() {
|
||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.RETRIEVE);
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ARCHERY_ARROW_RETRIEVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +59,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param target The {@link LivingEntity} damaged by the arrow
|
||||
*/
|
||||
public void retrieveArrows(LivingEntity target) {
|
||||
if (SkillUtils.activationSuccessful(SecondaryAbility.RETRIEVE, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ARCHERY_ARROW_RETRIEVAL, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
Archery.incrementTrackerValue(target);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param defender The {@link Player} being affected by the ability
|
||||
*/
|
||||
public double daze(Player defender) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.DAZE, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ARCHERY_DAZE, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -91,17 +92,15 @@ public class ArcheryManager extends SkillManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the effects of the Skill Shot ability
|
||||
* Calculates the damage to deal after Skill Shot has been applied
|
||||
*
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @param oldDamage The raw damage value of this arrow before we modify it
|
||||
*/
|
||||
public double skillShot(double damage) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.SKILL_SHOT, getPlayer())) {
|
||||
return damage;
|
||||
public double skillShot(double oldDamage) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.ALWAYS_FIRES, SubSkill.ARCHERY_SKILL_SHOT, getPlayer(), null, 0, 0)) {
|
||||
return oldDamage;
|
||||
}
|
||||
|
||||
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
|
||||
|
||||
return Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
|
||||
return Archery.getSkillShotBonusDamage(getPlayer(), oldDamage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.gmail.nossr50.skills.axes;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
|
||||
public class Axes {
|
||||
public static double axeMasteryMaxBonus = AdvancedConfig.getInstance().getAxeMasteryBonusMax();
|
||||
public static int axeMasteryMaxBonusLevel = AdvancedConfig.getInstance().getAxeMasteryMaxBonusLevel();
|
||||
public static double axeMasteryRankDamageMultiplier = AdvancedConfig.getInstance().getAxeMasteryRankDamageMultiplier();
|
||||
|
||||
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalHitPVPModifier();
|
||||
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalHitPVEModifier();
|
||||
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalStrikesPVPModifier();
|
||||
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalStrikesPVEModifier();
|
||||
|
||||
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
|
||||
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
|
||||
@@ -32,4 +35,14 @@ public class Axes {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For every rank in Axe Mastery we add RankDamageMultiplier to get the total bonus damage from Axe Mastery
|
||||
* @param player The target player
|
||||
* @return The axe mastery bonus damage which will be added to their attack
|
||||
*/
|
||||
public static double getAxeMasteryBonusDamage(Player player)
|
||||
{
|
||||
return RankUtils.getRank(player, SubSkill.AXES_AXE_MASTERY) * Axes.axeMasteryRankDamageMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,48 +2,46 @@ package com.gmail.nossr50.skills.axes;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.util.skills.*;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
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.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
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.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class AxesManager extends SkillManager {
|
||||
public AxesManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.AXES);
|
||||
super(mcMMOPlayer, PrimarySkill.AXES);
|
||||
}
|
||||
|
||||
public boolean canUseAxeMastery() {
|
||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.AXE_MASTERY);
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.AXES_AXE_MASTERY);
|
||||
}
|
||||
|
||||
public boolean canCriticalHit(LivingEntity target) {
|
||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.CRITICAL_HIT);
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.AXES_CRITICAL_STRIKES);
|
||||
}
|
||||
|
||||
public boolean canImpact(LivingEntity target) {
|
||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ARMOR_IMPACT) && Axes.hasArmor(target);
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.AXES_ARMOR_IMPACT) && Axes.hasArmor(target);
|
||||
}
|
||||
|
||||
public boolean canGreaterImpact(LivingEntity target) {
|
||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.GREATER_IMPACT) && !Axes.hasArmor(target);
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.AXES_GREATER_IMPACT) && !Axes.hasArmor(target);
|
||||
}
|
||||
|
||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||
return target.isValid() && mcMMOPlayer.getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||
return target.isValid() && mcMMOPlayer.getAbilityMode(SuperAbility.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
@@ -54,11 +52,11 @@ public class AxesManager extends SkillManager {
|
||||
* Handle the effects of the Axe Mastery ability
|
||||
*/
|
||||
public double axeMastery() {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.AXE_MASTERY, getPlayer())) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.ALWAYS_FIRES, SubSkill.AXES_AXE_MASTERY, getPlayer(), null, 0, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
|
||||
return Axes.getAxeMasteryBonusDamage(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +66,7 @@ public class AxesManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*/
|
||||
public double criticalHit(LivingEntity target, double damage) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.CRITICAL_HIT, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.AXES_CRITICAL_STRIKES, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -104,7 +102,7 @@ public class AxesManager extends SkillManager {
|
||||
|
||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||
if (armor != null && ItemUtils.isArmor(armor)) {
|
||||
if (SkillUtils.activationSuccessful(SecondaryAbility.ARMOR_IMPACT, getPlayer(), Axes.impactChance, activationChance)) {
|
||||
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_STATIC_CHANCE, SubSkill.AXES_ARMOR_IMPACT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +115,8 @@ public class AxesManager extends SkillManager {
|
||||
* @param target The {@link LivingEntity} being affected by the ability
|
||||
*/
|
||||
public double greaterImpact(LivingEntity target) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.GREATER_IMPACT, getPlayer(), Axes.greaterImpactChance, activationChance)) {
|
||||
//static chance (3rd param)
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_STATIC_CHANCE, SubSkill.AXES_GREATER_IMPACT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.gmail.nossr50.skills.child;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class ChildConfig extends AutoUpdateConfigLoader {
|
||||
@@ -20,15 +20,15 @@ public class ChildConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
FamilyTree.clearRegistrations(); // when reloading, need to clear statics
|
||||
|
||||
for (SkillType skill : SkillType.CHILD_SKILLS) {
|
||||
for (PrimarySkill skill : PrimarySkill.CHILD_SKILLS) {
|
||||
plugin.debug("Finding parents of " + skill.name());
|
||||
|
||||
EnumSet<SkillType> parentSkills = EnumSet.noneOf(SkillType.class);
|
||||
EnumSet<PrimarySkill> parentSkills = EnumSet.noneOf(PrimarySkill.class);
|
||||
boolean useDefaults = false; // If we had an error we back out and use defaults
|
||||
|
||||
for (String name : config.getStringList(StringUtils.getCapitalized(skill.name()))) {
|
||||
try {
|
||||
SkillType parentSkill = SkillType.valueOf(name.toUpperCase());
|
||||
PrimarySkill parentSkill = PrimarySkill.valueOf(name.toUpperCase());
|
||||
FamilyTree.enforceNotChildSkill(parentSkill);
|
||||
parentSkills.add(parentSkill);
|
||||
}
|
||||
@@ -46,12 +46,12 @@ public class ChildConfig extends AutoUpdateConfigLoader {
|
||||
* If they're dedicated enough to have modified it, they can have the errors it may produce.
|
||||
* Alternatively, this can be used to allow child skills to be parent skills, provided there are no circular dependencies this is an advanced sort of configuration.
|
||||
*/
|
||||
parentSkills.add(SkillType.valueOf(name.toUpperCase()));
|
||||
parentSkills.add(PrimarySkill.valueOf(name.toUpperCase()));
|
||||
}
|
||||
}
|
||||
|
||||
// Register them
|
||||
for (SkillType parentSkill : parentSkills) {
|
||||
for (PrimarySkill parentSkill : parentSkills) {
|
||||
plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name());
|
||||
FamilyTree.registerParent(skill, parentSkill);
|
||||
}
|
||||
|
||||
@@ -5,32 +5,32 @@ import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
|
||||
public class FamilyTree {
|
||||
private static HashMap<SkillType, Set<SkillType>> tree = new HashMap<SkillType, Set<SkillType>>();
|
||||
private static HashMap<PrimarySkill, Set<PrimarySkill>> tree = new HashMap<PrimarySkill, Set<PrimarySkill>>();
|
||||
|
||||
public static Set<SkillType> getParents(SkillType childSkill) {
|
||||
public static Set<PrimarySkill> getParents(PrimarySkill childSkill) {
|
||||
enforceChildSkill(childSkill);
|
||||
|
||||
// We do not check if we have the child skill in question, as not having it would mean we did something wrong, and an NPE is desired.
|
||||
return tree.get(childSkill);
|
||||
}
|
||||
|
||||
protected static void registerParent(SkillType childSkill, SkillType parentSkill) {
|
||||
protected static void registerParent(PrimarySkill childSkill, PrimarySkill parentSkill) {
|
||||
enforceChildSkill(childSkill);
|
||||
enforceNotChildSkill(parentSkill);
|
||||
|
||||
if (!tree.containsKey(childSkill)) {
|
||||
tree.put(childSkill, EnumSet.noneOf(SkillType.class));
|
||||
tree.put(childSkill, EnumSet.noneOf(PrimarySkill.class));
|
||||
}
|
||||
|
||||
tree.get(childSkill).add(parentSkill);
|
||||
}
|
||||
|
||||
protected static void closeRegistration() {
|
||||
for (SkillType childSkill : tree.keySet()) {
|
||||
Set<SkillType> immutableSet = Collections.unmodifiableSet(tree.get(childSkill));
|
||||
for (PrimarySkill childSkill : tree.keySet()) {
|
||||
Set<PrimarySkill> immutableSet = Collections.unmodifiableSet(tree.get(childSkill));
|
||||
tree.put(childSkill, immutableSet);
|
||||
}
|
||||
}
|
||||
@@ -39,13 +39,13 @@ public class FamilyTree {
|
||||
tree.clear();
|
||||
}
|
||||
|
||||
protected static void enforceChildSkill(SkillType skill) {
|
||||
protected static void enforceChildSkill(PrimarySkill skill) {
|
||||
if (!skill.isChildSkill()) {
|
||||
throw new IllegalArgumentException(skill.name() + " is not a child skill!");
|
||||
}
|
||||
}
|
||||
|
||||
protected static void enforceNotChildSkill(SkillType skill) {
|
||||
protected static void enforceNotChildSkill(PrimarySkill skill) {
|
||||
if (skill.isChildSkill()) {
|
||||
throw new IllegalArgumentException(skill.name() + " is a child skill!");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.excavation;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
@@ -26,7 +26,7 @@ public class Excavation {
|
||||
}
|
||||
|
||||
protected static int getBlockXP(BlockState blockState) {
|
||||
int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getType());
|
||||
int xp = ExperienceConfig.getInstance().getXp(PrimarySkill.EXCAVATION, blockState.getType());
|
||||
|
||||
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
|
||||
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
|
||||
|
||||
@@ -2,13 +2,13 @@ package com.gmail.nossr50.skills.excavation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
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.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
@@ -18,7 +18,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class ExcavationManager extends SkillManager {
|
||||
public ExcavationManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.EXCAVATION);
|
||||
super(mcMMOPlayer, PrimarySkill.EXCAVATION);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public class ExcavationManager extends SkillManager {
|
||||
public void excavationBlockCheck(BlockState blockState) {
|
||||
int xp = Excavation.getBlockXP(blockState);
|
||||
|
||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.EXCAVATION_TREASURE_HUNTER)) {
|
||||
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkill.EXCAVATION_TREASURE_HUNTER)) {
|
||||
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
|
||||
|
||||
if (!treasures.isEmpty()) {
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
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.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
@@ -14,7 +14,7 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillWeightedActivationCheckEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
||||
@@ -48,15 +48,15 @@ public class FishingManager extends SkillManager {
|
||||
private Location hookLocation;
|
||||
|
||||
public FishingManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.FISHING);
|
||||
super(mcMMOPlayer, PrimarySkill.FISHING);
|
||||
}
|
||||
|
||||
public boolean canShake(Entity target) {
|
||||
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SHAKE);
|
||||
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.FISHING_SHAKE);
|
||||
}
|
||||
|
||||
public boolean canMasterAngler() {
|
||||
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.MASTER_ANGLER);
|
||||
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.FISHING_MASTER_ANGLER);
|
||||
}
|
||||
|
||||
public boolean unleashTheKraken() {
|
||||
@@ -183,7 +183,7 @@ public class FishingManager extends SkillManager {
|
||||
|
||||
Player player = getPlayer();
|
||||
|
||||
if (!Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ICE_FISHING)) {
|
||||
if (!Permissions.isSubSkillEnabled(getPlayer(), SubSkill.FISHING_ICE_FISHING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -279,12 +279,12 @@ public class FishingManager extends SkillManager {
|
||||
*/
|
||||
public void handleFishing(Item fishingCatch) {
|
||||
this.fishingCatch = fishingCatch;
|
||||
int fishXp = ExperienceConfig.getInstance().getXp(SkillType.FISHING, fishingCatch.getItemStack().getType());
|
||||
int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkill.FISHING, fishingCatch.getItemStack().getType());
|
||||
int treasureXp = 0;
|
||||
Player player = getPlayer();
|
||||
FishingTreasure treasure = null;
|
||||
|
||||
if (Config.getInstance().getFishingDropsEnabled() && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER)) {
|
||||
if (Config.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkill.FISHING_TREASURE_HUNTER)) {
|
||||
treasure = getFishingTreasure();
|
||||
this.fishingCatch = null;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ public class FishingManager extends SkillManager {
|
||||
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
||||
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER) && ItemUtils.isEnchantable(treasureDrop)) {
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkill.FISHING_MAGIC_HUNTER) && ItemUtils.isEnchantable(treasureDrop)) {
|
||||
enchants = handleMagicHunter(treasureDrop);
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ public class FishingManager extends SkillManager {
|
||||
public void shakeCheck(LivingEntity target) {
|
||||
fishingTries--; // Because autoclicking to shake is OK.
|
||||
|
||||
SecondaryAbilityWeightedActivationCheckEvent activationEvent = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.SHAKE, getShakeProbability() / activationChance);
|
||||
SubSkillWeightedActivationCheckEvent activationEvent = new SubSkillWeightedActivationCheckEvent(getPlayer(), SubSkill.FISHING_SHAKE, getShakeProbability() / activationChance);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
|
||||
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
||||
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -27,7 +28,7 @@ import java.util.List;
|
||||
|
||||
public class HerbalismManager extends SkillManager {
|
||||
public HerbalismManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.HERBALISM);
|
||||
super(mcMMOPlayer, PrimarySkill.HERBALISM);
|
||||
}
|
||||
|
||||
public boolean canBlockCheck() {
|
||||
@@ -46,15 +47,15 @@ public class HerbalismManager extends SkillManager {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
Material itemType = inventory.getItemInMainHand().getType();
|
||||
|
||||
return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && BlockUtils.canMakeShroomy(blockState) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
||||
return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && BlockUtils.canMakeShroomy(blockState) && Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
public boolean canUseHylianLuck() {
|
||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.HYLIAN_LUCK);
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.HERBALISM_HYLIAN_LUCK);
|
||||
}
|
||||
|
||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
||||
return mcMMOPlayer.getAbilityMode(SuperAbility.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
@@ -62,7 +63,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canGreenTerraPlant() {
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
return mcMMOPlayer.getAbilityMode(SuperAbility.GREEN_TERRA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,14 +130,14 @@ public class HerbalismManager extends SkillManager {
|
||||
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) {
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) {
|
||||
drops = blockState.getBlock().getDrops();
|
||||
}
|
||||
}
|
||||
else {
|
||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getBlockData());
|
||||
|
||||
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
|
||||
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_DOUBLE_DROPS)) {
|
||||
drops = blockState.getBlock().getDrops();
|
||||
}
|
||||
|
||||
@@ -157,7 +158,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
|
||||
if (SkillUtils.activationSuccessful(SecondaryAbility.HERBALISM_DOUBLE_DROPS, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_DOUBLE_DROPS, player, this.skill, getSkillLevel(), activationChance)) {
|
||||
for (ItemStack item : drops) {
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), item, amount);
|
||||
}
|
||||
@@ -172,7 +173,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processGreenThumbBlocks(BlockState blockState) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.GREEN_THUMB_BLOCK, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_GREEN_THUMB, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
|
||||
return false;
|
||||
}
|
||||
@@ -187,7 +188,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processHylianLuck(BlockState blockState) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.HYLIAN_LUCK, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_HYLIAN_LUCK, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -242,7 +243,7 @@ public class HerbalismManager extends SkillManager {
|
||||
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
||||
player.updateInventory();
|
||||
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.SHROOM_THUMB, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_SHROOM_THUMB, player, this.skill, getSkillLevel(), activationChance)) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Fail"));
|
||||
return false;
|
||||
}
|
||||
@@ -299,7 +300,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!greenTerra && !SkillUtils.activationSuccessful(SecondaryAbility.GREEN_THUMB_PLANT, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
if (!greenTerra && !SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_GREEN_THUMB, player, this.skill, getSkillLevel(), activationChance)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user