mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Refactoring to make my life easier
This commit is contained in:
parent
35368db05d
commit
0d260a74c9
@ -8,7 +8,13 @@ Key:
|
|||||||
- Removal
|
- Removal
|
||||||
|
|
||||||
Version 2.0.1
|
Version 2.0.1
|
||||||
|
+ Added config setting to enable or disable classic mcMMO mode
|
||||||
|
! (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) 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
|
! Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use
|
||||||
! mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (I'll be explaining this in a write-up)
|
! mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (I'll be explaining this in a write-up)
|
||||||
! Refactored some unreadable code relating to SecondaryAbility activation in SkillUtils
|
! Refactored some unreadable code relating to SecondaryAbility activation in SkillUtils
|
||||||
|
3
pom.xml
3
pom.xml
@ -9,8 +9,9 @@
|
|||||||
<url>https://github.com/mcMMO-Dev/mcMMO/issues</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO/issues</url>
|
||||||
<system>GitHub</system>
|
<system>GitHub</system>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
<finalName>mcMMO</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.api;
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@ -12,37 +12,37 @@ public final class AbilityAPI {
|
|||||||
private AbilityAPI() {}
|
private AbilityAPI() {}
|
||||||
|
|
||||||
public static boolean berserkEnabled(Player player) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
public static boolean isAnyAbilityEnabled(Player player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
for (SuperAbility ability : SuperAbility.values()) {
|
||||||
if (mcMMOPlayer.getAbilityMode(ability)) {
|
if (mcMMOPlayer.getAbilityMode(ability)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,31 +56,31 @@ public final class AbilityAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setBerserkCooldown(Player player, long cooldown) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
public static boolean isBleeding(LivingEntity entity) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.api;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
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.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -34,7 +34,7 @@ public final class ExperienceAPI {
|
|||||||
* @return true if this is a valid mcMMO skill
|
* @return true if this is a valid mcMMO skill
|
||||||
*/
|
*/
|
||||||
public static boolean isValidSkillType(String skillType) {
|
public static boolean isValidSkillType(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
|
* @return true if this is a valid, non-child mcMMO skill
|
||||||
*/
|
*/
|
||||||
public static boolean isNonChildSkill(String skillType) {
|
public static boolean isNonChildSkill(String skillType) {
|
||||||
SkillType skill = SkillType.getSkill(skillType);
|
PrimarySkill skill = PrimarySkill.getSkill(skillType);
|
||||||
|
|
||||||
return skill != null && !skill.isChildSkill();
|
return skill != null && !skill.isChildSkill();
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ public final class ExperienceAPI {
|
|||||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
*/
|
*/
|
||||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) {
|
||||||
SkillType skill = getSkillType(skillType);
|
PrimarySkill skill = getSkillType(skillType);
|
||||||
|
|
||||||
if (isUnshared) {
|
if (isUnshared) {
|
||||||
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||||
@ -285,7 +285,7 @@ public final class ExperienceAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
|
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()));
|
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
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static int getXPRemaining(Player player, String skillType) {
|
public static int getXPRemaining(Player player, String skillType) {
|
||||||
SkillType skill = getNonChildSkillType(skillType);
|
PrimarySkill skill = getNonChildSkillType(skillType);
|
||||||
|
|
||||||
PlayerProfile profile = getPlayer(player).getProfile();
|
PlayerProfile profile = getPlayer(player).getProfile();
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ public final class ExperienceAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int getOfflineXPRemaining(String playerName, String skillType) {
|
public static int getOfflineXPRemaining(String playerName, String skillType) {
|
||||||
SkillType skill = getNonChildSkillType(skillType);
|
PrimarySkill skill = getNonChildSkillType(skillType);
|
||||||
PlayerProfile profile = getOfflineProfile(playerName);
|
PlayerProfile profile = getOfflineProfile(playerName);
|
||||||
|
|
||||||
return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill);
|
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
|
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||||
*/
|
*/
|
||||||
public static float getOfflineXPRemaining(UUID uuid, String skillType) {
|
public static float getOfflineXPRemaining(UUID uuid, String skillType) {
|
||||||
SkillType skill = getNonChildSkillType(skillType);
|
PrimarySkill skill = getNonChildSkillType(skillType);
|
||||||
PlayerProfile profile = getOfflineProfile(uuid);
|
PlayerProfile profile = getOfflineProfile(uuid);
|
||||||
|
|
||||||
return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill);
|
return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill);
|
||||||
@ -593,12 +593,12 @@ public final class ExperienceAPI {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addLevelOffline(String playerName, String skillType, int levels) {
|
public static void addLevelOffline(String playerName, String skillType, int levels) {
|
||||||
PlayerProfile profile = getOfflineProfile(playerName);
|
PlayerProfile profile = getOfflineProfile(playerName);
|
||||||
SkillType skill = getSkillType(skillType);
|
PrimarySkill skill = getSkillType(skillType);
|
||||||
|
|
||||||
if (skill.isChildSkill()) {
|
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()));
|
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,12 +624,12 @@ public final class ExperienceAPI {
|
|||||||
*/
|
*/
|
||||||
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
|
public static void addLevelOffline(UUID uuid, String skillType, int levels) {
|
||||||
PlayerProfile profile = getOfflineProfile(uuid);
|
PlayerProfile profile = getOfflineProfile(uuid);
|
||||||
SkillType skill = getSkillType(skillType);
|
PrimarySkill skill = getSkillType(skillType);
|
||||||
|
|
||||||
if (skill.isChildSkill()) {
|
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()));
|
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ public final class ExperienceAPI {
|
|||||||
int powerLevel = 0;
|
int powerLevel = 0;
|
||||||
PlayerProfile profile = getOfflineProfile(playerName);
|
PlayerProfile profile = getOfflineProfile(playerName);
|
||||||
|
|
||||||
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
powerLevel += profile.getSkillLevel(type);
|
powerLevel += profile.getSkillLevel(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,7 +737,7 @@ public final class ExperienceAPI {
|
|||||||
int powerLevel = 0;
|
int powerLevel = 0;
|
||||||
PlayerProfile profile = getOfflineProfile(uuid);
|
PlayerProfile profile = getOfflineProfile(uuid);
|
||||||
|
|
||||||
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
powerLevel += profile.getSkillLevel(type);
|
powerLevel += profile.getSkillLevel(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,7 +1015,7 @@ public final class ExperienceAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Utility methods follow.
|
// 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);
|
PlayerProfile profile = getOfflineProfile(playerUniqueId);
|
||||||
|
|
||||||
profile.addXp(skill, XP);
|
profile.addXp(skill, XP);
|
||||||
@ -1023,7 +1023,7 @@ public final class ExperienceAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@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);
|
PlayerProfile profile = getOfflineProfile(playerName);
|
||||||
|
|
||||||
profile.addXp(skill, XP);
|
profile.addXp(skill, XP);
|
||||||
@ -1052,8 +1052,8 @@ public final class ExperienceAPI {
|
|||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SkillType getSkillType(String skillType) throws InvalidSkillException {
|
private static PrimarySkill getSkillType(String skillType) throws InvalidSkillException {
|
||||||
SkillType skill = SkillType.getSkill(skillType);
|
PrimarySkill skill = PrimarySkill.getSkill(skillType);
|
||||||
|
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
throw new InvalidSkillException();
|
throw new InvalidSkillException();
|
||||||
@ -1062,8 +1062,8 @@ public final class ExperienceAPI {
|
|||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException {
|
private static PrimarySkill getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException {
|
||||||
SkillType skill = getSkillType(skillType);
|
PrimarySkill skill = getSkillType(skillType);
|
||||||
|
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
throw new UnsupportedOperationException("Child skills do not have XP");
|
throw new UnsupportedOperationException("Child skills do not have XP");
|
||||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
|
||||||
public final class SkillAPI {
|
public final class SkillAPI {
|
||||||
private SkillAPI() {}
|
private SkillAPI() {}
|
||||||
@ -18,7 +18,7 @@ public final class SkillAPI {
|
|||||||
* @return a list of strings with valid skill names
|
* @return a list of strings with valid skill names
|
||||||
*/
|
*/
|
||||||
public static List<String> getSkills() {
|
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
|
* @return a list of strings with valid skill names
|
||||||
*/
|
*/
|
||||||
public static List<String> getNonChildSkills() {
|
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
|
* @return a list of strings with valid skill names
|
||||||
*/
|
*/
|
||||||
public static List<String> getChildSkills() {
|
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
|
* @return a list of strings with valid skill names
|
||||||
*/
|
*/
|
||||||
public static List<String> getCombatSkills() {
|
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
|
* @return a list of strings with valid skill names
|
||||||
*/
|
*/
|
||||||
public static List<String> getGatheringSkills() {
|
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
|
* @return a list of strings with valid skill names
|
||||||
*/
|
*/
|
||||||
public static List<String> getMiscSkills() {
|
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>();
|
List<String> skills = new ArrayList<String>();
|
||||||
|
|
||||||
for (SkillType skillType : skillsTypes) {
|
for (PrimarySkill primarySkill : skillsTypes) {
|
||||||
skills.add(skillType.name());
|
skills.add(primarySkill.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
return skills;
|
return skills;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.experience;
|
package com.gmail.nossr50.commands.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
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.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
@ -22,7 +22,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||||
profile.addLevels(skill, value);
|
profile.addLevels(skill, value);
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()));
|
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.experience;
|
package com.gmail.nossr50.commands.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
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.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -22,7 +22,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (player != null) {
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND);
|
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND);
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()));
|
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.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -14,7 +15,6 @@ import org.bukkit.util.StringUtil;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList;
|
|||||||
public abstract class ExperienceCommand implements TabExecutor {
|
public abstract class ExperienceCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
SkillType skill;
|
PrimarySkill skill;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -40,7 +40,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
skill = SkillType.getSkill(args[0]);
|
skill = PrimarySkill.getSkill(args[0]);
|
||||||
|
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
@ -65,7 +65,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
skill = SkillType.getSkill(args[1]);
|
skill = PrimarySkill.getSkill(args[1]);
|
||||||
|
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
if (args[1].equalsIgnoreCase("all")) {
|
||||||
skill = null;
|
skill = null;
|
||||||
@ -116,7 +116,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
case 2:
|
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:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
@ -124,15 +124,15 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
|
|
||||||
protected abstract boolean permissionsCheckSelf(CommandSender sender);
|
protected abstract boolean permissionsCheckSelf(CommandSender sender);
|
||||||
protected abstract boolean permissionsCheckOthers(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 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) {
|
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||||
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
|
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) {
|
if (skill == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
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) {
|
if (skill == null) {
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
handleCommand(player, profile, skillType, value);
|
handleCommand(player, profile, primarySkill, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.experience;
|
package com.gmail.nossr50.commands.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
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.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
@ -22,7 +22,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
int skillLevel = profile.getSkillLevel(skill);
|
||||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
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.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -14,7 +15,6 @@ import org.bukkit.util.StringUtil;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableList;
|
|||||||
public class SkillresetCommand implements TabExecutor {
|
public class SkillresetCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
SkillType skill;
|
PrimarySkill skill;
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
@ -50,7 +50,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skill = SkillType.getSkill(args[1]);
|
skill = PrimarySkill.getSkill(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill);
|
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill);
|
||||||
@ -70,7 +70,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
skill = null;
|
skill = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skill = SkillType.getSkill(args[1]);
|
skill = PrimarySkill.getSkill(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
@ -110,13 +110,13 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
case 2:
|
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:
|
default:
|
||||||
return ImmutableList.of();
|
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);
|
int levelsRemoved = profile.getSkillLevel(skill);
|
||||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
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()));
|
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);
|
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) {
|
if (skill == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
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) {
|
if (skill == null) {
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
handleCommand(player, profile, skillType);
|
handleCommand(player, profile, primarySkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.hardcore;
|
package com.gmail.nossr50.commands.hardcore;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
@ -20,10 +20,10 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkEnabled(SkillType skill) {
|
protected boolean checkEnabled(PrimarySkill skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
for (SkillType skillType : SkillType.values()) {
|
for (PrimarySkill primarySkill : PrimarySkill.values()) {
|
||||||
if (!skillType.getHardcoreStatLossEnabled()) {
|
if (!primarySkill.getHardcoreStatLossEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,12 +35,12 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void enable(SkillType skill) {
|
protected void enable(PrimarySkill skill) {
|
||||||
toggle(true, skill);
|
toggle(true, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void disable(SkillType skill) {
|
protected void disable(PrimarySkill skill) {
|
||||||
toggle(false, 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)));
|
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) {
|
if (skill == null) {
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
skillType.setHardcoreStatLossEnabled(enable);
|
primarySkill.setHardcoreStatLossEnabled(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -4,12 +4,12 @@ import java.text.DecimalFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
@ -76,7 +76,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillType skill = SkillType.getSkill(args[0]);
|
PrimarySkill skill = PrimarySkill.getSkill(args[0]);
|
||||||
|
|
||||||
if (!CommandUtils.isChildSkill(sender, skill)) {
|
if (!CommandUtils.isChildSkill(sender, skill)) {
|
||||||
return true;
|
return true;
|
||||||
@ -125,8 +125,8 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
|||||||
|
|
||||||
protected abstract boolean checkTogglePermissions(CommandSender sender);
|
protected abstract boolean checkTogglePermissions(CommandSender sender);
|
||||||
protected abstract boolean checkModifyPermissions(CommandSender sender);
|
protected abstract boolean checkModifyPermissions(CommandSender sender);
|
||||||
protected abstract boolean checkEnabled(SkillType skill);
|
protected abstract boolean checkEnabled(PrimarySkill skill);
|
||||||
protected abstract void enable(SkillType skill);
|
protected abstract void enable(PrimarySkill skill);
|
||||||
protected abstract void disable(SkillType skill);
|
protected abstract void disable(PrimarySkill skill);
|
||||||
protected abstract void modify(CommandSender sender, double newPercentage);
|
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.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
@ -20,10 +20,10 @@ public class VampirismCommand extends HardcoreModeCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkEnabled(SkillType skill) {
|
protected boolean checkEnabled(PrimarySkill skill) {
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
for (SkillType skillType : SkillType.values()) {
|
for (PrimarySkill primarySkill : PrimarySkill.values()) {
|
||||||
if (!skillType.getHardcoreVampirismEnabled()) {
|
if (!primarySkill.getHardcoreVampirismEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,12 +35,12 @@ public class VampirismCommand extends HardcoreModeCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void enable(SkillType skill) {
|
protected void enable(PrimarySkill skill) {
|
||||||
toggle(true, skill);
|
toggle(true, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void disable(SkillType skill) {
|
protected void disable(PrimarySkill skill) {
|
||||||
toggle(false, 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)));
|
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) {
|
if (skill == null) {
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
skillType.setHardcoreVampirismEnabled(enable);
|
primarySkill.setHardcoreVampirismEnabled(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.player;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
@ -13,7 +14,6 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
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("Inspect.OfflineStats", playerName));
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
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(CommandUtils.displaySkill(profile, skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
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(CommandUtils.displaySkill(profile, skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
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));
|
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.player;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
@ -9,7 +10,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -45,7 +45,7 @@ public class MccooldownCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||||
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
for (SuperAbility ability : SuperAbility.values()) {
|
||||||
if (!ability.getPermissions(player)) {
|
if (!ability.getPermissions(player)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||||
@ -24,7 +24,7 @@ import java.util.List;
|
|||||||
public class MctopCommand implements TabExecutor {
|
public class MctopCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
SkillType skill = null;
|
PrimarySkill skill = null;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -69,13 +69,13 @@ public class MctopCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
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:
|
default:
|
||||||
return ImmutableList.of();
|
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)) {
|
if (skill != null && !Permissions.mctop(sender, skill)) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return;
|
return;
|
||||||
@ -112,19 +112,19 @@ public class MctopCommand implements TabExecutor {
|
|||||||
display(page, skill, sender);
|
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 useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
|
||||||
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
||||||
|
|
||||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
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)) {
|
if (CommandUtils.isInvalidSkill(sender, skillName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillType skill = SkillType.getSkill(skillName);
|
PrimarySkill skill = PrimarySkill.getSkill(skillName);
|
||||||
|
|
||||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||||
return null;
|
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,10 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
@ -23,28 +23,28 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
private boolean canGracefulRoll;
|
private boolean canGracefulRoll;
|
||||||
|
|
||||||
public AcrobaticsCommand() {
|
public AcrobaticsCommand() {
|
||||||
super(SkillType.ACROBATICS);
|
super(PrimarySkill.ACROBATICS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
// DODGE
|
// ACROBATICS_DODGE
|
||||||
if (canDodge) {
|
if (canDodge) {
|
||||||
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DODGE, isLucky);
|
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ACROBATICS_DODGE, isLucky);
|
||||||
dodgeChance = dodgeStrings[0];
|
dodgeChance = dodgeStrings[0];
|
||||||
dodgeChanceLucky = dodgeStrings[1];
|
dodgeChanceLucky = dodgeStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ROLL
|
// ACROBATICS_ROLL
|
||||||
if (canRoll) {
|
if (canRoll) {
|
||||||
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.ROLL, isLucky);
|
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ACROBATICS_ROLL, isLucky);
|
||||||
rollChance = rollStrings[0];
|
rollChance = rollStrings[0];
|
||||||
rollChanceLucky = rollStrings[1];
|
rollChanceLucky = rollStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// GRACEFUL ROLL
|
// GRACEFUL ACROBATICS_ROLL
|
||||||
if (canGracefulRoll) {
|
if (canGracefulRoll) {
|
||||||
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GRACEFUL_ROLL, isLucky);
|
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ACROBATICS_GRACEFUL_ROLL, isLucky);
|
||||||
gracefulRollChance = gracefulRollStrings[0];
|
gracefulRollChance = gracefulRollStrings[0];
|
||||||
gracefulRollChanceLucky = gracefulRollStrings[1];
|
gracefulRollChanceLucky = gracefulRollStrings[1];
|
||||||
}
|
}
|
||||||
@ -52,9 +52,9 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canDodge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DODGE);
|
canDodge = Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_DODGE);
|
||||||
canRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ROLL);
|
canRoll = Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_ROLL);
|
||||||
canGracefulRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL);
|
canGracefulRoll = Permissions.isSubSkillEnabled(player, SubSkill.ACROBATICS_GRACEFUL_ROLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy.Tier;
|
import com.gmail.nossr50.skills.alchemy.Alchemy.Tier;
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
||||||
@ -26,7 +26,7 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
private boolean canConcoctions;
|
private boolean canConcoctions;
|
||||||
|
|
||||||
public AlchemyCommand() {
|
public AlchemyCommand() {
|
||||||
super(SkillType.ALCHEMY);
|
super(PrimarySkill.ALCHEMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {
|
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {
|
||||||
@ -41,14 +41,14 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
// CATALYSIS
|
// ALCHEMY_CATALYSIS
|
||||||
if (canCatalysis) {
|
if (canCatalysis) {
|
||||||
String[] catalysisStrings = calculateAbilityDisplayValues(player, isLucky);
|
String[] catalysisStrings = calculateAbilityDisplayValues(player, isLucky);
|
||||||
brewSpeed = catalysisStrings[0];
|
brewSpeed = catalysisStrings[0];
|
||||||
brewSpeedLucky = catalysisStrings[1];
|
brewSpeedLucky = catalysisStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// CONCOCTIONS
|
// ALCHEMY_CONCOCTIONS
|
||||||
if (canConcoctions) {
|
if (canConcoctions) {
|
||||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||||
tier = alchemyManager.getTier();
|
tier = alchemyManager.getTier();
|
||||||
@ -59,8 +59,8 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canCatalysis = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS);
|
canCatalysis = Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CATALYSIS);
|
||||||
canConcoctions = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CONCOCTIONS);
|
canConcoctions = Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CONCOCTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.archery.Archery;
|
import com.gmail.nossr50.skills.archery.Archery;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -23,7 +23,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
private boolean canRetrieve;
|
private boolean canRetrieve;
|
||||||
|
|
||||||
public ArcheryCommand() {
|
public ArcheryCommand() {
|
||||||
super(SkillType.ARCHERY);
|
super(PrimarySkill.ARCHERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,16 +34,16 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
skillShotBonus = percent.format(Math.min(bonus, Archery.skillShotMaxBonusPercentage));
|
skillShotBonus = percent.format(Math.min(bonus, Archery.skillShotMaxBonusPercentage));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DAZE
|
// ARCHERY_DAZE
|
||||||
if (canDaze) {
|
if (canDaze) {
|
||||||
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DAZE, isLucky);
|
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ARCHERY_DAZE, isLucky);
|
||||||
dazeChance = dazeStrings[0];
|
dazeChance = dazeStrings[0];
|
||||||
dazeChanceLucky = dazeStrings[1];
|
dazeChanceLucky = dazeStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// RETRIEVE
|
// ARCHERY_RETRIEVE
|
||||||
if (canRetrieve) {
|
if (canRetrieve) {
|
||||||
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.RETRIEVE, isLucky);
|
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ARCHERY_RETRIEVE, isLucky);
|
||||||
retrieveChance = retrieveStrings[0];
|
retrieveChance = retrieveStrings[0];
|
||||||
retrieveChanceLucky = retrieveStrings[1];
|
retrieveChanceLucky = retrieveStrings[1];
|
||||||
}
|
}
|
||||||
@ -51,9 +51,9 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canSkillShot = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SKILL_SHOT);
|
canSkillShot = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_SKILL_SHOT);
|
||||||
canDaze = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DAZE);
|
canDaze = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_DAZE);
|
||||||
canRetrieve = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.RETRIEVE);
|
canRetrieve = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_RETRIEVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.axes.Axes;
|
import com.gmail.nossr50.skills.axes.Axes;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -26,7 +26,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
private boolean canGreaterImpact;
|
private boolean canGreaterImpact;
|
||||||
|
|
||||||
public AxesCommand() {
|
public AxesCommand() {
|
||||||
super(SkillType.AXES);
|
super(PrimarySkill.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,7 +45,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
|
|
||||||
// CRITICAL HIT
|
// CRITICAL HIT
|
||||||
if (canCritical) {
|
if (canCritical) {
|
||||||
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.CRITICAL_HIT, isLucky);
|
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SubSkill.AXES_CRITICAL_HIT, isLucky);
|
||||||
critChance = criticalHitStrings[0];
|
critChance = criticalHitStrings[0];
|
||||||
critChanceLucky = criticalHitStrings[1];
|
critChanceLucky = criticalHitStrings[1];
|
||||||
}
|
}
|
||||||
@ -59,10 +59,10 @@ public class AxesCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canSkullSplitter = Permissions.skullSplitter(player);
|
canSkullSplitter = Permissions.skullSplitter(player);
|
||||||
canCritical = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CRITICAL_HIT);
|
canCritical = Permissions.isSubSkillEnabled(player, SubSkill.AXES_CRITICAL_HIT);
|
||||||
canAxeMastery = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.AXE_MASTERY);
|
canAxeMastery = Permissions.isSubSkillEnabled(player, SubSkill.AXES_AXE_MASTERY);
|
||||||
canImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARMOR_IMPACT);
|
canImpact = Permissions.isSubSkillEnabled(player, SubSkill.AXES_ARMOR_IMPACT);
|
||||||
canGreaterImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GREATER_IMPACT);
|
canGreaterImpact = Permissions.isSubSkillEnabled(player, SubSkill.AXES_GREATER_IMPACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,8 +5,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
private boolean canTreasureHunt;
|
private boolean canTreasureHunt;
|
||||||
|
|
||||||
public ExcavationCommand() {
|
public ExcavationCommand() {
|
||||||
super(SkillType.EXCAVATION);
|
super(PrimarySkill.EXCAVATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,7 +34,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canGigaDrill = Permissions.gigaDrillBreaker(player);
|
canGigaDrill = Permissions.gigaDrillBreaker(player);
|
||||||
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER);
|
canTreasureHunt = Permissions.isSubSkillEnabled(player, SubSkill.EXCAVATION_TREASURE_HUNTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,14 +3,14 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||||
@ -44,7 +44,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
private boolean canIceFish;
|
private boolean canIceFish;
|
||||||
|
|
||||||
public FishingCommand() {
|
public FishingCommand() {
|
||||||
super(SkillType.FISHING);
|
super(PrimarySkill.FISHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -76,7 +76,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
magicChance = percent.format(totalEnchantChance / 100.0);
|
magicChance = percent.format(totalEnchantChance / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SHAKE
|
// FISHING_SHAKE
|
||||||
if (canShake) {
|
if (canShake) {
|
||||||
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability(), isLucky);
|
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability(), isLucky);
|
||||||
shakeChance = shakeStrings[0];
|
shakeChance = shakeStrings[0];
|
||||||
@ -111,12 +111,12 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER);
|
canTreasureHunt = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_TREASURE_HUNTER);
|
||||||
canMagicHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER);
|
canMagicHunt = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_MAGIC_HUNTER);
|
||||||
canShake = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHAKE);
|
canShake = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_SHAKE);
|
||||||
canFishermansDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET);
|
canFishermansDiet = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_FISHERMANS_DIET);
|
||||||
canMasterAngler = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MASTER_ANGLER);
|
canMasterAngler = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_MASTER_ANGLER);
|
||||||
canIceFish = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ICE_FISHING);
|
canIceFish = Permissions.isSubSkillEnabled(player, SubSkill.FISHING_ICE_FISHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -34,7 +34,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
private boolean canShroomThumb;
|
private boolean canShroomThumb;
|
||||||
|
|
||||||
public HerbalismCommand() {
|
public HerbalismCommand() {
|
||||||
super(SkillType.HERBALISM);
|
super(PrimarySkill.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,28 +55,28 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||||
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
|
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];
|
greenThumbChance = greenThumbStrings[0];
|
||||||
greenThumbChanceLucky = greenThumbStrings[1];
|
greenThumbChanceLucky = greenThumbStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HERBALISM_DOUBLE_DROPS, isLucky);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_DOUBLE_DROPS, isLucky);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// HYLIAN LUCK
|
// HYLIAN LUCK
|
||||||
if (hasHylianLuck) {
|
if (hasHylianLuck) {
|
||||||
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HYLIAN_LUCK, isLucky);
|
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_HYLIAN_LUCK, isLucky);
|
||||||
hylianLuckChance = hylianLuckStrings[0];
|
hylianLuckChance = hylianLuckStrings[0];
|
||||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// SHROOM THUMB
|
// SHROOM THUMB
|
||||||
if (canShroomThumb) {
|
if (canShroomThumb) {
|
||||||
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SHROOM_THUMB, isLucky);
|
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SubSkill.HERBALISM_SHROOM_THUMB, isLucky);
|
||||||
shroomThumbChance = shroomThumbStrings[0];
|
shroomThumbChance = shroomThumbStrings[0];
|
||||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||||
}
|
}
|
||||||
@ -84,13 +84,13 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
|
hasHylianLuck = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_HYLIAN_LUCK);
|
||||||
canGreenTerra = Permissions.greenTerra(player);
|
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);
|
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);
|
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);
|
canFarmersDiet = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_FARMERS_DIET);
|
||||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||||
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
canShroomThumb = Permissions.isSubSkillEnabled(player, SubSkill.HERBALISM_SHROOM_THUMB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
||||||
@ -35,7 +35,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
private boolean canDemoExpert;
|
private boolean canDemoExpert;
|
||||||
|
|
||||||
public MiningCommand() {
|
public MiningCommand() {
|
||||||
super(SkillType.MINING);
|
super(PrimarySkill.MINING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +49,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.MINING_DOUBLE_DROPS, isLucky);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkill.MINING_DOUBLE_DROPS, isLucky);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
canBiggerBombs = Permissions.biggerBombs(player);
|
canBiggerBombs = Permissions.biggerBombs(player);
|
||||||
canBlast = Permissions.remoteDetonation(player);
|
canBlast = Permissions.remoteDetonation(player);
|
||||||
canDemoExpert = Permissions.demolitionsExpertise(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);
|
canSuperBreaker = Permissions.superBreaker(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
@ -41,7 +41,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
private int stoneLevel;
|
private int stoneLevel;
|
||||||
|
|
||||||
public RepairCommand() {
|
public RepairCommand() {
|
||||||
super(SkillType.REPAIR);
|
super(PrimarySkill.REPAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,7 +65,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SUPER REPAIR
|
// SUPER REPAIR
|
||||||
if (canSuperRepair) {
|
if (canSuperRepair) {
|
||||||
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SUPER_REPAIR, isLucky);
|
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SubSkill.REPAIR_SUPER_REPAIR, isLucky);
|
||||||
superRepairChance = superRepairStrings[0];
|
superRepairChance = superRepairStrings[0];
|
||||||
superRepairChanceLucky = superRepairStrings[1];
|
superRepairChanceLucky = superRepairStrings[1];
|
||||||
}
|
}
|
||||||
@ -73,9 +73,9 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
|
canSuperRepair = Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_SUPER_REPAIR);
|
||||||
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
|
canMasterRepair = Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_REPAIR_MASTERY);
|
||||||
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
|
canArcaneForge = Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_ARCANE_FORGING);
|
||||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
@ -18,7 +18,7 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
private boolean canArcaneSalvage;
|
private boolean canArcaneSalvage;
|
||||||
|
|
||||||
public SalvageCommand() {
|
public SalvageCommand() {
|
||||||
super(SkillType.SALVAGE);
|
super(PrimarySkill.SALVAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,8 +29,8 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canAdvancedSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ADVANCED_SALVAGE);
|
canAdvancedSalvage = Permissions.isSubSkillEnabled(player, SubSkill.SALVAGE_ADVANCED_SALVAGE);
|
||||||
canArcaneSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_SALVAGE);
|
canArcaneSalvage = Permissions.isSubSkillEnabled(player, SubSkill.SALVAGE_ARCANE_SALVAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,6 +4,7 @@ import java.text.DecimalFormat;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -13,8 +14,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.Motd;
|
import com.gmail.nossr50.util.Motd;
|
||||||
@ -28,7 +28,7 @@ import com.gmail.nossr50.util.skills.PerksUtils;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
public abstract class SkillCommand implements TabExecutor {
|
public abstract class SkillCommand implements TabExecutor {
|
||||||
protected SkillType skill;
|
protected PrimarySkill skill;
|
||||||
private String skillName;
|
private String skillName;
|
||||||
|
|
||||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
@ -36,7 +36,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
private CommandExecutor skillGuideCommand;
|
private CommandExecutor skillGuideCommand;
|
||||||
|
|
||||||
public SkillCommand(SkillType skill) {
|
public SkillCommand(PrimarySkill skill) {
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
skillName = skill.getName();
|
skillName = skill.getName();
|
||||||
skillGuideCommand = new SkillGuideCommand(skill);
|
skillGuideCommand = new SkillGuideCommand(skill);
|
||||||
@ -79,9 +79,9 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Effects.Child", (int) skillValue));
|
player.sendMessage(LocaleLoader.getString("Effects.Child", (int) skillValue));
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||||
Set<SkillType> parents = FamilyTree.getParents(skill);
|
Set<PrimarySkill> parents = FamilyTree.getParents(skill);
|
||||||
|
|
||||||
for (SkillType parent : parents) {
|
for (PrimarySkill parent : parents) {
|
||||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,10 +141,10 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return displayValues;
|
return displayValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(float skillValue, SecondaryAbility skillAbility, boolean isLucky) {
|
protected String[] calculateAbilityDisplayValues(float skillValue, SubSkill subSkill, boolean isLucky) {
|
||||||
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility);
|
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) {
|
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||||
|
|
||||||
public SkillGuideCommand(SkillType skill) {
|
public SkillGuideCommand(PrimarySkill skill) {
|
||||||
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
||||||
guide = getGuide(skill);
|
guide = getGuide(skill);
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
return allStrings;
|
return allStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<String> getGuide(SkillType skill) {
|
private ArrayList<String> getGuide(PrimarySkill skill) {
|
||||||
ArrayList<String> guide = new ArrayList<String>();
|
ArrayList<String> guide = new ArrayList<String>();
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
|
@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
||||||
@ -27,7 +27,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
private boolean canVanillaXPBoost;
|
private boolean canVanillaXPBoost;
|
||||||
|
|
||||||
public SmeltingCommand() {
|
public SmeltingCommand() {
|
||||||
super(SkillType.SMELTING);
|
super(PrimarySkill.SMELTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,7 +39,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SECOND SMELT
|
// SECOND SMELT
|
||||||
if (canSecondSmelt) {
|
if (canSecondSmelt) {
|
||||||
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SECOND_SMELT, isLucky);
|
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SMELTING_SECOND_SMELT, isLucky);
|
||||||
secondSmeltChance = secondSmeltStrings[0];
|
secondSmeltChance = secondSmeltStrings[0];
|
||||||
secondSmeltChanceLucky = secondSmeltStrings[1];
|
secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||||
}
|
}
|
||||||
@ -54,9 +54,9 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canFuelEfficiency = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY);
|
canFuelEfficiency = Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_FUEL_EFFICIENCY);
|
||||||
canSecondSmelt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SECOND_SMELT);
|
canSecondSmelt = Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_SECOND_SMELT);
|
||||||
canFluxMine = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FLUX_MINING);
|
canFluxMine = Permissions.isSubSkillEnabled(player, SubSkill.SMELTING_FLUX_MINING);
|
||||||
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.swords.Swords;
|
import com.gmail.nossr50.skills.swords.Swords;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -26,7 +26,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
private boolean canBleed;
|
private boolean canBleed;
|
||||||
|
|
||||||
public SwordsCommand() {
|
public SwordsCommand() {
|
||||||
super(SkillType.SWORDS);
|
super(PrimarySkill.SWORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,18 +38,18 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
|
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// BLEED
|
// SWORDS_BLEED
|
||||||
if (canBleed) {
|
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];
|
bleedChance = bleedStrings[0];
|
||||||
bleedChanceLucky = bleedStrings[1];
|
bleedChanceLucky = bleedStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// COUNTER
|
// SWORDS_COUNTER
|
||||||
if (canCounter) {
|
if (canCounter) {
|
||||||
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.COUNTER, isLucky);
|
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SWORDS_COUNTER, isLucky);
|
||||||
counterChance = counterStrings[0];
|
counterChance = counterStrings[0];
|
||||||
counterChanceLucky = counterStrings[1];
|
counterChanceLucky = counterStrings[1];
|
||||||
}
|
}
|
||||||
@ -57,8 +57,8 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canBleed = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BLEED);
|
canBleed = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_BLEED);
|
||||||
canCounter = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.COUNTER);
|
canCounter = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_COUNTER);
|
||||||
canSerratedStrike = Permissions.serratedStrikes(player);
|
canSerratedStrike = Permissions.serratedStrikes(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.taming.Taming;
|
import com.gmail.nossr50.skills.taming.Taming;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -29,13 +29,13 @@ public class TamingCommand extends SkillCommand {
|
|||||||
private boolean canHolyHound;
|
private boolean canHolyHound;
|
||||||
|
|
||||||
public TamingCommand() {
|
public TamingCommand() {
|
||||||
super(SkillType.TAMING);
|
super(PrimarySkill.TAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
if (canGore) {
|
if (canGore) {
|
||||||
String[] goreStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GORE, isLucky);
|
String[] goreStrings = calculateAbilityDisplayValues(skillValue, SubSkill.TAMING_GORE, isLucky);
|
||||||
goreChance = goreStrings[0];
|
goreChance = goreStrings[0];
|
||||||
goreChanceLucky = goreStrings[1];
|
goreChanceLucky = goreStrings[1];
|
||||||
}
|
}
|
||||||
@ -43,15 +43,15 @@ public class TamingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canBeastLore = 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);
|
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
||||||
canEnvironmentallyAware = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ENVIRONMENTALLY_AWARE);
|
canEnvironmentallyAware = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_ENVIRONMENTALLY_AWARE);
|
||||||
canFastFood = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FAST_FOOD);
|
canFastFood = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_FAST_FOOD);
|
||||||
canGore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GORE);
|
canGore = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_GORE);
|
||||||
canSharpenedClaws = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHARPENED_CLAWS);
|
canSharpenedClaws = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_SHARPENED_CLAWS);
|
||||||
canShockProof = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHOCK_PROOF);
|
canShockProof = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_SHOCK_PROOF);
|
||||||
canThickFur = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.THICK_FUR);
|
canThickFur = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_THICK_FUR);
|
||||||
canHolyHound = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HOLY_HOUND);
|
canHolyHound = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_HOLY_HOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -29,7 +29,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
private boolean canIronGrip;
|
private boolean canIronGrip;
|
||||||
|
|
||||||
public UnarmedCommand() {
|
public UnarmedCommand() {
|
||||||
super(SkillType.UNARMED);
|
super(PrimarySkill.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -41,16 +41,16 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
berserkLengthEndurance = berserkStrings[1];
|
berserkLengthEndurance = berserkStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DISARM
|
// UNARMED_DISARM
|
||||||
if (canDisarm) {
|
if (canDisarm) {
|
||||||
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DISARM, isLucky);
|
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_DISARM, isLucky);
|
||||||
disarmChance = disarmStrings[0];
|
disarmChance = disarmStrings[0];
|
||||||
disarmChanceLucky = disarmStrings[1];
|
disarmChanceLucky = disarmStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEFLECT
|
// UNARMED_DEFLECT
|
||||||
if (canDeflect) {
|
if (canDeflect) {
|
||||||
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DEFLECT, isLucky);
|
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_DEFLECT, isLucky);
|
||||||
deflectChance = deflectStrings[0];
|
deflectChance = deflectStrings[0];
|
||||||
deflectChanceLucky = deflectStrings[1];
|
deflectChanceLucky = deflectStrings[1];
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// IRON GRIP
|
// IRON GRIP
|
||||||
if (canIronGrip) {
|
if (canIronGrip) {
|
||||||
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.IRON_GRIP, isLucky);
|
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_IRON_GRIP, isLucky);
|
||||||
ironGripChance = ironGripStrings[0];
|
ironGripChance = ironGripStrings[0];
|
||||||
ironGripChanceLucky = ironGripStrings[1];
|
ironGripChanceLucky = ironGripStrings[1];
|
||||||
}
|
}
|
||||||
@ -71,10 +71,10 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canBerserk = Permissions.berserk(player);
|
canBerserk = Permissions.berserk(player);
|
||||||
canIronArm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_ARM);
|
canIronArm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_ARM);
|
||||||
canDeflect = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DEFLECT);
|
canDeflect = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_DEFLECT);
|
||||||
canDisarm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DISARM);
|
canDisarm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_DISARM);
|
||||||
canIronGrip = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_GRIP);
|
canIronGrip = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_GRIP);
|
||||||
// TODO: Apparently we forgot about block cracker?
|
// TODO: Apparently we forgot about block cracker?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
private boolean canDoubleDrop;
|
private boolean canDoubleDrop;
|
||||||
|
|
||||||
public WoodcuttingCommand() {
|
public WoodcuttingCommand() {
|
||||||
super(SkillType.WOODCUTTING);
|
super(PrimarySkill.WOODCUTTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,7 +36,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.WOODCUTTING_HARVEST, isLucky);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkill.WOODCUTTING_DOUBLE_DROPS, isLucky);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -45,8 +45,8 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canTreeFell = Permissions.treeFeller(player);
|
canTreeFell = Permissions.treeFeller(player);
|
||||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_HARVEST) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||||
canLeafBlow = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_LEAF_BLOWER);
|
canLeafBlow = Permissions.isSubSkillEnabled(player, SubSkill.WOODCUTTING_LEAF_BLOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,15 +4,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
|
|
||||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||||
private static AdvancedConfig instance;
|
private static AdvancedConfig instance;
|
||||||
@ -45,11 +43,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ACROBATICS */
|
/* ACROBATICS */
|
||||||
if (getMaxChance(SecondaryAbility.DODGE) < 1) {
|
if (getMaxChance(SubSkill.ACROBATICS_DODGE) < 1) {
|
||||||
reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 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!");
|
reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,11 +55,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
|
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!");
|
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!");
|
reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,11 +67,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
|
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!");
|
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!");
|
reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,11 +124,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
|
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.DAZE) < 1) {
|
if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) {
|
||||||
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.DAZE) < 1) {
|
if (getMaxBonusLevel(SubSkill.ARCHERY_DAZE) < 1) {
|
||||||
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,11 +136,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.RETRIEVE) < 1) {
|
if (getMaxChance(SubSkill.ARCHERY_RETRIEVE) < 1) {
|
||||||
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.RETRIEVE) < 1) {
|
if (getMaxBonusLevel(SubSkill.ARCHERY_RETRIEVE) < 1) {
|
||||||
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,11 +157,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.CRITICAL_HIT) < 1) {
|
if (getMaxChance(SubSkill.AXES_CRITICAL_HIT) < 1) {
|
||||||
reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
|
reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.CRITICAL_HIT) < 1) {
|
if (getMaxBonusLevel(SubSkill.AXES_CRITICAL_HIT) < 1) {
|
||||||
reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,44 +263,44 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
|
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!");
|
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!");
|
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!");
|
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!");
|
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!");
|
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!");
|
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!");
|
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!");
|
reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MINING */
|
/* 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!");
|
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!");
|
reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,11 +369,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
|
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!");
|
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!");
|
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,11 +463,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!");
|
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!");
|
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!");
|
reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,11 +504,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* SWORDS */
|
/* SWORDS */
|
||||||
if (getMaxChance(SecondaryAbility.BLEED) < 1) {
|
if (getMaxChance(SubSkill.SWORDS_BLEED) < 1) {
|
||||||
reason.add("Skills.Swords.Bleed.ChanceMax should be at least 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!");
|
reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,11 +524,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
|
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.COUNTER) < 1) {
|
if (getMaxChance(SubSkill.SWORDS_COUNTER) < 1) {
|
||||||
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
|
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.COUNTER) < 1) {
|
if (getMaxBonusLevel(SubSkill.SWORDS_COUNTER) < 1) {
|
||||||
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,11 +546,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
|
|
||||||
/* TAMING */
|
/* TAMING */
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.GORE) < 1) {
|
if (getMaxChance(SubSkill.TAMING_GORE) < 1) {
|
||||||
reason.add("Skills.Taming.Gore.ChanceMax should be at least 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!");
|
reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,27 +607,27 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UNARMED */
|
/* UNARMED */
|
||||||
if (getMaxChance(SecondaryAbility.DISARM) < 1) {
|
if (getMaxChance(SubSkill.UNARMED_DISARM) < 1) {
|
||||||
reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 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!");
|
reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.DEFLECT) < 1) {
|
if (getMaxChance(SubSkill.UNARMED_DEFLECT) < 1) {
|
||||||
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
|
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.DEFLECT) < 1) {
|
if (getMaxBonusLevel(SubSkill.UNARMED_DEFLECT) < 1) {
|
||||||
reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Unarmed.Deflect.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!");
|
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!");
|
reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,11 +652,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
|
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.WOODCUTTING_HARVEST) < 1) {
|
if (getMaxChance(SubSkill.WOODCUTTING_DOUBLE_DROPS) < 1) {
|
||||||
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
|
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.WOODCUTTING_HARVEST) < 1) {
|
if (getMaxBonusLevel(SubSkill.WOODCUTTING_DOUBLE_DROPS) < 1) {
|
||||||
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,8 +687,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
|
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
|
||||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
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 int getMaxBonusLevel(SubSkill subSkill) { return config.getInt(subSkill.getAdvConfigAddress() + ".MaxBonusLevel"); }
|
||||||
public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".ChanceMax", 100.0D); }
|
public double getMaxChance(SubSkill subSkill) { return config.getDouble(subSkill.getAdvConfigAddress() + ".ChanceMax", 100.0D);}
|
||||||
|
|
||||||
/* ACROBATICS */
|
/* ACROBATICS */
|
||||||
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
||||||
|
@ -3,8 +3,8 @@ package com.gmail.nossr50.config;
|
|||||||
import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier;
|
import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -244,6 +244,8 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* General Settings */
|
/* 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); }
|
||||||
public String getLocale() { return config.getString("General.Locale", "en_us"); }
|
public String getLocale() { return config.getString("General.Locale", "en_us"); }
|
||||||
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
|
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
|
||||||
public boolean getShowProfileLoadedMessage() { return config.getBoolean("General.Show_Profile_Loaded", true); }
|
public boolean getShowProfileLoadedMessage() { return config.getBoolean("General.Show_Profile_Loaded", true); }
|
||||||
@ -350,16 +352,16 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Hardcore Mode */
|
/* Hardcore Mode */
|
||||||
public boolean getHardcoreStatLossEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
public boolean getHardcoreStatLossEnabled(PrimarySkill primarySkill) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), false); }
|
||||||
public void setHardcoreStatLossEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
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 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 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 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 boolean getHardcoreVampirismEnabled(PrimarySkill primarySkill) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), false); }
|
||||||
public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
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 double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); }
|
||||||
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
|
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
|
||||||
@ -440,8 +442,8 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
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 boolean getAbilitiesGateEnabled() { return config.getBoolean("Abilities.Activation.Level_Gate_Abilities"); }
|
||||||
|
|
||||||
public int getCooldown(AbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
public int getCooldown(SuperAbility ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||||
public int getMaxLength(AbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
public int getMaxLength(SuperAbility ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||||
|
|
||||||
/* Durability Settings */
|
/* Durability Settings */
|
||||||
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 1); }
|
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 1); }
|
||||||
@ -452,9 +454,9 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
/*
|
/*
|
||||||
* SKILL SETTINGS
|
* 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());
|
String skillName = StringUtils.getCapitalized(skill.toString());
|
||||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
|
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
|
||||||
if (section == null)
|
if (section == null)
|
||||||
@ -544,20 +546,20 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
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");
|
int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
|
||||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillAbilityGate(SkillType skill) {
|
public int getSkillAbilityGate(PrimarySkill skill) {
|
||||||
return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
|
return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getTruncateSkills() { return config.getBoolean("General.TruncateSkills", false); }
|
public boolean getTruncateSkills() { return config.getBoolean("General.TruncateSkills", false); }
|
||||||
|
|
||||||
/* PVP & PVE Settings */
|
/* PVP & PVE Settings */
|
||||||
public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
|
public boolean getPVPEnabled(PrimarySkill 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 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); }
|
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.config.AutoUpdateConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import org.bukkit.Material;
|
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); }
|
public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
||||||
|
|
||||||
/* Skill modifiers */
|
/* 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 */
|
/* Custom XP perk */
|
||||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||||
|
|
||||||
/* Diminished Returns */
|
/* Diminished Returns */
|
||||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
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); }
|
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||||
|
|
||||||
/* Conversion */
|
/* 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(" ", "_")); }
|
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||||
|
|
||||||
/* Materials */
|
/* Materials */
|
||||||
public int getXp(SkillType skill, Material data)
|
public int getXp(PrimarySkill skill, Material data)
|
||||||
{
|
{
|
||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||||
@ -203,7 +203,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Materials */
|
/* Materials */
|
||||||
public int getXp(SkillType skill, BlockData data)
|
public int getXp(PrimarySkill skill, BlockData data)
|
||||||
{
|
{
|
||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||||
@ -218,7 +218,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSkillBlock(SkillType skill, Material data)
|
public boolean isSkillBlock(PrimarySkill skill, Material data)
|
||||||
{
|
{
|
||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||||
@ -231,7 +231,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
return config.contains(wildcardString);
|
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 baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
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.DatabaseType;
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
|
||||||
public interface DatabaseManager {
|
public interface DatabaseManager {
|
||||||
// One month in milliseconds
|
// One month in milliseconds
|
||||||
@ -50,10 +50,10 @@ public interface DatabaseManager {
|
|||||||
* @param statsPerPage The number of stats per page
|
* @param statsPerPage The number of stats per page
|
||||||
* @return the requested leaderboard information
|
* @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>
|
* <p>
|
||||||
* The special value <code>null</code> is used to represent the Power
|
* The special value <code>null</code> is used to represent the Power
|
||||||
* Level rank (the combination of all skill levels).
|
* 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
|
* @param playerName The name of the user to retrieve the rankings for
|
||||||
* @return the requested rank information
|
* @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.
|
* Add a new user to the database.
|
||||||
|
@ -17,6 +17,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
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.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
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.runnables.database.UUIDUpdateAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
|
||||||
|
|
||||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
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 final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
||||||
private long lastUpdate = 0;
|
private long lastUpdate = 0;
|
||||||
|
|
||||||
@ -71,7 +69,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character);
|
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character);
|
||||||
|
|
||||||
boolean powerless = true;
|
boolean powerless = true;
|
||||||
for (int skill : skills.values()) {
|
for (int skill : skills.values()) {
|
||||||
@ -279,47 +277,47 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
else {
|
else {
|
||||||
// Otherwise write the new player information
|
// Otherwise write the new player information
|
||||||
writer.append(playerName).append(":");
|
writer.append(playerName).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.MINING)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.MINING)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.MINING)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.MINING)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.WOODCUTTING)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.WOODCUTTING)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.WOODCUTTING)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.WOODCUTTING)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.REPAIR)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.REPAIR)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.UNARMED)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.UNARMED)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.HERBALISM)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.HERBALISM)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.EXCAVATION)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.EXCAVATION)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.ARCHERY)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.ARCHERY)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.SWORDS)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.SWORDS)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.AXES)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.AXES)).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.ACROBATICS)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.ACROBATICS)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.REPAIR)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.REPAIR)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.UNARMED)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.UNARMED)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.HERBALISM)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.HERBALISM)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.EXCAVATION)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.EXCAVATION)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.ARCHERY)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.ARCHERY)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.SWORDS)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.SWORDS)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.AXES)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.AXES)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.ACROBATICS)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.ACROBATICS)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.TAMING)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.TAMING)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.TAMING)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.TAMING)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.BERSERK)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.BERSERK)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.GIGA_DRILL_BREAKER)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.GIGA_DRILL_BREAKER)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.TREE_FELLER)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.TREE_FELLER)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.GREEN_TERRA)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.GREEN_TERRA)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.SERRATED_STRIKES)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.SKULL_SPLITTER)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.SUPER_BREAKER)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.FISHING)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.FISHING)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbility.BLAST_MINING)).append(":");
|
||||||
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
||||||
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
|
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
|
||||||
writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":");
|
writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":");
|
||||||
writer.append(profile.getSkillLevel(SkillType.ALCHEMY)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkill.ALCHEMY)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.ALCHEMY)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkill.ALCHEMY)).append(":");
|
||||||
writer.append(uuid != null ? uuid.toString() : "NULL").append(":");
|
writer.append(uuid != null ? uuid.toString() : "NULL").append(":");
|
||||||
writer.append(profile.getScoreboardTipsShown()).append(":");
|
writer.append(profile.getScoreboardTipsShown()).append(":");
|
||||||
writer.append("\r\n");
|
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();
|
updateLeaderboards();
|
||||||
List<PlayerStat> statsList = skill == null ? powerLevels : playerStatHash.get(skill);
|
List<PlayerStat> statsList = skill == null ? powerLevels : playerStatHash.get(skill);
|
||||||
int fromIndex = (Math.max(pageNumber, 1) - 1) * statsPerPage;
|
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()));
|
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();
|
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)));
|
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,21 +762,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
playerName = data[USERNAME];
|
playerName = data[USERNAME];
|
||||||
int powerLevel = 0;
|
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(acrobatics, playerName, skills.get(PrimarySkill.ACROBATICS));
|
||||||
powerLevel += putStat(alchemy, playerName, skills.get(SkillType.ALCHEMY));
|
powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkill.ALCHEMY));
|
||||||
powerLevel += putStat(archery, playerName, skills.get(SkillType.ARCHERY));
|
powerLevel += putStat(archery, playerName, skills.get(PrimarySkill.ARCHERY));
|
||||||
powerLevel += putStat(axes, playerName, skills.get(SkillType.AXES));
|
powerLevel += putStat(axes, playerName, skills.get(PrimarySkill.AXES));
|
||||||
powerLevel += putStat(excavation, playerName, skills.get(SkillType.EXCAVATION));
|
powerLevel += putStat(excavation, playerName, skills.get(PrimarySkill.EXCAVATION));
|
||||||
powerLevel += putStat(fishing, playerName, skills.get(SkillType.FISHING));
|
powerLevel += putStat(fishing, playerName, skills.get(PrimarySkill.FISHING));
|
||||||
powerLevel += putStat(herbalism, playerName, skills.get(SkillType.HERBALISM));
|
powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkill.HERBALISM));
|
||||||
powerLevel += putStat(mining, playerName, skills.get(SkillType.MINING));
|
powerLevel += putStat(mining, playerName, skills.get(PrimarySkill.MINING));
|
||||||
powerLevel += putStat(repair, playerName, skills.get(SkillType.REPAIR));
|
powerLevel += putStat(repair, playerName, skills.get(PrimarySkill.REPAIR));
|
||||||
powerLevel += putStat(swords, playerName, skills.get(SkillType.SWORDS));
|
powerLevel += putStat(swords, playerName, skills.get(PrimarySkill.SWORDS));
|
||||||
powerLevel += putStat(taming, playerName, skills.get(SkillType.TAMING));
|
powerLevel += putStat(taming, playerName, skills.get(PrimarySkill.TAMING));
|
||||||
powerLevel += putStat(unarmed, playerName, skills.get(SkillType.UNARMED));
|
powerLevel += putStat(unarmed, playerName, skills.get(PrimarySkill.UNARMED));
|
||||||
powerLevel += putStat(woodcutting, playerName, skills.get(SkillType.WOODCUTTING));
|
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkill.WOODCUTTING));
|
||||||
|
|
||||||
putStat(powerLevels, playerName, powerLevel);
|
putStat(powerLevels, playerName, powerLevel);
|
||||||
}
|
}
|
||||||
@ -815,19 +813,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
Collections.sort(alchemy, c);
|
Collections.sort(alchemy, c);
|
||||||
Collections.sort(powerLevels, c);
|
Collections.sort(powerLevels, c);
|
||||||
|
|
||||||
playerStatHash.put(SkillType.MINING, mining);
|
playerStatHash.put(PrimarySkill.MINING, mining);
|
||||||
playerStatHash.put(SkillType.WOODCUTTING, woodcutting);
|
playerStatHash.put(PrimarySkill.WOODCUTTING, woodcutting);
|
||||||
playerStatHash.put(SkillType.REPAIR, repair);
|
playerStatHash.put(PrimarySkill.REPAIR, repair);
|
||||||
playerStatHash.put(SkillType.UNARMED, unarmed);
|
playerStatHash.put(PrimarySkill.UNARMED, unarmed);
|
||||||
playerStatHash.put(SkillType.HERBALISM, herbalism);
|
playerStatHash.put(PrimarySkill.HERBALISM, herbalism);
|
||||||
playerStatHash.put(SkillType.EXCAVATION, excavation);
|
playerStatHash.put(PrimarySkill.EXCAVATION, excavation);
|
||||||
playerStatHash.put(SkillType.ARCHERY, archery);
|
playerStatHash.put(PrimarySkill.ARCHERY, archery);
|
||||||
playerStatHash.put(SkillType.SWORDS, swords);
|
playerStatHash.put(PrimarySkill.SWORDS, swords);
|
||||||
playerStatHash.put(SkillType.AXES, axes);
|
playerStatHash.put(PrimarySkill.AXES, axes);
|
||||||
playerStatHash.put(SkillType.ACROBATICS, acrobatics);
|
playerStatHash.put(PrimarySkill.ACROBATICS, acrobatics);
|
||||||
playerStatHash.put(SkillType.TAMING, taming);
|
playerStatHash.put(PrimarySkill.TAMING, taming);
|
||||||
playerStatHash.put(SkillType.FISHING, fishing);
|
playerStatHash.put(PrimarySkill.FISHING, fishing);
|
||||||
playerStatHash.put(SkillType.ALCHEMY, alchemy);
|
playerStatHash.put(PrimarySkill.ALCHEMY, alchemy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -894,7 +892,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (Config.getInstance().getTruncateSkills()) {
|
||||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
int index = getSkillIndex(skill);
|
int index = getSkillIndex(skill);
|
||||||
if (index >= character.length) {
|
if (index >= character.length) {
|
||||||
continue;
|
continue;
|
||||||
@ -1034,8 +1032,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
updated |= oldVersion != null;
|
updated |= oldVersion != null;
|
||||||
|
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (Config.getInstance().getTruncateSkills()) {
|
||||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character);
|
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character);
|
||||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
int cap = Config.getInstance().getLevelCap(skill);
|
int cap = Config.getInstance().getLevelCap(skill);
|
||||||
if (skills.get(skill) > cap) {
|
if (skills.get(skill) > cap) {
|
||||||
updated = true;
|
updated = true;
|
||||||
@ -1129,40 +1127,40 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadFromLine(String[] character) {
|
private PlayerProfile loadFromLine(String[] character) {
|
||||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||||
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP
|
Map<PrimarySkill, Float> skillsXp = new EnumMap<PrimarySkill, Float>(PrimarySkill.class); // Skill & XP
|
||||||
Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
|
Map<SuperAbility, Integer> skillsDATS = new EnumMap<SuperAbility, Integer>(SuperAbility.class); // Ability & Cooldown
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
|
|
||||||
// TODO on updates, put new values in a try{} ?
|
// TODO on updates, put new values in a try{} ?
|
||||||
|
|
||||||
skillsXp.put(SkillType.TAMING, (float) Integer.valueOf(character[EXP_TAMING]));
|
skillsXp.put(PrimarySkill.TAMING, (float) Integer.valueOf(character[EXP_TAMING]));
|
||||||
skillsXp.put(SkillType.MINING, (float) Integer.valueOf(character[EXP_MINING]));
|
skillsXp.put(PrimarySkill.MINING, (float) Integer.valueOf(character[EXP_MINING]));
|
||||||
skillsXp.put(SkillType.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR]));
|
skillsXp.put(PrimarySkill.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR]));
|
||||||
skillsXp.put(SkillType.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING]));
|
skillsXp.put(PrimarySkill.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING]));
|
||||||
skillsXp.put(SkillType.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED]));
|
skillsXp.put(PrimarySkill.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED]));
|
||||||
skillsXp.put(SkillType.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM]));
|
skillsXp.put(PrimarySkill.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM]));
|
||||||
skillsXp.put(SkillType.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION]));
|
skillsXp.put(PrimarySkill.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION]));
|
||||||
skillsXp.put(SkillType.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY]));
|
skillsXp.put(PrimarySkill.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY]));
|
||||||
skillsXp.put(SkillType.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS]));
|
skillsXp.put(PrimarySkill.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS]));
|
||||||
skillsXp.put(SkillType.AXES, (float) Integer.valueOf(character[EXP_AXES]));
|
skillsXp.put(PrimarySkill.AXES, (float) Integer.valueOf(character[EXP_AXES]));
|
||||||
skillsXp.put(SkillType.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS]));
|
skillsXp.put(PrimarySkill.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS]));
|
||||||
skillsXp.put(SkillType.FISHING, (float) Integer.valueOf(character[EXP_FISHING]));
|
skillsXp.put(PrimarySkill.FISHING, (float) Integer.valueOf(character[EXP_FISHING]));
|
||||||
skillsXp.put(SkillType.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY]));
|
skillsXp.put(PrimarySkill.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY]));
|
||||||
|
|
||||||
// Taming - Unused
|
// 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
|
// Repair - Unused
|
||||||
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(character[COOLDOWN_TREE_FELLER]));
|
skillsDATS.put(SuperAbility.TREE_FELLER, Integer.valueOf(character[COOLDOWN_TREE_FELLER]));
|
||||||
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(character[COOLDOWN_BERSERK]));
|
skillsDATS.put(SuperAbility.BERSERK, Integer.valueOf(character[COOLDOWN_BERSERK]));
|
||||||
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(character[COOLDOWN_GREEN_TERRA]));
|
skillsDATS.put(SuperAbility.GREEN_TERRA, Integer.valueOf(character[COOLDOWN_GREEN_TERRA]));
|
||||||
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(character[COOLDOWN_GIGA_DRILL_BREAKER]));
|
skillsDATS.put(SuperAbility.GIGA_DRILL_BREAKER, Integer.valueOf(character[COOLDOWN_GIGA_DRILL_BREAKER]));
|
||||||
// Archery - Unused
|
// Archery - Unused
|
||||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[COOLDOWN_SERRATED_STRIKES]));
|
skillsDATS.put(SuperAbility.SERRATED_STRIKES, Integer.valueOf(character[COOLDOWN_SERRATED_STRIKES]));
|
||||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(character[COOLDOWN_SKULL_SPLITTER]));
|
skillsDATS.put(SuperAbility.SKULL_SPLITTER, Integer.valueOf(character[COOLDOWN_SKULL_SPLITTER]));
|
||||||
// Acrobatics - Unused
|
// 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 {
|
try {
|
||||||
mobHealthbarType = MobHealthbarType.valueOf(character[HEALTHBAR]);
|
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);
|
return new PlayerProfile(character[USERNAME], uuid, skills, skillsXp, skillsDATS, mobHealthbarType, scoreboardTipsShown);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<SkillType, Integer> getSkillMapFromLine(String[] character) {
|
private Map<PrimarySkill, Integer> getSkillMapFromLine(String[] character) {
|
||||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level
|
Map<PrimarySkill, Integer> skills = new EnumMap<PrimarySkill, Integer>(PrimarySkill.class); // Skill & Level
|
||||||
|
|
||||||
skills.put(SkillType.TAMING, Integer.valueOf(character[SKILLS_TAMING]));
|
skills.put(PrimarySkill.TAMING, Integer.valueOf(character[SKILLS_TAMING]));
|
||||||
skills.put(SkillType.MINING, Integer.valueOf(character[SKILLS_MINING]));
|
skills.put(PrimarySkill.MINING, Integer.valueOf(character[SKILLS_MINING]));
|
||||||
skills.put(SkillType.REPAIR, Integer.valueOf(character[SKILLS_REPAIR]));
|
skills.put(PrimarySkill.REPAIR, Integer.valueOf(character[SKILLS_REPAIR]));
|
||||||
skills.put(SkillType.WOODCUTTING, Integer.valueOf(character[SKILLS_WOODCUTTING]));
|
skills.put(PrimarySkill.WOODCUTTING, Integer.valueOf(character[SKILLS_WOODCUTTING]));
|
||||||
skills.put(SkillType.UNARMED, Integer.valueOf(character[SKILLS_UNARMED]));
|
skills.put(PrimarySkill.UNARMED, Integer.valueOf(character[SKILLS_UNARMED]));
|
||||||
skills.put(SkillType.HERBALISM, Integer.valueOf(character[SKILLS_HERBALISM]));
|
skills.put(PrimarySkill.HERBALISM, Integer.valueOf(character[SKILLS_HERBALISM]));
|
||||||
skills.put(SkillType.EXCAVATION, Integer.valueOf(character[SKILLS_EXCAVATION]));
|
skills.put(PrimarySkill.EXCAVATION, Integer.valueOf(character[SKILLS_EXCAVATION]));
|
||||||
skills.put(SkillType.ARCHERY, Integer.valueOf(character[SKILLS_ARCHERY]));
|
skills.put(PrimarySkill.ARCHERY, Integer.valueOf(character[SKILLS_ARCHERY]));
|
||||||
skills.put(SkillType.SWORDS, Integer.valueOf(character[SKILLS_SWORDS]));
|
skills.put(PrimarySkill.SWORDS, Integer.valueOf(character[SKILLS_SWORDS]));
|
||||||
skills.put(SkillType.AXES, Integer.valueOf(character[SKILLS_AXES]));
|
skills.put(PrimarySkill.AXES, Integer.valueOf(character[SKILLS_AXES]));
|
||||||
skills.put(SkillType.ACROBATICS, Integer.valueOf(character[SKILLS_ACROBATICS]));
|
skills.put(PrimarySkill.ACROBATICS, Integer.valueOf(character[SKILLS_ACROBATICS]));
|
||||||
skills.put(SkillType.FISHING, Integer.valueOf(character[SKILLS_FISHING]));
|
skills.put(PrimarySkill.FISHING, Integer.valueOf(character[SKILLS_FISHING]));
|
||||||
skills.put(SkillType.ALCHEMY, Integer.valueOf(character[SKILLS_ALCHEMY]));
|
skills.put(PrimarySkill.ALCHEMY, Integer.valueOf(character[SKILLS_ALCHEMY]));
|
||||||
|
|
||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
@ -1216,7 +1214,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() { }
|
public void onDisable() { }
|
||||||
|
|
||||||
private int getSkillIndex(SkillType skill) {
|
private int getSkillIndex(PrimarySkill skill) {
|
||||||
switch (skill) {
|
switch (skill) {
|
||||||
case ACROBATICS:
|
case ACROBATICS:
|
||||||
return SKILLS_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.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -226,22 +226,22 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||||
+ ", fishing = ?, alchemy = ?, total = ? WHERE user_id = ?");
|
+ ", fishing = ?, alchemy = ?, total = ? WHERE user_id = ?");
|
||||||
statement.setInt(1, profile.getSkillLevel(SkillType.TAMING));
|
statement.setInt(1, profile.getSkillLevel(PrimarySkill.TAMING));
|
||||||
statement.setInt(2, profile.getSkillLevel(SkillType.MINING));
|
statement.setInt(2, profile.getSkillLevel(PrimarySkill.MINING));
|
||||||
statement.setInt(3, profile.getSkillLevel(SkillType.REPAIR));
|
statement.setInt(3, profile.getSkillLevel(PrimarySkill.REPAIR));
|
||||||
statement.setInt(4, profile.getSkillLevel(SkillType.WOODCUTTING));
|
statement.setInt(4, profile.getSkillLevel(PrimarySkill.WOODCUTTING));
|
||||||
statement.setInt(5, profile.getSkillLevel(SkillType.UNARMED));
|
statement.setInt(5, profile.getSkillLevel(PrimarySkill.UNARMED));
|
||||||
statement.setInt(6, profile.getSkillLevel(SkillType.HERBALISM));
|
statement.setInt(6, profile.getSkillLevel(PrimarySkill.HERBALISM));
|
||||||
statement.setInt(7, profile.getSkillLevel(SkillType.EXCAVATION));
|
statement.setInt(7, profile.getSkillLevel(PrimarySkill.EXCAVATION));
|
||||||
statement.setInt(8, profile.getSkillLevel(SkillType.ARCHERY));
|
statement.setInt(8, profile.getSkillLevel(PrimarySkill.ARCHERY));
|
||||||
statement.setInt(9, profile.getSkillLevel(SkillType.SWORDS));
|
statement.setInt(9, profile.getSkillLevel(PrimarySkill.SWORDS));
|
||||||
statement.setInt(10, profile.getSkillLevel(SkillType.AXES));
|
statement.setInt(10, profile.getSkillLevel(PrimarySkill.AXES));
|
||||||
statement.setInt(11, profile.getSkillLevel(SkillType.ACROBATICS));
|
statement.setInt(11, profile.getSkillLevel(PrimarySkill.ACROBATICS));
|
||||||
statement.setInt(12, profile.getSkillLevel(SkillType.FISHING));
|
statement.setInt(12, profile.getSkillLevel(PrimarySkill.FISHING));
|
||||||
statement.setInt(13, profile.getSkillLevel(SkillType.ALCHEMY));
|
statement.setInt(13, profile.getSkillLevel(PrimarySkill.ALCHEMY));
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS)
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS)
|
||||||
total += profile.getSkillLevel(skillType);
|
total += profile.getSkillLevel(primarySkill);
|
||||||
statement.setInt(14, total);
|
statement.setInt(14, total);
|
||||||
statement.setInt(15, id);
|
statement.setInt(15, id);
|
||||||
success &= (statement.executeUpdate() != 0);
|
success &= (statement.executeUpdate() != 0);
|
||||||
@ -256,19 +256,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
+ ", unarmed = ?, herbalism = ?, excavation = ?"
|
||||||
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
|
||||||
+ ", fishing = ?, alchemy = ? WHERE user_id = ?");
|
+ ", fishing = ?, alchemy = ? WHERE user_id = ?");
|
||||||
statement.setInt(1, profile.getSkillXpLevel(SkillType.TAMING));
|
statement.setInt(1, profile.getSkillXpLevel(PrimarySkill.TAMING));
|
||||||
statement.setInt(2, profile.getSkillXpLevel(SkillType.MINING));
|
statement.setInt(2, profile.getSkillXpLevel(PrimarySkill.MINING));
|
||||||
statement.setInt(3, profile.getSkillXpLevel(SkillType.REPAIR));
|
statement.setInt(3, profile.getSkillXpLevel(PrimarySkill.REPAIR));
|
||||||
statement.setInt(4, profile.getSkillXpLevel(SkillType.WOODCUTTING));
|
statement.setInt(4, profile.getSkillXpLevel(PrimarySkill.WOODCUTTING));
|
||||||
statement.setInt(5, profile.getSkillXpLevel(SkillType.UNARMED));
|
statement.setInt(5, profile.getSkillXpLevel(PrimarySkill.UNARMED));
|
||||||
statement.setInt(6, profile.getSkillXpLevel(SkillType.HERBALISM));
|
statement.setInt(6, profile.getSkillXpLevel(PrimarySkill.HERBALISM));
|
||||||
statement.setInt(7, profile.getSkillXpLevel(SkillType.EXCAVATION));
|
statement.setInt(7, profile.getSkillXpLevel(PrimarySkill.EXCAVATION));
|
||||||
statement.setInt(8, profile.getSkillXpLevel(SkillType.ARCHERY));
|
statement.setInt(8, profile.getSkillXpLevel(PrimarySkill.ARCHERY));
|
||||||
statement.setInt(9, profile.getSkillXpLevel(SkillType.SWORDS));
|
statement.setInt(9, profile.getSkillXpLevel(PrimarySkill.SWORDS));
|
||||||
statement.setInt(10, profile.getSkillXpLevel(SkillType.AXES));
|
statement.setInt(10, profile.getSkillXpLevel(PrimarySkill.AXES));
|
||||||
statement.setInt(11, profile.getSkillXpLevel(SkillType.ACROBATICS));
|
statement.setInt(11, profile.getSkillXpLevel(PrimarySkill.ACROBATICS));
|
||||||
statement.setInt(12, profile.getSkillXpLevel(SkillType.FISHING));
|
statement.setInt(12, profile.getSkillXpLevel(PrimarySkill.FISHING));
|
||||||
statement.setInt(13, profile.getSkillXpLevel(SkillType.ALCHEMY));
|
statement.setInt(13, profile.getSkillXpLevel(PrimarySkill.ALCHEMY));
|
||||||
statement.setInt(14, id);
|
statement.setInt(14, id);
|
||||||
success &= (statement.executeUpdate() != 0);
|
success &= (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
@ -281,14 +281,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ " mining = ?, woodcutting = ?, unarmed = ?"
|
+ " mining = ?, woodcutting = ?, unarmed = ?"
|
||||||
+ ", herbalism = ?, excavation = ?, swords = ?"
|
+ ", herbalism = ?, excavation = ?, swords = ?"
|
||||||
+ ", axes = ?, blast_mining = ? WHERE user_id = ?");
|
+ ", axes = ?, blast_mining = ? WHERE user_id = ?");
|
||||||
statement.setLong(1, profile.getAbilityDATS(AbilityType.SUPER_BREAKER));
|
statement.setLong(1, profile.getAbilityDATS(SuperAbility.SUPER_BREAKER));
|
||||||
statement.setLong(2, profile.getAbilityDATS(AbilityType.TREE_FELLER));
|
statement.setLong(2, profile.getAbilityDATS(SuperAbility.TREE_FELLER));
|
||||||
statement.setLong(3, profile.getAbilityDATS(AbilityType.BERSERK));
|
statement.setLong(3, profile.getAbilityDATS(SuperAbility.BERSERK));
|
||||||
statement.setLong(4, profile.getAbilityDATS(AbilityType.GREEN_TERRA));
|
statement.setLong(4, profile.getAbilityDATS(SuperAbility.GREEN_TERRA));
|
||||||
statement.setLong(5, profile.getAbilityDATS(AbilityType.GIGA_DRILL_BREAKER));
|
statement.setLong(5, profile.getAbilityDATS(SuperAbility.GIGA_DRILL_BREAKER));
|
||||||
statement.setLong(6, profile.getAbilityDATS(AbilityType.SERRATED_STRIKES));
|
statement.setLong(6, profile.getAbilityDATS(SuperAbility.SERRATED_STRIKES));
|
||||||
statement.setLong(7, profile.getAbilityDATS(AbilityType.SKULL_SPLITTER));
|
statement.setLong(7, profile.getAbilityDATS(SuperAbility.SKULL_SPLITTER));
|
||||||
statement.setLong(8, profile.getAbilityDATS(AbilityType.BLAST_MINING));
|
statement.setLong(8, profile.getAbilityDATS(SuperAbility.BLAST_MINING));
|
||||||
statement.setInt(9, id);
|
statement.setInt(9, id);
|
||||||
success = (statement.executeUpdate() != 0);
|
success = (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
@ -319,7 +319,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
return success;
|
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>();
|
List<PlayerStat> stats = new ArrayList<PlayerStat>();
|
||||||
|
|
||||||
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase();
|
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase();
|
||||||
@ -356,8 +356,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<SkillType, Integer> readRank(String playerName) {
|
public Map<PrimarySkill, Integer> readRank(String playerName) {
|
||||||
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>();
|
||||||
|
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
@ -365,8 +365,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
connection = getConnection(PoolIdentifier.MISC);
|
connection = getConnection(PoolIdentifier.MISC);
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
String skillName = skillType.name().toLowerCase();
|
String skillName = primarySkill.name().toLowerCase();
|
||||||
// Get count of all users with higher skill level than player
|
// 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 " +
|
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 " +
|
"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()) {
|
while (resultSet.next()) {
|
||||||
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
|
if (resultSet.getString("user").equalsIgnoreCase(playerName)) {
|
||||||
skills.put(skillType, rank + resultSet.getRow());
|
skills.put(primarySkill, rank + resultSet.getRow());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -880,7 +880,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (Config.getInstance().getTruncateSkills()) {
|
||||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
int cap = Config.getInstance().getLevelCap(skill);
|
int cap = Config.getInstance().getLevelCap(skill);
|
||||||
if (cap != Integer.MAX_VALUE) {
|
if (cap != Integer.MAX_VALUE) {
|
||||||
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase() + "` = " + cap + " WHERE `" + skill.name().toLowerCase() + "` > " + cap);
|
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 {
|
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
||||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level
|
Map<PrimarySkill, Integer> skills = new EnumMap<PrimarySkill, Integer>(PrimarySkill.class); // Skill & Level
|
||||||
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP
|
Map<PrimarySkill, Float> skillsXp = new EnumMap<PrimarySkill, Float>(PrimarySkill.class); // Skill & XP
|
||||||
Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
|
Map<SuperAbility, Integer> skillsDATS = new EnumMap<SuperAbility, Integer>(SuperAbility.class); // Ability & Cooldown
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
@ -1052,46 +1052,46 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
final int OFFSET_DATS = 26;
|
final int OFFSET_DATS = 26;
|
||||||
final int OFFSET_OTHER = 38;
|
final int OFFSET_OTHER = 38;
|
||||||
|
|
||||||
skills.put(SkillType.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
skills.put(PrimarySkill.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
||||||
skills.put(SkillType.MINING, result.getInt(OFFSET_SKILLS + 2));
|
skills.put(PrimarySkill.MINING, result.getInt(OFFSET_SKILLS + 2));
|
||||||
skills.put(SkillType.REPAIR, result.getInt(OFFSET_SKILLS + 3));
|
skills.put(PrimarySkill.REPAIR, result.getInt(OFFSET_SKILLS + 3));
|
||||||
skills.put(SkillType.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
|
skills.put(PrimarySkill.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
|
||||||
skills.put(SkillType.UNARMED, result.getInt(OFFSET_SKILLS + 5));
|
skills.put(PrimarySkill.UNARMED, result.getInt(OFFSET_SKILLS + 5));
|
||||||
skills.put(SkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
|
skills.put(PrimarySkill.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
|
||||||
skills.put(SkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
|
skills.put(PrimarySkill.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
|
||||||
skills.put(SkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
|
skills.put(PrimarySkill.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
|
||||||
skills.put(SkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9));
|
skills.put(PrimarySkill.SWORDS, result.getInt(OFFSET_SKILLS + 9));
|
||||||
skills.put(SkillType.AXES, result.getInt(OFFSET_SKILLS + 10));
|
skills.put(PrimarySkill.AXES, result.getInt(OFFSET_SKILLS + 10));
|
||||||
skills.put(SkillType.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
|
skills.put(PrimarySkill.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
|
||||||
skills.put(SkillType.FISHING, result.getInt(OFFSET_SKILLS + 12));
|
skills.put(PrimarySkill.FISHING, result.getInt(OFFSET_SKILLS + 12));
|
||||||
skills.put(SkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
skills.put(PrimarySkill.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
||||||
|
|
||||||
skillsXp.put(SkillType.TAMING, result.getFloat(OFFSET_XP + 1));
|
skillsXp.put(PrimarySkill.TAMING, result.getFloat(OFFSET_XP + 1));
|
||||||
skillsXp.put(SkillType.MINING, result.getFloat(OFFSET_XP + 2));
|
skillsXp.put(PrimarySkill.MINING, result.getFloat(OFFSET_XP + 2));
|
||||||
skillsXp.put(SkillType.REPAIR, result.getFloat(OFFSET_XP + 3));
|
skillsXp.put(PrimarySkill.REPAIR, result.getFloat(OFFSET_XP + 3));
|
||||||
skillsXp.put(SkillType.WOODCUTTING, result.getFloat(OFFSET_XP + 4));
|
skillsXp.put(PrimarySkill.WOODCUTTING, result.getFloat(OFFSET_XP + 4));
|
||||||
skillsXp.put(SkillType.UNARMED, result.getFloat(OFFSET_XP + 5));
|
skillsXp.put(PrimarySkill.UNARMED, result.getFloat(OFFSET_XP + 5));
|
||||||
skillsXp.put(SkillType.HERBALISM, result.getFloat(OFFSET_XP + 6));
|
skillsXp.put(PrimarySkill.HERBALISM, result.getFloat(OFFSET_XP + 6));
|
||||||
skillsXp.put(SkillType.EXCAVATION, result.getFloat(OFFSET_XP + 7));
|
skillsXp.put(PrimarySkill.EXCAVATION, result.getFloat(OFFSET_XP + 7));
|
||||||
skillsXp.put(SkillType.ARCHERY, result.getFloat(OFFSET_XP + 8));
|
skillsXp.put(PrimarySkill.ARCHERY, result.getFloat(OFFSET_XP + 8));
|
||||||
skillsXp.put(SkillType.SWORDS, result.getFloat(OFFSET_XP + 9));
|
skillsXp.put(PrimarySkill.SWORDS, result.getFloat(OFFSET_XP + 9));
|
||||||
skillsXp.put(SkillType.AXES, result.getFloat(OFFSET_XP + 10));
|
skillsXp.put(PrimarySkill.AXES, result.getFloat(OFFSET_XP + 10));
|
||||||
skillsXp.put(SkillType.ACROBATICS, result.getFloat(OFFSET_XP + 11));
|
skillsXp.put(PrimarySkill.ACROBATICS, result.getFloat(OFFSET_XP + 11));
|
||||||
skillsXp.put(SkillType.FISHING, result.getFloat(OFFSET_XP + 12));
|
skillsXp.put(PrimarySkill.FISHING, result.getFloat(OFFSET_XP + 12));
|
||||||
skillsXp.put(SkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13));
|
skillsXp.put(PrimarySkill.ALCHEMY, result.getFloat(OFFSET_XP + 13));
|
||||||
|
|
||||||
// Taming - Unused - result.getInt(OFFSET_DATS + 1)
|
// 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)
|
// Repair - Unused - result.getInt(OFFSET_DATS + 3)
|
||||||
skillsDATS.put(AbilityType.TREE_FELLER, result.getInt(OFFSET_DATS + 4));
|
skillsDATS.put(SuperAbility.TREE_FELLER, result.getInt(OFFSET_DATS + 4));
|
||||||
skillsDATS.put(AbilityType.BERSERK, result.getInt(OFFSET_DATS + 5));
|
skillsDATS.put(SuperAbility.BERSERK, result.getInt(OFFSET_DATS + 5));
|
||||||
skillsDATS.put(AbilityType.GREEN_TERRA, result.getInt(OFFSET_DATS + 6));
|
skillsDATS.put(SuperAbility.GREEN_TERRA, result.getInt(OFFSET_DATS + 6));
|
||||||
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, result.getInt(OFFSET_DATS + 7));
|
skillsDATS.put(SuperAbility.GIGA_DRILL_BREAKER, result.getInt(OFFSET_DATS + 7));
|
||||||
// Archery - Unused - result.getInt(OFFSET_DATS + 8)
|
// Archery - Unused - result.getInt(OFFSET_DATS + 8)
|
||||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, result.getInt(OFFSET_DATS + 9));
|
skillsDATS.put(SuperAbility.SERRATED_STRIKES, result.getInt(OFFSET_DATS + 9));
|
||||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, result.getInt(OFFSET_DATS + 10));
|
skillsDATS.put(SuperAbility.SKULL_SPLITTER, result.getInt(OFFSET_DATS + 10));
|
||||||
// Acrobatics - Unused - result.getInt(OFFSET_DATS + 11)
|
// 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 {
|
try {
|
||||||
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 1));
|
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 = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
|
||||||
resultSet.last();
|
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");
|
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();
|
String skill_name = skill.name().toLowerCase();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -4,20 +4,20 @@ import java.util.concurrent.Delayed;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
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 {
|
public class SkillXpGain implements Delayed {
|
||||||
private final long expiryTime;
|
private final long expiryTime;
|
||||||
private final float xp;
|
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.expiryTime = System.currentTimeMillis() + getDuration();
|
||||||
this.xp = xp;
|
this.xp = xp;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkillType getSkill() {
|
public PrimarySkill getSkill() {
|
||||||
return type;
|
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.mods.CustomTool;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -61,7 +61,7 @@ public class McMMOPlayer {
|
|||||||
private Player player;
|
private Player player;
|
||||||
private PlayerProfile profile;
|
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 party;
|
||||||
private Party invite;
|
private Party invite;
|
||||||
@ -77,8 +77,8 @@ public class McMMOPlayer {
|
|||||||
private boolean abilityUse = true;
|
private boolean abilityUse = true;
|
||||||
private boolean godMode;
|
private boolean godMode;
|
||||||
|
|
||||||
private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
private final Map<SuperAbility, Boolean> abilityMode = new HashMap<SuperAbility, Boolean>();
|
||||||
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
private final Map<SuperAbility, Boolean> abilityInformed = new HashMap<SuperAbility, Boolean>();
|
||||||
|
|
||||||
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||||
|
|
||||||
@ -107,11 +107,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),
|
* 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.
|
* 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 {
|
try {
|
||||||
for (SkillType skillType : SkillType.values()) {
|
for (PrimarySkill primarySkill : PrimarySkill.values()) {
|
||||||
skillManagers.put(skillType, skillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
skillManagers.put(primarySkill, primarySkill.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
@ -119,9 +119,9 @@ public class McMMOPlayer {
|
|||||||
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbilityType abilityType : AbilityType.values()) {
|
for (SuperAbility superAbility : SuperAbility.values()) {
|
||||||
abilityMode.put(abilityType, false);
|
abilityMode.put(superAbility, false);
|
||||||
abilityInformed.put(abilityType, true); // This is intended
|
abilityInformed.put(superAbility, true); // This is intended
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ToolType toolType : ToolType.values()) {
|
for (ToolType toolType : ToolType.values()) {
|
||||||
@ -130,63 +130,63 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AcrobaticsManager getAcrobaticsManager() {
|
public AcrobaticsManager getAcrobaticsManager() {
|
||||||
return (AcrobaticsManager) skillManagers.get(SkillType.ACROBATICS);
|
return (AcrobaticsManager) skillManagers.get(PrimarySkill.ACROBATICS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlchemyManager getAlchemyManager() {
|
public AlchemyManager getAlchemyManager() {
|
||||||
return (AlchemyManager) skillManagers.get(SkillType.ALCHEMY);
|
return (AlchemyManager) skillManagers.get(PrimarySkill.ALCHEMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArcheryManager getArcheryManager() {
|
public ArcheryManager getArcheryManager() {
|
||||||
return (ArcheryManager) skillManagers.get(SkillType.ARCHERY);
|
return (ArcheryManager) skillManagers.get(PrimarySkill.ARCHERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxesManager getAxesManager() {
|
public AxesManager getAxesManager() {
|
||||||
return (AxesManager) skillManagers.get(SkillType.AXES);
|
return (AxesManager) skillManagers.get(PrimarySkill.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExcavationManager getExcavationManager() {
|
public ExcavationManager getExcavationManager() {
|
||||||
return (ExcavationManager) skillManagers.get(SkillType.EXCAVATION);
|
return (ExcavationManager) skillManagers.get(PrimarySkill.EXCAVATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FishingManager getFishingManager() {
|
public FishingManager getFishingManager() {
|
||||||
return (FishingManager) skillManagers.get(SkillType.FISHING);
|
return (FishingManager) skillManagers.get(PrimarySkill.FISHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HerbalismManager getHerbalismManager() {
|
public HerbalismManager getHerbalismManager() {
|
||||||
return (HerbalismManager) skillManagers.get(SkillType.HERBALISM);
|
return (HerbalismManager) skillManagers.get(PrimarySkill.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MiningManager getMiningManager() {
|
public MiningManager getMiningManager() {
|
||||||
return (MiningManager) skillManagers.get(SkillType.MINING);
|
return (MiningManager) skillManagers.get(PrimarySkill.MINING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RepairManager getRepairManager() {
|
public RepairManager getRepairManager() {
|
||||||
return (RepairManager) skillManagers.get(SkillType.REPAIR);
|
return (RepairManager) skillManagers.get(PrimarySkill.REPAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SalvageManager getSalvageManager() {
|
public SalvageManager getSalvageManager() {
|
||||||
return (SalvageManager) skillManagers.get(SkillType.SALVAGE);
|
return (SalvageManager) skillManagers.get(PrimarySkill.SALVAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SmeltingManager getSmeltingManager() {
|
public SmeltingManager getSmeltingManager() {
|
||||||
return (SmeltingManager) skillManagers.get(SkillType.SMELTING);
|
return (SmeltingManager) skillManagers.get(PrimarySkill.SMELTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SwordsManager getSwordsManager() {
|
public SwordsManager getSwordsManager() {
|
||||||
return (SwordsManager) skillManagers.get(SkillType.SWORDS);
|
return (SwordsManager) skillManagers.get(PrimarySkill.SWORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TamingManager getTamingManager() {
|
public TamingManager getTamingManager() {
|
||||||
return (TamingManager) skillManagers.get(SkillType.TAMING);
|
return (TamingManager) skillManagers.get(PrimarySkill.TAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnarmedManager getUnarmedManager() {
|
public UnarmedManager getUnarmedManager() {
|
||||||
return (UnarmedManager) skillManagers.get(SkillType.UNARMED);
|
return (UnarmedManager) skillManagers.get(PrimarySkill.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WoodcuttingManager getWoodcuttingManager() {
|
public WoodcuttingManager getWoodcuttingManager() {
|
||||||
return (WoodcuttingManager) skillManagers.get(SkillType.WOODCUTTING);
|
return (WoodcuttingManager) skillManagers.get(PrimarySkill.WOODCUTTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -197,7 +197,7 @@ public class McMMOPlayer {
|
|||||||
* Reset the mode of all abilities.
|
* Reset the mode of all abilities.
|
||||||
*/
|
*/
|
||||||
public void resetAbilityMode() {
|
public void resetAbilityMode() {
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
for (SuperAbility ability : SuperAbility.values()) {
|
||||||
// Correctly disable and handle any special deactivate code
|
// Correctly disable and handle any special deactivate code
|
||||||
new AbilityDisableTask(this, ability).run();
|
new AbilityDisableTask(this, ability).run();
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ public class McMMOPlayer {
|
|||||||
* @param ability The ability to check
|
* @param ability The ability to check
|
||||||
* @return true if the ability is enabled, false otherwise
|
* @return true if the ability is enabled, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean getAbilityMode(AbilityType ability) {
|
public boolean getAbilityMode(SuperAbility ability) {
|
||||||
return abilityMode.get(ability);
|
return abilityMode.get(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ public class McMMOPlayer {
|
|||||||
* @param ability The ability to check
|
* @param ability The ability to check
|
||||||
* @param isActive True if the ability is active, false otherwise
|
* @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);
|
abilityMode.put(ability, isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ public class McMMOPlayer {
|
|||||||
* @param ability The ability to check
|
* @param ability The ability to check
|
||||||
* @return true if the ability is informed, false otherwise
|
* @return true if the ability is informed, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean getAbilityInformed(AbilityType ability) {
|
public boolean getAbilityInformed(SuperAbility ability) {
|
||||||
return abilityInformed.get(ability);
|
return abilityInformed.get(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ public class McMMOPlayer {
|
|||||||
* @param ability The ability to check
|
* @param ability The ability to check
|
||||||
* @param isInformed True if the ability is informed, false otherwise
|
* @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);
|
abilityInformed.put(ability, isInformed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ public class McMMOPlayer {
|
|||||||
public int getPowerLevel() {
|
public int getPowerLevel() {
|
||||||
int powerLevel = 0;
|
int powerLevel = 0;
|
||||||
|
|
||||||
for (SkillType type : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
if (type.getPermissions(player)) {
|
if (type.getPermissions(player)) {
|
||||||
powerLevel += getSkillLevel(type);
|
powerLevel += getSkillLevel(type);
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ public class McMMOPlayer {
|
|||||||
* @param skill Skill being used
|
* @param skill Skill being used
|
||||||
* @param xp Experience amount to process
|
* @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.");
|
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
|
||||||
|
|
||||||
if (xp <= 0.0) {
|
if (xp <= 0.0) {
|
||||||
@ -407,10 +407,10 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
|
Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill);
|
||||||
float splitXp = xp / parentSkills.size();
|
float splitXp = xp / parentSkills.size();
|
||||||
|
|
||||||
for (SkillType parentSkill : parentSkills) {
|
for (PrimarySkill parentSkill : parentSkills) {
|
||||||
if (parentSkill.getPermissions(player)) {
|
if (parentSkill.getPermissions(player)) {
|
||||||
beginXpGain(parentSkill, splitXp, xpGainReason);
|
beginXpGain(parentSkill, splitXp, xpGainReason);
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ public class McMMOPlayer {
|
|||||||
* @param skill Skill being used
|
* @param skill Skill being used
|
||||||
* @param xp Experience amount to process
|
* @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);
|
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason);
|
||||||
|
|
||||||
if (party == null) {
|
if (party == null) {
|
||||||
@ -448,56 +448,56 @@ public class McMMOPlayer {
|
|||||||
/**
|
/**
|
||||||
* Applies an experience gain
|
* Applies an experience gain
|
||||||
*
|
*
|
||||||
* @param skillType Skill being used
|
* @param primarySkill Skill being used
|
||||||
* @param xp Experience amount to add
|
* @param xp Experience amount to add
|
||||||
*/
|
*/
|
||||||
public void applyXpGain(SkillType skillType, float xp, XPGainReason xpGainReason) {
|
public void applyXpGain(PrimarySkill primarySkill, float xp, XPGainReason xpGainReason) {
|
||||||
if (!skillType.getPermissions(player)) {
|
if (!primarySkill.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skillType.isChildSkill()) {
|
if (primarySkill.isChildSkill()) {
|
||||||
Set<SkillType> parentSkills = FamilyTree.getParents(skillType);
|
Set<PrimarySkill> parentSkills = FamilyTree.getParents(primarySkill);
|
||||||
|
|
||||||
for (SkillType parentSkill : parentSkills) {
|
for (PrimarySkill parentSkill : parentSkills) {
|
||||||
applyXpGain(parentSkill, xp / parentSkills.size(), xpGainReason);
|
applyXpGain(parentSkill, xp / parentSkills.size(), xpGainReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EventUtils.handleXpGainEvent(player, skillType, xp, xpGainReason)) {
|
if (!EventUtils.handleXpGainEvent(player, primarySkill, xp, xpGainReason)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isUsingUnarmed = (skillType == SkillType.UNARMED);
|
isUsingUnarmed = (primarySkill == PrimarySkill.UNARMED);
|
||||||
checkXp(skillType, xpGainReason);
|
checkXp(primarySkill, xpGainReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the XP of a skill.
|
* 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) {
|
private void checkXp(PrimarySkill primarySkill, XPGainReason xpGainReason) {
|
||||||
if (getSkillXpLevelRaw(skillType) < getXpToLevel(skillType)) {
|
if (getSkillXpLevelRaw(primarySkill) < getXpToLevel(primarySkill)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int levelsGained = 0;
|
int levelsGained = 0;
|
||||||
float xpRemoved = 0;
|
float xpRemoved = 0;
|
||||||
|
|
||||||
while (getSkillXpLevelRaw(skillType) >= getXpToLevel(skillType)) {
|
while (getSkillXpLevelRaw(primarySkill) >= getXpToLevel(primarySkill)) {
|
||||||
if (hasReachedLevelCap(skillType)) {
|
if (hasReachedLevelCap(primarySkill)) {
|
||||||
setSkillXpLevel(skillType, 0);
|
setSkillXpLevel(primarySkill, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
xpRemoved += profile.levelUp(skillType);
|
xpRemoved += profile.levelUp(primarySkill);
|
||||||
levelsGained++;
|
levelsGained++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EventUtils.handleLevelChangeEvent(player, skillType, levelsGained, xpRemoved, true, xpGainReason)) {
|
if (!EventUtils.handleLevelChangeEvent(player, primarySkill, levelsGained, xpRemoved, true, xpGainReason)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ public class McMMOPlayer {
|
|||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
|
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(primarySkill.toString()) + ".Skillup", levelsGained, getSkillLevel(primarySkill)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -675,16 +675,16 @@ public class McMMOPlayer {
|
|||||||
/**
|
/**
|
||||||
* Modifies an experience gain using skill modifiers, global rate and perks
|
* 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
|
* @param xp Experience amount to process
|
||||||
* @return Modified experience
|
* @return Modified experience
|
||||||
*/
|
*/
|
||||||
private float modifyXpGain(SkillType skillType, float xp) {
|
private float modifyXpGain(PrimarySkill primarySkill, float xp) {
|
||||||
if (player.getGameMode() == GameMode.CREATIVE || (skillType.getMaxLevel() <= getSkillLevel(skillType)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
if (player.getGameMode() == GameMode.CREATIVE || (primarySkill.getMaxLevel() <= getSkillLevel(primarySkill)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xp = (float) (xp / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
xp = (float) (xp / primarySkill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||||
|
|
||||||
if (Config.getInstance().getToolModsEnabled()) {
|
if (Config.getInstance().getToolModsEnabled()) {
|
||||||
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
||||||
@ -694,7 +694,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PerksUtils.handleXpPerks(player, xp, skillType);
|
return PerksUtils.handleXpPerks(player, xp, primarySkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkGodMode() {
|
public void checkGodMode() {
|
||||||
@ -716,9 +716,9 @@ public class McMMOPlayer {
|
|||||||
*
|
*
|
||||||
* @param skill The skill the ability is based on
|
* @param skill The skill the ability is based on
|
||||||
*/
|
*/
|
||||||
public void checkAbilityActivation(SkillType skill) {
|
public void checkAbilityActivation(PrimarySkill skill) {
|
||||||
ToolType tool = skill.getTool();
|
ToolType tool = skill.getTool();
|
||||||
AbilityType ability = skill.getAbility();
|
SuperAbility ability = skill.getAbility();
|
||||||
|
|
||||||
setToolPreparationMode(tool, false);
|
setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
@ -746,7 +746,7 @@ public class McMMOPlayer {
|
|||||||
* Axes and Woodcutting are odd because they share the same tool.
|
* Axes and Woodcutting are odd because they share the same tool.
|
||||||
* We show them the too tired message when they take action.
|
* 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));
|
player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,14 +772,14 @@ public class McMMOPlayer {
|
|||||||
profile.setAbilityDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
profile.setAbilityDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||||
setAbilityMode(ability, true);
|
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);
|
SkillUtils.handleAbilitySpeedIncrease(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
new AbilityDisableTask(this, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR);
|
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()) {
|
if (Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -794,13 +794,13 @@ public class McMMOPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbilityType abilityType : AbilityType.values()) {
|
for (SuperAbility superAbility : SuperAbility.values()) {
|
||||||
if (getAbilityMode(abilityType)) {
|
if (getAbilityMode(superAbility)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbilityType ability = skill.getAbility();
|
SuperAbility ability = skill.getAbility();
|
||||||
ToolType tool = skill.getTool();
|
ToolType tool = skill.getTool();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -808,7 +808,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
|
* 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 (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);
|
int timeRemaining = calculateTimeRemaining(ability);
|
||||||
|
|
||||||
if (!getAbilityMode(ability) && timeRemaining > 0) {
|
if (!getAbilityMode(ability) && timeRemaining > 0) {
|
||||||
@ -829,59 +829,59 @@ public class McMMOPlayer {
|
|||||||
/**
|
/**
|
||||||
* Calculate the time remaining until the ability's cooldown expires.
|
* 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
|
* @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;
|
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);
|
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);
|
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.
|
* 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);
|
return profile.getSkillLevel(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSkillXpLevelRaw(SkillType skill) {
|
public float getSkillXpLevelRaw(PrimarySkill skill) {
|
||||||
return profile.getSkillXpLevelRaw(skill);
|
return profile.getSkillXpLevelRaw(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillXpLevel(SkillType skill) {
|
public int getSkillXpLevel(PrimarySkill skill) {
|
||||||
return profile.getSkillXpLevel(skill);
|
return profile.getSkillXpLevel(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSkillXpLevel(SkillType skill, float xpLevel) {
|
public void setSkillXpLevel(PrimarySkill skill, float xpLevel) {
|
||||||
profile.setSkillXpLevel(skill, xpLevel);
|
profile.setSkillXpLevel(skill, xpLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getXpToLevel(SkillType skill) {
|
public int getXpToLevel(PrimarySkill skill) {
|
||||||
return profile.getXpToLevel(skill);
|
return profile.getXpToLevel(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeXp(SkillType skill, int xp) {
|
public void removeXp(PrimarySkill skill, int xp) {
|
||||||
profile.removeXp(skill, xp);
|
profile.removeXp(skill, xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modifySkill(SkillType skill, int level) {
|
public void modifySkill(PrimarySkill skill, int level) {
|
||||||
profile.modifySkill(skill, level);
|
profile.modifySkill(skill, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLevels(SkillType skill, int levels) {
|
public void addLevels(PrimarySkill skill, int levels) {
|
||||||
profile.addLevels(skill, levels);
|
profile.addLevels(skill, levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addXp(SkillType skill, float xp) {
|
public void addXp(PrimarySkill skill, float xp) {
|
||||||
profile.addXp(skill, xp);
|
profile.addXp(skill, xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAbilityDATS(AbilityType ability, long DATS) {
|
public void setAbilityDATS(SuperAbility ability, long DATS) {
|
||||||
profile.setAbilityDATS(ability, DATS);
|
profile.setAbilityDATS(ability, DATS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.DelayQueue;
|
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.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.experience.SkillXpGain;
|
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.runnables.player.PlayerProfileSaveTask;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -31,13 +31,13 @@ public class PlayerProfile {
|
|||||||
private int scoreboardTipsShown;
|
private int scoreboardTipsShown;
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
|
private final Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>(); // Skill & Level
|
||||||
private final Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
|
private final Map<PrimarySkill, Float> skillsXp = new HashMap<PrimarySkill, Float>(); // Skill & XP
|
||||||
private final Map<AbilityType, Integer> abilityDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
|
private final Map<SuperAbility, Integer> abilityDATS = new HashMap<SuperAbility, Integer>(); // Ability & Cooldown
|
||||||
|
|
||||||
// Store previous XP gains for deminished returns
|
// Store previous XP gains for deminished returns
|
||||||
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
|
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
|
@Deprecated
|
||||||
public PlayerProfile(String playerName) {
|
public PlayerProfile(String playerName) {
|
||||||
@ -51,13 +51,13 @@ public class PlayerProfile {
|
|||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||||
scoreboardTipsShown = 0;
|
scoreboardTipsShown = 0;
|
||||||
|
|
||||||
for (AbilityType abilityType : AbilityType.values()) {
|
for (SuperAbility superAbility : SuperAbility.values()) {
|
||||||
abilityDATS.put(abilityType, 0);
|
abilityDATS.put(superAbility, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
skills.put(skillType, 0);
|
skills.put(primarySkill, 0);
|
||||||
skillsXp.put(skillType, 0F);
|
skillsXp.put(primarySkill, 0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class PlayerProfile {
|
|||||||
this.loaded = isLoaded;
|
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.playerName = playerName;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.mobHealthbarType = mobHealthbarType;
|
this.mobHealthbarType = mobHealthbarType;
|
||||||
@ -156,20 +156,20 @@ public class PlayerProfile {
|
|||||||
/**
|
/**
|
||||||
* Get the current deactivation timestamp of an ability.
|
* 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
|
* @return the deactivation timestamp for the ability
|
||||||
*/
|
*/
|
||||||
public long getAbilityDATS(AbilityType ability) {
|
public long getAbilityDATS(SuperAbility ability) {
|
||||||
return abilityDATS.get(ability);
|
return abilityDATS.get(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current deactivation timestamp of an 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
|
* @param DATS the DATS of the ability
|
||||||
*/
|
*/
|
||||||
protected void setAbilityDATS(AbilityType ability, long DATS) {
|
protected void setAbilityDATS(SuperAbility ability, long DATS) {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
abilityDATS.put(ability, (int) (DATS * .001D));
|
abilityDATS.put(ability, (int) (DATS * .001D));
|
||||||
@ -181,7 +181,7 @@ public class PlayerProfile {
|
|||||||
protected void resetCooldowns() {
|
protected void resetCooldowns() {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
for (AbilityType ability : abilityDATS.keySet()) {
|
for (SuperAbility ability : abilityDATS.keySet()) {
|
||||||
abilityDATS.put(ability, 0);
|
abilityDATS.put(ability, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,19 +190,19 @@ public class PlayerProfile {
|
|||||||
* Xp Functions
|
* Xp Functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getSkillLevel(SkillType skill) {
|
public int getSkillLevel(PrimarySkill skill) {
|
||||||
return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill);
|
return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSkillXpLevelRaw(SkillType skill) {
|
public float getSkillXpLevelRaw(PrimarySkill skill) {
|
||||||
return skillsXp.get(skill);
|
return skillsXp.get(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillXpLevel(SkillType skill) {
|
public int getSkillXpLevel(PrimarySkill skill) {
|
||||||
return (int) Math.floor(getSkillXpLevelRaw(skill));
|
return (int) Math.floor(getSkillXpLevelRaw(skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSkillXpLevel(SkillType skill, float xpLevel) {
|
public void setSkillXpLevel(PrimarySkill skill, float xpLevel) {
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ public class PlayerProfile {
|
|||||||
skillsXp.put(skill, xpLevel);
|
skillsXp.put(skill, xpLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float levelUp(SkillType skill) {
|
protected float levelUp(PrimarySkill skill) {
|
||||||
float xpRemoved = getXpToLevel(skill);
|
float xpRemoved = getXpToLevel(skill);
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -229,7 +229,7 @@ public class PlayerProfile {
|
|||||||
* @param skill Type of skill to modify
|
* @param skill Type of skill to modify
|
||||||
* @param xp Amount of xp to remove
|
* @param xp Amount of xp to remove
|
||||||
*/
|
*/
|
||||||
public void removeXp(SkillType skill, int xp) {
|
public void removeXp(PrimarySkill skill, int xp) {
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ public class PlayerProfile {
|
|||||||
skillsXp.put(skill, skillsXp.get(skill) - xp);
|
skillsXp.put(skill, skillsXp.get(skill) - xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeXp(SkillType skill, float xp) {
|
public void removeXp(PrimarySkill skill, float xp) {
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ public class PlayerProfile {
|
|||||||
* @param skill Type of skill to modify
|
* @param skill Type of skill to modify
|
||||||
* @param level New level value for the skill
|
* @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()) {
|
if (skill.isChildSkill()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ public class PlayerProfile {
|
|||||||
* @param skill Type of skill to add levels to
|
* @param skill Type of skill to add levels to
|
||||||
* @param levels Number of levels to add
|
* @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);
|
modifySkill(skill, skills.get(skill) + levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,14 +282,14 @@ public class PlayerProfile {
|
|||||||
* @param skill Type of skill to add experience to
|
* @param skill Type of skill to add experience to
|
||||||
* @param xp Number of experience to add
|
* @param xp Number of experience to add
|
||||||
*/
|
*/
|
||||||
public void addXp(SkillType skill, float xp) {
|
public void addXp(PrimarySkill skill, float xp) {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
Set<SkillType> parentSkills = FamilyTree.getParents(skill);
|
Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill);
|
||||||
float dividedXP = (xp / parentSkills.size());
|
float dividedXP = (xp / parentSkills.size());
|
||||||
|
|
||||||
for (SkillType parentSkill : parentSkills) {
|
for (PrimarySkill parentSkill : parentSkills) {
|
||||||
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,11 +304,11 @@ public class PlayerProfile {
|
|||||||
*
|
*
|
||||||
* @return xp Experience amount registered
|
* @return xp Experience amount registered
|
||||||
*/
|
*/
|
||||||
public float getRegisteredXpGain(SkillType skillType) {
|
public float getRegisteredXpGain(PrimarySkill primarySkill) {
|
||||||
float xp = 0F;
|
float xp = 0F;
|
||||||
|
|
||||||
if (rollingSkillsXp.get(skillType) != null) {
|
if (rollingSkillsXp.get(primarySkill) != null) {
|
||||||
xp = rollingSkillsXp.get(skillType);
|
xp = rollingSkillsXp.get(primarySkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
return xp;
|
return xp;
|
||||||
@ -318,12 +318,12 @@ public class PlayerProfile {
|
|||||||
* Register an experience gain
|
* Register an experience gain
|
||||||
* This is used for diminished XP returns
|
* This is used for diminished XP returns
|
||||||
*
|
*
|
||||||
* @param skillType Skill being used
|
* @param primarySkill Skill being used
|
||||||
* @param xp Experience amount to add
|
* @param xp Experience amount to add
|
||||||
*/
|
*/
|
||||||
public void registerXpGain(SkillType skillType, float xp) {
|
public void registerXpGain(PrimarySkill primarySkill, float xp) {
|
||||||
gainedSkillsXp.add(new SkillXpGain(skillType, xp));
|
gainedSkillsXp.add(new SkillXpGain(primarySkill, xp));
|
||||||
rollingSkillsXp.put(skillType, getRegisteredXpGain(skillType) + xp);
|
rollingSkillsXp.put(primarySkill, getRegisteredXpGain(primarySkill) + xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -340,21 +340,21 @@ public class PlayerProfile {
|
|||||||
/**
|
/**
|
||||||
* Get the amount of Xp remaining before the next level.
|
* 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
|
* @return the total amount of Xp until next level
|
||||||
*/
|
*/
|
||||||
public int getXpToLevel(SkillType skillType) {
|
public int getXpToLevel(PrimarySkill primarySkill) {
|
||||||
int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(skillType);
|
int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkill);
|
||||||
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
||||||
|
|
||||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType);
|
return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getChildSkillLevel(SkillType skillType) {
|
private int getChildSkillLevel(PrimarySkill primarySkill) {
|
||||||
Set<SkillType> parents = FamilyTree.getParents(skillType);
|
Set<PrimarySkill> parents = FamilyTree.getParents(primarySkill);
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
|
||||||
for (SkillType parent : parents) {
|
for (PrimarySkill parent : parents) {
|
||||||
sum += Math.min(getSkillLevel(parent), parent.getMaxLevel());
|
sum += Math.min(getSkillLevel(parent), parent.getMaxLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,44 +35,44 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
public enum SkillType {
|
public enum PrimarySkill {
|
||||||
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SecondaryAbility.DODGE, SecondaryAbility.GRACEFUL_ROLL, SecondaryAbility.ROLL)),
|
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SubSkill.ACROBATICS_DODGE, SubSkill.ACROBATICS_GRACEFUL_ROLL, SubSkill.ACROBATICS_ROLL)),
|
||||||
ALCHEMY(AlchemyManager.class, Color.FUCHSIA, ImmutableList.of(SecondaryAbility.CATALYSIS, SecondaryAbility.CONCOCTIONS)),
|
ALCHEMY(AlchemyManager.class, Color.FUCHSIA, ImmutableList.of(SubSkill.ALCHEMY_CATALYSIS, SubSkill.ALCHEMY_CONCOCTIONS)),
|
||||||
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SecondaryAbility.DAZE, SecondaryAbility.RETRIEVE, SecondaryAbility.SKILL_SHOT)),
|
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SubSkill.ARCHERY_DAZE, SubSkill.ARCHERY_RETRIEVE, SubSkill.ARCHERY_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)),
|
AXES(AxesManager.class, Color.AQUA, SuperAbility.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SubSkill.AXES_ARMOR_IMPACT, SubSkill.AXES_AXE_MASTERY, SubSkill.AXES_CRITICAL_HIT, SubSkill.AXES_GREATER_IMPACT)),
|
||||||
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbility.EXCAVATION_TREASURE_HUNTER)),
|
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), SuperAbility.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SubSkill.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)),
|
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, 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)),
|
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, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
|
MINING(MiningManager.class, Color.GRAY, SuperAbility.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SubSkill.MINING_DOUBLE_DROPS)),
|
||||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SUPER_REPAIR)),
|
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(SecondaryAbility.ADVANCED_SALVAGE, SecondaryAbility.ARCANE_SALVAGE)),
|
SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SubSkill.SALVAGE_ADVANCED_SALVAGE, SubSkill.SALVAGE_ARCANE_SALVAGE)),
|
||||||
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
|
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), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
|
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbility.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SubSkill.SWORDS_BLEED, SubSkill.SWORDS_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)),
|
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, 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, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP)),
|
UNARMED(UnarmedManager.class, Color.BLACK, SuperAbility.BERSERK, ToolType.FISTS, ImmutableList.of(SubSkill.UNARMED_BLOCK_CRACKER, SubSkill.UNARMED_DEFLECT, SubSkill.UNARMED_DISARM, SubSkill.UNARMED_IRON_ARM, SubSkill.UNARMED_IRON_GRIP)),
|
||||||
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.WOODCUTTING_LEAF_BLOWER, SecondaryAbility.WOODCUTTING_HARVEST));
|
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbility.TREE_FELLER, ToolType.AXE, ImmutableList.of(SubSkill.WOODCUTTING_LEAF_BLOWER, SubSkill.WOODCUTTING_DOUBLE_DROPS));
|
||||||
|
|
||||||
private Class<? extends SkillManager> managerClass;
|
private Class<? extends SkillManager> managerClass;
|
||||||
private Color runescapeColor;
|
private Color runescapeColor;
|
||||||
private AbilityType ability;
|
private SuperAbility ability;
|
||||||
private ToolType tool;
|
private ToolType tool;
|
||||||
private List<SecondaryAbility> secondaryAbilities;
|
private List<SubSkill> subSkills;
|
||||||
|
|
||||||
public static final List<String> SKILL_NAMES;
|
public static final List<String> SKILL_NAMES;
|
||||||
|
|
||||||
public static final List<SkillType> CHILD_SKILLS;
|
public static final List<PrimarySkill> CHILD_SKILLS;
|
||||||
public static final List<SkillType> NON_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<PrimarySkill> 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<PrimarySkill> 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> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
List<SkillType> childSkills = new ArrayList<SkillType>();
|
List<PrimarySkill> childSkills = new ArrayList<PrimarySkill>();
|
||||||
List<SkillType> nonChildSkills = new ArrayList<SkillType>();
|
List<PrimarySkill> nonChildSkills = new ArrayList<PrimarySkill>();
|
||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
|
|
||||||
for (SkillType skill : values()) {
|
for (PrimarySkill skill : values()) {
|
||||||
if (skill.isChildSkill()) {
|
if (skill.isChildSkill()) {
|
||||||
childSkills.add(skill);
|
childSkills.add(skill);
|
||||||
}
|
}
|
||||||
@ -90,23 +90,23 @@ public enum SkillType {
|
|||||||
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SecondaryAbility> secondaryAbilities) {
|
private PrimarySkill(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkill> subSkills) {
|
||||||
this(managerClass, runescapeColor, null, null, secondaryAbilities);
|
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.managerClass = managerClass;
|
||||||
this.runescapeColor = runescapeColor;
|
this.runescapeColor = runescapeColor;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
this.secondaryAbilities = secondaryAbilities;
|
this.subSkills = subSkills;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends SkillManager> getManagerClass() {
|
public Class<? extends SkillManager> getManagerClass() {
|
||||||
return managerClass;
|
return managerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbilityType getAbility() {
|
public SuperAbility getAbility() {
|
||||||
return ability;
|
return ability;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,24 +153,24 @@ public enum SkillType {
|
|||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SecondaryAbility> getSkillAbilities() {
|
public List<SubSkill> getSkillAbilities() {
|
||||||
return secondaryAbilities;
|
return subSkills;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getXpModifier() {
|
public double getXpModifier() {
|
||||||
return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
|
return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkillType getSkill(String skillName) {
|
public static PrimarySkill getSkill(String skillName) {
|
||||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
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"))) {
|
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillType type : values()) {
|
for (PrimarySkill type : values()) {
|
||||||
if (type.name().equalsIgnoreCase(skillName)) {
|
if (type.name().equalsIgnoreCase(skillName)) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@ -195,17 +195,17 @@ public enum SkillType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkillType bySecondaryAbility(SecondaryAbility skillAbility) {
|
public static PrimarySkill bySecondaryAbility(SubSkill subSkill) {
|
||||||
for (SkillType type : values()) {
|
for (PrimarySkill type : values()) {
|
||||||
if (type.getSkillAbilities().contains(skillAbility)) {
|
if (type.getSkillAbilities().contains(subSkill)) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkillType byAbility(AbilityType ability) {
|
public static PrimarySkill byAbility(SuperAbility ability) {
|
||||||
for (SkillType type : values()) {
|
for (PrimarySkill type : values()) {
|
||||||
if (type.getAbility() == ability) {
|
if (type.getAbility() == ability) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
@ -1,102 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
|
||||||
|
|
||||||
import static com.gmail.nossr50.datatypes.skills.SkillType.*;
|
|
||||||
public enum SecondaryAbility {
|
|
||||||
/* !! Warning -- Do not let subskills share a name with any existing SkillType as it will clash with the static import !! */
|
|
||||||
|
|
||||||
/* ACROBATICS */
|
|
||||||
DODGE(ACROBATICS),
|
|
||||||
GRACEFUL_ROLL(ACROBATICS),
|
|
||||||
ROLL(ACROBATICS),
|
|
||||||
|
|
||||||
/* ALCHEMY */
|
|
||||||
CATALYSIS(ALCHEMY),
|
|
||||||
CONCOCTIONS(ALCHEMY),
|
|
||||||
|
|
||||||
/* ARCHERY */
|
|
||||||
DAZE(ARCHERY),
|
|
||||||
RETRIEVE(ARCHERY),
|
|
||||||
SKILL_SHOT(ARCHERY),
|
|
||||||
|
|
||||||
/* Axes */
|
|
||||||
ARMOR_IMPACT(AXES),
|
|
||||||
AXE_MASTERY(AXES),
|
|
||||||
CRITICAL_HIT(AXES),
|
|
||||||
GREATER_IMPACT(AXES),
|
|
||||||
|
|
||||||
/* Excavation */
|
|
||||||
EXCAVATION_TREASURE_HUNTER(EXCAVATION),
|
|
||||||
|
|
||||||
/* Fishing */
|
|
||||||
FISHERMANS_DIET(FISHING),
|
|
||||||
FISHING_TREASURE_HUNTER(FISHING),
|
|
||||||
ICE_FISHING(FISHING),
|
|
||||||
MAGIC_HUNTER(FISHING),
|
|
||||||
MASTER_ANGLER(FISHING),
|
|
||||||
SHAKE(FISHING),
|
|
||||||
|
|
||||||
/* Herbalism */
|
|
||||||
FARMERS_DIET(HERBALISM),
|
|
||||||
GREEN_THUMB_PLANT(HERBALISM),
|
|
||||||
GREEN_THUMB_BLOCK(HERBALISM),
|
|
||||||
HERBALISM_DOUBLE_DROPS(HERBALISM),
|
|
||||||
HYLIAN_LUCK(HERBALISM),
|
|
||||||
SHROOM_THUMB(HERBALISM),
|
|
||||||
|
|
||||||
/* Mining */
|
|
||||||
MINING_DOUBLE_DROPS(MINING),
|
|
||||||
|
|
||||||
/* Repair */
|
|
||||||
ARCANE_FORGING(REPAIR),
|
|
||||||
REPAIR_MASTERY(REPAIR),
|
|
||||||
SUPER_REPAIR(REPAIR),
|
|
||||||
|
|
||||||
/* Salvage */
|
|
||||||
ADVANCED_SALVAGE(SALVAGE),
|
|
||||||
ARCANE_SALVAGE(SALVAGE),
|
|
||||||
|
|
||||||
/* Smelting */
|
|
||||||
FLUX_MINING(SMELTING),
|
|
||||||
FUEL_EFFICIENCY(SMELTING),
|
|
||||||
SECOND_SMELT(SMELTING),
|
|
||||||
|
|
||||||
/* Swords */
|
|
||||||
BLEED(SWORDS),
|
|
||||||
COUNTER(SWORDS),
|
|
||||||
|
|
||||||
/* Taming */
|
|
||||||
BEAST_LORE(TAMING),
|
|
||||||
CALL_OF_THE_WILD(TAMING),
|
|
||||||
ENVIRONMENTALLY_AWARE(TAMING),
|
|
||||||
FAST_FOOD(TAMING),
|
|
||||||
GORE(TAMING),
|
|
||||||
HOLY_HOUND(TAMING),
|
|
||||||
SHARPENED_CLAWS(TAMING),
|
|
||||||
SHOCK_PROOF(TAMING),
|
|
||||||
THICK_FUR(TAMING),
|
|
||||||
PUMMEL(TAMING),
|
|
||||||
|
|
||||||
/* Unarmed */
|
|
||||||
BLOCK_CRACKER(UNARMED),
|
|
||||||
DEFLECT(UNARMED),
|
|
||||||
DISARM(UNARMED),
|
|
||||||
IRON_ARM(UNARMED),
|
|
||||||
IRON_GRIP(UNARMED),
|
|
||||||
|
|
||||||
/* Woodcutting */
|
|
||||||
WOODCUTTING_TREE_FELLER(WOODCUTTING),
|
|
||||||
WOODCUTTING_LEAF_BLOWER(WOODCUTTING),
|
|
||||||
WOODCUTTING_SURGEON(WOODCUTTING),
|
|
||||||
WOODCUTTING_NATURES_BOUNTY(WOODCUTTING),
|
|
||||||
WOODCUTTING_SPLINTER(WOODCUTTING),
|
|
||||||
WOODCUTTING_HARVEST(WOODCUTTING);
|
|
||||||
|
|
||||||
private final SkillType parentSkill;
|
|
||||||
|
|
||||||
SecondaryAbility(SkillType parentSkill)
|
|
||||||
{
|
|
||||||
this.parentSkill = parentSkill;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SkillType getParentSkill() { return parentSkill; }
|
|
||||||
}
|
|
@ -7,10 +7,10 @@ package com.gmail.nossr50.datatypes.skills;
|
|||||||
*/
|
*/
|
||||||
public class SkillMilestone {
|
public class SkillMilestone {
|
||||||
private int unlockLevel; //Level that grants access to this skill
|
private int unlockLevel; //Level that grants access to this skill
|
||||||
private SecondaryAbility subskill; //Subskill that this milestone belongs to
|
private SubSkill subskill; //Subskill that this milestone belongs to
|
||||||
private SkillMilestone childMilestone; //Next rank in the milestone
|
private SkillMilestone childMilestone; //Next rank in the milestone
|
||||||
|
|
||||||
public SkillMilestone(SecondaryAbility subskill, int unlockLevel, SkillMilestone childMilestone)
|
public SkillMilestone(SubSkill subskill, int unlockLevel, SkillMilestone childMilestone)
|
||||||
{
|
{
|
||||||
this.subskill = subskill;
|
this.subskill = subskill;
|
||||||
this.unlockLevel = unlockLevel;
|
this.unlockLevel = unlockLevel;
|
||||||
@ -20,7 +20,7 @@ public class SkillMilestone {
|
|||||||
this.childMilestone = childMilestone;
|
this.childMilestone = childMilestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkillMilestone(SecondaryAbility subskill, int unlockLevel)
|
public SkillMilestone(SubSkill subskill, int unlockLevel)
|
||||||
{
|
{
|
||||||
this(subskill, unlockLevel, null);
|
this(subskill, unlockLevel, null);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class SkillMilestone {
|
|||||||
return unlockLevel;
|
return unlockLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SecondaryAbility getSubskill() {
|
public SubSkill getSubskill() {
|
||||||
return subskill;
|
return subskill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
165
src/main/java/com/gmail/nossr50/datatypes/skills/SubSkill.java
Normal file
165
src/main/java/com/gmail/nossr50/datatypes/skills/SubSkill.java
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill.*;
|
||||||
|
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,
|
||||||
|
ACROBATICS_GRACEFUL_ROLL,
|
||||||
|
ACROBATICS_ROLL,
|
||||||
|
|
||||||
|
/* ALCHEMY */
|
||||||
|
ALCHEMY_CATALYSIS,
|
||||||
|
ALCHEMY_CONCOCTIONS,
|
||||||
|
|
||||||
|
/* ARCHERY */
|
||||||
|
ARCHERY_DAZE,
|
||||||
|
ARCHERY_RETRIEVE,
|
||||||
|
ARCHERY_SKILL_SHOT,
|
||||||
|
|
||||||
|
/* Axes */
|
||||||
|
AXES_ARMOR_IMPACT,
|
||||||
|
AXES_AXE_MASTERY,
|
||||||
|
AXES_CRITICAL_HIT,
|
||||||
|
AXES_GREATER_IMPACT,
|
||||||
|
|
||||||
|
/* Excavation */
|
||||||
|
EXCAVATION_TREASURE_HUNTER,
|
||||||
|
|
||||||
|
/* 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,
|
||||||
|
|
||||||
|
/* 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,
|
||||||
|
|
||||||
|
/* Taming */
|
||||||
|
TAMING_BEAST_LORE,
|
||||||
|
TAMING_CALL_OF_THE_WILD,
|
||||||
|
TAMING_ENVIRONMENTALLY_AWARE,
|
||||||
|
TAMING_FAST_FOOD,
|
||||||
|
TAMING_GORE,
|
||||||
|
TAMING_HOLY_HOUND,
|
||||||
|
TAMING_SHARPENED_CLAWS,
|
||||||
|
TAMING_SHOCK_PROOF,
|
||||||
|
TAMING_THICK_FUR,
|
||||||
|
TAMING_PUMMEL,
|
||||||
|
|
||||||
|
/* Unarmed */
|
||||||
|
UNARMED_BLOCK_CRACKER,
|
||||||
|
UNARMED_DEFLECT,
|
||||||
|
UNARMED_DISARM,
|
||||||
|
UNARMED_IRON_ARM,
|
||||||
|
UNARMED_IRON_GRIP,
|
||||||
|
|
||||||
|
/* Woodcutting */
|
||||||
|
WOODCUTTING_TREE_FELLER,
|
||||||
|
WOODCUTTING_LEAF_BLOWER,
|
||||||
|
WOODCUTTING_SURGEON,
|
||||||
|
WOODCUTTING_NATURES_BOUNTY,
|
||||||
|
WOODCUTTING_SPLINTER,
|
||||||
|
WOODCUTTING_DOUBLE_DROPS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* !!! 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 = "";
|
||||||
|
char[] enumNameCharArray = subSkillName.toString().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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Split the string up so we can capitalize each part
|
||||||
|
*/
|
||||||
|
String subskillNameWithoutPrefix = subSkillName.toString().substring(subStringIndex);
|
||||||
|
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
|
for(String string : splitStrings)
|
||||||
|
{
|
||||||
|
endResult += StringUtils.getCapitalized(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return endResult;
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,7 @@ import com.gmail.nossr50.util.BlockUtils;
|
|||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public enum AbilityType {
|
public enum SuperAbility {
|
||||||
BERSERK(
|
BERSERK(
|
||||||
"Unarmed.Skills.Berserk.On",
|
"Unarmed.Skills.Berserk.On",
|
||||||
"Unarmed.Skills.Berserk.Off",
|
"Unarmed.Skills.Berserk.Off",
|
||||||
@ -77,7 +77,7 @@ public enum AbilityType {
|
|||||||
private String abilityRefresh;
|
private String abilityRefresh;
|
||||||
private String abilityPlayerOff;
|
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.abilityOn = abilityOn;
|
||||||
this.abilityOff = abilityOff;
|
this.abilityOff = abilityOff;
|
||||||
this.abilityPlayer = abilityPlayer;
|
this.abilityPlayer = abilityPlayer;
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
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 {
|
public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
protected SkillType skill;
|
protected PrimarySkill skill;
|
||||||
protected int skillLevel;
|
protected int skillLevel;
|
||||||
protected XPGainReason xpGainReason;
|
protected XPGainReason xpGainReason;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected McMMOPlayerExperienceEvent(Player player, SkillType skill) {
|
protected McMMOPlayerExperienceEvent(Player player, PrimarySkill skill) {
|
||||||
super(player);
|
super(player);
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||||
this.xpGainReason = XPGainReason.UNKNOWN;
|
this.xpGainReason = XPGainReason.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected McMMOPlayerExperienceEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
protected McMMOPlayerExperienceEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||||
super(player);
|
super(player);
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(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
|
* @return The skill involved in this event
|
||||||
*/
|
*/
|
||||||
public SkillType getSkill() {
|
public PrimarySkill getSkill() {
|
||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,11 +10,11 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
|||||||
*/
|
*/
|
||||||
public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent {
|
public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public McMMOPlayerLevelChangeEvent(Player player, SkillType skill) {
|
public McMMOPlayerLevelChangeEvent(Player player, PrimarySkill skill) {
|
||||||
super(player, skill, XPGainReason.UNKNOWN);
|
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);
|
super(player, skill, xpGainReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,23 +13,23 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
|
|||||||
private int levelsLost;
|
private int levelsLost;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill) {
|
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill) {
|
||||||
super(player, skill, XPGainReason.UNKNOWN);
|
super(player, skill, XPGainReason.UNKNOWN);
|
||||||
this.levelsLost = 1;
|
this.levelsLost = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill, int levelsLost) {
|
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, int levelsLost) {
|
||||||
super(player, skill, XPGainReason.UNKNOWN);
|
super(player, skill, XPGainReason.UNKNOWN);
|
||||||
this.levelsLost = levelsLost;
|
this.levelsLost = levelsLost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public McMMOPlayerLevelDownEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||||
super(player, skill, xpGainReason);
|
super(player, skill, xpGainReason);
|
||||||
this.levelsLost = 1;
|
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);
|
super(player, skill, xpGainReason);
|
||||||
this.levelsLost = levelsLost;
|
this.levelsLost = levelsLost;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,23 +13,23 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
|
|||||||
private int levelsGained;
|
private int levelsGained;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill) {
|
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill) {
|
||||||
super(player, skill, XPGainReason.UNKNOWN);
|
super(player, skill, XPGainReason.UNKNOWN);
|
||||||
this.levelsGained = 1;
|
this.levelsGained = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, int levelsGained) {
|
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, int levelsGained) {
|
||||||
super(player, skill, XPGainReason.UNKNOWN);
|
super(player, skill, XPGainReason.UNKNOWN);
|
||||||
this.levelsGained = levelsGained;
|
this.levelsGained = levelsGained;
|
||||||
}
|
}
|
||||||
|
|
||||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) {
|
||||||
super(player, skill, xpGainReason);
|
super(player, skill, xpGainReason);
|
||||||
this.levelsGained = 1;
|
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);
|
super(player, skill, xpGainReason);
|
||||||
this.levelsGained = levelsGained;
|
this.levelsGained = levelsGained;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,12 +13,12 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
|||||||
private float xpGained;
|
private float xpGained;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public McMMOPlayerXpGainEvent(Player player, SkillType skill, float xpGained) {
|
public McMMOPlayerXpGainEvent(Player player, PrimarySkill skill, float xpGained) {
|
||||||
super(player, skill, XPGainReason.UNKNOWN);
|
super(player, skill, XPGainReason.UNKNOWN);
|
||||||
this.xpGained = xpGained;
|
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);
|
super(player, skill, xpGainReason);
|
||||||
this.xpGained = xpGained;
|
this.xpGained = xpGained;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
package com.gmail.nossr50.events.skills;
|
package com.gmail.nossr50.events.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic event for mcMMO skill handling.
|
* Generic event for mcMMO skill handling.
|
||||||
*/
|
*/
|
||||||
public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
||||||
protected SkillType skill;
|
protected PrimarySkill skill;
|
||||||
protected int skillLevel;
|
protected int skillLevel;
|
||||||
|
|
||||||
protected McMMOPlayerSkillEvent(Player player, SkillType skill) {
|
protected McMMOPlayerSkillEvent(Player player, PrimarySkill skill) {
|
||||||
super(player);
|
super(player);
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(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
|
* @return The skill involved in this event
|
||||||
*/
|
*/
|
||||||
public SkillType getSkill() {
|
public PrimarySkill getSkill() {
|
||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package com.gmail.nossr50.events.skills.abilities;
|
package com.gmail.nossr50.events.skills.abilities;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
|
|
||||||
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public McMMOPlayerAbilityActivateEvent(Player player, SkillType skill) {
|
public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkill skill) {
|
||||||
super(player, skill);
|
super(player, skill);
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package com.gmail.nossr50.events.skills.abilities;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
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 class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
|
||||||
public McMMOPlayerAbilityDeactivateEvent(Player player, SkillType skill) {
|
public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkill skill) {
|
||||||
super(player, skill);
|
super(player, skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,19 @@ package com.gmail.nossr50.events.skills.abilities;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
public class McMMOPlayerAbilityEvent extends 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);
|
super(player, skill);
|
||||||
ability = skill.getAbility();
|
ability = skill.getAbility();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbilityType getAbility() {
|
public SuperAbility getAbility() {
|
||||||
return ability;
|
return ability;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.events.skills.alchemy;
|
package com.gmail.nossr50.events.skills.alchemy;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
@ -15,7 +15,7 @@ public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cance
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) {
|
public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) {
|
||||||
super(player, SkillType.ALCHEMY);
|
super(player, PrimarySkill.ALCHEMY);
|
||||||
this.brewingStand = brewingStand;
|
this.brewingStand = brewingStand;
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.events.skills.alchemy;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
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;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
@ -12,7 +12,7 @@ public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public McMMOPlayerCatalysisEvent(Player player, double speed) {
|
public McMMOPlayerCatalysisEvent(Player player, double speed) {
|
||||||
super(player, SkillType.ALCHEMY);
|
super(player, PrimarySkill.ALCHEMY);
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package com.gmail.nossr50.events.skills.fishing;
|
package com.gmail.nossr50.events.skills.fishing;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
public class McMMOPlayerFishingEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
public class McMMOPlayerFishingEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
protected McMMOPlayerFishingEvent(Player player) {
|
protected McMMOPlayerFishingEvent(Player player) {
|
||||||
super(player, SkillType.FISHING);
|
super(player, PrimarySkill.FISHING);
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.events.skills.repair;
|
package com.gmail.nossr50.events.skills.repair;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,7 +17,7 @@ public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implement
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) {
|
public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) {
|
||||||
super(player, SkillType.REPAIR);
|
super(player, PrimarySkill.REPAIR);
|
||||||
this.repairAmount = repairAmount;
|
this.repairAmount = repairAmount;
|
||||||
this.repairMaterial = repairMaterial;
|
this.repairMaterial = repairMaterial;
|
||||||
this.repairedObject = repairedObject;
|
this.repairedObject = repairedObject;
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,7 +17,7 @@ public class McMMOPlayerSalvageCheckEvent extends McMMOPlayerSkillEvent implemen
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public McMMOPlayerSalvageCheckEvent(Player player, ItemStack salvageItem, ItemStack salvageResults, ItemStack enchantedBook) {
|
public McMMOPlayerSalvageCheckEvent(Player player, ItemStack salvageItem, ItemStack salvageResults, ItemStack enchantedBook) {
|
||||||
super(player, SkillType.SALVAGE);
|
super(player, PrimarySkill.SALVAGE);
|
||||||
this.salvageItem = salvageItem;
|
this.salvageItem = salvageItem;
|
||||||
this.salvageResults = salvageResults;
|
this.salvageResults = salvageResults;
|
||||||
this.enchantedBook = enchantedBook;
|
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;
|
package com.gmail.nossr50.events.skills.secondaryabilities;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
public class SubSkillWeightedActivationCheckEvent extends SubSkillEvent {
|
||||||
|
|
||||||
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
|
|
||||||
private double chance;
|
private double chance;
|
||||||
|
|
||||||
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, double chance) {
|
public SubSkillWeightedActivationCheckEvent(Player player, SubSkill ability, double chance) {
|
||||||
super(player, ability);
|
super(player, ability);
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.events.skills.unarmed;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
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;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
@ -11,7 +11,7 @@ public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Can
|
|||||||
private Player defender;
|
private Player defender;
|
||||||
|
|
||||||
public McMMOPlayerDisarmEvent(Player defender) {
|
public McMMOPlayerDisarmEvent(Player defender) {
|
||||||
super(defender, SkillType.UNARMED);
|
super(defender, PrimarySkill.UNARMED);
|
||||||
this.defender = defender;
|
this.defender = defender;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ package com.gmail.nossr50.listeners;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||||
@ -136,10 +136,10 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
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();
|
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();
|
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,26 +194,26 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
if (herbalismManager.canActivateAbility()) {
|
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.
|
* We don't check the block store here because herbalism has too many unusual edge cases.
|
||||||
* Instead, we check it inside the drops handler.
|
* Instead, we check it inside the drops handler.
|
||||||
*/
|
*/
|
||||||
if (SkillType.HERBALISM.getPermissions(player)) {
|
if (PrimarySkill.HERBALISM.getPermissions(player)) {
|
||||||
herbalismManager.herbalismBlockCheck(blockState);
|
herbalismManager.herbalismBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MINING */
|
/* 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 miningManager = mcMMOPlayer.getMiningManager();
|
||||||
miningManager.miningBlockCheck(blockState);
|
miningManager.miningBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WOOD CUTTING */
|
/* 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();
|
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||||
woodcuttingManager.processTreeFeller(blockState);
|
woodcuttingManager.processTreeFeller(blockState);
|
||||||
@ -224,11 +224,11 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* EXCAVATION */
|
/* 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 excavationManager = mcMMOPlayer.getExcavationManager();
|
||||||
excavationManager.excavationBlockCheck(blockState);
|
excavationManager.excavationBlockCheck(blockState);
|
||||||
|
|
||||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
if (mcMMOPlayer.getAbilityMode(SuperAbility.GIGA_DRILL_BREAKER)) {
|
||||||
excavationManager.gigaDrillBreaker(blockState);
|
excavationManager.gigaDrillBreaker(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,30 +318,30 @@ public class BlockListener implements Listener {
|
|||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
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);
|
SkillUtils.removeAbilityBuff(heldItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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);
|
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(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)) {
|
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)) {
|
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)) {
|
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))) {
|
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.
|
* 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());
|
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.
|
* 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)) {
|
if (mcMMOPlayer.getHerbalismManager().processGreenTerra(blockState)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
|
else if (mcMMOPlayer.getAbilityMode(SuperAbility.BERSERK) && heldItem.getType() == Material.AIR) {
|
||||||
if (AbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
if (SuperAbility.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
player.playSound(block.getLocation(), Sound.ENTITY_ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
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.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||||
@ -583,7 +583,7 @@ public class EntityListener implements Listener {
|
|||||||
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
||||||
* 1000
|
* 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));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -595,7 +595,7 @@ public class EntityListener implements Listener {
|
|||||||
* @ 1000
|
* @ 1000
|
||||||
*/
|
*/
|
||||||
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 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));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -604,13 +604,13 @@ public class EntityListener implements Listener {
|
|||||||
* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @
|
* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @
|
||||||
* 1000
|
* 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));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SALMON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
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));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -2,8 +2,9 @@ package com.gmail.nossr50.listeners;
|
|||||||
|
|
||||||
import java.util.List;
|
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.events.fake.FakeBrewEvent;
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -25,8 +26,6 @@ import org.bukkit.metadata.MetadataValue;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
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.runnables.player.PlayerUpdateInventoryTask;
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||||
@ -88,7 +87,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +105,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) {
|
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.SMELTING.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
|
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkill.SMELTING)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +146,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
HumanEntity whoClicked = event.getWhoClicked();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
HumanEntity whoClicked = event.getWhoClicked();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|||||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.ShareHandler;
|
import com.gmail.nossr50.party.ShareHandler;
|
||||||
@ -186,7 +186,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerFishHighest(PlayerFishEvent event) {
|
public void onPlayerFishHighest(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
|
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.FISHING.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ public class PlayerListener implements Listener {
|
|||||||
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1));
|
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()));
|
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -241,7 +241,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
|
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.FISHING.getPermissions(player)) {
|
||||||
return;
|
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 pickupSuccess = Unarmed.handleItemPickup(player.getInventory(), drop);
|
||||||
boolean cancel = Config.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
|
boolean cancel = Config.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
|
||||||
event.setCancelled(cancel);
|
event.setCancelled(cancel);
|
||||||
@ -414,7 +414,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* 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();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* 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();
|
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* 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();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
|
|
||||||
// Cancel repairing an enchanted item
|
// Cancel repairing an enchanted item
|
||||||
@ -464,7 +464,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* 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();
|
SalvageManager salvageManager = mcMMOPlayer.getSalvageManager();
|
||||||
|
|
||||||
// Cancel salvaging an enchanted item
|
// Cancel salvaging an enchanted item
|
||||||
@ -511,15 +511,15 @@ public class PlayerListener implements Listener {
|
|||||||
if (BlockUtils.canActivateAbilities(blockState)) {
|
if (BlockUtils.canActivateAbilities(blockState)) {
|
||||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
if (Config.getInstance().getAbilitiesEnabled()) {
|
||||||
if (BlockUtils.canActivateHerbalism(blockState)) {
|
if (BlockUtils.canActivateHerbalism(blockState)) {
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.HERBALISM);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.AXES);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.AXES);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.EXCAVATION);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.EXCAVATION);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.MINING);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.MINING);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.SWORDS);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.SWORDS);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.UNARMED);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.UNARMED);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.WOODCUTTING);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.WOODCUTTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChimaeraWing.activationCheck(player);
|
ChimaeraWing.activationCheck(player);
|
||||||
@ -564,13 +564,13 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
/* ACTIVATION CHECKS */
|
/* ACTIVATION CHECKS */
|
||||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
if (Config.getInstance().getAbilitiesEnabled()) {
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.AXES);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.AXES);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.EXCAVATION);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.EXCAVATION);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.HERBALISM);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.HERBALISM);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.MINING);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.MINING);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.SWORDS);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.SWORDS);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.UNARMED);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.UNARMED);
|
||||||
mcMMOPlayer.processAbilityActivation(SkillType.WOODCUTTING);
|
mcMMOPlayer.processAbilityActivation(PrimarySkill.WOODCUTTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITEM CHECKS */
|
/* ITEM CHECKS */
|
||||||
@ -670,7 +670,7 @@ public class PlayerListener implements Listener {
|
|||||||
String lowerCaseCommand = command.toLowerCase();
|
String lowerCaseCommand = command.toLowerCase();
|
||||||
|
|
||||||
// Do these ACTUALLY have to be lower case to work properly?
|
// 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 skillName = skill.toString().toLowerCase();
|
||||||
String localizedName = skill.getName().toLowerCase();
|
String localizedName = skill.getName().toLowerCase();
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
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.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.McMMOPlayerLevelUpEvent;
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||||
@ -20,7 +20,7 @@ public class SelfListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
|
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
SkillType skill = event.getSkill();
|
PrimarySkill skill = event.getSkill();
|
||||||
|
|
||||||
ScoreboardManager.handleLevelUp(player, skill);
|
ScoreboardManager.handleLevelUp(player, skill);
|
||||||
|
|
||||||
@ -47,8 +47,8 @@ public class SelfListener implements Listener {
|
|||||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||||
if (event.getXpGainReason() == XPGainReason.COMMAND)
|
if (event.getXpGainReason() == XPGainReason.COMMAND)
|
||||||
return;
|
return;
|
||||||
SkillType skillType = event.getSkill();
|
PrimarySkill primarySkill = event.getSkill();
|
||||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType);
|
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkill);
|
||||||
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||||
// Diminished returns is turned off
|
// Diminished returns is turned off
|
||||||
return;
|
return;
|
||||||
@ -63,15 +63,15 @@ public class SelfListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (skillType.isChildSkill()) {
|
if (primarySkill.isChildSkill()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float modifiedThreshold = (float) (threshold / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
float modifiedThreshold = (float) (threshold / primarySkill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||||
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(skillType) - modifiedThreshold) / modifiedThreshold;
|
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkill) - modifiedThreshold) / modifiedThreshold;
|
||||||
|
|
||||||
if (difference > 0) {
|
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(difference * 100 + "% over the threshold!");
|
||||||
// System.out.println("Previous: " + event.getRawXpGained());
|
// System.out.println("Previous: " + event.getRawXpGained());
|
||||||
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
||||||
|
@ -90,6 +90,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
// XP Event Check
|
// XP Event Check
|
||||||
private boolean xpEventEnabled;
|
private boolean xpEventEnabled;
|
||||||
|
|
||||||
|
private boolean classicModeEnabled;
|
||||||
|
|
||||||
/* Metadata Values */
|
/* Metadata Values */
|
||||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||||
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
|
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
|
||||||
@ -187,6 +189,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
getServer().getPluginManager().disablePlugin(this);
|
getServer().getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Grab the setting for classic mode
|
||||||
|
classicModeEnabled = Config.getInstance().getClassicMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.party;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -25,10 +25,10 @@ public final class ShareHandler {
|
|||||||
*
|
*
|
||||||
* @param xp Xp without party sharing
|
* @param xp Xp without party sharing
|
||||||
* @param mcMMOPlayer Player initiating the Xp gain
|
* @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
|
* @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();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party.getXpShareMode() != ShareMode.EQUAL) {
|
if (party.getXpShareMode() != ShareMode.EQUAL) {
|
||||||
@ -48,7 +48,7 @@ public final class ShareHandler {
|
|||||||
float splitXp = (float) (xp / partySize * shareBonus);
|
float splitXp = (float) (xp / partySize * shareBonus);
|
||||||
|
|
||||||
for (Player member : nearMembers) {
|
for (Player member : nearMembers) {
|
||||||
UserManager.getPlayer(member).beginUnsharedXpGain(skillType, splitXp, xpGainReason);
|
UserManager.getPlayer(member).beginUnsharedXpGain(primarySkill, splitXp, xpGainReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
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;
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class McrankCommandAsyncTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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);
|
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 java.util.Map;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
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.
|
* Display the results of McrankCommandAsyncTask to the sender.
|
||||||
*/
|
*/
|
||||||
public class McrankCommandDisplayTask extends BukkitRunnable {
|
public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||||
private final Map<SkillType, Integer> skills;
|
private final Map<PrimarySkill, Integer> skills;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
private final boolean useBoard, useChat;
|
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.skills = skills;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.playerName = playerName;
|
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.Heading"));
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
|
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)) {
|
if (!skill.getPermissions(player)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,17 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
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;
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
public class MctopCommandAsyncTask extends BukkitRunnable {
|
public class MctopCommandAsyncTask extends BukkitRunnable {
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final SkillType skill;
|
private final PrimarySkill skill;
|
||||||
private final int page;
|
private final int page;
|
||||||
private final boolean useBoard, useChat;
|
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.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");
|
Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient");
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.runnables.commands;
|
package com.gmail.nossr50.runnables.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
@ -18,11 +18,11 @@ import java.util.List;
|
|||||||
public class MctopCommandDisplayTask extends BukkitRunnable {
|
public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||||
private final List<PlayerStat> userStats;
|
private final List<PlayerStat> userStats;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
private final SkillType skill;
|
private final PrimarySkill skill;
|
||||||
private final int page;
|
private final int page;
|
||||||
private final boolean useBoard, useChat;
|
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.userStats = userStats;
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.runnables.database;
|
package com.gmail.nossr50.runnables.database;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
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.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -59,20 +59,20 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
private void editValues(PlayerProfile profile) {
|
private void editValues(PlayerProfile profile) {
|
||||||
mcMMO.p.debug("========================================================================");
|
mcMMO.p.debug("========================================================================");
|
||||||
mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":");
|
mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":");
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) {
|
||||||
int oldLevel = profile.getSkillLevel(skillType);
|
int oldLevel = profile.getSkillLevel(primarySkill);
|
||||||
int oldXPLevel = profile.getSkillXpLevel(skillType);
|
int oldXPLevel = profile.getSkillXpLevel(primarySkill);
|
||||||
int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel);
|
int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel);
|
||||||
|
|
||||||
if (totalOldXP == 0) {
|
if (totalOldXP == 0) {
|
||||||
continue;
|
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 newLevel = newExperienceValues[0];
|
||||||
int newXPlevel = newExperienceValues[1];
|
int newXPlevel = newExperienceValues[1];
|
||||||
|
|
||||||
mcMMO.p.debug(" Skill: " + skillType.toString());
|
mcMMO.p.debug(" Skill: " + primarySkill.toString());
|
||||||
|
|
||||||
mcMMO.p.debug(" OLD:");
|
mcMMO.p.debug(" OLD:");
|
||||||
mcMMO.p.debug(" Level: " + oldLevel);
|
mcMMO.p.debug(" Level: " + oldLevel);
|
||||||
@ -84,8 +84,8 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
mcMMO.p.debug(" XP " + newXPlevel);
|
mcMMO.p.debug(" XP " + newXPlevel);
|
||||||
mcMMO.p.debug("------------------------------------------------------------------------");
|
mcMMO.p.debug("------------------------------------------------------------------------");
|
||||||
|
|
||||||
profile.modifySkill(skillType, newLevel);
|
profile.modifySkill(primarySkill, newLevel);
|
||||||
profile.setSkillXpLevel(skillType, newXPlevel);
|
profile.setSkillXpLevel(primarySkill, newXPlevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
|
|
||||||
public class AbilityCooldownTask extends BukkitRunnable {
|
public class AbilityCooldownTask extends BukkitRunnable {
|
||||||
private McMMOPlayer mcMMOPlayer;
|
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.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -8,7 +9,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
@ -17,9 +17,9 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
|
|
||||||
public class AbilityDisableTask extends BukkitRunnable {
|
public class AbilityDisableTask extends BukkitRunnable {
|
||||||
private McMMOPlayer mcMMOPlayer;
|
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.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerBrewEvent;
|
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerBrewEvent;
|
||||||
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
|
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
@ -38,8 +38,8 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
|||||||
brewSpeed = DEFAULT_BREW_SPEED;
|
brewSpeed = DEFAULT_BREW_SPEED;
|
||||||
brewTimer = DEFAULT_BREW_TICKS;
|
brewTimer = DEFAULT_BREW_TICKS;
|
||||||
|
|
||||||
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
|
if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CATALYSIS)) {
|
||||||
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.ALCHEMY));
|
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkill.ALCHEMY));
|
||||||
|
|
||||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.datatypes.skills.XPGainReason;
|
||||||
|
|
||||||
public class AwardCombatXpTask extends BukkitRunnable {
|
public class AwardCombatXpTask extends BukkitRunnable {
|
||||||
private McMMOPlayer mcMMOPlayer;
|
private McMMOPlayer mcMMOPlayer;
|
||||||
private double baseXp;
|
private double baseXp;
|
||||||
private SkillType skillType;
|
private PrimarySkill primarySkill;
|
||||||
private LivingEntity target;
|
private LivingEntity target;
|
||||||
private XPGainReason xpGainReason;
|
private XPGainReason xpGainReason;
|
||||||
private double baseHealth;
|
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.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.skillType = skillType;
|
this.primarySkill = primarySkill;
|
||||||
this.baseXp = baseXp;
|
this.baseXp = baseXp;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.xpGainReason = xpGainReason;
|
this.xpGainReason = xpGainReason;
|
||||||
@ -39,6 +39,6 @@ public class AwardCombatXpTask extends BukkitRunnable {
|
|||||||
damage += health;
|
damage += health;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.beginXpGain(skillType, (int) (damage * baseXp), xpGainReason);
|
mcMMOPlayer.beginXpGain(primarySkill, (int) (damage * baseXp), xpGainReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||||
|
|
||||||
public abstract class SkillManager {
|
public abstract class SkillManager {
|
||||||
protected McMMOPlayer mcMMOPlayer;
|
protected McMMOPlayer mcMMOPlayer;
|
||||||
protected int activationChance;
|
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.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.activationChance = PerksUtils.handleLuckyPerks(mcMMOPlayer.getPlayer(), skill);
|
this.activationChance = PerksUtils.handleLuckyPerks(mcMMOPlayer.getPlayer(), skill);
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.acrobatics;
|
package com.gmail.nossr50.skills.acrobatics;
|
||||||
|
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -11,8 +12,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -26,15 +26,15 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
Location lastFallLocation;
|
Location lastFallLocation;
|
||||||
|
|
||||||
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
|
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.ACROBATICS);
|
super(mcMMOPlayer, PrimarySkill.ACROBATICS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRoll() {
|
public boolean canRoll() {
|
||||||
return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ROLL);
|
return !exploitPrevention() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ACROBATICS_ROLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDodge(Entity damager) {
|
public boolean canDodge(Entity damager) {
|
||||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DODGE)) {
|
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ACROBATICS_DODGE)) {
|
||||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.DODGE, player, this.skill, 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);
|
ParticleEffectUtils.playDodgeEffect(player);
|
||||||
|
|
||||||
if (mcMMOPlayer.useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
@ -82,13 +82,13 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
public double rollCheck(double damage) {
|
public double rollCheck(double damage) {
|
||||||
Player player = getPlayer();
|
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);
|
return gracefulRollCheck(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
|
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.ROLL, player, this.skill, 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"));
|
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
||||||
applyXpGain(calculateRollXP(damage, true), XPGainReason.PVE);
|
applyXpGain(calculateRollXP(damage, true), XPGainReason.PVE);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
private double gracefulRollCheck(double damage) {
|
private double gracefulRollCheck(double damage) {
|
||||||
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
|
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.GRACEFUL_ROLL, getPlayer(), this.skill, 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"));
|
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
|
||||||
applyXpGain(calculateRollXP(damage, true), XPGainReason.PVE);
|
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.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -17,7 +17,7 @@ public class AlchemyManager extends SkillManager {
|
|||||||
private final double LUCKY_MODIFIER = 4.0 / 3.0;
|
private final double LUCKY_MODIFIER = 4.0 / 3.0;
|
||||||
|
|
||||||
public AlchemyManager(McMMOPlayer mcMMOPlayer) {
|
public AlchemyManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.ALCHEMY);
|
super(mcMMOPlayer, PrimarySkill.ALCHEMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTier() {
|
public int getTier() {
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
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.AlchemyPotion;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.events.fake.FakeBrewEvent;
|
import com.gmail.nossr50.events.fake.FakeBrewEvent;
|
||||||
@ -94,7 +94,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> getValidIngredients(Player player) {
|
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) {
|
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
package com.gmail.nossr50.skills.archery;
|
||||||
|
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -10,8 +11,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -21,19 +21,19 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
|
|
||||||
public class ArcheryManager extends SkillManager {
|
public class ArcheryManager extends SkillManager {
|
||||||
public ArcheryManager(McMMOPlayer mcMMOPlayer) {
|
public ArcheryManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.ARCHERY);
|
super(mcMMOPlayer, PrimarySkill.ARCHERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDaze(LivingEntity target) {
|
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() {
|
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() {
|
public boolean canRetrieveArrows() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.RETRIEVE);
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.ARCHERY_RETRIEVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +59,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param target The {@link LivingEntity} damaged by the arrow
|
* @param target The {@link LivingEntity} damaged by the arrow
|
||||||
*/
|
*/
|
||||||
public void retrieveArrows(LivingEntity target) {
|
public void retrieveArrows(LivingEntity target) {
|
||||||
if (SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.RETRIEVE, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ARCHERY_RETRIEVE, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
Archery.incrementTrackerValue(target);
|
Archery.incrementTrackerValue(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param defender The {@link Player} being affected by the ability
|
* @param defender The {@link Player} being affected by the ability
|
||||||
*/
|
*/
|
||||||
public double daze(Player defender) {
|
public double daze(Player defender) {
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.DAZE, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.ARCHERY_DAZE, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public double skillShot(double damage) {
|
public double skillShot(double damage) {
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.ALWAYS_FIRES, SecondaryAbility.SKILL_SHOT, getPlayer(), null, 0, 0)) {
|
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.ALWAYS_FIRES, SubSkill.ARCHERY_SKILL_SHOT, getPlayer(), null, 0, 0)) {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,16 +2,16 @@ package com.gmail.nossr50.skills.axes;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.datatypes.skills.SubSkill;
|
||||||
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -24,27 +24,27 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
|
|
||||||
public class AxesManager extends SkillManager {
|
public class AxesManager extends SkillManager {
|
||||||
public AxesManager(McMMOPlayer mcMMOPlayer) {
|
public AxesManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.AXES);
|
super(mcMMOPlayer, PrimarySkill.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseAxeMastery() {
|
public boolean canUseAxeMastery() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.AXE_MASTERY);
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.AXES_AXE_MASTERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canCriticalHit(LivingEntity target) {
|
public boolean canCriticalHit(LivingEntity target) {
|
||||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.CRITICAL_HIT);
|
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.AXES_CRITICAL_HIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canImpact(LivingEntity target) {
|
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) {
|
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) {
|
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() {
|
public boolean canActivateAbility() {
|
||||||
@ -55,7 +55,7 @@ public class AxesManager extends SkillManager {
|
|||||||
* Handle the effects of the Axe Mastery ability
|
* Handle the effects of the Axe Mastery ability
|
||||||
*/
|
*/
|
||||||
public double axeMastery() {
|
public double axeMastery() {
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.ALWAYS_FIRES, SecondaryAbility.AXE_MASTERY, getPlayer(), null, 0, 0)) {
|
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.ALWAYS_FIRES, SubSkill.AXES_AXE_MASTERY, getPlayer(), null, 0, 0)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public class AxesManager extends SkillManager {
|
|||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public double criticalHit(LivingEntity target, double damage) {
|
public double criticalHit(LivingEntity target, double damage) {
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.CRITICAL_HIT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.AXES_CRITICAL_HIT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class AxesManager extends SkillManager {
|
|||||||
|
|
||||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||||
if (armor != null && ItemUtils.isArmor(armor)) {
|
if (armor != null && ItemUtils.isArmor(armor)) {
|
||||||
if (SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_STATIC_CHANCE, SecondaryAbility.ARMOR_IMPACT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_STATIC_CHANCE, SubSkill.AXES_ARMOR_IMPACT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
|
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ public class AxesManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public double greaterImpact(LivingEntity target) {
|
public double greaterImpact(LivingEntity target) {
|
||||||
//static chance (3rd param)
|
//static chance (3rd param)
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_STATIC_CHANCE, SecondaryAbility.GREATER_IMPACT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_STATIC_CHANCE, SubSkill.AXES_GREATER_IMPACT, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ package com.gmail.nossr50.skills.child;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public class ChildConfig extends AutoUpdateConfigLoader {
|
public class ChildConfig extends AutoUpdateConfigLoader {
|
||||||
@ -20,15 +20,15 @@ public class ChildConfig extends AutoUpdateConfigLoader {
|
|||||||
|
|
||||||
FamilyTree.clearRegistrations(); // when reloading, need to clear statics
|
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());
|
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
|
boolean useDefaults = false; // If we had an error we back out and use defaults
|
||||||
|
|
||||||
for (String name : config.getStringList(StringUtils.getCapitalized(skill.name()))) {
|
for (String name : config.getStringList(StringUtils.getCapitalized(skill.name()))) {
|
||||||
try {
|
try {
|
||||||
SkillType parentSkill = SkillType.valueOf(name.toUpperCase());
|
PrimarySkill parentSkill = PrimarySkill.valueOf(name.toUpperCase());
|
||||||
FamilyTree.enforceNotChildSkill(parentSkill);
|
FamilyTree.enforceNotChildSkill(parentSkill);
|
||||||
parentSkills.add(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.
|
* 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.
|
* 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
|
// Register them
|
||||||
for (SkillType parentSkill : parentSkills) {
|
for (PrimarySkill parentSkill : parentSkills) {
|
||||||
plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name());
|
plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name());
|
||||||
FamilyTree.registerParent(skill, parentSkill);
|
FamilyTree.registerParent(skill, parentSkill);
|
||||||
}
|
}
|
||||||
|
@ -5,32 +5,32 @@ import java.util.EnumSet;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
|
|
||||||
public class FamilyTree {
|
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);
|
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.
|
// 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);
|
return tree.get(childSkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void registerParent(SkillType childSkill, SkillType parentSkill) {
|
protected static void registerParent(PrimarySkill childSkill, PrimarySkill parentSkill) {
|
||||||
enforceChildSkill(childSkill);
|
enforceChildSkill(childSkill);
|
||||||
enforceNotChildSkill(parentSkill);
|
enforceNotChildSkill(parentSkill);
|
||||||
|
|
||||||
if (!tree.containsKey(childSkill)) {
|
if (!tree.containsKey(childSkill)) {
|
||||||
tree.put(childSkill, EnumSet.noneOf(SkillType.class));
|
tree.put(childSkill, EnumSet.noneOf(PrimarySkill.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
tree.get(childSkill).add(parentSkill);
|
tree.get(childSkill).add(parentSkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void closeRegistration() {
|
protected static void closeRegistration() {
|
||||||
for (SkillType childSkill : tree.keySet()) {
|
for (PrimarySkill childSkill : tree.keySet()) {
|
||||||
Set<SkillType> immutableSet = Collections.unmodifiableSet(tree.get(childSkill));
|
Set<PrimarySkill> immutableSet = Collections.unmodifiableSet(tree.get(childSkill));
|
||||||
tree.put(childSkill, immutableSet);
|
tree.put(childSkill, immutableSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,13 +39,13 @@ public class FamilyTree {
|
|||||||
tree.clear();
|
tree.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void enforceChildSkill(SkillType skill) {
|
protected static void enforceChildSkill(PrimarySkill skill) {
|
||||||
if (!skill.isChildSkill()) {
|
if (!skill.isChildSkill()) {
|
||||||
throw new IllegalArgumentException(skill.name() + " is not a child skill!");
|
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()) {
|
if (skill.isChildSkill()) {
|
||||||
throw new IllegalArgumentException(skill.name() + " is a child skill!");
|
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.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
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.datatypes.treasure.ExcavationTreasure;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
@ -26,7 +26,7 @@ public class Excavation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static int getBlockXP(BlockState blockState) {
|
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)) {
|
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
|
||||||
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
|
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
|
||||||
|
@ -2,13 +2,13 @@ package com.gmail.nossr50.skills.excavation;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -18,7 +18,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
|
|
||||||
public class ExcavationManager extends SkillManager {
|
public class ExcavationManager extends SkillManager {
|
||||||
public ExcavationManager(McMMOPlayer mcMMOPlayer) {
|
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) {
|
public void excavationBlockCheck(BlockState blockState) {
|
||||||
int xp = Excavation.getBlockXP(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);
|
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
|
||||||
|
|
||||||
if (!treasures.isEmpty()) {
|
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.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
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.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
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.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
||||||
@ -48,15 +48,15 @@ public class FishingManager extends SkillManager {
|
|||||||
private Location hookLocation;
|
private Location hookLocation;
|
||||||
|
|
||||||
public FishingManager(McMMOPlayer mcMMOPlayer) {
|
public FishingManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.FISHING);
|
super(mcMMOPlayer, PrimarySkill.FISHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canShake(Entity target) {
|
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() {
|
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() {
|
public boolean unleashTheKraken() {
|
||||||
@ -183,7 +183,7 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (!Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ICE_FISHING)) {
|
if (!Permissions.isSubSkillEnabled(getPlayer(), SubSkill.FISHING_ICE_FISHING)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,12 +279,12 @@ public class FishingManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void handleFishing(Item fishingCatch) {
|
public void handleFishing(Item fishingCatch) {
|
||||||
this.fishingCatch = 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;
|
int treasureXp = 0;
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
FishingTreasure treasure = null;
|
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();
|
treasure = getFishingTreasure();
|
||||||
this.fishingCatch = null;
|
this.fishingCatch = null;
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ public class FishingManager extends SkillManager {
|
|||||||
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
||||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
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);
|
enchants = handleMagicHunter(treasureDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ public class FishingManager extends SkillManager {
|
|||||||
public void shakeCheck(LivingEntity target) {
|
public void shakeCheck(LivingEntity target) {
|
||||||
fishingTries--; // Because autoclicking to shake is OK.
|
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);
|
mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
|
||||||
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
||||||
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
||||||
|
@ -12,7 +12,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class HerbalismManager extends SkillManager {
|
public class HerbalismManager extends SkillManager {
|
||||||
public HerbalismManager(McMMOPlayer mcMMOPlayer) {
|
public HerbalismManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.HERBALISM);
|
super(mcMMOPlayer, PrimarySkill.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockCheck() {
|
public boolean canBlockCheck() {
|
||||||
@ -47,15 +47,15 @@ public class HerbalismManager extends SkillManager {
|
|||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
Material itemType = inventory.getItemInMainHand().getType();
|
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() {
|
public boolean canUseHylianLuck() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.HYLIAN_LUCK);
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.HERBALISM_HYLIAN_LUCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
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() {
|
public boolean canActivateAbility() {
|
||||||
@ -63,7 +63,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreenTerraPlant() {
|
public boolean canGreenTerraPlant() {
|
||||||
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA);
|
return mcMMOPlayer.getAbilityMode(SuperAbility.GREEN_TERRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,14 +130,14 @@ public class HerbalismManager extends SkillManager {
|
|||||||
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
||||||
xp = customBlock.getXpGain();
|
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();
|
drops = blockState.getBlock().getDrops();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getBlockData());
|
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();
|
drops = blockState.getBlock().getDrops();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
|
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
|
||||||
if (SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.HERBALISM_DOUBLE_DROPS, player, this.skill, 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) {
|
for (ItemStack item : drops) {
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), item, amount);
|
Misc.dropItems(Misc.getBlockCenter(blockState), item, amount);
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processGreenThumbBlocks(BlockState blockState) {
|
public boolean processGreenThumbBlocks(BlockState blockState) {
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.GREEN_THUMB_BLOCK, getPlayer(), this.skill, 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"));
|
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processHylianLuck(BlockState blockState) {
|
public boolean processHylianLuck(BlockState blockState) {
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.HYLIAN_LUCK, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_HYLIAN_LUCK, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
|
|
||||||
if (!SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.SHROOM_THUMB, player, this.skill, 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"));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Fail"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!greenTerra && !SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.GREEN_THUMB_PLANT, player, this.skill, getSkillLevel(), activationChance)) {
|
if (!greenTerra && !SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.HERBALISM_GREEN_THUMB, player, this.skill, getSkillLevel(), activationChance)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -16,7 +16,7 @@ public class Mining {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public static int getBlockXp(BlockState blockState) {
|
public static int getBlockXp(BlockState blockState) {
|
||||||
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockState.getType());
|
int xp = ExperienceConfig.getInstance().getXp(PrimarySkill.MINING, blockState.getType());
|
||||||
|
|
||||||
if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
|
if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
|
||||||
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
|
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
|
||||||
|
@ -2,9 +2,9 @@ package com.gmail.nossr50.skills.mining;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
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.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -15,7 +15,7 @@ import com.gmail.nossr50.util.BlockUtils;
|
|||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -30,7 +30,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MiningManager extends SkillManager {
|
public class MiningManager extends SkillManager {
|
||||||
public MiningManager(McMMOPlayer mcMMOPlayer) {
|
public MiningManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.MINING);
|
super(mcMMOPlayer, PrimarySkill.MINING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseDemolitionsExpertise() {
|
public boolean canUseDemolitionsExpertise() {
|
||||||
@ -61,7 +61,7 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);
|
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);
|
||||||
|
|
||||||
if (!Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MINING_DOUBLE_DROPS)) {
|
if (!Permissions.isSubSkillEnabled(player, SubSkill.MINING_DOUBLE_DROPS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
//TODO: Make this readable
|
//TODO: Make this readable
|
||||||
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
|
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
|
||||||
if (SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.MINING_DOUBLE_DROPS, player, this.skill, getSkillLevel(), activationChance)) {
|
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.MINING_DOUBLE_DROPS, player, this.skill, getSkillLevel(), activationChance)) {
|
||||||
if (silkTouch) {
|
if (silkTouch) {
|
||||||
Mining.handleSilkTouchDrops(blockState);
|
Mining.handleSilkTouchDrops(blockState);
|
||||||
}
|
}
|
||||||
@ -103,16 +103,16 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
|
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
|
||||||
|
|
||||||
SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
|
SkillUtils.sendSkillMessage(player, SuperAbility.BLAST_MINING.getAbilityPlayer(player));
|
||||||
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
||||||
|
|
||||||
tnt.setMetadata(mcMMO.tntMetadataKey, mcMMOPlayer.getPlayerMetadata());
|
tnt.setMetadata(mcMMO.tntMetadataKey, mcMMOPlayer.getPlayerMetadata());
|
||||||
tnt.setFuseTicks(0);
|
tnt.setFuseTicks(0);
|
||||||
targetBlock.setType(Material.AIR);
|
targetBlock.setType(Material.AIR);
|
||||||
|
|
||||||
mcMMOPlayer.setAbilityDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
|
mcMMOPlayer.setAbilityDATS(SuperAbility.BLAST_MINING, System.currentTimeMillis());
|
||||||
mcMMOPlayer.setAbilityInformed(AbilityType.BLAST_MINING, false);
|
mcMMOPlayer.setAbilityInformed(SuperAbility.BLAST_MINING, false);
|
||||||
new AbilityCooldownTask(mcMMOPlayer, AbilityType.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, AbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
new AbilityCooldownTask(mcMMOPlayer, SuperAbility.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, SuperAbility.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -287,7 +287,7 @@ public class MiningManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean blastMiningCooldownOver() {
|
private boolean blastMiningCooldownOver() {
|
||||||
int timeRemaining = mcMMOPlayer.calculateTimeRemaining(AbilityType.BLAST_MINING);
|
int timeRemaining = mcMMOPlayer.calculateTimeRemaining(SuperAbility.BLAST_MINING);
|
||||||
|
|
||||||
if (timeRemaining > 0) {
|
if (timeRemaining > 0) {
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||||
|
@ -3,8 +3,8 @@ package com.gmail.nossr50.skills.repair;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -15,7 +15,7 @@ import com.gmail.nossr50.util.EventUtils;
|
|||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -23,7 +23,6 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -33,7 +32,7 @@ public class RepairManager extends SkillManager {
|
|||||||
private int lastClick;
|
private int lastClick;
|
||||||
|
|
||||||
public RepairManager(McMMOPlayer mcMMOPlayer) {
|
public RepairManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.REPAIR);
|
super(mcMMOPlayer, PrimarySkill.REPAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,12 +244,12 @@ public class RepairManager extends SkillManager {
|
|||||||
private short repairCalculate(short durability, int repairAmount) {
|
private short repairCalculate(short durability, int repairAmount) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY)) {
|
if (Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_REPAIR_MASTERY)) {
|
||||||
double bonus = repairAmount * Math.min((((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * getSkillLevel()) / 100.0D), Repair.repairMasteryMaxBonus / 100.0D);
|
double bonus = repairAmount * Math.min((((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * getSkillLevel()) / 100.0D), Repair.repairMasteryMaxBonus / 100.0D);
|
||||||
repairAmount += bonus;
|
repairAmount += bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR) && checkPlayerProcRepair()) {
|
if (Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_SUPER_REPAIR) && checkPlayerProcRepair()) {
|
||||||
repairAmount *= 2.0D;
|
repairAmount *= 2.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +266,7 @@ public class RepairManager extends SkillManager {
|
|||||||
* @return true if bonus granted, false otherwise
|
* @return true if bonus granted, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean checkPlayerProcRepair() {
|
private boolean checkPlayerProcRepair() {
|
||||||
if (SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.SUPER_REPAIR, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
if (SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.REPAIR_SUPER_REPAIR, getPlayer(), this.skill, getSkillLevel(), activationChance)) {
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
getPlayer().sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -294,7 +293,7 @@ public class RepairManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getArcaneForgingRank() == 0 || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING)) {
|
if (getArcaneForgingRank() == 0 || !Permissions.isSubSkillEnabled(player, SubSkill.REPAIR_ARCANE_FORGING)) {
|
||||||
for (Enchantment enchant : enchants.keySet()) {
|
for (Enchantment enchant : enchants.keySet()) {
|
||||||
item.removeEnchantment(enchant);
|
item.removeEnchantment(enchant);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.salvage;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -20,7 +20,6 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -30,7 +29,7 @@ public class SalvageManager extends SkillManager {
|
|||||||
private int lastClick;
|
private int lastClick;
|
||||||
|
|
||||||
public SalvageManager(McMMOPlayer mcMMOPlayer) {
|
public SalvageManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.SALVAGE);
|
super(mcMMOPlayer, PrimarySkill.SALVAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.smelting;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -44,6 +44,6 @@ public class Smelting {
|
|||||||
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();
|
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();
|
||||||
|
|
||||||
protected static int getResourceXp(ItemStack smelting) {
|
protected static int getResourceXp(ItemStack smelting) {
|
||||||
return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, smelting.getType());
|
return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(PrimarySkill.SMELTING, smelting.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package com.gmail.nossr50.skills.smelting;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
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.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -16,7 +16,7 @@ import com.gmail.nossr50.util.EventUtils;
|
|||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import com.gmail.nossr50.util.skills.SecondarySkillActivationType;
|
import com.gmail.nossr50.util.skills.SubSkillActivationType;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -33,15 +33,15 @@ import java.util.List;
|
|||||||
|
|
||||||
public class SmeltingManager extends SkillManager {
|
public class SmeltingManager extends SkillManager {
|
||||||
public SmeltingManager(McMMOPlayer mcMMOPlayer) {
|
public SmeltingManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.SMELTING);
|
super(mcMMOPlayer, PrimarySkill.SMELTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseFluxMining(BlockState blockState) {
|
public boolean canUseFluxMining(BlockState blockState) {
|
||||||
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.FLUX_MINING) && !mcMMO.getPlaceStore().isTrue(blockState);
|
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.isSubSkillEnabled(getPlayer(), SubSkill.SMELTING_FLUX_MINING) && !mcMMO.getPlaceStore().isTrue(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSecondSmeltSuccessful() {
|
public boolean isSecondSmeltSuccessful() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SECOND_SMELT) && SkillUtils.isActivationSuccessful(SecondarySkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SecondaryAbility.SECOND_SMELT, getPlayer(), this.skill, getSkillLevel(), activationChance);
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkill.SMELTING_SECOND_SMELT) && SkillUtils.isActivationSuccessful(SubSkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkill.SMELTING_SECOND_SMELT, getPlayer(), this.skill, getSkillLevel(), activationChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,7 +53,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
public boolean processFluxMining(BlockState blockState) {
|
public boolean processFluxMining(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.FLUX_MINING, Smelting.fluxMiningChance / activationChance);
|
SubSkillWeightedActivationCheckEvent event = new SubSkillWeightedActivationCheckEvent(getPlayer(), SubSkill.SMELTING_FLUX_MINING, Smelting.fluxMiningChance / activationChance);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user