mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 17:23:42 +01:00 
			
		
		
		
	Refactoring + adding a new skillranks config (not functional yet)
This commit is contained in:
		| @@ -17,10 +17,11 @@ Version 2.1.0 | ||||
|  + Added the tagline "Overhaul Era" to various locations until 3.0.0 comes out | ||||
|  + (Sound) Volume and Pitch of sounds can now be configured in the new sounds.yml file | ||||
|  + (MySQL) Added support for SSL for MySQL/MariaDB (On by default) | ||||
|  + (Skills) Adding a new subskill to child skills called 'Understanding The Art' this adds nothing new, but tracks your progress in that child skill, which was previous a bit obfuscated. | ||||
|  + (Skills) Tool alerts now are sent to the Action Bar | ||||
|  + (Skills) Super Ability activation alerts are now sent to the Action Bar | ||||
|  + (Skills) Certain Skill messages are now sent to the Action Bar | ||||
|  + (Config) Skill Ranks are now defined in skillranks.yml if a skill does not have a rank it's unlocked right away | ||||
|  + (Config) Skill Rank requirements are now defined in skillranks.yml you cannot add or remove ranks from this file | ||||
|  + (Config) Added option to use SSL for MySQL in config.yml | ||||
|  + (Config) Added option to disable the new URL links to config.yml | ||||
|  + (Config) New config file added coreskills.yml | ||||
| @@ -51,6 +52,7 @@ Version 2.1.0 | ||||
|  = (MySQL) When converting from MySQL to flatfile mcMMO will now properly include all users in the conversion process | ||||
|  + (Party) Parties can now have size limits (configurable in config.yml), party size is unlimited by default | ||||
|  ! (Party) Party member list will only include members of the party that you can see (aren't vanished) | ||||
|  ! (Skills) Some skill level rank requirements have changed | ||||
|  ! (Skills) Fixed an edge case bug where Blast Mining wouldn't inform the player that it was on cooldown | ||||
|  ! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default) | ||||
|  ! (Skills) Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use | ||||
| @@ -59,6 +61,9 @@ Version 2.1.0 | ||||
|  ! (Skills) Woodcutting's Double Drop subskill is now named Harvest Lumber | ||||
|  ! (Skills) Archery's Skill Shot now uses a rank system | ||||
|  ! (Skills) Axe's Axe Mastery now uses a rank system | ||||
|  ! (Skills) Axe's Impact now uses a rank system | ||||
|  ! (Skills) Herbalism's Farmer's Diet now uses a rank system | ||||
|  ! (Skills) Herbalism's Green Thumb now uses a rank system | ||||
|  ! (Config) Unarmed.IronArm in advanced.yml is now Unarmed.IronArmStyle | ||||
|  ! (Config) Unarmed.Deflect in advanced.yml is now Unarmed.ArrowDeflect | ||||
|  ! (Config) Swords.Counter in advanced.yml is now Swords.CounterAttack | ||||
| @@ -77,9 +82,9 @@ Version 2.1.0 | ||||
|  ! (Locale) Super Abilities no longer have (ABILITY) in their Skill.Effect strings | ||||
|  ! (API) mcMMO is now built against Spigot-API instead of Bukkit | ||||
|  ! (API) Moved a lot of methods from SkillCommand to SkillUtils | ||||
|  ! (API) SkillType is now PrimarySkill | ||||
|  ! (API) SkillType is now PrimarySkillType | ||||
|  ! (API) SecondarySkill is now SubSkillType | ||||
|  ! (API) AbilityType is now SuperAbility | ||||
|  ! (API) AbilityType is now SuperAbilityType | ||||
|  ! (API) SecondaryAbilityEvent is now SubSkillEvent | ||||
|  ! (API) SubSkillType has had many helpful methods added to it | ||||
|  ! (API) GREEN_THUMB_PLANT & GREEN_THUMB_BLOCK are replaced by GREEN_THUMB | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.api; | ||||
| import java.util.Set; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -34,7 +34,7 @@ public final class ExperienceAPI { | ||||
|      * @return true if this is a valid mcMMO skill | ||||
|      */ | ||||
|     public static boolean isValidSkillType(String skillType) { | ||||
|         return PrimarySkill.getSkill(skillType) != null; | ||||
|         return PrimarySkillType.getSkill(skillType) != null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -48,7 +48,7 @@ public final class ExperienceAPI { | ||||
|      * @return true if this is a valid, non-child mcMMO skill | ||||
|      */ | ||||
|     public static boolean isNonChildSkill(String skillType) { | ||||
|         PrimarySkill skill = PrimarySkill.getSkill(skillType); | ||||
|         PrimarySkillType skill = PrimarySkillType.getSkill(skillType); | ||||
|  | ||||
|         return skill != null && !skill.isChildSkill(); | ||||
|     } | ||||
| @@ -261,7 +261,7 @@ public final class ExperienceAPI { | ||||
|      * @throws InvalidXPGainReasonException if the given xpGainReason is not valid | ||||
|      */ | ||||
|     public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason, boolean isUnshared) { | ||||
|         PrimarySkill skill = getSkillType(skillType); | ||||
|         PrimarySkillType skill = getSkillType(skillType); | ||||
|  | ||||
|         if (isUnshared) { | ||||
|             getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason)); | ||||
| @@ -285,7 +285,7 @@ public final class ExperienceAPI { | ||||
|      */ | ||||
|     @Deprecated | ||||
|     public static void addModifiedXPOffline(String playerName, String skillType, int XP) { | ||||
|         PrimarySkill skill = getSkillType(skillType); | ||||
|         PrimarySkillType skill = getSkillType(skillType); | ||||
|  | ||||
|         addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier())); | ||||
|     } | ||||
| @@ -515,7 +515,7 @@ public final class ExperienceAPI { | ||||
|      * @throws UnsupportedOperationException if the given skill is a child skill | ||||
|      */ | ||||
|     public static int getXPRemaining(Player player, String skillType) { | ||||
|         PrimarySkill skill = getNonChildSkillType(skillType); | ||||
|         PrimarySkillType skill = getNonChildSkillType(skillType); | ||||
|  | ||||
|         PlayerProfile profile = getPlayer(player).getProfile(); | ||||
|  | ||||
| @@ -537,7 +537,7 @@ public final class ExperienceAPI { | ||||
|      */ | ||||
|     @Deprecated | ||||
|     public static int getOfflineXPRemaining(String playerName, String skillType) { | ||||
|         PrimarySkill skill = getNonChildSkillType(skillType); | ||||
|         PrimarySkillType skill = getNonChildSkillType(skillType); | ||||
|         PlayerProfile profile = getOfflineProfile(playerName); | ||||
|  | ||||
|         return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill); | ||||
| @@ -557,7 +557,7 @@ public final class ExperienceAPI { | ||||
|      * @throws UnsupportedOperationException if the given skill is a child skill | ||||
|      */ | ||||
|     public static float getOfflineXPRemaining(UUID uuid, String skillType) { | ||||
|         PrimarySkill skill = getNonChildSkillType(skillType); | ||||
|         PrimarySkillType skill = getNonChildSkillType(skillType); | ||||
|         PlayerProfile profile = getOfflineProfile(uuid); | ||||
|  | ||||
|         return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill); | ||||
| @@ -593,12 +593,12 @@ public final class ExperienceAPI { | ||||
|     @Deprecated | ||||
|     public static void addLevelOffline(String playerName, String skillType, int levels) { | ||||
|         PlayerProfile profile = getOfflineProfile(playerName); | ||||
|         PrimarySkill skill = getSkillType(skillType); | ||||
|         PrimarySkillType skill = getSkillType(skillType); | ||||
|  | ||||
|         if (skill.isChildSkill()) { | ||||
|             Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill); | ||||
|             Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); | ||||
|  | ||||
|             for (PrimarySkill parentSkill : parentSkills) { | ||||
|             for (PrimarySkillType parentSkill : parentSkills) { | ||||
|                 profile.addLevels(parentSkill, (levels / parentSkills.size())); | ||||
|             } | ||||
|  | ||||
| @@ -624,12 +624,12 @@ public final class ExperienceAPI { | ||||
|      */ | ||||
|     public static void addLevelOffline(UUID uuid, String skillType, int levels) { | ||||
|         PlayerProfile profile = getOfflineProfile(uuid); | ||||
|         PrimarySkill skill = getSkillType(skillType); | ||||
|         PrimarySkillType skill = getSkillType(skillType); | ||||
|  | ||||
|         if (skill.isChildSkill()) { | ||||
|             Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill); | ||||
|             Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); | ||||
|  | ||||
|             for (PrimarySkill parentSkill : parentSkills) { | ||||
|             for (PrimarySkillType parentSkill : parentSkills) { | ||||
|                 profile.addLevels(parentSkill, (levels / parentSkills.size())); | ||||
|             } | ||||
|  | ||||
| @@ -716,7 +716,7 @@ public final class ExperienceAPI { | ||||
|         int powerLevel = 0; | ||||
|         PlayerProfile profile = getOfflineProfile(playerName); | ||||
|  | ||||
|         for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|         for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             powerLevel += profile.getSkillLevel(type); | ||||
|         } | ||||
|  | ||||
| @@ -737,7 +737,7 @@ public final class ExperienceAPI { | ||||
|         int powerLevel = 0; | ||||
|         PlayerProfile profile = getOfflineProfile(uuid); | ||||
|  | ||||
|         for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|         for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             powerLevel += profile.getSkillLevel(type); | ||||
|         } | ||||
|  | ||||
| @@ -1015,7 +1015,7 @@ public final class ExperienceAPI { | ||||
|     } | ||||
|  | ||||
|     // Utility methods follow. | ||||
|     private static void addOfflineXP(UUID playerUniqueId, PrimarySkill skill, int XP) { | ||||
|     private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) { | ||||
|         PlayerProfile profile = getOfflineProfile(playerUniqueId); | ||||
|  | ||||
|         profile.addXp(skill, XP); | ||||
| @@ -1023,7 +1023,7 @@ public final class ExperienceAPI { | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     private static void addOfflineXP(String playerName, PrimarySkill skill, int XP) { | ||||
|     private static void addOfflineXP(String playerName, PrimarySkillType skill, int XP) { | ||||
|         PlayerProfile profile = getOfflineProfile(playerName); | ||||
|  | ||||
|         profile.addXp(skill, XP); | ||||
| @@ -1052,8 +1052,8 @@ public final class ExperienceAPI { | ||||
|         return profile; | ||||
|     } | ||||
|  | ||||
|     private static PrimarySkill getSkillType(String skillType) throws InvalidSkillException { | ||||
|         PrimarySkill skill = PrimarySkill.getSkill(skillType); | ||||
|     private static PrimarySkillType getSkillType(String skillType) throws InvalidSkillException { | ||||
|         PrimarySkillType skill = PrimarySkillType.getSkill(skillType); | ||||
|  | ||||
|         if (skill == null) { | ||||
|             throw new InvalidSkillException(); | ||||
| @@ -1062,8 +1062,8 @@ public final class ExperienceAPI { | ||||
|         return skill; | ||||
|     } | ||||
|  | ||||
|     private static PrimarySkill getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException { | ||||
|         PrimarySkill skill = getSkillType(skillType); | ||||
|     private static PrimarySkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException { | ||||
|         PrimarySkillType skill = getSkillType(skillType); | ||||
|  | ||||
|         if (skill.isChildSkill()) { | ||||
|             throw new UnsupportedOperationException("Child skills do not have XP"); | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public final class SkillAPI { | ||||
|     private SkillAPI() {} | ||||
| @@ -18,7 +18,7 @@ public final class SkillAPI { | ||||
|      * @return a list of strings with valid skill names | ||||
|      */ | ||||
|     public static List<String> getSkills() { | ||||
|         return getListFromEnum(Arrays.asList(PrimarySkill.values())); | ||||
|         return getListFromEnum(Arrays.asList(PrimarySkillType.values())); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -30,7 +30,7 @@ public final class SkillAPI { | ||||
|      * @return a list of strings with valid skill names | ||||
|      */ | ||||
|     public static List<String> getNonChildSkills() { | ||||
|         return getListFromEnum(PrimarySkill.NON_CHILD_SKILLS); | ||||
|         return getListFromEnum(PrimarySkillType.NON_CHILD_SKILLS); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -42,7 +42,7 @@ public final class SkillAPI { | ||||
|      * @return a list of strings with valid skill names | ||||
|      */ | ||||
|     public static List<String> getChildSkills() { | ||||
|         return getListFromEnum(PrimarySkill.CHILD_SKILLS); | ||||
|         return getListFromEnum(PrimarySkillType.CHILD_SKILLS); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -54,7 +54,7 @@ public final class SkillAPI { | ||||
|      * @return a list of strings with valid skill names | ||||
|      */ | ||||
|     public static List<String> getCombatSkills() { | ||||
|         return getListFromEnum(PrimarySkill.COMBAT_SKILLS); | ||||
|         return getListFromEnum(PrimarySkillType.COMBAT_SKILLS); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -66,7 +66,7 @@ public final class SkillAPI { | ||||
|      * @return a list of strings with valid skill names | ||||
|      */ | ||||
|     public static List<String> getGatheringSkills() { | ||||
|         return getListFromEnum(PrimarySkill.GATHERING_SKILLS); | ||||
|         return getListFromEnum(PrimarySkillType.GATHERING_SKILLS); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -78,14 +78,14 @@ public final class SkillAPI { | ||||
|      * @return a list of strings with valid skill names | ||||
|      */ | ||||
|     public static List<String> getMiscSkills() { | ||||
|         return getListFromEnum(PrimarySkill.MISC_SKILLS); | ||||
|         return getListFromEnum(PrimarySkillType.MISC_SKILLS); | ||||
|     } | ||||
|  | ||||
|     private static List<String> getListFromEnum(List<PrimarySkill> skillsTypes) { | ||||
|     private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) { | ||||
|         List<String> skills = new ArrayList<String>(); | ||||
|  | ||||
|         for (PrimarySkill primarySkill : skillsTypes) { | ||||
|             skills.add(primarySkill.name()); | ||||
|         for (PrimarySkillType primarySkillType : skillsTypes) { | ||||
|             skills.add(primarySkillType.name()); | ||||
|         } | ||||
|  | ||||
|         return skills; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.commands.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| @@ -22,7 +22,7 @@ public class AddlevelsCommand extends ExperienceCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value) { | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { | ||||
|         float xpRemoved = profile.getSkillXpLevelRaw(skill); | ||||
|         profile.addLevels(skill, value); | ||||
|  | ||||
| @@ -40,7 +40,7 @@ public class AddlevelsCommand extends ExperienceCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill) { | ||||
|     protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { | ||||
|         player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName())); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.commands.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| @@ -22,7 +22,7 @@ public class AddxpCommand extends ExperienceCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value) { | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { | ||||
|         if (player != null) { | ||||
|             UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND); | ||||
|         } | ||||
| @@ -38,7 +38,7 @@ public class AddxpCommand extends ExperienceCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill) { | ||||
|     protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { | ||||
|         player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName())); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.OfflinePlayer; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandSender; | ||||
| @@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList; | ||||
| public abstract class ExperienceCommand implements TabExecutor { | ||||
|     @Override | ||||
|     public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||||
|         PrimarySkill skill; | ||||
|         PrimarySkillType skill; | ||||
|  | ||||
|         switch (args.length) { | ||||
|             case 2: | ||||
| @@ -40,7 +40,7 @@ public abstract class ExperienceCommand implements TabExecutor { | ||||
|                     return true; | ||||
|                 } | ||||
|  | ||||
|                 skill = PrimarySkill.getSkill(args[0]); | ||||
|                 skill = PrimarySkillType.getSkill(args[0]); | ||||
|  | ||||
|                 if (args[1].equalsIgnoreCase("all")) { | ||||
|                     skill = null; | ||||
| @@ -65,7 +65,7 @@ public abstract class ExperienceCommand implements TabExecutor { | ||||
|                     return true; | ||||
|                 } | ||||
|  | ||||
|                 skill = PrimarySkill.getSkill(args[1]); | ||||
|                 skill = PrimarySkillType.getSkill(args[1]); | ||||
|  | ||||
|                 if (args[1].equalsIgnoreCase("all")) { | ||||
|                     skill = null; | ||||
| @@ -116,7 +116,7 @@ public abstract class ExperienceCommand implements TabExecutor { | ||||
|                 List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender); | ||||
|                 return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); | ||||
|             case 2: | ||||
|                 return StringUtil.copyPartialMatches(args[1], PrimarySkill.SKILL_NAMES, new ArrayList<String>(PrimarySkill.SKILL_NAMES.size())); | ||||
|                 return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size())); | ||||
|             default: | ||||
|                 return ImmutableList.of(); | ||||
|         } | ||||
| @@ -124,15 +124,15 @@ public abstract class ExperienceCommand implements TabExecutor { | ||||
|  | ||||
|     protected abstract boolean permissionsCheckSelf(CommandSender sender); | ||||
|     protected abstract boolean permissionsCheckOthers(CommandSender sender); | ||||
|     protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value); | ||||
|     protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value); | ||||
|     protected abstract void handlePlayerMessageAll(Player player, int value); | ||||
|     protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill); | ||||
|     protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill); | ||||
|  | ||||
|     private boolean validateArguments(CommandSender sender, String skillName, String value) { | ||||
|         return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName))); | ||||
|     } | ||||
|  | ||||
|     protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkill skill) { | ||||
|     protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); | ||||
|         } | ||||
| @@ -141,10 +141,10 @@ public abstract class ExperienceCommand implements TabExecutor { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected void editValues(Player player, PlayerProfile profile, PrimarySkill skill, int value) { | ||||
|     protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { | ||||
|         if (skill == null) { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 handleCommand(player, profile, primarySkill, value); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 handleCommand(player, profile, primarySkillType, value); | ||||
|             } | ||||
|  | ||||
|             if (player != null) { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.commands.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| @@ -22,7 +22,7 @@ public class MmoeditCommand extends ExperienceCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill, int value) { | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { | ||||
|         int skillLevel = profile.getSkillLevel(skill); | ||||
|         float xpRemoved = profile.getSkillXpLevelRaw(skill); | ||||
|  | ||||
| @@ -46,7 +46,7 @@ public class MmoeditCommand extends ExperienceCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void handlePlayerMessageSkill(Player player, int value, PrimarySkill skill) { | ||||
|     protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { | ||||
|         player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value)); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.OfflinePlayer; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandSender; | ||||
| @@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableList; | ||||
| public class SkillresetCommand implements TabExecutor { | ||||
|     @Override | ||||
|     public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||||
|         PrimarySkill skill; | ||||
|         PrimarySkillType skill; | ||||
|         switch (args.length) { | ||||
|             case 1: | ||||
|                 if (CommandUtils.noConsoleUsage(sender)) { | ||||
| @@ -50,7 +50,7 @@ public class SkillresetCommand implements TabExecutor { | ||||
|                     skill = null; | ||||
|                 } | ||||
|                 else { | ||||
|                     skill = PrimarySkill.getSkill(args[1]); | ||||
|                     skill = PrimarySkillType.getSkill(args[1]); | ||||
|                 } | ||||
|  | ||||
|                 editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill); | ||||
| @@ -70,7 +70,7 @@ public class SkillresetCommand implements TabExecutor { | ||||
|                     skill = null; | ||||
|                 } | ||||
|                 else { | ||||
|                     skill = PrimarySkill.getSkill(args[1]); | ||||
|                     skill = PrimarySkillType.getSkill(args[1]); | ||||
|                 } | ||||
|  | ||||
|                 String playerName = CommandUtils.getMatchedPlayerName(args[0]); | ||||
| @@ -110,13 +110,13 @@ public class SkillresetCommand implements TabExecutor { | ||||
|                 List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender); | ||||
|                 return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); | ||||
|             case 2: | ||||
|                 return StringUtil.copyPartialMatches(args[1], PrimarySkill.SKILL_NAMES, new ArrayList<String>(PrimarySkill.SKILL_NAMES.size())); | ||||
|                 return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size())); | ||||
|             default: | ||||
|                 return ImmutableList.of(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkill skill) { | ||||
|     protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill) { | ||||
|         int levelsRemoved = profile.getSkillLevel(skill); | ||||
|         float xpRemoved = profile.getSkillXpLevelRaw(skill); | ||||
|  | ||||
| @@ -142,7 +142,7 @@ public class SkillresetCommand implements TabExecutor { | ||||
|         player.sendMessage(LocaleLoader.getString("Commands.Reset.All")); | ||||
|     } | ||||
|  | ||||
|     protected void handlePlayerMessageSkill(Player player, PrimarySkill skill) { | ||||
|     protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) { | ||||
|         player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName())); | ||||
|     } | ||||
|  | ||||
| @@ -150,7 +150,7 @@ public class SkillresetCommand implements TabExecutor { | ||||
|         return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName); | ||||
|     } | ||||
|  | ||||
|     protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkill skill) { | ||||
|     protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); | ||||
|         } | ||||
| @@ -159,10 +159,10 @@ public class SkillresetCommand implements TabExecutor { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected void editValues(Player player, PlayerProfile profile, PrimarySkill skill) { | ||||
|     protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 handleCommand(player, profile, primarySkill); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 handleCommand(player, profile, primarySkillType); | ||||
|             } | ||||
|  | ||||
|             if (player != null) { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.commands.hardcore; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -20,10 +20,10 @@ public class HardcoreCommand extends HardcoreModeCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected boolean checkEnabled(PrimarySkill skill) { | ||||
|     protected boolean checkEnabled(PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.values()) { | ||||
|                 if (!primarySkill.getHardcoreStatLossEnabled()) { | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { | ||||
|                 if (!primarySkillType.getHardcoreStatLossEnabled()) { | ||||
|                     return false; | ||||
|                 } | ||||
|             } | ||||
| @@ -35,12 +35,12 @@ public class HardcoreCommand extends HardcoreModeCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void enable(PrimarySkill skill) { | ||||
|     protected void enable(PrimarySkillType skill) { | ||||
|         toggle(true, skill); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void disable(PrimarySkill skill) { | ||||
|     protected void disable(PrimarySkillType skill) { | ||||
|         toggle(false, skill); | ||||
|     } | ||||
|  | ||||
| @@ -50,10 +50,10 @@ public class HardcoreCommand extends HardcoreModeCommand { | ||||
|         sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D))); | ||||
|     } | ||||
|  | ||||
|     private void toggle(boolean enable, PrimarySkill skill) { | ||||
|     private void toggle(boolean enable, PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 primarySkill.setHardcoreStatLossEnabled(enable); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 primarySkillType.setHardcoreStatLossEnabled(enable); | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import java.text.DecimalFormat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.command.TabExecutor; | ||||
| @@ -76,7 +76,7 @@ public abstract class HardcoreModeCommand implements TabExecutor { | ||||
|                     return true; | ||||
|                 } | ||||
|  | ||||
|                 PrimarySkill skill = PrimarySkill.getSkill(args[0]); | ||||
|                 PrimarySkillType skill = PrimarySkillType.getSkill(args[0]); | ||||
|  | ||||
|                 if (!CommandUtils.isChildSkill(sender, skill)) { | ||||
|                     return true; | ||||
| @@ -125,8 +125,8 @@ public abstract class HardcoreModeCommand implements TabExecutor { | ||||
|  | ||||
|     protected abstract boolean checkTogglePermissions(CommandSender sender); | ||||
|     protected abstract boolean checkModifyPermissions(CommandSender sender); | ||||
|     protected abstract boolean checkEnabled(PrimarySkill skill); | ||||
|     protected abstract void enable(PrimarySkill skill); | ||||
|     protected abstract void disable(PrimarySkill skill); | ||||
|     protected abstract boolean checkEnabled(PrimarySkillType skill); | ||||
|     protected abstract void enable(PrimarySkillType skill); | ||||
|     protected abstract void disable(PrimarySkillType skill); | ||||
|     protected abstract void modify(CommandSender sender, double newPercentage); | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.util.Permissions; | ||||
|  | ||||
| @@ -20,10 +20,10 @@ public class VampirismCommand extends HardcoreModeCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected boolean checkEnabled(PrimarySkill skill) { | ||||
|     protected boolean checkEnabled(PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.values()) { | ||||
|                 if (!primarySkill.getHardcoreVampirismEnabled()) { | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { | ||||
|                 if (!primarySkillType.getHardcoreVampirismEnabled()) { | ||||
|                     return false; | ||||
|                 } | ||||
|             } | ||||
| @@ -35,12 +35,12 @@ public class VampirismCommand extends HardcoreModeCommand { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void enable(PrimarySkill skill) { | ||||
|     protected void enable(PrimarySkillType skill) { | ||||
|         toggle(true, skill); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void disable(PrimarySkill skill) { | ||||
|     protected void disable(PrimarySkillType skill) { | ||||
|         toggle(false, skill); | ||||
|     } | ||||
|  | ||||
| @@ -50,10 +50,10 @@ public class VampirismCommand extends HardcoreModeCommand { | ||||
|         sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D))); | ||||
|     } | ||||
|  | ||||
|     private void toggle(boolean enable, PrimarySkill skill) { | ||||
|     private void toggle(boolean enable, PrimarySkillType skill) { | ||||
|         if (skill == null) { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 primarySkill.setHardcoreVampirismEnabled(enable); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 primarySkillType.setHardcoreVampirismEnabled(enable); | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.player; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.command.TabExecutor; | ||||
| @@ -53,17 +53,17 @@ public class InspectCommand implements TabExecutor { | ||||
|                     sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName)); | ||||
|  | ||||
|                     sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); | ||||
|                     for (PrimarySkill skill : PrimarySkill.GATHERING_SKILLS) { | ||||
|                     for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) { | ||||
|                         sender.sendMessage(CommandUtils.displaySkill(profile, skill)); | ||||
|                     } | ||||
|  | ||||
|                     sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); | ||||
|                     for (PrimarySkill skill : PrimarySkill.COMBAT_SKILLS) { | ||||
|                     for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) { | ||||
|                         sender.sendMessage(CommandUtils.displaySkill(profile, skill)); | ||||
|                     } | ||||
|  | ||||
|                     sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); | ||||
|                     for (PrimarySkill skill : PrimarySkill.MISC_SKILLS) { | ||||
|                     for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) { | ||||
|                         sender.sendMessage(CommandUtils.displaySkill(profile, skill)); | ||||
|                     } | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.player; | ||||
|  | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; | ||||
| @@ -24,7 +24,7 @@ import java.util.List; | ||||
| public class MctopCommand implements TabExecutor { | ||||
|     @Override | ||||
|     public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||||
|         PrimarySkill skill = null; | ||||
|         PrimarySkillType skill = null; | ||||
|  | ||||
|         switch (args.length) { | ||||
|             case 0: | ||||
| @@ -69,13 +69,13 @@ public class MctopCommand implements TabExecutor { | ||||
|     public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||||
|         switch (args.length) { | ||||
|             case 1: | ||||
|                 return StringUtil.copyPartialMatches(args[0], PrimarySkill.SKILL_NAMES, new ArrayList<String>(PrimarySkill.SKILL_NAMES.size())); | ||||
|                 return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size())); | ||||
|             default: | ||||
|                 return ImmutableList.of(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void display(int page, PrimarySkill skill, CommandSender sender, Command command) { | ||||
|     private void display(int page, PrimarySkillType skill, CommandSender sender, Command command) { | ||||
|         if (skill != null && !Permissions.mctop(sender, skill)) { | ||||
|             sender.sendMessage(command.getPermissionMessage()); | ||||
|             return; | ||||
| @@ -112,19 +112,19 @@ public class MctopCommand implements TabExecutor { | ||||
|         display(page, skill, sender); | ||||
|     } | ||||
|  | ||||
|     private void display(int page, PrimarySkill skill, CommandSender sender) { | ||||
|     private void display(int page, PrimarySkillType skill, CommandSender sender) { | ||||
|         boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard()); | ||||
|         boolean useChat = !useBoard || Config.getInstance().getTopUseChat(); | ||||
|  | ||||
|         new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); | ||||
|     } | ||||
|  | ||||
|     private PrimarySkill extractSkill(CommandSender sender, String skillName) { | ||||
|     private PrimarySkillType extractSkill(CommandSender sender, String skillName) { | ||||
|         if (CommandUtils.isInvalidSkill(sender, skillName)) { | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         PrimarySkill skill = PrimarySkill.getSkill(skillName); | ||||
|         PrimarySkillType skill = PrimarySkillType.getSkill(skillName); | ||||
|  | ||||
|         if (CommandUtils.isChildSkill(sender, skill)) { | ||||
|             return null; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import com.gmail.nossr50.util.skills.SkillUtils; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.util.Permissions; | ||||
|  | ||||
| @@ -21,7 +21,7 @@ public class AcrobaticsCommand extends SkillCommand { | ||||
|     private boolean canRoll; | ||||
|  | ||||
|     public AcrobaticsCommand() { | ||||
|         super(PrimarySkill.ACROBATICS); | ||||
|         super(PrimarySkillType.ACROBATICS); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -82,7 +82,7 @@ public class AcrobaticsCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ACROBATICS); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -28,7 +28,7 @@ public class AlchemyCommand extends SkillCommand { | ||||
|     private boolean canConcoctions; | ||||
|  | ||||
|     public AlchemyCommand() { | ||||
|         super(PrimarySkill.ALCHEMY); | ||||
|         super(PrimarySkillType.ALCHEMY); | ||||
|     } | ||||
|  | ||||
|     protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) { | ||||
| @@ -107,7 +107,7 @@ public class AlchemyCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ALCHEMY); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -25,7 +25,7 @@ public class ArcheryCommand extends SkillCommand { | ||||
|     private boolean canRetrieve; | ||||
|  | ||||
|     public ArcheryCommand() { | ||||
|         super(PrimarySkill.ARCHERY); | ||||
|         super(PrimarySkillType.ARCHERY); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -100,7 +100,7 @@ public class ArcheryCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ARCHERY); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -28,7 +28,7 @@ public class AxesCommand extends SkillCommand { | ||||
|     private boolean canGreaterImpact; | ||||
|  | ||||
|     public AxesCommand() { | ||||
|         super(PrimarySkill.AXES); | ||||
|         super(PrimarySkillType.AXES); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -125,7 +125,7 @@ public class AxesCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.AXES); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,12 +3,12 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.util.Permissions; | ||||
|  | ||||
| @@ -20,7 +20,7 @@ public class ExcavationCommand extends SkillCommand { | ||||
|     private boolean canTreasureHunt; | ||||
|  | ||||
|     public ExcavationCommand() { | ||||
|         super(PrimarySkill.EXCAVATION); | ||||
|         super(PrimarySkillType.EXCAVATION); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -69,7 +69,7 @@ public class ExcavationCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.EXCAVATION); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -12,7 +12,7 @@ import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.config.treasure.TreasureConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.treasure.Rarity; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.fishing.Fishing; | ||||
| @@ -46,7 +46,7 @@ public class FishingCommand extends SkillCommand { | ||||
|     private boolean canIceFish; | ||||
|  | ||||
|     public FishingCommand() { | ||||
|         super(PrimarySkill.FISHING); | ||||
|         super(PrimarySkillType.FISHING); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -209,7 +209,7 @@ public class FishingCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.FISHING); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.FISHING); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.commands.skills; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.herbalism.Herbalism; | ||||
| @@ -36,7 +36,7 @@ public class HerbalismCommand extends SkillCommand { | ||||
|     private boolean canShroomThumb; | ||||
|  | ||||
|     public HerbalismCommand() { | ||||
|         super(PrimarySkill.HERBALISM); | ||||
|         super(PrimarySkillType.HERBALISM); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -169,7 +169,7 @@ public class HerbalismCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.HERBALISM); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,13 +3,13 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.mining.BlastMining; | ||||
| import com.gmail.nossr50.skills.mining.BlastMining.Tier; | ||||
| @@ -37,7 +37,7 @@ public class MiningCommand extends SkillCommand { | ||||
|     private boolean canDemoExpert; | ||||
|  | ||||
|     public MiningCommand() { | ||||
|         super(PrimarySkill.MINING); | ||||
|         super(PrimarySkillType.MINING); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -157,7 +157,7 @@ public class MiningCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.MINING); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -1,11 +1,10 @@ | ||||
| package com.gmail.nossr50.commands.skills; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||
| import com.gmail.nossr50.listeners.InteractionManager; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.util.Permissions; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import com.google.common.collect.ImmutableList; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandSender; | ||||
| @@ -35,7 +34,7 @@ public class MmoInfoCommand implements TabExecutor { | ||||
|                     return false; | ||||
|  | ||||
|                 //Real skill | ||||
|                 if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkill.SUBSKILL_NAMES.contains(args[0])) | ||||
|                 if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0])) | ||||
|                 { | ||||
|                     displayInfo(player, args[0]); | ||||
|                     return true; | ||||
| @@ -52,7 +51,7 @@ public class MmoInfoCommand implements TabExecutor { | ||||
|     public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||||
|         switch (args.length) { | ||||
|             case 1: | ||||
|                 return StringUtil.copyPartialMatches(args[0], PrimarySkill.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkill.SUBSKILL_NAMES.size())); | ||||
|                 return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkillType.SUBSKILL_NAMES.size())); | ||||
|             default: | ||||
|                 return ImmutableList.of(); | ||||
|         } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.MaterialType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.skills.repair.ArcaneForging; | ||||
| @@ -43,7 +43,7 @@ public class RepairCommand extends SkillCommand { | ||||
|     private int stoneLevel; | ||||
|  | ||||
|     public RepairCommand() { | ||||
|         super(PrimarySkill.REPAIR); | ||||
|         super(PrimarySkillType.REPAIR); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -162,7 +162,7 @@ public class RepairCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.REPAIR); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -20,7 +20,7 @@ public class SalvageCommand extends SkillCommand { | ||||
|     private boolean canArcaneSalvage; | ||||
|  | ||||
|     public SalvageCommand() { | ||||
|         super(PrimarySkill.SALVAGE); | ||||
|         super(PrimarySkillType.SALVAGE); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -83,7 +83,7 @@ public class SalvageCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SALVAGE); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import java.text.DecimalFormat; | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| @@ -30,7 +30,7 @@ import org.bukkit.command.TabExecutor; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| public abstract class SkillCommand implements TabExecutor { | ||||
|     protected PrimarySkill skill; | ||||
|     protected PrimarySkillType skill; | ||||
|     private String skillName; | ||||
|  | ||||
|     protected DecimalFormat percent = new DecimalFormat("##0.00%"); | ||||
| @@ -38,7 +38,7 @@ public abstract class SkillCommand implements TabExecutor { | ||||
|  | ||||
|     private CommandExecutor skillGuideCommand; | ||||
|  | ||||
|     public SkillCommand(PrimarySkill skill) { | ||||
|     public SkillCommand(PrimarySkillType skill) { | ||||
|         this.skill = skill; | ||||
|         skillName = skill.getName(); | ||||
|         skillGuideCommand = new SkillGuideCommand(skill); | ||||
| @@ -143,10 +143,10 @@ public abstract class SkillCommand implements TabExecutor { | ||||
|             //LEVEL | ||||
|             player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue)); | ||||
|  | ||||
|             Set<PrimarySkill> parents = FamilyTree.getParents(skill); | ||||
|             Set<PrimarySkillType> parents = FamilyTree.getParents(skill); | ||||
|  | ||||
|             //TODO: Add JSON here | ||||
|             for (PrimarySkill parent : parents) { | ||||
|             for (PrimarySkillType parent : parents) { | ||||
|                 player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent))); | ||||
|             } | ||||
|         } | ||||
| @@ -161,9 +161,9 @@ public abstract class SkillCommand implements TabExecutor { | ||||
|             player.sendMessage(LocaleLoader.getString("Effects.Child", skillValue)); | ||||
|  | ||||
|             player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents"))); | ||||
|             Set<PrimarySkill> parents = FamilyTree.getParents(skill); | ||||
|             Set<PrimarySkillType> parents = FamilyTree.getParents(skill); | ||||
|  | ||||
|             for (PrimarySkill parent : parents) { | ||||
|             for (PrimarySkillType parent : parents) { | ||||
|                 player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent))); | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandExecutor; | ||||
| import org.bukkit.command.CommandSender; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
|  | ||||
| @@ -17,7 +17,7 @@ public class SkillGuideCommand implements CommandExecutor { | ||||
|  | ||||
|     private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid"); | ||||
|  | ||||
|     public SkillGuideCommand(PrimarySkill skill) { | ||||
|     public SkillGuideCommand(PrimarySkillType skill) { | ||||
|         header = LocaleLoader.getString("Guides.Header", skill.getName()); | ||||
|         guide = getGuide(skill); | ||||
|     } | ||||
| @@ -86,7 +86,7 @@ public class SkillGuideCommand implements CommandExecutor { | ||||
|         return allStrings; | ||||
|     } | ||||
|  | ||||
|     private ArrayList<String> getGuide(PrimarySkill skill) { | ||||
|     private ArrayList<String> getGuide(PrimarySkillType skill) { | ||||
|         ArrayList<String> guide = new ArrayList<String>(); | ||||
|  | ||||
|         for (int i = 0; i < 10; i++) { | ||||
|   | ||||
| @@ -3,13 +3,13 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.smelting.Smelting; | ||||
| import com.gmail.nossr50.skills.smelting.Smelting.Tier; | ||||
| @@ -29,7 +29,7 @@ public class SmeltingCommand extends SkillCommand { | ||||
|     private boolean canVanillaXPBoost; | ||||
|  | ||||
|     public SmeltingCommand() { | ||||
|         super(PrimarySkill.SMELTING); | ||||
|         super(PrimarySkillType.SMELTING); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -124,7 +124,7 @@ public class SmeltingCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SMELTING); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -28,7 +28,7 @@ public class SwordsCommand extends SkillCommand { | ||||
|     private boolean canBleed; | ||||
|  | ||||
|     public SwordsCommand() { | ||||
|         super(PrimarySkill.SWORDS); | ||||
|         super(PrimarySkillType.SWORDS); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -109,7 +109,7 @@ public class SwordsCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -31,7 +31,7 @@ public class TamingCommand extends SkillCommand { | ||||
|     private boolean canHolyHound; | ||||
|  | ||||
|     public TamingCommand() { | ||||
|         super(PrimarySkill.TAMING); | ||||
|         super(PrimarySkillType.TAMING); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -175,7 +175,7 @@ public class TamingCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.TAMING); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.TAMING); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -31,7 +31,7 @@ public class UnarmedCommand extends SkillCommand { | ||||
|     private boolean canIronGrip; | ||||
|  | ||||
|     public UnarmedCommand() { | ||||
|         super(PrimarySkill.UNARMED); | ||||
|         super(PrimarySkillType.UNARMED); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -139,7 +139,7 @@ public class UnarmedCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.UNARMED); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.util.TextComponentFactory; | ||||
| import net.md_5.bungee.api.chat.TextComponent; | ||||
| @@ -27,7 +27,7 @@ public class WoodcuttingCommand extends SkillCommand { | ||||
|     private boolean canNaturesBounty; | ||||
|  | ||||
|     public WoodcuttingCommand() { | ||||
|         super(PrimarySkill.WOODCUTTING); | ||||
|         super(PrimarySkillType.WOODCUTTING); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -129,7 +129,7 @@ public class WoodcuttingCommand extends SkillCommand { | ||||
|     protected List<TextComponent> getTextComponents(Player player) { | ||||
|         List<TextComponent> textComponents = new ArrayList<>(); | ||||
|  | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.WOODCUTTING); | ||||
|         TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING); | ||||
|  | ||||
|         return textComponents; | ||||
|     } | ||||
|   | ||||
| @@ -5,10 +5,9 @@ import java.util.Arrays; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.interactions.NotificationType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.alchemy.Alchemy; | ||||
| import com.gmail.nossr50.skills.fishing.Fishing; | ||||
| import com.gmail.nossr50.skills.mining.BlastMining; | ||||
| @@ -1029,7 +1028,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { | ||||
|         //For now we will only check ranks of stuff I've overhauled | ||||
|         for(SubSkillType subSkillType : SubSkillType.values()) | ||||
|         { | ||||
|             if(subSkillType.getParentSkill() == PrimarySkill.WOODCUTTING) | ||||
|             if(subSkillType.getParentSkill() == PrimarySkillType.WOODCUTTING) | ||||
|             { | ||||
|                 //Keeping track of the rank requirements and making sure there are no logical errors | ||||
|                 int curRank = 0; | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier; | ||||
| import com.gmail.nossr50.datatypes.MobHealthbarType; | ||||
| import com.gmail.nossr50.datatypes.party.PartyFeature; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.block.data.BlockData; | ||||
| @@ -362,16 +362,16 @@ public class Config extends AutoUpdateConfigLoader { | ||||
|     } | ||||
|  | ||||
|     /* Hardcore Mode */ | ||||
|     public boolean getHardcoreStatLossEnabled(PrimarySkill primarySkill) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), false); } | ||||
|     public void setHardcoreStatLossEnabled(PrimarySkill primarySkill, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), enabled); } | ||||
|     public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false); } | ||||
|     public void setHardcoreStatLossEnabled(PrimarySkillType primarySkillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled); } | ||||
|  | ||||
|     public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); } | ||||
|     public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); } | ||||
|  | ||||
|     public int getHardcoreDeathStatPenaltyLevelThreshold() { return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0); } | ||||
|  | ||||
|     public boolean getHardcoreVampirismEnabled(PrimarySkill primarySkill) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), false); } | ||||
|     public void setHardcoreVampirismEnabled(PrimarySkill primarySkill, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkill.toString()), enabled); } | ||||
|     public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false); } | ||||
|     public void setHardcoreVampirismEnabled(PrimarySkillType primarySkillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled); } | ||||
|  | ||||
|     public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); } | ||||
|     public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); } | ||||
| @@ -466,9 +466,9 @@ public class Config extends AutoUpdateConfigLoader { | ||||
|     /* | ||||
|      * SKILL SETTINGS | ||||
|      */ | ||||
|     public boolean getDoubleDropsEnabled(PrimarySkill skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); } | ||||
|     public boolean getDoubleDropsEnabled(PrimarySkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); } | ||||
|  | ||||
|     public boolean getDoubleDropsDisabled(PrimarySkill skill) { | ||||
|     public boolean getDoubleDropsDisabled(PrimarySkillType skill) { | ||||
|         String skillName = StringUtils.getCapitalized(skill.toString()); | ||||
|         ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName); | ||||
|         if (section == null) | ||||
| @@ -558,20 +558,20 @@ public class Config extends AutoUpdateConfigLoader { | ||||
|         return (cap <= 0) ? Integer.MAX_VALUE : cap; | ||||
|     } | ||||
|  | ||||
|     public int getLevelCap(PrimarySkill skill) { | ||||
|     public int getLevelCap(PrimarySkillType skill) { | ||||
|         int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap"); | ||||
|         return (cap <= 0) ? Integer.MAX_VALUE : cap; | ||||
|     } | ||||
|  | ||||
|     public int getSkillAbilityGate(PrimarySkill skill) { | ||||
|     public int getSkillAbilityGate(PrimarySkillType skill) { | ||||
|         return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate"); | ||||
|     } | ||||
|  | ||||
|     public boolean getTruncateSkills() { return config.getBoolean("General.TruncateSkills", false); } | ||||
|  | ||||
|     /* PVP & PVE Settings */ | ||||
|     public boolean getPVPEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); } | ||||
|     public boolean getPVEEnabled(PrimarySkill skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); } | ||||
|     public boolean getPVPEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); } | ||||
|     public boolean getPVEEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); } | ||||
|      | ||||
|     //public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.config; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
|  | ||||
| @@ -49,11 +49,11 @@ public class CoreSkillsConfig extends AutoUpdateConfigLoader { | ||||
|  | ||||
|     /** | ||||
|      * Whether or not this primary skill is enabled | ||||
|      * @param primarySkill target primary skill | ||||
|      * @param primarySkillType target primary skill | ||||
|      * @return true if enabled | ||||
|      */ | ||||
|     public boolean isPrimarySkillEnabled(PrimarySkill primarySkill) | ||||
|     public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) | ||||
|     { | ||||
|         return config.getBoolean(StringUtils.getCapitalized(primarySkill.toString())+".Enabled", true); | ||||
|         return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString())+".Enabled", true); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										25
									
								
								src/main/java/com/gmail/nossr50/config/RankConfig.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/main/java/com/gmail/nossr50/config/RankConfig.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| package com.gmail.nossr50.config; | ||||
|  | ||||
| public class RankConfig extends AutoUpdateConfigLoader { | ||||
|     private static RankConfig instance; | ||||
|  | ||||
|     public RankConfig() | ||||
|     { | ||||
|         super("skillranks.yml"); | ||||
|         validate(); | ||||
|         this.instance = this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void loadKeys() { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     public static RankConfig getInstance() | ||||
|     { | ||||
|         if(instance == null) | ||||
|             return new RankConfig(); | ||||
|  | ||||
|         return instance; | ||||
|     } | ||||
| } | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.config.experience; | ||||
| import com.gmail.nossr50.config.AutoUpdateConfigLoader; | ||||
| import com.gmail.nossr50.datatypes.experience.FormulaType; | ||||
| import com.gmail.nossr50.datatypes.skills.MaterialType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
| import org.bukkit.Material; | ||||
| @@ -160,14 +160,14 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { | ||||
|     public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); } | ||||
|  | ||||
|     /* Skill modifiers */ | ||||
|     public double getFormulaSkillModifier(PrimarySkill skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); } | ||||
|     public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); } | ||||
|  | ||||
|     /* Custom XP perk */ | ||||
|     public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); } | ||||
|  | ||||
|     /* Diminished Returns */ | ||||
|     public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); } | ||||
|     public int getDiminishedReturnsThreshold(PrimarySkill skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); } | ||||
|     public int getDiminishedReturnsThreshold(PrimarySkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); } | ||||
|     public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); } | ||||
|  | ||||
|     /* Conversion */ | ||||
| @@ -187,7 +187,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { | ||||
|     public boolean hasCombatXP(EntityType entity) {return config.contains("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } | ||||
|  | ||||
|     /* Materials  */ | ||||
|     public int getXp(PrimarySkill skill, Material data) | ||||
|     public int getXp(PrimarySkillType skill, Material data) | ||||
|     { | ||||
|         String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data); | ||||
| @@ -203,7 +203,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { | ||||
|     } | ||||
|  | ||||
|     /* Materials  */ | ||||
|     public int getXp(PrimarySkill skill, BlockData data) | ||||
|     public int getXp(PrimarySkillType skill, BlockData data) | ||||
|     { | ||||
|         String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); | ||||
| @@ -218,7 +218,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     public boolean isSkillBlock(PrimarySkill skill, Material data) | ||||
|     public boolean isSkillBlock(PrimarySkillType skill, Material data) | ||||
|     { | ||||
|         String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data); | ||||
| @@ -231,7 +231,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { | ||||
|         return config.contains(wildcardString); | ||||
|     } | ||||
|  | ||||
|     public boolean isSkillBlock(PrimarySkill skill, BlockData data) | ||||
|     public boolean isSkillBlock(PrimarySkillType skill, BlockData data) | ||||
|     { | ||||
|         String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + "."; | ||||
|         String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.database.DatabaseType; | ||||
| import com.gmail.nossr50.datatypes.database.PlayerStat; | ||||
| import com.gmail.nossr50.datatypes.player.PlayerProfile; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public interface DatabaseManager { | ||||
|     // One month in milliseconds | ||||
| @@ -50,10 +50,10 @@ public interface DatabaseManager { | ||||
|     * @param statsPerPage The number of stats per page | ||||
|     * @return the requested leaderboard information | ||||
|     */ | ||||
|     public List<PlayerStat> readLeaderboard(PrimarySkill skill, int pageNumber, int statsPerPage); | ||||
|     public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage); | ||||
|  | ||||
|     /** | ||||
|      * Retrieve rank info into a HashMap from PrimarySkill to the rank. | ||||
|      * Retrieve rank info into a HashMap from PrimarySkillType to the rank. | ||||
|      * <p> | ||||
|      * The special value <code>null</code> is used to represent the Power | ||||
|      * Level rank (the combination of all skill levels). | ||||
| @@ -61,7 +61,7 @@ public interface DatabaseManager { | ||||
|      * @param playerName The name of the user to retrieve the rankings for | ||||
|      * @return the requested rank information | ||||
|      */ | ||||
|     public Map<PrimarySkill, Integer> readRank(String playerName); | ||||
|     public Map<PrimarySkillType, Integer> readRank(String playerName); | ||||
|  | ||||
|     /** | ||||
|      * Add a new user to the database. | ||||
|   | ||||
| @@ -18,7 +18,7 @@ import java.util.Map; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.player.UniqueDataType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import org.bukkit.OfflinePlayer; | ||||
|  | ||||
| @@ -34,7 +34,7 @@ import com.gmail.nossr50.util.Misc; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
|  | ||||
| public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|     private final HashMap<PrimarySkill, List<PlayerStat>> playerStatHash = new HashMap<PrimarySkill, List<PlayerStat>>(); | ||||
|     private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<PrimarySkillType, List<PlayerStat>>(); | ||||
|     private final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>(); | ||||
|     private long lastUpdate = 0; | ||||
|  | ||||
| @@ -70,7 +70,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|  | ||||
|                 while ((line = in.readLine()) != null) { | ||||
|                     String[] character = line.split(":"); | ||||
|                     Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character); | ||||
|                     Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); | ||||
|  | ||||
|                     boolean powerless = true; | ||||
|                     for (int skill : skills.values()) { | ||||
| @@ -323,31 +323,31 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|  | ||||
|     private void writeUserToLine(PlayerProfile profile, String playerName, UUID uuid, StringBuilder writer) { | ||||
|         writer.append(playerName).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.MINING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.MINING)).append(":"); | ||||
|         writer.append(":"); | ||||
|         writer.append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.MINING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.WOODCUTTING)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.WOODCUTTING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.REPAIR)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.UNARMED)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.HERBALISM)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.EXCAVATION)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.ARCHERY)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.SWORDS)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.AXES)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.ACROBATICS)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.REPAIR)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.UNARMED)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.HERBALISM)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.EXCAVATION)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.ARCHERY)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.SWORDS)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.AXES)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.ACROBATICS)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.MINING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.WOODCUTTING)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.WOODCUTTING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.REPAIR)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.UNARMED)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.HERBALISM)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.EXCAVATION)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.ARCHERY)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.SWORDS)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.AXES)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.ACROBATICS)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.REPAIR)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.UNARMED)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.HERBALISM)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.EXCAVATION)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.ARCHERY)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.SWORDS)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.AXES)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.ACROBATICS)).append(":"); | ||||
|         writer.append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.TAMING)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.TAMING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.TAMING)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.TAMING)).append(":"); | ||||
|         writer.append((int) profile.getAbilityDATS(SuperAbilityType.BERSERK)).append(":"); | ||||
|         writer.append((int) profile.getAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER)).append(":"); | ||||
|         writer.append((int) profile.getAbilityDATS(SuperAbilityType.TREE_FELLER)).append(":"); | ||||
| @@ -356,21 +356,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|         writer.append((int) profile.getAbilityDATS(SuperAbilityType.SKULL_SPLITTER)).append(":"); | ||||
|         writer.append((int) profile.getAbilityDATS(SuperAbilityType.SUPER_BREAKER)).append(":"); | ||||
|         writer.append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.FISHING)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.FISHING)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.FISHING)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.FISHING)).append(":"); | ||||
|         writer.append((int) profile.getAbilityDATS(SuperAbilityType.BLAST_MINING)).append(":"); | ||||
|         writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":"); | ||||
|         MobHealthbarType mobHealthbarType = profile.getMobHealthbarType(); | ||||
|         writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkill.ALCHEMY)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkill.ALCHEMY)).append(":"); | ||||
|         writer.append(profile.getSkillLevel(PrimarySkillType.ALCHEMY)).append(":"); | ||||
|         writer.append(profile.getSkillXpLevel(PrimarySkillType.ALCHEMY)).append(":"); | ||||
|         writer.append(uuid != null ? uuid.toString() : "NULL").append(":"); | ||||
|         writer.append(profile.getScoreboardTipsShown()).append(":"); | ||||
|         writer.append(profile.getUniqueData(UniqueDataType.CHIMAERA_WING_DATS)).append(":"); | ||||
|         writer.append("\r\n"); | ||||
|     } | ||||
|  | ||||
|     public List<PlayerStat> readLeaderboard(PrimarySkill skill, int pageNumber, int statsPerPage) { | ||||
|     public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage) { | ||||
|         updateLeaderboards(); | ||||
|         List<PlayerStat> statsList = skill == null ? powerLevels : playerStatHash.get(skill); | ||||
|         int fromIndex = (Math.max(pageNumber, 1) - 1) * statsPerPage; | ||||
| @@ -378,12 +378,12 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|         return statsList.subList(Math.min(fromIndex, statsList.size()), Math.min(fromIndex + statsPerPage, statsList.size())); | ||||
|     } | ||||
|  | ||||
|     public Map<PrimarySkill, Integer> readRank(String playerName) { | ||||
|     public Map<PrimarySkillType, Integer> readRank(String playerName) { | ||||
|         updateLeaderboards(); | ||||
|  | ||||
|         Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>(); | ||||
|         Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>(); | ||||
|  | ||||
|         for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|         for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill))); | ||||
|         } | ||||
|  | ||||
| @@ -778,21 +778,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|                     playerName = data[USERNAME]; | ||||
|                     int powerLevel = 0; | ||||
|  | ||||
|                     Map<PrimarySkill, Integer> skills = getSkillMapFromLine(data); | ||||
|                     Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(data); | ||||
|  | ||||
|                     powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkill.ACROBATICS)); | ||||
|                     powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkill.ALCHEMY)); | ||||
|                     powerLevel += putStat(archery, playerName, skills.get(PrimarySkill.ARCHERY)); | ||||
|                     powerLevel += putStat(axes, playerName, skills.get(PrimarySkill.AXES)); | ||||
|                     powerLevel += putStat(excavation, playerName, skills.get(PrimarySkill.EXCAVATION)); | ||||
|                     powerLevel += putStat(fishing, playerName, skills.get(PrimarySkill.FISHING)); | ||||
|                     powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkill.HERBALISM)); | ||||
|                     powerLevel += putStat(mining, playerName, skills.get(PrimarySkill.MINING)); | ||||
|                     powerLevel += putStat(repair, playerName, skills.get(PrimarySkill.REPAIR)); | ||||
|                     powerLevel += putStat(swords, playerName, skills.get(PrimarySkill.SWORDS)); | ||||
|                     powerLevel += putStat(taming, playerName, skills.get(PrimarySkill.TAMING)); | ||||
|                     powerLevel += putStat(unarmed, playerName, skills.get(PrimarySkill.UNARMED)); | ||||
|                     powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkill.WOODCUTTING)); | ||||
|                     powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkillType.ACROBATICS)); | ||||
|                     powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkillType.ALCHEMY)); | ||||
|                     powerLevel += putStat(archery, playerName, skills.get(PrimarySkillType.ARCHERY)); | ||||
|                     powerLevel += putStat(axes, playerName, skills.get(PrimarySkillType.AXES)); | ||||
|                     powerLevel += putStat(excavation, playerName, skills.get(PrimarySkillType.EXCAVATION)); | ||||
|                     powerLevel += putStat(fishing, playerName, skills.get(PrimarySkillType.FISHING)); | ||||
|                     powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkillType.HERBALISM)); | ||||
|                     powerLevel += putStat(mining, playerName, skills.get(PrimarySkillType.MINING)); | ||||
|                     powerLevel += putStat(repair, playerName, skills.get(PrimarySkillType.REPAIR)); | ||||
|                     powerLevel += putStat(swords, playerName, skills.get(PrimarySkillType.SWORDS)); | ||||
|                     powerLevel += putStat(taming, playerName, skills.get(PrimarySkillType.TAMING)); | ||||
|                     powerLevel += putStat(unarmed, playerName, skills.get(PrimarySkillType.UNARMED)); | ||||
|                     powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.WOODCUTTING)); | ||||
|  | ||||
|                     putStat(powerLevels, playerName, powerLevel); | ||||
|                 } | ||||
| @@ -829,19 +829,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|         Collections.sort(alchemy, c); | ||||
|         Collections.sort(powerLevels, c); | ||||
|  | ||||
|         playerStatHash.put(PrimarySkill.MINING, mining); | ||||
|         playerStatHash.put(PrimarySkill.WOODCUTTING, woodcutting); | ||||
|         playerStatHash.put(PrimarySkill.REPAIR, repair); | ||||
|         playerStatHash.put(PrimarySkill.UNARMED, unarmed); | ||||
|         playerStatHash.put(PrimarySkill.HERBALISM, herbalism); | ||||
|         playerStatHash.put(PrimarySkill.EXCAVATION, excavation); | ||||
|         playerStatHash.put(PrimarySkill.ARCHERY, archery); | ||||
|         playerStatHash.put(PrimarySkill.SWORDS, swords); | ||||
|         playerStatHash.put(PrimarySkill.AXES, axes); | ||||
|         playerStatHash.put(PrimarySkill.ACROBATICS, acrobatics); | ||||
|         playerStatHash.put(PrimarySkill.TAMING, taming); | ||||
|         playerStatHash.put(PrimarySkill.FISHING, fishing); | ||||
|         playerStatHash.put(PrimarySkill.ALCHEMY, alchemy); | ||||
|         playerStatHash.put(PrimarySkillType.MINING, mining); | ||||
|         playerStatHash.put(PrimarySkillType.WOODCUTTING, woodcutting); | ||||
|         playerStatHash.put(PrimarySkillType.REPAIR, repair); | ||||
|         playerStatHash.put(PrimarySkillType.UNARMED, unarmed); | ||||
|         playerStatHash.put(PrimarySkillType.HERBALISM, herbalism); | ||||
|         playerStatHash.put(PrimarySkillType.EXCAVATION, excavation); | ||||
|         playerStatHash.put(PrimarySkillType.ARCHERY, archery); | ||||
|         playerStatHash.put(PrimarySkillType.SWORDS, swords); | ||||
|         playerStatHash.put(PrimarySkillType.AXES, axes); | ||||
|         playerStatHash.put(PrimarySkillType.ACROBATICS, acrobatics); | ||||
|         playerStatHash.put(PrimarySkillType.TAMING, taming); | ||||
|         playerStatHash.put(PrimarySkillType.FISHING, fishing); | ||||
|         playerStatHash.put(PrimarySkillType.ALCHEMY, alchemy); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -908,7 +908,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|                         } | ||||
|  | ||||
|                         if (Config.getInstance().getTruncateSkills()) { | ||||
|                             for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                             for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                                 int index = getSkillIndex(skill); | ||||
|                                 if (index >= character.length) { | ||||
|                                     continue; | ||||
| @@ -1048,8 +1048,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|                         updated |= oldVersion != null; | ||||
|  | ||||
|                         if (Config.getInstance().getTruncateSkills()) { | ||||
|                             Map<PrimarySkill, Integer> skills = getSkillMapFromLine(character); | ||||
|                             for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                             Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); | ||||
|                             for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                                 int cap = Config.getInstance().getLevelCap(skill); | ||||
|                                 if (skills.get(skill) > cap) { | ||||
|                                     updated = true; | ||||
| @@ -1143,8 +1143,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|     } | ||||
|  | ||||
|     private PlayerProfile loadFromLine(String[] character) { | ||||
|         Map<PrimarySkill, Integer>   skills     = getSkillMapFromLine(character);      // Skill levels | ||||
|         Map<PrimarySkill, Float>     skillsXp   = new EnumMap<PrimarySkill, Float>(PrimarySkill.class);     // Skill & XP | ||||
|         Map<PrimarySkillType, Integer>   skills     = getSkillMapFromLine(character);      // Skill levels | ||||
|         Map<PrimarySkillType, Float>     skillsXp   = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class);     // Skill & XP | ||||
|         Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown | ||||
|         Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); | ||||
|         MobHealthbarType mobHealthbarType; | ||||
| @@ -1152,19 +1152,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|  | ||||
|         // TODO on updates, put new values in a try{} ? | ||||
|  | ||||
|         skillsXp.put(PrimarySkill.TAMING, (float) Integer.valueOf(character[EXP_TAMING])); | ||||
|         skillsXp.put(PrimarySkill.MINING, (float) Integer.valueOf(character[EXP_MINING])); | ||||
|         skillsXp.put(PrimarySkill.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR])); | ||||
|         skillsXp.put(PrimarySkill.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING])); | ||||
|         skillsXp.put(PrimarySkill.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED])); | ||||
|         skillsXp.put(PrimarySkill.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM])); | ||||
|         skillsXp.put(PrimarySkill.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION])); | ||||
|         skillsXp.put(PrimarySkill.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY])); | ||||
|         skillsXp.put(PrimarySkill.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS])); | ||||
|         skillsXp.put(PrimarySkill.AXES, (float) Integer.valueOf(character[EXP_AXES])); | ||||
|         skillsXp.put(PrimarySkill.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS])); | ||||
|         skillsXp.put(PrimarySkill.FISHING, (float) Integer.valueOf(character[EXP_FISHING])); | ||||
|         skillsXp.put(PrimarySkill.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY])); | ||||
|         skillsXp.put(PrimarySkillType.TAMING, (float) Integer.valueOf(character[EXP_TAMING])); | ||||
|         skillsXp.put(PrimarySkillType.MINING, (float) Integer.valueOf(character[EXP_MINING])); | ||||
|         skillsXp.put(PrimarySkillType.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR])); | ||||
|         skillsXp.put(PrimarySkillType.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING])); | ||||
|         skillsXp.put(PrimarySkillType.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED])); | ||||
|         skillsXp.put(PrimarySkillType.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM])); | ||||
|         skillsXp.put(PrimarySkillType.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION])); | ||||
|         skillsXp.put(PrimarySkillType.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY])); | ||||
|         skillsXp.put(PrimarySkillType.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS])); | ||||
|         skillsXp.put(PrimarySkillType.AXES, (float) Integer.valueOf(character[EXP_AXES])); | ||||
|         skillsXp.put(PrimarySkillType.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS])); | ||||
|         skillsXp.put(PrimarySkillType.FISHING, (float) Integer.valueOf(character[EXP_FISHING])); | ||||
|         skillsXp.put(PrimarySkillType.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY])); | ||||
|  | ||||
|         // Taming - Unused | ||||
|         skillsDATS.put(SuperAbilityType.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER])); | ||||
| @@ -1211,22 +1211,22 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|         return new PlayerProfile(character[USERNAME], uuid, skills, skillsXp, skillsDATS, mobHealthbarType, scoreboardTipsShown, uniquePlayerDataMap); | ||||
|     } | ||||
|  | ||||
|     private Map<PrimarySkill, Integer> getSkillMapFromLine(String[] character) { | ||||
|         Map<PrimarySkill, Integer> skills = new EnumMap<PrimarySkill, Integer>(PrimarySkill.class);   // Skill & Level | ||||
|     private Map<PrimarySkillType, Integer> getSkillMapFromLine(String[] character) { | ||||
|         Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class);   // Skill & Level | ||||
|  | ||||
|         skills.put(PrimarySkill.TAMING, Integer.valueOf(character[SKILLS_TAMING])); | ||||
|         skills.put(PrimarySkill.MINING, Integer.valueOf(character[SKILLS_MINING])); | ||||
|         skills.put(PrimarySkill.REPAIR, Integer.valueOf(character[SKILLS_REPAIR])); | ||||
|         skills.put(PrimarySkill.WOODCUTTING, Integer.valueOf(character[SKILLS_WOODCUTTING])); | ||||
|         skills.put(PrimarySkill.UNARMED, Integer.valueOf(character[SKILLS_UNARMED])); | ||||
|         skills.put(PrimarySkill.HERBALISM, Integer.valueOf(character[SKILLS_HERBALISM])); | ||||
|         skills.put(PrimarySkill.EXCAVATION, Integer.valueOf(character[SKILLS_EXCAVATION])); | ||||
|         skills.put(PrimarySkill.ARCHERY, Integer.valueOf(character[SKILLS_ARCHERY])); | ||||
|         skills.put(PrimarySkill.SWORDS, Integer.valueOf(character[SKILLS_SWORDS])); | ||||
|         skills.put(PrimarySkill.AXES, Integer.valueOf(character[SKILLS_AXES])); | ||||
|         skills.put(PrimarySkill.ACROBATICS, Integer.valueOf(character[SKILLS_ACROBATICS])); | ||||
|         skills.put(PrimarySkill.FISHING, Integer.valueOf(character[SKILLS_FISHING])); | ||||
|         skills.put(PrimarySkill.ALCHEMY, Integer.valueOf(character[SKILLS_ALCHEMY])); | ||||
|         skills.put(PrimarySkillType.TAMING, Integer.valueOf(character[SKILLS_TAMING])); | ||||
|         skills.put(PrimarySkillType.MINING, Integer.valueOf(character[SKILLS_MINING])); | ||||
|         skills.put(PrimarySkillType.REPAIR, Integer.valueOf(character[SKILLS_REPAIR])); | ||||
|         skills.put(PrimarySkillType.WOODCUTTING, Integer.valueOf(character[SKILLS_WOODCUTTING])); | ||||
|         skills.put(PrimarySkillType.UNARMED, Integer.valueOf(character[SKILLS_UNARMED])); | ||||
|         skills.put(PrimarySkillType.HERBALISM, Integer.valueOf(character[SKILLS_HERBALISM])); | ||||
|         skills.put(PrimarySkillType.EXCAVATION, Integer.valueOf(character[SKILLS_EXCAVATION])); | ||||
|         skills.put(PrimarySkillType.ARCHERY, Integer.valueOf(character[SKILLS_ARCHERY])); | ||||
|         skills.put(PrimarySkillType.SWORDS, Integer.valueOf(character[SKILLS_SWORDS])); | ||||
|         skills.put(PrimarySkillType.AXES, Integer.valueOf(character[SKILLS_AXES])); | ||||
|         skills.put(PrimarySkillType.ACROBATICS, Integer.valueOf(character[SKILLS_ACROBATICS])); | ||||
|         skills.put(PrimarySkillType.FISHING, Integer.valueOf(character[SKILLS_FISHING])); | ||||
|         skills.put(PrimarySkillType.ALCHEMY, Integer.valueOf(character[SKILLS_ALCHEMY])); | ||||
|  | ||||
|         return skills; | ||||
|     } | ||||
| @@ -1238,7 +1238,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { | ||||
|     @Override | ||||
|     public void onDisable() { } | ||||
|  | ||||
|     private int getSkillIndex(PrimarySkill skill) { | ||||
|     private int getSkillIndex(PrimarySkillType skill) { | ||||
|         switch (skill) { | ||||
|             case ACROBATICS: | ||||
|                 return SKILLS_ACROBATICS; | ||||
|   | ||||
| @@ -7,8 +7,8 @@ import com.gmail.nossr50.datatypes.database.PlayerStat; | ||||
| import com.gmail.nossr50.datatypes.database.UpgradeType; | ||||
| import com.gmail.nossr50.datatypes.player.PlayerProfile; | ||||
| import com.gmail.nossr50.datatypes.player.UniqueDataType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| @@ -234,22 +234,22 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|                     + ", unarmed = ?, herbalism = ?, excavation = ?" | ||||
|                     + ", archery = ?, swords = ?, axes = ?, acrobatics = ?" | ||||
|                     + ", fishing = ?, alchemy = ?, total = ? WHERE user_id = ?"); | ||||
|             statement.setInt(1, profile.getSkillLevel(PrimarySkill.TAMING)); | ||||
|             statement.setInt(2, profile.getSkillLevel(PrimarySkill.MINING)); | ||||
|             statement.setInt(3, profile.getSkillLevel(PrimarySkill.REPAIR)); | ||||
|             statement.setInt(4, profile.getSkillLevel(PrimarySkill.WOODCUTTING)); | ||||
|             statement.setInt(5, profile.getSkillLevel(PrimarySkill.UNARMED)); | ||||
|             statement.setInt(6, profile.getSkillLevel(PrimarySkill.HERBALISM)); | ||||
|             statement.setInt(7, profile.getSkillLevel(PrimarySkill.EXCAVATION)); | ||||
|             statement.setInt(8, profile.getSkillLevel(PrimarySkill.ARCHERY)); | ||||
|             statement.setInt(9, profile.getSkillLevel(PrimarySkill.SWORDS)); | ||||
|             statement.setInt(10, profile.getSkillLevel(PrimarySkill.AXES)); | ||||
|             statement.setInt(11, profile.getSkillLevel(PrimarySkill.ACROBATICS)); | ||||
|             statement.setInt(12, profile.getSkillLevel(PrimarySkill.FISHING)); | ||||
|             statement.setInt(13, profile.getSkillLevel(PrimarySkill.ALCHEMY)); | ||||
|             statement.setInt(1, profile.getSkillLevel(PrimarySkillType.TAMING)); | ||||
|             statement.setInt(2, profile.getSkillLevel(PrimarySkillType.MINING)); | ||||
|             statement.setInt(3, profile.getSkillLevel(PrimarySkillType.REPAIR)); | ||||
|             statement.setInt(4, profile.getSkillLevel(PrimarySkillType.WOODCUTTING)); | ||||
|             statement.setInt(5, profile.getSkillLevel(PrimarySkillType.UNARMED)); | ||||
|             statement.setInt(6, profile.getSkillLevel(PrimarySkillType.HERBALISM)); | ||||
|             statement.setInt(7, profile.getSkillLevel(PrimarySkillType.EXCAVATION)); | ||||
|             statement.setInt(8, profile.getSkillLevel(PrimarySkillType.ARCHERY)); | ||||
|             statement.setInt(9, profile.getSkillLevel(PrimarySkillType.SWORDS)); | ||||
|             statement.setInt(10, profile.getSkillLevel(PrimarySkillType.AXES)); | ||||
|             statement.setInt(11, profile.getSkillLevel(PrimarySkillType.ACROBATICS)); | ||||
|             statement.setInt(12, profile.getSkillLevel(PrimarySkillType.FISHING)); | ||||
|             statement.setInt(13, profile.getSkillLevel(PrimarySkillType.ALCHEMY)); | ||||
|             int total = 0; | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) | ||||
|                 total += profile.getSkillLevel(primarySkill); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) | ||||
|                 total += profile.getSkillLevel(primarySkillType); | ||||
|             statement.setInt(14, total); | ||||
|             statement.setInt(15, id); | ||||
|             success &= (statement.executeUpdate() != 0); | ||||
| @@ -264,19 +264,19 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|                     + ", unarmed = ?, herbalism = ?, excavation = ?" | ||||
|                     + ", archery = ?, swords = ?, axes = ?, acrobatics = ?" | ||||
|                     + ", fishing = ?, alchemy = ? WHERE user_id = ?"); | ||||
|             statement.setInt(1, profile.getSkillXpLevel(PrimarySkill.TAMING)); | ||||
|             statement.setInt(2, profile.getSkillXpLevel(PrimarySkill.MINING)); | ||||
|             statement.setInt(3, profile.getSkillXpLevel(PrimarySkill.REPAIR)); | ||||
|             statement.setInt(4, profile.getSkillXpLevel(PrimarySkill.WOODCUTTING)); | ||||
|             statement.setInt(5, profile.getSkillXpLevel(PrimarySkill.UNARMED)); | ||||
|             statement.setInt(6, profile.getSkillXpLevel(PrimarySkill.HERBALISM)); | ||||
|             statement.setInt(7, profile.getSkillXpLevel(PrimarySkill.EXCAVATION)); | ||||
|             statement.setInt(8, profile.getSkillXpLevel(PrimarySkill.ARCHERY)); | ||||
|             statement.setInt(9, profile.getSkillXpLevel(PrimarySkill.SWORDS)); | ||||
|             statement.setInt(10, profile.getSkillXpLevel(PrimarySkill.AXES)); | ||||
|             statement.setInt(11, profile.getSkillXpLevel(PrimarySkill.ACROBATICS)); | ||||
|             statement.setInt(12, profile.getSkillXpLevel(PrimarySkill.FISHING)); | ||||
|             statement.setInt(13, profile.getSkillXpLevel(PrimarySkill.ALCHEMY)); | ||||
|             statement.setInt(1, profile.getSkillXpLevel(PrimarySkillType.TAMING)); | ||||
|             statement.setInt(2, profile.getSkillXpLevel(PrimarySkillType.MINING)); | ||||
|             statement.setInt(3, profile.getSkillXpLevel(PrimarySkillType.REPAIR)); | ||||
|             statement.setInt(4, profile.getSkillXpLevel(PrimarySkillType.WOODCUTTING)); | ||||
|             statement.setInt(5, profile.getSkillXpLevel(PrimarySkillType.UNARMED)); | ||||
|             statement.setInt(6, profile.getSkillXpLevel(PrimarySkillType.HERBALISM)); | ||||
|             statement.setInt(7, profile.getSkillXpLevel(PrimarySkillType.EXCAVATION)); | ||||
|             statement.setInt(8, profile.getSkillXpLevel(PrimarySkillType.ARCHERY)); | ||||
|             statement.setInt(9, profile.getSkillXpLevel(PrimarySkillType.SWORDS)); | ||||
|             statement.setInt(10, profile.getSkillXpLevel(PrimarySkillType.AXES)); | ||||
|             statement.setInt(11, profile.getSkillXpLevel(PrimarySkillType.ACROBATICS)); | ||||
|             statement.setInt(12, profile.getSkillXpLevel(PrimarySkillType.FISHING)); | ||||
|             statement.setInt(13, profile.getSkillXpLevel(PrimarySkillType.ALCHEMY)); | ||||
|             statement.setInt(14, id); | ||||
|             success &= (statement.executeUpdate() != 0); | ||||
|             statement.close(); | ||||
| @@ -328,7 +328,7 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|         return success; | ||||
|     } | ||||
|  | ||||
|     public List<PlayerStat> readLeaderboard(PrimarySkill skill, int pageNumber, int statsPerPage) { | ||||
|     public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage) { | ||||
|         List<PlayerStat> stats = new ArrayList<PlayerStat>(); | ||||
|  | ||||
|         String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase(); | ||||
| @@ -365,8 +365,8 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|         return stats; | ||||
|     } | ||||
|  | ||||
|     public Map<PrimarySkill, Integer> readRank(String playerName) { | ||||
|         Map<PrimarySkill, Integer> skills = new HashMap<PrimarySkill, Integer>(); | ||||
|     public Map<PrimarySkillType, Integer> readRank(String playerName) { | ||||
|         Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>(); | ||||
|  | ||||
|         ResultSet resultSet = null; | ||||
|         PreparedStatement statement = null; | ||||
| @@ -374,8 +374,8 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|  | ||||
|         try { | ||||
|             connection = getConnection(PoolIdentifier.MISC); | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 String skillName = primarySkill.name().toLowerCase(); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 String skillName = primarySkillType.name().toLowerCase(); | ||||
|                 // Get count of all users with higher skill level than player | ||||
|                 String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " + | ||||
|                         "AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " + | ||||
| @@ -402,7 +402,7 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|  | ||||
|                 while (resultSet.next()) { | ||||
|                     if (resultSet.getString("user").equalsIgnoreCase(playerName)) { | ||||
|                         skills.put(primarySkill, rank + resultSet.getRow()); | ||||
|                         skills.put(primarySkillType, rank + resultSet.getRow()); | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
| @@ -890,7 +890,7 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|             } | ||||
|  | ||||
|             if (Config.getInstance().getTruncateSkills()) { | ||||
|                 for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                     int cap = Config.getInstance().getLevelCap(skill); | ||||
|                     if (cap != Integer.MAX_VALUE) { | ||||
|                         statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase() + "` = " + cap + " WHERE `" + skill.name().toLowerCase() + "` > " + cap); | ||||
| @@ -1052,8 +1052,8 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|     } | ||||
|  | ||||
|     private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException { | ||||
|         Map<PrimarySkill, Integer> skills = new EnumMap<PrimarySkill, Integer>(PrimarySkill.class); // Skill & Level | ||||
|         Map<PrimarySkill, Float> skillsXp = new EnumMap<PrimarySkill, Float>(PrimarySkill.class); // Skill & XP | ||||
|         Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level | ||||
|         Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP | ||||
|         Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown | ||||
|         Map<UniqueDataType, Integer> uniqueData = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); //Chimaera wing cooldown and other misc info | ||||
|         MobHealthbarType mobHealthbarType; | ||||
| @@ -1066,33 +1066,33 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|         final int OFFSET_DATS = 26; | ||||
|         final int OFFSET_OTHER = 39; | ||||
|  | ||||
|         skills.put(PrimarySkill.TAMING, result.getInt(OFFSET_SKILLS + 1)); | ||||
|         skills.put(PrimarySkill.MINING, result.getInt(OFFSET_SKILLS + 2)); | ||||
|         skills.put(PrimarySkill.REPAIR, result.getInt(OFFSET_SKILLS + 3)); | ||||
|         skills.put(PrimarySkill.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4)); | ||||
|         skills.put(PrimarySkill.UNARMED, result.getInt(OFFSET_SKILLS + 5)); | ||||
|         skills.put(PrimarySkill.HERBALISM, result.getInt(OFFSET_SKILLS + 6)); | ||||
|         skills.put(PrimarySkill.EXCAVATION, result.getInt(OFFSET_SKILLS + 7)); | ||||
|         skills.put(PrimarySkill.ARCHERY, result.getInt(OFFSET_SKILLS + 8)); | ||||
|         skills.put(PrimarySkill.SWORDS, result.getInt(OFFSET_SKILLS + 9)); | ||||
|         skills.put(PrimarySkill.AXES, result.getInt(OFFSET_SKILLS + 10)); | ||||
|         skills.put(PrimarySkill.ACROBATICS, result.getInt(OFFSET_SKILLS + 11)); | ||||
|         skills.put(PrimarySkill.FISHING, result.getInt(OFFSET_SKILLS + 12)); | ||||
|         skills.put(PrimarySkill.ALCHEMY, result.getInt(OFFSET_SKILLS + 13)); | ||||
|         skills.put(PrimarySkillType.TAMING, result.getInt(OFFSET_SKILLS + 1)); | ||||
|         skills.put(PrimarySkillType.MINING, result.getInt(OFFSET_SKILLS + 2)); | ||||
|         skills.put(PrimarySkillType.REPAIR, result.getInt(OFFSET_SKILLS + 3)); | ||||
|         skills.put(PrimarySkillType.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4)); | ||||
|         skills.put(PrimarySkillType.UNARMED, result.getInt(OFFSET_SKILLS + 5)); | ||||
|         skills.put(PrimarySkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6)); | ||||
|         skills.put(PrimarySkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7)); | ||||
|         skills.put(PrimarySkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8)); | ||||
|         skills.put(PrimarySkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9)); | ||||
|         skills.put(PrimarySkillType.AXES, result.getInt(OFFSET_SKILLS + 10)); | ||||
|         skills.put(PrimarySkillType.ACROBATICS, result.getInt(OFFSET_SKILLS + 11)); | ||||
|         skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12)); | ||||
|         skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13)); | ||||
|  | ||||
|         skillsXp.put(PrimarySkill.TAMING, result.getFloat(OFFSET_XP + 1)); | ||||
|         skillsXp.put(PrimarySkill.MINING, result.getFloat(OFFSET_XP + 2)); | ||||
|         skillsXp.put(PrimarySkill.REPAIR, result.getFloat(OFFSET_XP + 3)); | ||||
|         skillsXp.put(PrimarySkill.WOODCUTTING, result.getFloat(OFFSET_XP + 4)); | ||||
|         skillsXp.put(PrimarySkill.UNARMED, result.getFloat(OFFSET_XP + 5)); | ||||
|         skillsXp.put(PrimarySkill.HERBALISM, result.getFloat(OFFSET_XP + 6)); | ||||
|         skillsXp.put(PrimarySkill.EXCAVATION, result.getFloat(OFFSET_XP + 7)); | ||||
|         skillsXp.put(PrimarySkill.ARCHERY, result.getFloat(OFFSET_XP + 8)); | ||||
|         skillsXp.put(PrimarySkill.SWORDS, result.getFloat(OFFSET_XP + 9)); | ||||
|         skillsXp.put(PrimarySkill.AXES, result.getFloat(OFFSET_XP + 10)); | ||||
|         skillsXp.put(PrimarySkill.ACROBATICS, result.getFloat(OFFSET_XP + 11)); | ||||
|         skillsXp.put(PrimarySkill.FISHING, result.getFloat(OFFSET_XP + 12)); | ||||
|         skillsXp.put(PrimarySkill.ALCHEMY, result.getFloat(OFFSET_XP + 13)); | ||||
|         skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_XP + 1)); | ||||
|         skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_XP + 2)); | ||||
|         skillsXp.put(PrimarySkillType.REPAIR, result.getFloat(OFFSET_XP + 3)); | ||||
|         skillsXp.put(PrimarySkillType.WOODCUTTING, result.getFloat(OFFSET_XP + 4)); | ||||
|         skillsXp.put(PrimarySkillType.UNARMED, result.getFloat(OFFSET_XP + 5)); | ||||
|         skillsXp.put(PrimarySkillType.HERBALISM, result.getFloat(OFFSET_XP + 6)); | ||||
|         skillsXp.put(PrimarySkillType.EXCAVATION, result.getFloat(OFFSET_XP + 7)); | ||||
|         skillsXp.put(PrimarySkillType.ARCHERY, result.getFloat(OFFSET_XP + 8)); | ||||
|         skillsXp.put(PrimarySkillType.SWORDS, result.getFloat(OFFSET_XP + 9)); | ||||
|         skillsXp.put(PrimarySkillType.AXES, result.getFloat(OFFSET_XP + 10)); | ||||
|         skillsXp.put(PrimarySkillType.ACROBATICS, result.getFloat(OFFSET_XP + 11)); | ||||
|         skillsXp.put(PrimarySkillType.FISHING, result.getFloat(OFFSET_XP + 12)); | ||||
|         skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13)); | ||||
|  | ||||
|         // Taming - Unused - result.getInt(OFFSET_DATS + 1) | ||||
|         skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2)); | ||||
| @@ -1235,10 +1235,10 @@ public final class SQLDatabaseManager implements DatabaseManager { | ||||
|             resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'"); | ||||
|             resultSet.last(); | ||||
|  | ||||
|             if (resultSet.getRow() != PrimarySkill.NON_CHILD_SKILLS.size()) { | ||||
|             if (resultSet.getRow() != PrimarySkillType.NON_CHILD_SKILLS.size()) { | ||||
|                 mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases"); | ||||
|  | ||||
|                 for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                     String skill_name = skill.name().toLowerCase(); | ||||
|  | ||||
|                     try { | ||||
|   | ||||
| @@ -4,20 +4,20 @@ import java.util.concurrent.Delayed; | ||||
| import java.util.concurrent.TimeUnit; | ||||
|  | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public class SkillXpGain implements Delayed { | ||||
|     private final long expiryTime; | ||||
|     private final float xp; | ||||
|     private final PrimarySkill type; | ||||
|     private final PrimarySkillType type; | ||||
|  | ||||
|     public SkillXpGain(PrimarySkill type, float xp) { | ||||
|     public SkillXpGain(PrimarySkillType type, float xp) { | ||||
|         this.expiryTime = System.currentTimeMillis() + getDuration(); | ||||
|         this.xp = xp; | ||||
|         this.type = type; | ||||
|     } | ||||
|  | ||||
|     public PrimarySkill getSkill() { | ||||
|     public PrimarySkillType getSkill() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType; | ||||
| import com.gmail.nossr50.datatypes.mods.CustomTool; | ||||
| import com.gmail.nossr50.datatypes.party.Party; | ||||
| import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.ToolType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| @@ -63,7 +63,7 @@ public class McMMOPlayer { | ||||
|     private Player        player; | ||||
|     private PlayerProfile profile; | ||||
|  | ||||
|     private final Map<PrimarySkill, SkillManager> skillManagers = new HashMap<PrimarySkill, SkillManager>(); | ||||
|     private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<PrimarySkillType, SkillManager>(); | ||||
|  | ||||
|     private Party   party; | ||||
|     private Party   invite; | ||||
| @@ -110,11 +110,11 @@ public class McMMOPlayer { | ||||
|         /* | ||||
|          * I'm using this method because it makes code shorter and safer (we don't have to add all SkillTypes manually), | ||||
|          * but I actually have no idea about the performance impact, if there is any. | ||||
|          * If in the future someone wants to remove this, don't forget to also remove what is in the PrimarySkill enum. - bm01 | ||||
|          * If in the future someone wants to remove this, don't forget to also remove what is in the PrimarySkillType enum. - bm01 | ||||
|          */ | ||||
|         try { | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.values()) { | ||||
|                 skillManagers.put(primarySkill, primarySkill.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this)); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { | ||||
|                 skillManagers.put(primarySkillType, primarySkillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this)); | ||||
|             } | ||||
|         } | ||||
|         catch (Exception e) { | ||||
| @@ -133,63 +133,63 @@ public class McMMOPlayer { | ||||
|     } | ||||
|  | ||||
|     public AcrobaticsManager getAcrobaticsManager() { | ||||
|         return (AcrobaticsManager) skillManagers.get(PrimarySkill.ACROBATICS); | ||||
|         return (AcrobaticsManager) skillManagers.get(PrimarySkillType.ACROBATICS); | ||||
|     } | ||||
|  | ||||
|     public AlchemyManager getAlchemyManager() { | ||||
|         return (AlchemyManager) skillManagers.get(PrimarySkill.ALCHEMY); | ||||
|         return (AlchemyManager) skillManagers.get(PrimarySkillType.ALCHEMY); | ||||
|     } | ||||
|  | ||||
|     public ArcheryManager getArcheryManager() { | ||||
|         return (ArcheryManager) skillManagers.get(PrimarySkill.ARCHERY); | ||||
|         return (ArcheryManager) skillManagers.get(PrimarySkillType.ARCHERY); | ||||
|     } | ||||
|  | ||||
|     public AxesManager getAxesManager() { | ||||
|         return (AxesManager) skillManagers.get(PrimarySkill.AXES); | ||||
|         return (AxesManager) skillManagers.get(PrimarySkillType.AXES); | ||||
|     } | ||||
|  | ||||
|     public ExcavationManager getExcavationManager() { | ||||
|         return (ExcavationManager) skillManagers.get(PrimarySkill.EXCAVATION); | ||||
|         return (ExcavationManager) skillManagers.get(PrimarySkillType.EXCAVATION); | ||||
|     } | ||||
|  | ||||
|     public FishingManager getFishingManager() { | ||||
|         return (FishingManager) skillManagers.get(PrimarySkill.FISHING); | ||||
|         return (FishingManager) skillManagers.get(PrimarySkillType.FISHING); | ||||
|     } | ||||
|  | ||||
|     public HerbalismManager getHerbalismManager() { | ||||
|         return (HerbalismManager) skillManagers.get(PrimarySkill.HERBALISM); | ||||
|         return (HerbalismManager) skillManagers.get(PrimarySkillType.HERBALISM); | ||||
|     } | ||||
|  | ||||
|     public MiningManager getMiningManager() { | ||||
|         return (MiningManager) skillManagers.get(PrimarySkill.MINING); | ||||
|         return (MiningManager) skillManagers.get(PrimarySkillType.MINING); | ||||
|     } | ||||
|  | ||||
|     public RepairManager getRepairManager() { | ||||
|         return (RepairManager) skillManagers.get(PrimarySkill.REPAIR); | ||||
|         return (RepairManager) skillManagers.get(PrimarySkillType.REPAIR); | ||||
|     } | ||||
|  | ||||
|     public SalvageManager getSalvageManager() { | ||||
|         return (SalvageManager) skillManagers.get(PrimarySkill.SALVAGE); | ||||
|         return (SalvageManager) skillManagers.get(PrimarySkillType.SALVAGE); | ||||
|     } | ||||
|  | ||||
|     public SmeltingManager getSmeltingManager() { | ||||
|         return (SmeltingManager) skillManagers.get(PrimarySkill.SMELTING); | ||||
|         return (SmeltingManager) skillManagers.get(PrimarySkillType.SMELTING); | ||||
|     } | ||||
|  | ||||
|     public SwordsManager getSwordsManager() { | ||||
|         return (SwordsManager) skillManagers.get(PrimarySkill.SWORDS); | ||||
|         return (SwordsManager) skillManagers.get(PrimarySkillType.SWORDS); | ||||
|     } | ||||
|  | ||||
|     public TamingManager getTamingManager() { | ||||
|         return (TamingManager) skillManagers.get(PrimarySkill.TAMING); | ||||
|         return (TamingManager) skillManagers.get(PrimarySkillType.TAMING); | ||||
|     } | ||||
|  | ||||
|     public UnarmedManager getUnarmedManager() { | ||||
|         return (UnarmedManager) skillManagers.get(PrimarySkill.UNARMED); | ||||
|         return (UnarmedManager) skillManagers.get(PrimarySkillType.UNARMED); | ||||
|     } | ||||
|  | ||||
|     public WoodcuttingManager getWoodcuttingManager() { | ||||
|         return (WoodcuttingManager) skillManagers.get(PrimarySkill.WOODCUTTING); | ||||
|         return (WoodcuttingManager) skillManagers.get(PrimarySkillType.WOODCUTTING); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
| @@ -395,7 +395,7 @@ public class McMMOPlayer { | ||||
|     public int getPowerLevel() { | ||||
|         int powerLevel = 0; | ||||
|  | ||||
|         for (PrimarySkill type : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|         for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             if (type.getPermissions(player)) { | ||||
|                 powerLevel += getSkillLevel(type); | ||||
|             } | ||||
| @@ -410,7 +410,7 @@ public class McMMOPlayer { | ||||
|      * @param skill Skill being used | ||||
|      * @param xp Experience amount to process | ||||
|      */ | ||||
|     public void beginXpGain(PrimarySkill skill, float xp, XPGainReason xpGainReason) { | ||||
|     public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason) { | ||||
|         Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero."); | ||||
|  | ||||
|         if (xp <= 0.0) { | ||||
| @@ -418,10 +418,10 @@ public class McMMOPlayer { | ||||
|         } | ||||
|  | ||||
|         if (skill.isChildSkill()) { | ||||
|             Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill); | ||||
|             Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); | ||||
|             float splitXp = xp / parentSkills.size(); | ||||
|  | ||||
|             for (PrimarySkill parentSkill : parentSkills) { | ||||
|             for (PrimarySkillType parentSkill : parentSkills) { | ||||
|                 if (parentSkill.getPermissions(player)) { | ||||
|                     beginXpGain(parentSkill, splitXp, xpGainReason); | ||||
|                 } | ||||
| @@ -444,7 +444,7 @@ public class McMMOPlayer { | ||||
|      * @param skill Skill being used | ||||
|      * @param xp Experience amount to process | ||||
|      */ | ||||
|     public void beginUnsharedXpGain(PrimarySkill skill, float xp, XPGainReason xpGainReason) { | ||||
|     public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason) { | ||||
|         applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason); | ||||
|  | ||||
|         if (party == null) { | ||||
| @@ -459,56 +459,56 @@ public class McMMOPlayer { | ||||
|     /** | ||||
|      * Applies an experience gain | ||||
|      * | ||||
|      * @param primarySkill Skill being used | ||||
|      * @param primarySkillType Skill being used | ||||
|      * @param xp Experience amount to add | ||||
|      */ | ||||
|     public void applyXpGain(PrimarySkill primarySkill, float xp, XPGainReason xpGainReason) { | ||||
|         if (!primarySkill.getPermissions(player)) { | ||||
|     public void applyXpGain(PrimarySkillType primarySkillType, float xp, XPGainReason xpGainReason) { | ||||
|         if (!primarySkillType.getPermissions(player)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (primarySkill.isChildSkill()) { | ||||
|             Set<PrimarySkill> parentSkills = FamilyTree.getParents(primarySkill); | ||||
|         if (primarySkillType.isChildSkill()) { | ||||
|             Set<PrimarySkillType> parentSkills = FamilyTree.getParents(primarySkillType); | ||||
|  | ||||
|             for (PrimarySkill parentSkill : parentSkills) { | ||||
|             for (PrimarySkillType parentSkill : parentSkills) { | ||||
|                 applyXpGain(parentSkill, xp / parentSkills.size(), xpGainReason); | ||||
|             } | ||||
|  | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (!EventUtils.handleXpGainEvent(player, primarySkill, xp, xpGainReason)) { | ||||
|         if (!EventUtils.handleXpGainEvent(player, primarySkillType, xp, xpGainReason)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         isUsingUnarmed = (primarySkill == PrimarySkill.UNARMED); | ||||
|         checkXp(primarySkill, xpGainReason); | ||||
|         isUsingUnarmed = (primarySkillType == PrimarySkillType.UNARMED); | ||||
|         checkXp(primarySkillType, xpGainReason); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Check the XP of a skill. | ||||
|      * | ||||
|      * @param primarySkill The skill to check | ||||
|      * @param primarySkillType The skill to check | ||||
|      */ | ||||
|     private void checkXp(PrimarySkill primarySkill, XPGainReason xpGainReason) { | ||||
|         if (getSkillXpLevelRaw(primarySkill) < getXpToLevel(primarySkill)) { | ||||
|     private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason) { | ||||
|         if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int levelsGained = 0; | ||||
|         float xpRemoved = 0; | ||||
|  | ||||
|         while (getSkillXpLevelRaw(primarySkill) >= getXpToLevel(primarySkill)) { | ||||
|             if (hasReachedLevelCap(primarySkill)) { | ||||
|                 setSkillXpLevel(primarySkill, 0); | ||||
|         while (getSkillXpLevelRaw(primarySkillType) >= getXpToLevel(primarySkillType)) { | ||||
|             if (hasReachedLevelCap(primarySkillType)) { | ||||
|                 setSkillXpLevel(primarySkillType, 0); | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
|             xpRemoved += profile.levelUp(primarySkill); | ||||
|             xpRemoved += profile.levelUp(primarySkillType); | ||||
|             levelsGained++; | ||||
|         } | ||||
|  | ||||
|         if (!EventUtils.handleLevelChangeEvent(player, primarySkill, levelsGained, xpRemoved, true, xpGainReason)) { | ||||
|         if (!EventUtils.handleLevelChangeEvent(player, primarySkillType, levelsGained, xpRemoved, true, xpGainReason)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -520,7 +520,7 @@ public class McMMOPlayer { | ||||
|          * Check to see if the player unlocked any new skills | ||||
|          */ | ||||
|  | ||||
|         NotificationManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkill, profile.getSkillLevel(primarySkill)); | ||||
|         NotificationManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkillType, profile.getSkillLevel(primarySkillType)); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
| @@ -690,16 +690,16 @@ public class McMMOPlayer { | ||||
|     /** | ||||
|      * Modifies an experience gain using skill modifiers, global rate and perks | ||||
|      * | ||||
|      * @param primarySkill Skill being used | ||||
|      * @param primarySkillType Skill being used | ||||
|      * @param xp Experience amount to process | ||||
|      * @return Modified experience | ||||
|      */ | ||||
|     private float modifyXpGain(PrimarySkill primarySkill, float xp) { | ||||
|         if (player.getGameMode() == GameMode.CREATIVE || (primarySkill.getMaxLevel() <= getSkillLevel(primarySkill)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) { | ||||
|     private float modifyXpGain(PrimarySkillType primarySkillType, float xp) { | ||||
|         if (player.getGameMode() == GameMode.CREATIVE || (primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) { | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         xp = (float) (xp / primarySkill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()); | ||||
|         xp = (float) (xp / primarySkillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()); | ||||
|  | ||||
|         if (Config.getInstance().getToolModsEnabled()) { | ||||
|             CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand()); | ||||
| @@ -709,7 +709,7 @@ public class McMMOPlayer { | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return PerksUtils.handleXpPerks(player, xp, primarySkill); | ||||
|         return PerksUtils.handleXpPerks(player, xp, primarySkillType); | ||||
|     } | ||||
|  | ||||
|     public void checkGodMode() { | ||||
| @@ -731,7 +731,7 @@ public class McMMOPlayer { | ||||
|      * | ||||
|      * @param skill The skill the ability is based on | ||||
|      */ | ||||
|     public void checkAbilityActivation(PrimarySkill skill) { | ||||
|     public void checkAbilityActivation(PrimarySkillType skill) { | ||||
|         ToolType tool = skill.getTool(); | ||||
|         SuperAbilityType ability = skill.getAbility(); | ||||
|  | ||||
| @@ -761,7 +761,7 @@ public class McMMOPlayer { | ||||
|              * Axes and Woodcutting are odd because they share the same tool. | ||||
|              * We show them the too tired message when they take action. | ||||
|              */ | ||||
|             if (skill == PrimarySkill.WOODCUTTING || skill == PrimarySkill.AXES) { | ||||
|             if (skill == PrimarySkillType.WOODCUTTING || skill == PrimarySkillType.AXES) { | ||||
|                 NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining)); | ||||
|             } | ||||
|  | ||||
| @@ -796,7 +796,7 @@ public class McMMOPlayer { | ||||
|         new AbilityDisableTask(this, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR); | ||||
|     } | ||||
|  | ||||
|     public void processAbilityActivation(PrimarySkill skill) { | ||||
|     public void processAbilityActivation(PrimarySkillType skill) { | ||||
|         if (Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) { | ||||
|             return; | ||||
|         } | ||||
| @@ -825,7 +825,7 @@ public class McMMOPlayer { | ||||
|          * Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action | ||||
|          */ | ||||
|         if (ability.getPermissions(player) && tool.inHand(inHand) && !getToolPreparationMode(tool)) { | ||||
|             if (skill != PrimarySkill.WOODCUTTING && skill != PrimarySkill.AXES) { | ||||
|             if (skill != PrimarySkillType.WOODCUTTING && skill != PrimarySkillType.AXES) { | ||||
|                 int timeRemaining = calculateTimeRemaining(ability); | ||||
|  | ||||
|                 if (!getAbilityMode(ability) && timeRemaining > 0) { | ||||
| @@ -855,46 +855,46 @@ public class McMMOPlayer { | ||||
|         return (int) (((deactivatedTimestamp + (PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / Misc.TIME_CONVERSION_FACTOR); | ||||
|     } | ||||
|  | ||||
|     private boolean hasReachedLevelCap(PrimarySkill skill) { | ||||
|     private boolean hasReachedLevelCap(PrimarySkillType skill) { | ||||
|         return (skill.getMaxLevel() < getSkillLevel(skill) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|      * These functions are wrapped from PlayerProfile so that we don't always have to store it alongside the McMMOPlayer object. | ||||
|      */ | ||||
|     public int getSkillLevel(PrimarySkill skill) { | ||||
|     public int getSkillLevel(PrimarySkillType skill) { | ||||
|         return profile.getSkillLevel(skill); | ||||
|     } | ||||
|  | ||||
|     public float getSkillXpLevelRaw(PrimarySkill skill) { | ||||
|     public float getSkillXpLevelRaw(PrimarySkillType skill) { | ||||
|         return profile.getSkillXpLevelRaw(skill); | ||||
|     } | ||||
|  | ||||
|     public int getSkillXpLevel(PrimarySkill skill) { | ||||
|     public int getSkillXpLevel(PrimarySkillType skill) { | ||||
|         return profile.getSkillXpLevel(skill); | ||||
|     } | ||||
|  | ||||
|     public void setSkillXpLevel(PrimarySkill skill, float xpLevel) { | ||||
|     public void setSkillXpLevel(PrimarySkillType skill, float xpLevel) { | ||||
|         profile.setSkillXpLevel(skill, xpLevel); | ||||
|     } | ||||
|  | ||||
|     public int getXpToLevel(PrimarySkill skill) { | ||||
|     public int getXpToLevel(PrimarySkillType skill) { | ||||
|         return profile.getXpToLevel(skill); | ||||
|     } | ||||
|  | ||||
|     public void removeXp(PrimarySkill skill, int xp) { | ||||
|     public void removeXp(PrimarySkillType skill, int xp) { | ||||
|         profile.removeXp(skill, xp); | ||||
|     } | ||||
|  | ||||
|     public void modifySkill(PrimarySkill skill, int level) { | ||||
|     public void modifySkill(PrimarySkillType skill, int level) { | ||||
|         profile.modifySkill(skill, level); | ||||
|     } | ||||
|  | ||||
|     public void addLevels(PrimarySkill skill, int levels) { | ||||
|     public void addLevels(PrimarySkillType skill, int levels) { | ||||
|         profile.addLevels(skill, levels); | ||||
|     } | ||||
|  | ||||
|     public void addXp(PrimarySkill skill, float xp) { | ||||
|     public void addXp(PrimarySkillType skill, float xp) { | ||||
|         profile.addXp(skill, xp); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import java.util.Set; | ||||
| import java.util.UUID; | ||||
| import java.util.concurrent.DelayQueue; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| @@ -31,14 +31,14 @@ public class PlayerProfile { | ||||
|     private int scoreboardTipsShown; | ||||
|  | ||||
|     /* Skill Data */ | ||||
|     private final Map<PrimarySkill, Integer>   skills     = new HashMap<PrimarySkill, Integer>();   // Skill & Level | ||||
|     private final Map<PrimarySkill, Float>     skillsXp   = new HashMap<PrimarySkill, Float>();     // Skill & XP | ||||
|     private final Map<PrimarySkillType, Integer>   skills     = new HashMap<PrimarySkillType, Integer>();   // Skill & Level | ||||
|     private final Map<PrimarySkillType, Float>     skillsXp   = new HashMap<PrimarySkillType, Float>();     // Skill & XP | ||||
|     private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<SuperAbilityType, Integer>(); // Ability & Cooldown | ||||
|     private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..) | ||||
|  | ||||
|     // Store previous XP gains for deminished returns | ||||
|     private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>(); | ||||
|     private HashMap<PrimarySkill, Float> rollingSkillsXp = new HashMap<PrimarySkill, Float>(); | ||||
|     private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<PrimarySkillType, Float>(); | ||||
|  | ||||
|     @Deprecated | ||||
|     public PlayerProfile(String playerName) { | ||||
| @@ -56,9 +56,9 @@ public class PlayerProfile { | ||||
|             abilityDATS.put(superAbilityType, 0); | ||||
|         } | ||||
|  | ||||
|         for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|             skills.put(primarySkill, 0); | ||||
|             skillsXp.put(primarySkill, 0F); | ||||
|         for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             skills.put(primarySkillType, 0); | ||||
|             skillsXp.put(primarySkillType, 0F); | ||||
|         } | ||||
|  | ||||
|         //Misc Cooldowns | ||||
| @@ -76,7 +76,7 @@ public class PlayerProfile { | ||||
|         this.loaded = isLoaded; | ||||
|     } | ||||
|  | ||||
|     public PlayerProfile(String playerName, UUID uuid, Map<PrimarySkill, Integer> levelData, Map<PrimarySkill, Float> xpData, Map<SuperAbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map<UniqueDataType, Integer> uniqueProfileData) { | ||||
|     public PlayerProfile(String playerName, UUID uuid, Map<PrimarySkillType, Integer> levelData, Map<PrimarySkillType, Float> xpData, Map<SuperAbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map<UniqueDataType, Integer> uniqueProfileData) { | ||||
|         this.playerName = playerName; | ||||
|         this.uuid = uuid; | ||||
|         this.mobHealthbarType = mobHealthbarType; | ||||
| @@ -209,19 +209,19 @@ public class PlayerProfile { | ||||
|      * Xp Functions | ||||
|      */ | ||||
|  | ||||
|     public int getSkillLevel(PrimarySkill skill) { | ||||
|     public int getSkillLevel(PrimarySkillType skill) { | ||||
|         return skill.isChildSkill() ? getChildSkillLevel(skill) : skills.get(skill); | ||||
|     } | ||||
|  | ||||
|     public float getSkillXpLevelRaw(PrimarySkill skill) { | ||||
|     public float getSkillXpLevelRaw(PrimarySkillType skill) { | ||||
|         return skillsXp.get(skill); | ||||
|     } | ||||
|  | ||||
|     public int getSkillXpLevel(PrimarySkill skill) { | ||||
|     public int getSkillXpLevel(PrimarySkillType skill) { | ||||
|         return (int) Math.floor(getSkillXpLevelRaw(skill)); | ||||
|     } | ||||
|  | ||||
|     public void setSkillXpLevel(PrimarySkill skill, float xpLevel) { | ||||
|     public void setSkillXpLevel(PrimarySkillType skill, float xpLevel) { | ||||
|         if (skill.isChildSkill()) { | ||||
|             return; | ||||
|         } | ||||
| @@ -231,7 +231,7 @@ public class PlayerProfile { | ||||
|         skillsXp.put(skill, xpLevel); | ||||
|     } | ||||
|  | ||||
|     protected float levelUp(PrimarySkill skill) { | ||||
|     protected float levelUp(PrimarySkillType skill) { | ||||
|         float xpRemoved = getXpToLevel(skill); | ||||
|  | ||||
|         changed = true; | ||||
| @@ -248,7 +248,7 @@ public class PlayerProfile { | ||||
|      * @param skill Type of skill to modify | ||||
|      * @param xp Amount of xp to remove | ||||
|      */ | ||||
|     public void removeXp(PrimarySkill skill, int xp) { | ||||
|     public void removeXp(PrimarySkillType skill, int xp) { | ||||
|         if (skill.isChildSkill()) { | ||||
|             return; | ||||
|         } | ||||
| @@ -258,7 +258,7 @@ public class PlayerProfile { | ||||
|         skillsXp.put(skill, skillsXp.get(skill) - xp); | ||||
|     } | ||||
|  | ||||
|     public void removeXp(PrimarySkill skill, float xp) { | ||||
|     public void removeXp(PrimarySkillType skill, float xp) { | ||||
|         if (skill.isChildSkill()) { | ||||
|             return; | ||||
|         } | ||||
| @@ -274,7 +274,7 @@ public class PlayerProfile { | ||||
|      * @param skill Type of skill to modify | ||||
|      * @param level New level value for the skill | ||||
|      */ | ||||
|     public void modifySkill(PrimarySkill skill, int level) { | ||||
|     public void modifySkill(PrimarySkillType skill, int level) { | ||||
|         if (skill.isChildSkill()) { | ||||
|             return; | ||||
|         } | ||||
| @@ -291,7 +291,7 @@ public class PlayerProfile { | ||||
|      * @param skill Type of skill to add levels to | ||||
|      * @param levels Number of levels to add | ||||
|      */ | ||||
|     public void addLevels(PrimarySkill skill, int levels) { | ||||
|     public void addLevels(PrimarySkillType skill, int levels) { | ||||
|         modifySkill(skill, skills.get(skill) + levels); | ||||
|     } | ||||
|  | ||||
| @@ -301,14 +301,14 @@ public class PlayerProfile { | ||||
|      * @param skill Type of skill to add experience to | ||||
|      * @param xp Number of experience to add | ||||
|      */ | ||||
|     public void addXp(PrimarySkill skill, float xp) { | ||||
|     public void addXp(PrimarySkillType skill, float xp) { | ||||
|         changed = true; | ||||
|  | ||||
|         if (skill.isChildSkill()) { | ||||
|             Set<PrimarySkill> parentSkills = FamilyTree.getParents(skill); | ||||
|             Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); | ||||
|             float dividedXP = (xp / parentSkills.size()); | ||||
|  | ||||
|             for (PrimarySkill parentSkill : parentSkills) { | ||||
|             for (PrimarySkillType parentSkill : parentSkills) { | ||||
|                 skillsXp.put(parentSkill, skillsXp.get(parentSkill) + dividedXP); | ||||
|             } | ||||
|         } | ||||
| @@ -323,11 +323,11 @@ public class PlayerProfile { | ||||
|      * | ||||
|      * @return xp Experience amount registered | ||||
|      */ | ||||
|     public float getRegisteredXpGain(PrimarySkill primarySkill) { | ||||
|     public float getRegisteredXpGain(PrimarySkillType primarySkillType) { | ||||
|         float xp = 0F; | ||||
|  | ||||
|         if (rollingSkillsXp.get(primarySkill) != null) { | ||||
|             xp = rollingSkillsXp.get(primarySkill); | ||||
|         if (rollingSkillsXp.get(primarySkillType) != null) { | ||||
|             xp = rollingSkillsXp.get(primarySkillType); | ||||
|         } | ||||
|  | ||||
|         return xp; | ||||
| @@ -337,12 +337,12 @@ public class PlayerProfile { | ||||
|      * Register an experience gain | ||||
|      * This is used for diminished XP returns | ||||
|      * | ||||
|      * @param primarySkill Skill being used | ||||
|      * @param primarySkillType Skill being used | ||||
|      * @param xp Experience amount to add | ||||
|      */ | ||||
|     public void registerXpGain(PrimarySkill primarySkill, float xp) { | ||||
|         gainedSkillsXp.add(new SkillXpGain(primarySkill, xp)); | ||||
|         rollingSkillsXp.put(primarySkill, getRegisteredXpGain(primarySkill) + xp); | ||||
|     public void registerXpGain(PrimarySkillType primarySkillType, float xp) { | ||||
|         gainedSkillsXp.add(new SkillXpGain(primarySkillType, xp)); | ||||
|         rollingSkillsXp.put(primarySkillType, getRegisteredXpGain(primarySkillType) + xp); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -359,21 +359,21 @@ public class PlayerProfile { | ||||
|     /** | ||||
|      * Get the amount of Xp remaining before the next level. | ||||
|      * | ||||
|      * @param primarySkill Type of skill to check | ||||
|      * @param primarySkillType Type of skill to check | ||||
|      * @return the total amount of Xp until next level | ||||
|      */ | ||||
|     public int getXpToLevel(PrimarySkill primarySkill) { | ||||
|         int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkill); | ||||
|     public int getXpToLevel(PrimarySkillType primarySkillType) { | ||||
|         int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType); | ||||
|         FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType(); | ||||
|  | ||||
|         return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType); | ||||
|     } | ||||
|  | ||||
|     private int getChildSkillLevel(PrimarySkill primarySkill) { | ||||
|         Set<PrimarySkill> parents = FamilyTree.getParents(primarySkill); | ||||
|     private int getChildSkillLevel(PrimarySkillType primarySkillType) { | ||||
|         Set<PrimarySkillType> parents = FamilyTree.getParents(primarySkillType); | ||||
|         int sum = 0; | ||||
|  | ||||
|         for (PrimarySkill parent : parents) { | ||||
|         for (PrimarySkillType parent : parents) { | ||||
|             sum += Math.min(getSkillLevel(parent), parent.getMaxLevel()); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,7 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils; | ||||
| 
 | ||||
| import com.google.common.collect.ImmutableList; | ||||
| 
 | ||||
| public enum PrimarySkill { | ||||
| public enum PrimarySkillType { | ||||
|     ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SubSkillType.ACROBATICS_DODGE, SubSkillType.ACROBATICS_ROLL)), | ||||
|     ALCHEMY(AlchemyManager.class, Color.FUCHSIA, ImmutableList.of(SubSkillType.ALCHEMY_CATALYSIS, SubSkillType.ALCHEMY_CONCOCTIONS)), | ||||
|     ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SubSkillType.ARCHERY_DAZE, SubSkillType.ARCHERY_ARROW_RETRIEVAL, SubSkillType.ARCHERY_SKILL_SHOT)), | ||||
| @@ -45,8 +45,8 @@ public enum PrimarySkill { | ||||
|     HERBALISM(HerbalismManager.class, Color.GREEN, SuperAbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SubSkillType.HERBALISM_FARMERS_DIET, SubSkillType.HERBALISM_GREEN_THUMB, SubSkillType.HERBALISM_DOUBLE_DROPS, SubSkillType.HERBALISM_HYLIAN_LUCK, SubSkillType.HERBALISM_SHROOM_THUMB)), | ||||
|     MINING(MiningManager.class, Color.GRAY, SuperAbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SubSkillType.MINING_SUPER_BREAKER, SubSkillType.MINING_DEMOLITIONS_EXPERTISE, SubSkillType.MINING_BIGGER_BOMBS, SubSkillType.MINING_BLAST_MINING, SubSkillType.MINING_DOUBLE_DROPS)), | ||||
|     REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SubSkillType.REPAIR_ARCANE_FORGING, SubSkillType.REPAIR_REPAIR_MASTERY, SubSkillType.REPAIR_SUPER_REPAIR)), | ||||
|     SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SubSkillType.SALVAGE_ADVANCED_SALVAGE, SubSkillType.SALVAGE_ARCANE_SALVAGE)), | ||||
|     SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SubSkillType.SMELTING_FLUX_MINING, SubSkillType.SMELTING_FUEL_EFFICIENCY, SubSkillType.SMELTING_SECOND_SMELT)), | ||||
|     SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SubSkillType.SALVAGE_UNDERSTANDING_THE_ART, SubSkillType.SALVAGE_ADVANCED_SALVAGE, SubSkillType.SALVAGE_ARCANE_SALVAGE)), | ||||
|     SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SubSkillType.SMELTING_UNDERSTANDING_THE_ART, SubSkillType.SMELTING_FLUX_MINING, SubSkillType.SMELTING_FUEL_EFFICIENCY, SubSkillType.SMELTING_SECOND_SMELT)), | ||||
|     SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SubSkillType.SWORDS_SERRATED_STRIKES, SubSkillType.SWORDS_BLEED, SubSkillType.SWORDS_COUNTER_ATTACK)), | ||||
|     TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SubSkillType.TAMING_BEAST_LORE, SubSkillType.TAMING_CALL_OF_THE_WILD, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE, SubSkillType.TAMING_FAST_FOOD_SERVICE, SubSkillType.TAMING_GORE, SubSkillType.TAMING_HOLY_HOUND, SubSkillType.TAMING_SHARPENED_CLAWS, SubSkillType.TAMING_SHOCK_PROOF, SubSkillType.TAMING_THICK_FUR, SubSkillType.TAMING_PUMMEL)), | ||||
|     UNARMED(UnarmedManager.class, Color.BLACK, SuperAbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SubSkillType.UNARMED_BERSERK, SubSkillType.UNARMED_BLOCK_CRACKER, SubSkillType.UNARMED_ARROW_DEFLECT, SubSkillType.UNARMED_DISARM, SubSkillType.UNARMED_IRON_ARM_STYLE, SubSkillType.UNARMED_IRON_GRIP)), | ||||
| @@ -61,20 +61,20 @@ public enum PrimarySkill { | ||||
|     public static final List<String> SKILL_NAMES; | ||||
|     public static final List<String> SUBSKILL_NAMES; | ||||
| 
 | ||||
|     public static final List<PrimarySkill> CHILD_SKILLS; | ||||
|     public static final List<PrimarySkill> NON_CHILD_SKILLS; | ||||
|     public static final List<PrimarySkillType> CHILD_SKILLS; | ||||
|     public static final List<PrimarySkillType> NON_CHILD_SKILLS; | ||||
| 
 | ||||
|     public static final List<PrimarySkill> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED); | ||||
|     public static final List<PrimarySkill> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING); | ||||
|     public static final List<PrimarySkill> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING); | ||||
|     public static final List<PrimarySkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED); | ||||
|     public static final List<PrimarySkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING); | ||||
|     public static final List<PrimarySkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING); | ||||
| 
 | ||||
|     static { | ||||
|         List<PrimarySkill> childSkills = new ArrayList<PrimarySkill>(); | ||||
|         List<PrimarySkill> nonChildSkills = new ArrayList<PrimarySkill>(); | ||||
|         List<PrimarySkillType> childSkills = new ArrayList<PrimarySkillType>(); | ||||
|         List<PrimarySkillType> nonChildSkills = new ArrayList<PrimarySkillType>(); | ||||
|         ArrayList<String> names = new ArrayList<String>(); | ||||
|         ArrayList<String> subSkillNames = new ArrayList<>(); | ||||
| 
 | ||||
|         for (PrimarySkill skill : values()) { | ||||
|         for (PrimarySkillType skill : values()) { | ||||
|             if (skill.isChildSkill()) { | ||||
|                 childSkills.add(skill); | ||||
|             } | ||||
| @@ -97,11 +97,11 @@ public enum PrimarySkill { | ||||
|         NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills); | ||||
|     } | ||||
| 
 | ||||
|     private PrimarySkill(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) { | ||||
|     private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) { | ||||
|         this(managerClass, runescapeColor, null, null, subSkillTypes); | ||||
|     } | ||||
| 
 | ||||
|     private PrimarySkill(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) { | ||||
|     private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) { | ||||
|         this.managerClass = managerClass; | ||||
|         this.runescapeColor = runescapeColor; | ||||
|         this.ability = ability; | ||||
| @@ -168,16 +168,16 @@ public enum PrimarySkill { | ||||
|         return ExperienceConfig.getInstance().getFormulaSkillModifier(this); | ||||
|     } | ||||
| 
 | ||||
|     public static PrimarySkill getSkill(String skillName) { | ||||
|     public static PrimarySkillType getSkill(String skillName) { | ||||
|         if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) { | ||||
|             for (PrimarySkill type : values()) { | ||||
|             for (PrimarySkillType type : values()) { | ||||
|                 if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) { | ||||
|                     return type; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         for (PrimarySkill type : values()) { | ||||
|         for (PrimarySkillType type : values()) { | ||||
|             if (type.name().equalsIgnoreCase(skillName)) { | ||||
|                 return type; | ||||
|             } | ||||
| @@ -202,8 +202,8 @@ public enum PrimarySkill { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static PrimarySkill bySecondaryAbility(SubSkillType subSkillType) { | ||||
|         for (PrimarySkill type : values()) { | ||||
|     public static PrimarySkillType bySecondaryAbility(SubSkillType subSkillType) { | ||||
|         for (PrimarySkillType type : values()) { | ||||
|             if (type.getSkillAbilities().contains(subSkillType)) { | ||||
|                 return type; | ||||
|             } | ||||
| @@ -211,8 +211,8 @@ public enum PrimarySkill { | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     public static PrimarySkill byAbility(SuperAbilityType ability) { | ||||
|         for (PrimarySkill type : values()) { | ||||
|     public static PrimarySkillType byAbility(SuperAbilityType ability) { | ||||
|         for (PrimarySkillType type : values()) { | ||||
|             if (type.getAbility() == ability) { | ||||
|                 return type; | ||||
|             } | ||||
| @@ -4,7 +4,7 @@ import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
|  | ||||
| public enum SubSkillType { | ||||
|     /* !! Warning -- Do not let subskills share a name with any existing PrimarySkill as it will clash with the static import !! */ | ||||
|     /* !! Warning -- Do not let subskills share a name with any existing PrimarySkillType as it will clash with the static import !! */ | ||||
|  | ||||
|     /* ACROBATICS */ | ||||
|     ACROBATICS_DODGE, | ||||
| @@ -60,11 +60,13 @@ public enum SubSkillType { | ||||
|     /* Salvage */ | ||||
|     SALVAGE_ADVANCED_SALVAGE, | ||||
|     SALVAGE_ARCANE_SALVAGE, | ||||
|     SALVAGE_UNDERSTANDING_THE_ART, | ||||
|  | ||||
|     /* Smelting */ | ||||
|     SMELTING_FLUX_MINING, | ||||
|     SMELTING_FUEL_EFFICIENCY, | ||||
|     SMELTING_SECOND_SMELT, | ||||
|     SMELTING_UNDERSTANDING_THE_ART, | ||||
|  | ||||
|     /* Swords */ | ||||
|     SWORDS_BLEED, | ||||
| @@ -122,11 +124,11 @@ public enum SubSkillType { | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * !!! This relies on the immutable lists in PrimarySkill being populated !!! | ||||
|      * !!! This relies on the immutable lists in PrimarySkillType being populated !!! | ||||
|      * If we add skills, those immutable lists need to be updated | ||||
|      * @return | ||||
|      */ | ||||
|     public PrimarySkill getParentSkill() { return PrimarySkill.bySecondaryAbility(this); } | ||||
|     public PrimarySkillType getParentSkill() { return PrimarySkillType.bySecondaryAbility(this); } | ||||
|  | ||||
|     /** | ||||
|      * Returns the permission root address for the advanced.yml for this subskill | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| package com.gmail.nossr50.datatypes.skills.interfaces; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public interface ChildSkill extends Skill { | ||||
|     /** | ||||
|      * Get's the other parent for this Skill | ||||
|      * @return the other parent | ||||
|      */ | ||||
|     PrimarySkill getSecondParent(); | ||||
|     PrimarySkillType getSecondParent(); | ||||
| } | ||||
|   | ||||
| @@ -1,13 +1,13 @@ | ||||
| package com.gmail.nossr50.datatypes.skills.interfaces; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public interface Skill { | ||||
|     /** | ||||
|      * The primary skill | ||||
|      * @return this primary skill | ||||
|      */ | ||||
|     PrimarySkill getPrimarySkill(); | ||||
|     PrimarySkillType getPrimarySkill(); | ||||
|  | ||||
|     /** | ||||
|      * Returns the key name used for this skill in conjunction with config files | ||||
|   | ||||
| @@ -1,13 +1,11 @@ | ||||
| package com.gmail.nossr50.datatypes.skills.subskills.acrobatics; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
| import net.md_5.bungee.api.chat.ComponentBuilder; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Event; | ||||
| import org.bukkit.event.EventPriority; | ||||
|  | ||||
| @@ -58,8 +56,8 @@ public abstract class AcrobaticsSubSkill extends AbstractSubSkill { | ||||
|      * @return The name of the primary skill | ||||
|      */ | ||||
|     @Override | ||||
|     public PrimarySkill getPrimarySkill() { | ||||
|         return PrimarySkill.ACROBATICS; | ||||
|     public PrimarySkillType getPrimarySkill() { | ||||
|         return PrimarySkillType.ACROBATICS; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
| import org.bukkit.event.HandlerList; | ||||
| @@ -14,19 +14,19 @@ import com.gmail.nossr50.util.player.UserManager; | ||||
|  */ | ||||
| public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements Cancellable { | ||||
|     private boolean cancelled; | ||||
|     protected PrimarySkill skill; | ||||
|     protected PrimarySkillType skill; | ||||
|     protected int skillLevel; | ||||
|     protected XPGainReason xpGainReason; | ||||
|  | ||||
|     @Deprecated | ||||
|     protected McMMOPlayerExperienceEvent(Player player, PrimarySkill skill) { | ||||
|     protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player); | ||||
|         this.skill = skill; | ||||
|         this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill); | ||||
|         this.xpGainReason = XPGainReason.UNKNOWN; | ||||
|     } | ||||
|  | ||||
|     protected McMMOPlayerExperienceEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) { | ||||
|     protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) { | ||||
|         super(player); | ||||
|         this.skill = skill; | ||||
|         this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill); | ||||
| @@ -36,7 +36,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements | ||||
|     /** | ||||
|      * @return The skill involved in this event | ||||
|      */ | ||||
|     public PrimarySkill getSkill() { | ||||
|     public PrimarySkillType getSkill() { | ||||
|         return skill; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| @@ -10,11 +10,11 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
|  */ | ||||
| public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent { | ||||
|     @Deprecated | ||||
|     public McMMOPlayerLevelChangeEvent(Player player, PrimarySkill skill) { | ||||
|     public McMMOPlayerLevelChangeEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player, skill, XPGainReason.UNKNOWN); | ||||
|     } | ||||
|  | ||||
|     public McMMOPlayerLevelChangeEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) { | ||||
|     public McMMOPlayerLevelChangeEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) { | ||||
|         super(player, skill, xpGainReason); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.HandlerList; | ||||
|  | ||||
| @@ -13,23 +13,23 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent { | ||||
|     private int levelsLost; | ||||
|  | ||||
|     @Deprecated | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill) { | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player, skill, XPGainReason.UNKNOWN); | ||||
|         this.levelsLost = 1; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, int levelsLost) { | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill, int levelsLost) { | ||||
|         super(player, skill, XPGainReason.UNKNOWN); | ||||
|         this.levelsLost = levelsLost; | ||||
|     } | ||||
|  | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) { | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) { | ||||
|         super(player, skill, xpGainReason); | ||||
|         this.levelsLost = 1; | ||||
|     } | ||||
|  | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkill skill, int levelsLost, XPGainReason xpGainReason) { | ||||
|     public McMMOPlayerLevelDownEvent(Player player, PrimarySkillType skill, int levelsLost, XPGainReason xpGainReason) { | ||||
|         super(player, skill, xpGainReason); | ||||
|         this.levelsLost = levelsLost; | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.HandlerList; | ||||
|  | ||||
| @@ -13,23 +13,23 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent { | ||||
|     private int levelsGained; | ||||
|  | ||||
|     @Deprecated | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill) { | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player, skill, XPGainReason.UNKNOWN); | ||||
|         this.levelsGained = 1; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, int levelsGained) { | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill, int levelsGained) { | ||||
|         super(player, skill, XPGainReason.UNKNOWN); | ||||
|         this.levelsGained = levelsGained; | ||||
|     } | ||||
|  | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, XPGainReason xpGainReason) { | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill, XPGainReason xpGainReason) { | ||||
|         super(player, skill, xpGainReason); | ||||
|         this.levelsGained = 1; | ||||
|     } | ||||
|  | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkill skill, int levelsGained, XPGainReason xpGainReason) { | ||||
|     public McMMOPlayerLevelUpEvent(Player player, PrimarySkillType skill, int levelsGained, XPGainReason xpGainReason) { | ||||
|         super(player, skill, xpGainReason); | ||||
|         this.levelsGained = levelsGained; | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.experience; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.HandlerList; | ||||
|  | ||||
| @@ -13,12 +13,12 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent { | ||||
|     private float xpGained; | ||||
|  | ||||
|     @Deprecated | ||||
|     public McMMOPlayerXpGainEvent(Player player, PrimarySkill skill, float xpGained) { | ||||
|     public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained) { | ||||
|         super(player, skill, XPGainReason.UNKNOWN); | ||||
|         this.xpGained = xpGained; | ||||
|     } | ||||
|  | ||||
|     public McMMOPlayerXpGainEvent(Player player, PrimarySkill skill, float xpGained, XPGainReason xpGainReason) { | ||||
|     public McMMOPlayerXpGainEvent(Player player, PrimarySkillType skill, float xpGained, XPGainReason xpGainReason) { | ||||
|         super(player, skill, xpGainReason); | ||||
|         this.xpGained = xpGained; | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.skills; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.HandlerList; | ||||
| import org.bukkit.event.player.PlayerEvent; | ||||
| @@ -11,10 +11,10 @@ import com.gmail.nossr50.util.player.UserManager; | ||||
|  * Generic event for mcMMO skill handling. | ||||
|  */ | ||||
| public abstract class McMMOPlayerSkillEvent extends PlayerEvent { | ||||
|     protected PrimarySkill skill; | ||||
|     protected PrimarySkillType skill; | ||||
|     protected int skillLevel; | ||||
|  | ||||
|     protected McMMOPlayerSkillEvent(Player player, PrimarySkill skill) { | ||||
|     protected McMMOPlayerSkillEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player); | ||||
|         this.skill = skill; | ||||
|         this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill); | ||||
| @@ -23,7 +23,7 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent { | ||||
|     /** | ||||
|      * @return The skill involved in this event | ||||
|      */ | ||||
|     public PrimarySkill getSkill() { | ||||
|     public PrimarySkillType getSkill() { | ||||
|         return skill; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,13 +1,13 @@ | ||||
| package com.gmail.nossr50.events.skills.abilities; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
|  | ||||
| public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable { | ||||
|     private boolean cancelled; | ||||
|  | ||||
|     public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkill skill) { | ||||
|     public McMMOPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player, skill); | ||||
|         cancelled = false; | ||||
|     } | ||||
|   | ||||
| @@ -2,10 +2,10 @@ package com.gmail.nossr50.events.skills.abilities; | ||||
|  | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent { | ||||
|     public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkill skill) { | ||||
|     public McMMOPlayerAbilityDeactivateEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player, skill); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,13 +3,13 @@ package com.gmail.nossr50.events.skills.abilities; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; | ||||
|  | ||||
| public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent { | ||||
|     private SuperAbilityType ability; | ||||
|  | ||||
|     protected McMMOPlayerAbilityEvent(Player player, PrimarySkill skill) { | ||||
|     protected McMMOPlayerAbilityEvent(Player player, PrimarySkillType skill) { | ||||
|         super(player, skill); | ||||
|         ability = skill.getAbility(); | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.skills.alchemy; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.block.Block; | ||||
| import org.bukkit.block.BlockState; | ||||
| import org.bukkit.block.BrewingStand; | ||||
| @@ -15,7 +15,7 @@ public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cance | ||||
|     private boolean cancelled; | ||||
|  | ||||
|     public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) { | ||||
|         super(player, PrimarySkill.ALCHEMY); | ||||
|         super(player, PrimarySkillType.ALCHEMY); | ||||
|         this.brewingStand = brewingStand; | ||||
|         cancelled = false; | ||||
|     } | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| package com.gmail.nossr50.events.skills.alchemy; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| 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 McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable { | ||||
| @@ -12,7 +12,7 @@ public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements | ||||
|     private boolean cancelled; | ||||
|  | ||||
|     public McMMOPlayerCatalysisEvent(Player player, double speed) { | ||||
|         super(player, PrimarySkill.ALCHEMY); | ||||
|         super(player, PrimarySkillType.ALCHEMY); | ||||
|         this.speed = speed; | ||||
|         cancelled = false; | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.skills.fishing; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
|  | ||||
| @@ -10,7 +10,7 @@ public class McMMOPlayerFishingEvent extends McMMOPlayerSkillEvent implements Ca | ||||
|     private boolean cancelled; | ||||
|  | ||||
|     protected McMMOPlayerFishingEvent(Player player) { | ||||
|         super(player, PrimarySkill.FISHING); | ||||
|         super(player, PrimarySkillType.FISHING); | ||||
|         cancelled = false; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.events.skills.repair; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| @@ -17,7 +17,7 @@ public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implement | ||||
|     private boolean cancelled; | ||||
|  | ||||
|     public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) { | ||||
|         super(player, PrimarySkill.REPAIR); | ||||
|         super(player, PrimarySkillType.REPAIR); | ||||
|         this.repairAmount = repairAmount; | ||||
|         this.repairMaterial = repairMaterial; | ||||
|         this.repairedObject = repairedObject; | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| package com.gmail.nossr50.events.skills.salvage; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; | ||||
|  | ||||
| /** | ||||
| @@ -17,7 +17,7 @@ public class McMMOPlayerSalvageCheckEvent extends McMMOPlayerSkillEvent implemen | ||||
|     private boolean cancelled; | ||||
|  | ||||
|     public McMMOPlayerSalvageCheckEvent(Player player, ItemStack salvageItem, ItemStack salvageResults, ItemStack enchantedBook) { | ||||
|         super(player, PrimarySkill.SALVAGE); | ||||
|         super(player, PrimarySkillType.SALVAGE); | ||||
|         this.salvageItem = salvageItem; | ||||
|         this.salvageResults = salvageResults; | ||||
|         this.enchantedBook = enchantedBook; | ||||
|   | ||||
| @@ -2,11 +2,10 @@ package com.gmail.nossr50.events.skills.secondaryabilities; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.interfaces.SubSkill; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; | ||||
|  | ||||
| public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable { | ||||
| @@ -20,7 +19,7 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable | ||||
|      */ | ||||
|     @Deprecated | ||||
|     public SubSkillEvent(Player player, SubSkillType subSkillType) { | ||||
|         super(player, PrimarySkill.bySecondaryAbility(subSkillType)); | ||||
|         super(player, PrimarySkillType.bySecondaryAbility(subSkillType)); | ||||
|         this.subSkillType = subSkillType; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.events.skills.unarmed; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.Cancellable; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; | ||||
|  | ||||
| public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable { | ||||
| @@ -11,7 +11,7 @@ public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Can | ||||
|     private Player defender; | ||||
|  | ||||
|     public McMMOPlayerDisarmEvent(Player defender) { | ||||
|         super(defender, PrimarySkill.UNARMED); | ||||
|         super(defender, PrimarySkillType.UNARMED); | ||||
|         this.defender = defender; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -3,8 +3,8 @@ package com.gmail.nossr50.listeners; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.config.HiddenConfig; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.ToolType; | ||||
| import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; | ||||
| import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; | ||||
| @@ -152,10 +152,10 @@ public class BlockListener implements Listener { | ||||
|  | ||||
|         McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); | ||||
|  | ||||
|         if (blockState.getType() == Repair.anvilMaterial && PrimarySkill.REPAIR.getPermissions(player)) { | ||||
|         if (blockState.getType() == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player)) { | ||||
|             mcMMOPlayer.getRepairManager().placedAnvilCheck(); | ||||
|         } | ||||
|         else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkill.SALVAGE.getPermissions(player)) { | ||||
|         else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player)) { | ||||
|             mcMMOPlayer.getSalvageManager().placedAnvilCheck(); | ||||
|         } | ||||
|     } | ||||
| @@ -210,26 +210,26 @@ public class BlockListener implements Listener { | ||||
|  | ||||
|             /* Green Terra */ | ||||
|             if (herbalismManager.canActivateAbility()) { | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkill.HERBALISM); | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM); | ||||
|             } | ||||
|  | ||||
|             /* | ||||
|              * We don't check the block store here because herbalism has too many unusual edge cases. | ||||
|              * Instead, we check it inside the drops handler. | ||||
|              */ | ||||
|             if (PrimarySkill.HERBALISM.getPermissions(player)) { | ||||
|             if (PrimarySkillType.HERBALISM.getPermissions(player)) { | ||||
|                 herbalismManager.herbalismBlockCheck(blockState); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /* MINING */ | ||||
|         else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && PrimarySkill.MINING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|         else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && PrimarySkillType.MINING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|             MiningManager miningManager = mcMMOPlayer.getMiningManager(); | ||||
|             miningManager.miningBlockCheck(blockState); | ||||
|         } | ||||
|  | ||||
|         /* WOOD CUTTING */ | ||||
|         else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && PrimarySkill.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|         else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && PrimarySkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|             WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager(); | ||||
|             if (woodcuttingManager.canUseTreeFeller(heldItem)) { | ||||
|                 woodcuttingManager.processTreeFeller(blockState); | ||||
| @@ -240,7 +240,7 @@ public class BlockListener implements Listener { | ||||
|         } | ||||
|  | ||||
|         /* EXCAVATION */ | ||||
|         else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && PrimarySkill.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|         else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && PrimarySkillType.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { | ||||
|             ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager(); | ||||
|             excavationManager.excavationBlockCheck(blockState); | ||||
|  | ||||
| @@ -345,19 +345,19 @@ public class BlockListener implements Listener { | ||||
|             } | ||||
|  | ||||
|             if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) { | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkill.HERBALISM); | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM); | ||||
|             } | ||||
|             else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) { | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkill.WOODCUTTING); | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkillType.WOODCUTTING); | ||||
|             } | ||||
|             else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) { | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkill.MINING); | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkillType.MINING); | ||||
|             } | ||||
|             else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) { | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkill.EXCAVATION); | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION); | ||||
|             } | ||||
|             else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) { | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkill.UNARMED); | ||||
|                 mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.listeners; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.events.fake.FakeBrewEvent; | ||||
| import org.bukkit.Location; | ||||
| @@ -105,7 +105,7 @@ public class InventoryListener implements Listener { | ||||
|  | ||||
|         Player player = getPlayerFromFurnace(furnaceBlock); | ||||
|  | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.SMELTING.getPermissions(player)) { | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.SMELTING.getPermissions(player)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -122,7 +122,7 @@ public class InventoryListener implements Listener { | ||||
|  | ||||
|         Player player = getPlayerFromFurnace(furnaceBlock); | ||||
|  | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkill.SMELTING)) { | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkillType.SMELTING)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.chat.ChatMode; | ||||
| import com.gmail.nossr50.datatypes.party.Party; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.party.ShareHandler; | ||||
| @@ -187,7 +187,7 @@ public class PlayerListener implements Listener { | ||||
|     public void onPlayerFishHighest(PlayerFishEvent event) { | ||||
|         Player player = event.getPlayer(); | ||||
|  | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.FISHING.getPermissions(player)) { | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -211,7 +211,7 @@ public class PlayerListener implements Listener { | ||||
|                     fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1)); | ||||
|                 } | ||||
|  | ||||
|                 if (Permissions.vanillaXpBoost(player, PrimarySkill.FISHING)) { | ||||
|                 if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) { | ||||
|                     event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop())); | ||||
|                 } | ||||
|                 return; | ||||
| @@ -242,7 +242,7 @@ public class PlayerListener implements Listener { | ||||
|     public void onPlayerFishMonitor(PlayerFishEvent event) { | ||||
|         Player player = event.getPlayer(); | ||||
|  | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !PrimarySkill.FISHING.getPermissions(player)) { | ||||
|         if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| @@ -415,7 +415,7 @@ public class PlayerListener implements Listener { | ||||
|  | ||||
|                 if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) { | ||||
|                     /* REPAIR CHECKS */ | ||||
|                     if (type == Repair.anvilMaterial && PrimarySkill.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) { | ||||
|                     if (type == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) { | ||||
|                         RepairManager repairManager = mcMMOPlayer.getRepairManager(); | ||||
|                         event.setCancelled(true); | ||||
|  | ||||
| @@ -426,7 +426,7 @@ public class PlayerListener implements Listener { | ||||
|                         } | ||||
|                     } | ||||
|                     /* SALVAGE CHECKS */ | ||||
|                     else if (type == Salvage.anvilMaterial && PrimarySkill.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) { | ||||
|                     else if (type == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) { | ||||
|                         SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager(); | ||||
|                         event.setCancelled(true); | ||||
|  | ||||
| @@ -455,7 +455,7 @@ public class PlayerListener implements Listener { | ||||
|  | ||||
|                 if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) { | ||||
|                     /* REPAIR CHECKS */ | ||||
|                     if (type == Repair.anvilMaterial && PrimarySkill.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) { | ||||
|                     if (type == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) { | ||||
|                         RepairManager repairManager = mcMMOPlayer.getRepairManager(); | ||||
|  | ||||
|                         // Cancel repairing an enchanted item | ||||
| @@ -465,7 +465,7 @@ public class PlayerListener implements Listener { | ||||
|                         } | ||||
|                     } | ||||
|                     /* SALVAGE CHECKS */ | ||||
|                     else if (type == Salvage.anvilMaterial && PrimarySkill.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) { | ||||
|                     else if (type == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) { | ||||
|                         SalvageManager salvageManager = mcMMOPlayer.getSalvageManager(); | ||||
|  | ||||
|                         // Cancel salvaging an enchanted item | ||||
| @@ -512,15 +512,15 @@ public class PlayerListener implements Listener { | ||||
|                 if (BlockUtils.canActivateAbilities(blockState)) { | ||||
|                     if (Config.getInstance().getAbilitiesEnabled()) { | ||||
|                         if (BlockUtils.canActivateHerbalism(blockState)) { | ||||
|                             mcMMOPlayer.processAbilityActivation(PrimarySkill.HERBALISM); | ||||
|                             mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM); | ||||
|                         } | ||||
|  | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkill.AXES); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkill.EXCAVATION); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkill.MINING); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkill.SWORDS); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkill.UNARMED); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkill.WOODCUTTING); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED); | ||||
|                         mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING); | ||||
|                     } | ||||
|  | ||||
|                     ChimaeraWing.activationCheck(player); | ||||
| @@ -565,13 +565,13 @@ public class PlayerListener implements Listener { | ||||
|                  | ||||
|                 /* ACTIVATION CHECKS */ | ||||
|                 if (Config.getInstance().getAbilitiesEnabled()) { | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.AXES); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.EXCAVATION); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.HERBALISM); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.MINING); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.SWORDS); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.UNARMED); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkill.WOODCUTTING); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED); | ||||
|                     mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING); | ||||
|                 } | ||||
|  | ||||
|                 /* ITEM CHECKS */ | ||||
| @@ -671,7 +671,7 @@ public class PlayerListener implements Listener { | ||||
|             String lowerCaseCommand = command.toLowerCase(); | ||||
|  | ||||
|             // Do these ACTUALLY have to be lower case to work properly? | ||||
|             for (PrimarySkill skill : PrimarySkill.values()) { | ||||
|             for (PrimarySkillType skill : PrimarySkillType.values()) { | ||||
|                 String skillName = skill.toString().toLowerCase(); | ||||
|                 String localizedName = skill.getName().toLowerCase(); | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.listeners; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.EventHandler; | ||||
| @@ -20,7 +20,7 @@ public class SelfListener implements Listener { | ||||
|     @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) | ||||
|     public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) { | ||||
|         Player player = event.getPlayer(); | ||||
|         PrimarySkill skill = event.getSkill(); | ||||
|         PrimarySkillType skill = event.getSkill(); | ||||
|  | ||||
|         ScoreboardManager.handleLevelUp(player, skill); | ||||
|  | ||||
| @@ -47,8 +47,8 @@ public class SelfListener implements Listener { | ||||
|     public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { | ||||
|         if (event.getXpGainReason() == XPGainReason.COMMAND) | ||||
|             return; | ||||
|         PrimarySkill primarySkill = event.getSkill(); | ||||
|         int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkill); | ||||
|         PrimarySkillType primarySkillType = event.getSkill(); | ||||
|         int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType); | ||||
|         if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) { | ||||
|             // Diminished returns is turned off | ||||
|             return; | ||||
| @@ -63,15 +63,15 @@ public class SelfListener implements Listener { | ||||
|         Player player = event.getPlayer(); | ||||
|         McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); | ||||
|  | ||||
|         if (primarySkill.isChildSkill()) { | ||||
|         if (primarySkillType.isChildSkill()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         float modifiedThreshold = (float) (threshold / primarySkill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()); | ||||
|         float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkill) - modifiedThreshold) / modifiedThreshold; | ||||
|         float modifiedThreshold = (float) (threshold / primarySkillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()); | ||||
|         float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) - modifiedThreshold) / modifiedThreshold; | ||||
|  | ||||
|         if (difference > 0) { | ||||
| //            System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkill) + " / Threshold value: " + threshold); | ||||
| //            System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) + " / Threshold value: " + threshold); | ||||
| //            System.out.println(difference * 100 + "% over the threshold!"); | ||||
| //            System.out.println("Previous: " + event.getRawXpGained()); | ||||
| //            System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference))); | ||||
|   | ||||
| @@ -12,7 +12,7 @@ import com.gmail.nossr50.config.skills.salvage.SalvageConfigManager; | ||||
| import com.gmail.nossr50.config.treasure.TreasureConfig; | ||||
| import com.gmail.nossr50.database.DatabaseManager; | ||||
| import com.gmail.nossr50.database.DatabaseManagerFactory; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll; | ||||
| import com.gmail.nossr50.listeners.*; | ||||
| import com.gmail.nossr50.party.PartyManager; | ||||
| @@ -379,6 +379,7 @@ public class mcMMO extends JavaPlugin { | ||||
|         PotionConfig.getInstance(); | ||||
|         CoreSkillsConfig.getInstance(); | ||||
|         SoundConfig.getInstance(); | ||||
|         RankConfig.getInstance(); | ||||
|  | ||||
|         new ChildConfig(); | ||||
|  | ||||
| @@ -435,7 +436,7 @@ public class mcMMO extends JavaPlugin { | ||||
|          * Acrobatics skills | ||||
|          */ | ||||
|  | ||||
|         if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkill.ACROBATICS)) | ||||
|         if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS)) | ||||
|         { | ||||
|             System.out.println("[mcMMO]" + " enabling Acrobatics Skills"); | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.party; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Item; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| @@ -25,10 +25,10 @@ public final class ShareHandler { | ||||
|      * | ||||
|      * @param xp Xp without party sharing | ||||
|      * @param mcMMOPlayer Player initiating the Xp gain | ||||
|      * @param primarySkill Skill being used | ||||
|      * @param primarySkillType Skill being used | ||||
|      * @return True is the xp has been shared | ||||
|      */ | ||||
|     public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, PrimarySkill primarySkill, XPGainReason xpGainReason) { | ||||
|     public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, XPGainReason xpGainReason) { | ||||
|         Party party = mcMMOPlayer.getParty(); | ||||
|  | ||||
|         if (party.getXpShareMode() != ShareMode.EQUAL) { | ||||
| @@ -48,7 +48,7 @@ public final class ShareHandler { | ||||
|         float splitXp = (float) (xp / partySize * shareBonus); | ||||
|  | ||||
|         for (Player member : nearMembers) { | ||||
|             UserManager.getPlayer(member).beginUnsharedXpGain(primarySkill, splitXp, xpGainReason); | ||||
|             UserManager.getPlayer(member).beginUnsharedXpGain(primarySkillType, splitXp, xpGainReason); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|   | ||||
| @@ -2,12 +2,12 @@ package com.gmail.nossr50.runnables.commands; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
|  | ||||
| import org.apache.commons.lang.Validate; | ||||
|  | ||||
| @@ -32,7 +32,7 @@ public class McrankCommandAsyncTask extends BukkitRunnable { | ||||
|  | ||||
|     @Override | ||||
|     public void run() { | ||||
|         Map<PrimarySkill, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName); | ||||
|         Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName); | ||||
|  | ||||
|         new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat).runTaskLater(mcMMO.p, 1); | ||||
|     } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.runnables.commands; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
| @@ -15,12 +15,12 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager; | ||||
|  * Display the results of McrankCommandAsyncTask to the sender. | ||||
|  */ | ||||
| public class McrankCommandDisplayTask extends BukkitRunnable { | ||||
|     private final Map<PrimarySkill, Integer> skills; | ||||
|     private final Map<PrimarySkillType, Integer> skills; | ||||
|     private final CommandSender sender; | ||||
|     private final String playerName; | ||||
|     private final boolean useBoard, useChat; | ||||
|  | ||||
|     McrankCommandDisplayTask(Map<PrimarySkill, Integer> skills, CommandSender sender, String playerName, boolean useBoard, boolean useChat) { | ||||
|     McrankCommandDisplayTask(Map<PrimarySkillType, Integer> skills, CommandSender sender, String playerName, boolean useBoard, boolean useChat) { | ||||
|         this.skills = skills; | ||||
|         this.sender = sender; | ||||
|         this.playerName = playerName; | ||||
| @@ -47,7 +47,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable { | ||||
|         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading")); | ||||
|         sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName)); | ||||
|  | ||||
|         for (PrimarySkill skill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|         for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             if (!skill.getPermissions(player)) { | ||||
|                 continue; | ||||
|             } | ||||
|   | ||||
| @@ -8,17 +8,17 @@ import org.bukkit.scheduler.BukkitRunnable; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.datatypes.database.PlayerStat; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| import org.apache.commons.lang.Validate; | ||||
|  | ||||
| public class MctopCommandAsyncTask extends BukkitRunnable { | ||||
|     private final CommandSender sender; | ||||
|     private final PrimarySkill skill; | ||||
|     private final PrimarySkillType skill; | ||||
|     private final int page; | ||||
|     private final boolean useBoard, useChat; | ||||
|  | ||||
|     public MctopCommandAsyncTask(int page, PrimarySkill skill, CommandSender sender, boolean useBoard, boolean useChat) { | ||||
|     public MctopCommandAsyncTask(int page, PrimarySkillType skill, CommandSender sender, boolean useBoard, boolean useChat) { | ||||
|         Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off"); | ||||
|         Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient"); | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| package com.gmail.nossr50.runnables.commands; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.database.PlayerStat; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.util.scoreboards.ScoreboardManager; | ||||
| @@ -18,11 +18,11 @@ import java.util.List; | ||||
| public class MctopCommandDisplayTask extends BukkitRunnable { | ||||
|     private final List<PlayerStat> userStats; | ||||
|     private final CommandSender sender; | ||||
|     private final PrimarySkill skill; | ||||
|     private final PrimarySkillType skill; | ||||
|     private final int page; | ||||
|     private final boolean useBoard, useChat; | ||||
|  | ||||
|     MctopCommandDisplayTask(List<PlayerStat> userStats, int page, PrimarySkill skill, CommandSender sender, boolean useBoard, boolean useChat) { | ||||
|     MctopCommandDisplayTask(List<PlayerStat> userStats, int page, PrimarySkillType skill, CommandSender sender, boolean useBoard, boolean useChat) { | ||||
|         this.userStats = userStats; | ||||
|         this.page = page; | ||||
|         this.skill = skill; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.runnables.database; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
|  | ||||
| @@ -59,20 +59,20 @@ public class FormulaConversionTask extends BukkitRunnable { | ||||
|     private void editValues(PlayerProfile profile) { | ||||
|         mcMMO.p.debug("========================================================================"); | ||||
|         mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":"); | ||||
|         for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|             int oldLevel = profile.getSkillLevel(primarySkill); | ||||
|             int oldXPLevel = profile.getSkillXpLevel(primarySkill); | ||||
|         for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|             int oldLevel = profile.getSkillLevel(primarySkillType); | ||||
|             int oldXPLevel = profile.getSkillXpLevel(primarySkillType); | ||||
|             int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel); | ||||
|  | ||||
|             if (totalOldXP == 0) { | ||||
|                 continue; | ||||
|             } | ||||
|  | ||||
|             int[] newExperienceValues = mcMMO.getFormulaManager().calculateNewLevel(primarySkill, (int) Math.floor(totalOldXP / ExperienceConfig.getInstance().getExpModifier()), formulaType); | ||||
|             int[] newExperienceValues = mcMMO.getFormulaManager().calculateNewLevel(primarySkillType, (int) Math.floor(totalOldXP / ExperienceConfig.getInstance().getExpModifier()), formulaType); | ||||
|             int newLevel = newExperienceValues[0]; | ||||
|             int newXPlevel = newExperienceValues[1]; | ||||
|  | ||||
|             mcMMO.p.debug("  Skill: " + primarySkill.toString()); | ||||
|             mcMMO.p.debug("  Skill: " + primarySkillType.toString()); | ||||
|  | ||||
|             mcMMO.p.debug("    OLD:"); | ||||
|             mcMMO.p.debug("      Level: " + oldLevel); | ||||
| @@ -84,8 +84,8 @@ public class FormulaConversionTask extends BukkitRunnable { | ||||
|             mcMMO.p.debug("      XP " + newXPlevel); | ||||
|             mcMMO.p.debug("------------------------------------------------------------------------"); | ||||
|  | ||||
|             profile.modifySkill(primarySkill, newLevel); | ||||
|             profile.setSkillXpLevel(primarySkill, newXPlevel); | ||||
|             profile.modifySkill(primarySkillType, newLevel); | ||||
|             profile.setSkillXpLevel(primarySkillType, newXPlevel); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerBrewEvent; | ||||
| import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent; | ||||
| import com.gmail.nossr50.skills.alchemy.Alchemy; | ||||
| @@ -39,7 +39,7 @@ public class AlchemyBrewTask extends BukkitRunnable { | ||||
|         brewTimer = DEFAULT_BREW_TICKS; | ||||
|  | ||||
|         if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)) { | ||||
|             double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkill.ALCHEMY)); | ||||
|             double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY)); | ||||
|  | ||||
|             McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis); | ||||
|             mcMMO.p.getServer().getPluginManager().callEvent(event); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.runnables.skills; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.LivingEntity; | ||||
| import org.bukkit.scheduler.BukkitRunnable; | ||||
|  | ||||
| @@ -10,14 +10,14 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| public class AwardCombatXpTask extends BukkitRunnable { | ||||
|     private McMMOPlayer mcMMOPlayer; | ||||
|     private double baseXp; | ||||
|     private PrimarySkill primarySkill; | ||||
|     private PrimarySkillType primarySkillType; | ||||
|     private LivingEntity target; | ||||
|     private XPGainReason xpGainReason; | ||||
|     private double baseHealth; | ||||
|  | ||||
|     public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, PrimarySkill primarySkill, double baseXp, LivingEntity target, XPGainReason xpGainReason) { | ||||
|     public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, double baseXp, LivingEntity target, XPGainReason xpGainReason) { | ||||
|         this.mcMMOPlayer = mcMMOPlayer; | ||||
|         this.primarySkill = primarySkill; | ||||
|         this.primarySkillType = primarySkillType; | ||||
|         this.baseXp = baseXp; | ||||
|         this.target = target; | ||||
|         this.xpGainReason = xpGainReason; | ||||
| @@ -39,6 +39,6 @@ public class AwardCombatXpTask extends BukkitRunnable { | ||||
|             damage += health; | ||||
|         } | ||||
|  | ||||
|         mcMMOPlayer.beginXpGain(primarySkill, (int) (damage * baseXp), xpGainReason); | ||||
|         mcMMOPlayer.beginXpGain(primarySkillType, (int) (damage * baseXp), xpGainReason); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.gmail.nossr50.skills; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.entity.Entity; | ||||
| import org.bukkit.entity.LivingEntity; | ||||
| import org.bukkit.entity.Player; | ||||
| @@ -12,9 +12,9 @@ import com.gmail.nossr50.util.skills.PerksUtils; | ||||
| public abstract class SkillManager { | ||||
|     protected McMMOPlayer mcMMOPlayer; | ||||
|     protected int activationChance; | ||||
|     protected PrimarySkill skill; | ||||
|     protected PrimarySkillType skill; | ||||
|  | ||||
|     public SkillManager(McMMOPlayer mcMMOPlayer, PrimarySkill skill) { | ||||
|     public SkillManager(McMMOPlayer mcMMOPlayer, PrimarySkillType skill) { | ||||
|         this.mcMMOPlayer = mcMMOPlayer; | ||||
|         this.activationChance = PerksUtils.handleLuckyPerks(mcMMOPlayer.getPlayer(), skill); | ||||
|         this.skill = skill; | ||||
|   | ||||
| @@ -1,20 +1,13 @@ | ||||
| package com.gmail.nossr50.skills.acrobatics; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.interactions.NotificationType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.listeners.InteractionManager; | ||||
| import com.gmail.nossr50.util.skills.SkillActivationType; | ||||
| import org.bukkit.Location; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.enchantments.Enchantment; | ||||
| import org.bukkit.entity.Entity; | ||||
| import org.bukkit.entity.LightningStrike; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.SkillManager; | ||||
| @@ -26,7 +19,7 @@ import com.gmail.nossr50.util.skills.SkillUtils; | ||||
| public class AcrobaticsManager extends SkillManager { | ||||
|  | ||||
|     public AcrobaticsManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.ACROBATICS); | ||||
|         super(mcMMOPlayer, PrimarySkillType.ACROBATICS); | ||||
|     } | ||||
|  | ||||
|     public boolean canDodge(Entity damager) { | ||||
|   | ||||
| @@ -2,12 +2,12 @@ package com.gmail.nossr50.skills.alchemy; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.config.skills.alchemy.PotionConfig; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; | ||||
| import com.gmail.nossr50.skills.SkillManager; | ||||
| @@ -17,7 +17,7 @@ public class AlchemyManager extends SkillManager { | ||||
|     private final double LUCKY_MODIFIER = 4.0 / 3.0; | ||||
|  | ||||
|     public AlchemyManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.ALCHEMY); | ||||
|         super(mcMMOPlayer, PrimarySkillType.ALCHEMY); | ||||
|     } | ||||
|  | ||||
|     public int getTier() { | ||||
|   | ||||
| @@ -11,7 +11,7 @@ import org.bukkit.potion.PotionEffectType; | ||||
|  | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.SkillManager; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| @@ -21,7 +21,7 @@ import com.gmail.nossr50.util.skills.SkillUtils; | ||||
|  | ||||
| public class ArcheryManager extends SkillManager { | ||||
|     public ArcheryManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.ARCHERY); | ||||
|         super(mcMMOPlayer, PrimarySkillType.ARCHERY); | ||||
|     } | ||||
|  | ||||
|     public boolean canDaze(LivingEntity target) { | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.axes; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.util.skills.*; | ||||
| @@ -11,7 +12,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.ToolType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.SkillManager; | ||||
| @@ -21,7 +21,7 @@ import com.gmail.nossr50.util.player.UserManager; | ||||
|  | ||||
| public class AxesManager extends SkillManager { | ||||
|     public AxesManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.AXES); | ||||
|         super(mcMMOPlayer, PrimarySkillType.AXES); | ||||
|     } | ||||
|  | ||||
|     public boolean canUseAxeMastery() { | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.child; | ||||
|  | ||||
| import java.util.EnumSet; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.configuration.file.YamlConfiguration; | ||||
|  | ||||
| import com.gmail.nossr50.config.AutoUpdateConfigLoader; | ||||
| @@ -20,15 +20,15 @@ public class ChildConfig extends AutoUpdateConfigLoader { | ||||
|  | ||||
|         FamilyTree.clearRegistrations(); // when reloading, need to clear statics | ||||
|  | ||||
|         for (PrimarySkill skill : PrimarySkill.CHILD_SKILLS) { | ||||
|         for (PrimarySkillType skill : PrimarySkillType.CHILD_SKILLS) { | ||||
|             plugin.debug("Finding parents of " + skill.name()); | ||||
|  | ||||
|             EnumSet<PrimarySkill> parentSkills = EnumSet.noneOf(PrimarySkill.class); | ||||
|             EnumSet<PrimarySkillType> parentSkills = EnumSet.noneOf(PrimarySkillType.class); | ||||
|             boolean useDefaults = false; // If we had an error we back out and use defaults | ||||
|  | ||||
|             for (String name : config.getStringList(StringUtils.getCapitalized(skill.name()))) { | ||||
|                 try { | ||||
|                     PrimarySkill parentSkill = PrimarySkill.valueOf(name.toUpperCase()); | ||||
|                     PrimarySkillType parentSkill = PrimarySkillType.valueOf(name.toUpperCase()); | ||||
|                     FamilyTree.enforceNotChildSkill(parentSkill); | ||||
|                     parentSkills.add(parentSkill); | ||||
|                 } | ||||
| @@ -46,12 +46,12 @@ public class ChildConfig extends AutoUpdateConfigLoader { | ||||
|                      * If they're dedicated enough to have modified it, they can have the errors it may produce. | ||||
|                      * Alternatively, this can be used to allow child skills to be parent skills, provided there are no circular dependencies this is an advanced sort of configuration. | ||||
|                      */ | ||||
|                     parentSkills.add(PrimarySkill.valueOf(name.toUpperCase())); | ||||
|                     parentSkills.add(PrimarySkillType.valueOf(name.toUpperCase())); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             // Register them | ||||
|             for (PrimarySkill parentSkill : parentSkills) { | ||||
|             for (PrimarySkillType parentSkill : parentSkills) { | ||||
|                 plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name()); | ||||
|                 FamilyTree.registerParent(skill, parentSkill); | ||||
|             } | ||||
|   | ||||
| @@ -5,32 +5,32 @@ import java.util.EnumSet; | ||||
| import java.util.HashMap; | ||||
| import java.util.Set; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
|  | ||||
| public class FamilyTree { | ||||
|     private static HashMap<PrimarySkill, Set<PrimarySkill>> tree = new HashMap<PrimarySkill, Set<PrimarySkill>>(); | ||||
|     private static HashMap<PrimarySkillType, Set<PrimarySkillType>> tree = new HashMap<PrimarySkillType, Set<PrimarySkillType>>(); | ||||
|  | ||||
|     public static Set<PrimarySkill> getParents(PrimarySkill childSkill) { | ||||
|     public static Set<PrimarySkillType> getParents(PrimarySkillType childSkill) { | ||||
|         enforceChildSkill(childSkill); | ||||
|  | ||||
|         // We do not check if we have the child skill in question, as not having it would mean we did something wrong, and an NPE is desired. | ||||
|         return tree.get(childSkill); | ||||
|     } | ||||
|  | ||||
|     protected static void registerParent(PrimarySkill childSkill, PrimarySkill parentSkill) { | ||||
|     protected static void registerParent(PrimarySkillType childSkill, PrimarySkillType parentSkill) { | ||||
|         enforceChildSkill(childSkill); | ||||
|         enforceNotChildSkill(parentSkill); | ||||
|  | ||||
|         if (!tree.containsKey(childSkill)) { | ||||
|             tree.put(childSkill, EnumSet.noneOf(PrimarySkill.class)); | ||||
|             tree.put(childSkill, EnumSet.noneOf(PrimarySkillType.class)); | ||||
|         } | ||||
|  | ||||
|         tree.get(childSkill).add(parentSkill); | ||||
|     } | ||||
|  | ||||
|     protected static void closeRegistration() { | ||||
|         for (PrimarySkill childSkill : tree.keySet()) { | ||||
|             Set<PrimarySkill> immutableSet = Collections.unmodifiableSet(tree.get(childSkill)); | ||||
|         for (PrimarySkillType childSkill : tree.keySet()) { | ||||
|             Set<PrimarySkillType> immutableSet = Collections.unmodifiableSet(tree.get(childSkill)); | ||||
|             tree.put(childSkill, immutableSet); | ||||
|         } | ||||
|     } | ||||
| @@ -39,13 +39,13 @@ public class FamilyTree { | ||||
|         tree.clear(); | ||||
|     } | ||||
|  | ||||
|     protected static void enforceChildSkill(PrimarySkill skill) { | ||||
|     protected static void enforceChildSkill(PrimarySkillType skill) { | ||||
|         if (!skill.isChildSkill()) { | ||||
|             throw new IllegalArgumentException(skill.name() + " is not a child skill!"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected static void enforceNotChildSkill(PrimarySkill skill) { | ||||
|     protected static void enforceNotChildSkill(PrimarySkillType skill) { | ||||
|         if (skill.isChildSkill()) { | ||||
|             throw new IllegalArgumentException(skill.name() + " is a child skill!"); | ||||
|         } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.excavation; | ||||
|  | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.config.treasure.TreasureConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.util.StringUtils; | ||||
| @@ -26,7 +26,7 @@ public class Excavation { | ||||
|     } | ||||
|  | ||||
|     protected static int getBlockXP(BlockState blockState) { | ||||
|         int xp = ExperienceConfig.getInstance().getXp(PrimarySkill.EXCAVATION, blockState.getType()); | ||||
|         int xp = ExperienceConfig.getInstance().getXp(PrimarySkillType.EXCAVATION, blockState.getType()); | ||||
|  | ||||
|         if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) { | ||||
|             xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.excavation; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import org.bukkit.Location; | ||||
| import org.bukkit.block.BlockState; | ||||
|  | ||||
| @@ -18,7 +18,7 @@ import com.gmail.nossr50.util.skills.SkillUtils; | ||||
|  | ||||
| public class ExcavationManager extends SkillManager { | ||||
|     public ExcavationManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.EXCAVATION); | ||||
|         super(mcMMOPlayer, PrimarySkillType.EXCAVATION); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.config.treasure.TreasureConfig; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure; | ||||
| @@ -50,7 +50,7 @@ public class FishingManager extends SkillManager { | ||||
|     private Location hookLocation; | ||||
|  | ||||
|     public FishingManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.FISHING); | ||||
|         super(mcMMOPlayer, PrimarySkillType.FISHING); | ||||
|     } | ||||
|  | ||||
|     public boolean canShake(Entity target) { | ||||
| @@ -281,7 +281,7 @@ public class FishingManager extends SkillManager { | ||||
|      */ | ||||
|     public void handleFishing(Item fishingCatch) { | ||||
|         this.fishingCatch = fishingCatch; | ||||
|         int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkill.FISHING, fishingCatch.getItemStack().getType()); | ||||
|         int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkillType.FISHING, fishingCatch.getItemStack().getType()); | ||||
|         int treasureXp = 0; | ||||
|         Player player = getPlayer(); | ||||
|         FishingTreasure treasure = null; | ||||
|   | ||||
| @@ -28,7 +28,7 @@ import java.util.List; | ||||
|  | ||||
| public class HerbalismManager extends SkillManager { | ||||
|     public HerbalismManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.HERBALISM); | ||||
|         super(mcMMOPlayer, PrimarySkillType.HERBALISM); | ||||
|     } | ||||
|  | ||||
|     public boolean canBlockCheck() { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| package com.gmail.nossr50.skills.mining; | ||||
|  | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| import org.bukkit.Material; | ||||
| @@ -16,7 +16,7 @@ public class Mining { | ||||
|      * @param blockState The {@link BlockState} to check ability activation for | ||||
|      */ | ||||
|     public static int getBlockXp(BlockState blockState) { | ||||
|         int xp = ExperienceConfig.getInstance().getXp(PrimarySkill.MINING, blockState.getType()); | ||||
|         int xp = ExperienceConfig.getInstance().getXp(PrimarySkillType.MINING, blockState.getType()); | ||||
|  | ||||
|         if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) { | ||||
|             xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); | ||||
|   | ||||
| @@ -3,8 +3,8 @@ package com.gmail.nossr50.skills.mining; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.interactions.NotificationType; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -31,7 +31,7 @@ import java.util.List; | ||||
|  | ||||
| public class MiningManager extends SkillManager { | ||||
|     public MiningManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.MINING); | ||||
|         super(mcMMOPlayer, PrimarySkillType.MINING); | ||||
|     } | ||||
|  | ||||
|     public boolean canUseDemolitionsExpertise() { | ||||
|   | ||||
| @@ -3,8 +3,8 @@ package com.gmail.nossr50.skills.repair; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -20,7 +20,6 @@ import com.gmail.nossr50.util.skills.SkillUtils; | ||||
| import com.gmail.nossr50.util.sounds.SoundManager; | ||||
| import com.gmail.nossr50.util.sounds.SoundType; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.enchantments.Enchantment; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| @@ -34,7 +33,7 @@ public class RepairManager extends SkillManager { | ||||
|     private int     lastClick; | ||||
|  | ||||
|     public RepairManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.REPAIR); | ||||
|         super(mcMMOPlayer, PrimarySkillType.REPAIR); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.salvage; | ||||
|  | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.skills.SkillManager; | ||||
| @@ -17,7 +17,6 @@ import com.gmail.nossr50.util.sounds.SoundManager; | ||||
| import com.gmail.nossr50.util.sounds.SoundType; | ||||
| import org.bukkit.Location; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.Sound; | ||||
| import org.bukkit.enchantments.Enchantment; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| @@ -31,7 +30,7 @@ public class SalvageManager extends SkillManager { | ||||
|     private int     lastClick; | ||||
|  | ||||
|     public SalvageManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.SALVAGE); | ||||
|         super(mcMMOPlayer, PrimarySkillType.SALVAGE); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.smelting; | ||||
|  | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
|  | ||||
| @@ -44,6 +44,6 @@ public class Smelting { | ||||
|     public static double fluxMiningChance      = AdvancedConfig.getInstance().getFluxMiningChance(); | ||||
|  | ||||
|     protected static int getResourceXp(ItemStack smelting) { | ||||
|         return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(PrimarySkill.SMELTING, smelting.getType()); | ||||
|         return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(PrimarySkillType.SMELTING, smelting.getType()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.skills.smelting; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillWeightedActivationCheckEvent; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| @@ -34,7 +34,7 @@ import java.util.List; | ||||
|  | ||||
| public class SmeltingManager extends SkillManager { | ||||
|     public SmeltingManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.SMELTING); | ||||
|         super(mcMMOPlayer, PrimarySkillType.SMELTING); | ||||
|     } | ||||
|  | ||||
|     public boolean canUseFluxMining(BlockState blockState) { | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.swords; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.util.skills.SkillActivationType; | ||||
| @@ -24,7 +24,7 @@ import com.gmail.nossr50.util.skills.SkillUtils; | ||||
|  | ||||
| public class SwordsManager extends SkillManager { | ||||
|     public SwordsManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.SWORDS); | ||||
|         super(mcMMOPlayer, PrimarySkillType.SWORDS); | ||||
|     } | ||||
|  | ||||
|     public boolean canActivateAbility() { | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.interactions.NotificationType; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.events.fake.FakeEntityTameEvent; | ||||
| @@ -33,7 +33,7 @@ import java.util.List; | ||||
|  | ||||
| public class TamingManager extends SkillManager { | ||||
|     public TamingManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.TAMING); | ||||
|         super(mcMMOPlayer, PrimarySkillType.TAMING); | ||||
|     } | ||||
|  | ||||
|     private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<EntityType, List<TrackedTamingEntity>>(); | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.ToolType; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -26,7 +26,7 @@ import org.bukkit.block.data.BlockData; | ||||
|  | ||||
| public class UnarmedManager extends SkillManager { | ||||
|     public UnarmedManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.UNARMED); | ||||
|         super(mcMMOPlayer, PrimarySkillType.UNARMED); | ||||
|     } | ||||
|  | ||||
|     public boolean canActivateAbility() { | ||||
|   | ||||
| @@ -3,7 +3,7 @@ package com.gmail.nossr50.skills.woodcutting; | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.util.BlockUtils; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| @@ -43,7 +43,7 @@ public final class Woodcutting { | ||||
|             return mcMMO.getModManager().getBlock(blockState).getXpGain(); | ||||
|         } | ||||
|  | ||||
|         return ExperienceConfig.getInstance().getXp(PrimarySkill.WOODCUTTING, blockState.getType()); | ||||
|         return ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.mods.CustomBlock; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| @@ -26,7 +26,7 @@ import java.util.Set; | ||||
| public class WoodcuttingManager extends SkillManager { | ||||
|  | ||||
|     public WoodcuttingManager(McMMOPlayer mcMMOPlayer) { | ||||
|         super(mcMMOPlayer, PrimarySkill.WOODCUTTING); | ||||
|         super(mcMMOPlayer, PrimarySkillType.WOODCUTTING); | ||||
|     } | ||||
|  | ||||
|     public boolean canUseLeafBlower(ItemStack heldItem) { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| package com.gmail.nossr50.util; | ||||
|  | ||||
| import com.gmail.nossr50.config.experience.ExperienceConfig; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.skills.repair.Repair; | ||||
| import com.gmail.nossr50.skills.salvage.Salvage; | ||||
| @@ -172,7 +172,7 @@ public final class BlockUtils { | ||||
|      * @return true if the block should affected by Green Terra, false otherwise | ||||
|      */ | ||||
|     public static boolean affectedByGreenTerra(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkill.HERBALISM, blockState.getBlockData())) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkillType.HERBALISM, blockState.getBlockData())) { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
| @@ -188,7 +188,7 @@ public final class BlockUtils { | ||||
|      *         otherwise | ||||
|      */ | ||||
|     public static Boolean affectedBySuperBreaker(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkill.MINING, blockState.getBlockData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkillType.MINING, blockState.getBlockData())) | ||||
|             return true; | ||||
|  | ||||
|         return isOre(blockState) || mcMMO.getModManager().isCustomMiningBlock(blockState); | ||||
| @@ -203,7 +203,7 @@ public final class BlockUtils { | ||||
|      *         otherwise | ||||
|      */ | ||||
|     public static boolean affectedByGigaDrillBreaker(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkill.EXCAVATION, blockState.getBlockData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkillType.EXCAVATION, blockState.getBlockData())) | ||||
|             return true; | ||||
|         return mcMMO.getModManager().isCustomExcavationBlock(blockState); | ||||
|     } | ||||
| @@ -216,7 +216,7 @@ public final class BlockUtils { | ||||
|      * @return true if the block is a log, false otherwise | ||||
|      */ | ||||
|     public static boolean isLog(BlockState blockState) { | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkill.WOODCUTTING, blockState.getBlockData())) | ||||
|         if (ExperienceConfig.getInstance().isSkillBlock(PrimarySkillType.WOODCUTTING, blockState.getBlockData())) | ||||
|             return true; | ||||
|         return mcMMO.getModManager().isCustomLog(blockState); | ||||
|     } | ||||
|   | ||||
| @@ -3,9 +3,9 @@ package com.gmail.nossr50.util; | ||||
| import com.gmail.nossr50.datatypes.party.Party; | ||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||
| import com.gmail.nossr50.datatypes.player.PlayerProfile; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkill; | ||||
| import com.gmail.nossr50.datatypes.skills.XPGainReason; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||
| import com.gmail.nossr50.events.experience.McMMOPlayerLevelChangeEvent; | ||||
| @@ -140,7 +140,7 @@ public class EventUtils { | ||||
|      * Others | ||||
|      */ | ||||
|  | ||||
|     public static McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkill skill) { | ||||
|     public static McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) { | ||||
|         McMMOPlayerAbilityActivateEvent event = new McMMOPlayerAbilityActivateEvent(player, skill); | ||||
|         mcMMO.p.getServer().getPluginManager().callEvent(event); | ||||
|  | ||||
| @@ -181,7 +181,7 @@ public class EventUtils { | ||||
|         return event; | ||||
|     } | ||||
|  | ||||
|     public static boolean handleLevelChangeEvent(Player player, PrimarySkill skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { | ||||
|     public static boolean handleLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { | ||||
|         McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); | ||||
|         mcMMO.p.getServer().getPluginManager().callEvent(event); | ||||
|  | ||||
| @@ -268,7 +268,7 @@ public class EventUtils { | ||||
|         return !isCancelled; | ||||
|     } | ||||
|  | ||||
|     public static boolean handleXpGainEvent(Player player, PrimarySkill skill, float xpGained, XPGainReason xpGainReason) { | ||||
|     public static boolean handleXpGainEvent(Player player, PrimarySkillType skill, float xpGained, XPGainReason xpGainReason) { | ||||
|         McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skill, xpGained, xpGainReason); | ||||
|         mcMMO.p.getServer().getPluginManager().callEvent(event); | ||||
|  | ||||
| @@ -293,19 +293,19 @@ public class EventUtils { | ||||
|             experienceChanged = event.getExperienceChanged(); | ||||
|             PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile(); | ||||
|  | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 String skillName = primarySkill.toString(); | ||||
|                 int playerSkillLevel = playerProfile.getSkillLevel(primarySkill); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 String skillName = primarySkillType.toString(); | ||||
|                 int playerSkillLevel = playerProfile.getSkillLevel(primarySkillType); | ||||
|  | ||||
|                 playerProfile.modifySkill(primarySkill, playerSkillLevel - levelChanged.get(skillName)); | ||||
|                 playerProfile.removeXp(primarySkill, experienceChanged.get(skillName)); | ||||
|                 playerProfile.modifySkill(primarySkillType, playerSkillLevel - levelChanged.get(skillName)); | ||||
|                 playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName)); | ||||
|  | ||||
|                 if (playerProfile.getSkillXpLevel(primarySkill) < 0) { | ||||
|                     playerProfile.setSkillXpLevel(primarySkill, 0); | ||||
|                 if (playerProfile.getSkillXpLevel(primarySkillType) < 0) { | ||||
|                     playerProfile.setSkillXpLevel(primarySkillType, 0); | ||||
|                 } | ||||
|  | ||||
|                 if (playerProfile.getSkillLevel(primarySkill) < 0) { | ||||
|                     playerProfile.modifySkill(primarySkill, 0); | ||||
|                 if (playerProfile.getSkillLevel(primarySkillType) < 0) { | ||||
|                     playerProfile.modifySkill(primarySkillType, 0); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -331,22 +331,22 @@ public class EventUtils { | ||||
|             McMMOPlayer killerPlayer = UserManager.getPlayer(killer); | ||||
|             PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile(); | ||||
|  | ||||
|             for (PrimarySkill primarySkill : PrimarySkill.NON_CHILD_SKILLS) { | ||||
|                 String skillName = primarySkill.toString(); | ||||
|                 int victimSkillLevel = victimProfile.getSkillLevel(primarySkill); | ||||
|             for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { | ||||
|                 String skillName = primarySkillType.toString(); | ||||
|                 int victimSkillLevel = victimProfile.getSkillLevel(primarySkillType); | ||||
|  | ||||
|                 killerPlayer.addLevels(primarySkill, levelChangedKiller.get(skillName)); | ||||
|                 killerPlayer.beginUnsharedXpGain(primarySkill, experienceChangedKiller.get(skillName), XPGainReason.VAMPIRISM); | ||||
|                 killerPlayer.addLevels(primarySkillType, levelChangedKiller.get(skillName)); | ||||
|                 killerPlayer.beginUnsharedXpGain(primarySkillType, experienceChangedKiller.get(skillName), XPGainReason.VAMPIRISM); | ||||
|  | ||||
|                 victimProfile.modifySkill(primarySkill, victimSkillLevel - levelChangedVictim.get(skillName)); | ||||
|                 victimProfile.removeXp(primarySkill, experienceChangedVictim.get(skillName)); | ||||
|                 victimProfile.modifySkill(primarySkillType, victimSkillLevel - levelChangedVictim.get(skillName)); | ||||
|                 victimProfile.removeXp(primarySkillType, experienceChangedVictim.get(skillName)); | ||||
|  | ||||
|                 if (victimProfile.getSkillXpLevel(primarySkill) < 0) { | ||||
|                     victimProfile.setSkillXpLevel(primarySkill, 0); | ||||
|                 if (victimProfile.getSkillXpLevel(primarySkillType) < 0) { | ||||
|                     victimProfile.setSkillXpLevel(primarySkillType, 0); | ||||
|                 } | ||||
|  | ||||
|                 if (victimProfile.getSkillLevel(primarySkill) < 0) { | ||||
|                     victimProfile.modifySkill(primarySkill, 0); | ||||
|                 if (victimProfile.getSkillLevel(primarySkillType) < 0) { | ||||
|                     victimProfile.modifySkill(primarySkillType, 0); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -355,7 +355,7 @@ public class EventUtils { | ||||
|     } | ||||
|  | ||||
|     public static McMMOPlayerAbilityDeactivateEvent callAbilityDeactivateEvent(Player player, SuperAbilityType ability) { | ||||
|         McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, PrimarySkill.byAbility(ability)); | ||||
|         McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, PrimarySkillType.byAbility(ability)); | ||||
|         mcMMO.p.getServer().getPluginManager().callEvent(event); | ||||
|  | ||||
|         return event; | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50