Fishing stats are now hidden until skill is unlocked

This commit is contained in:
nossr50 2019-01-15 03:16:21 -08:00
parent 427d8c3b21
commit 1aa4df01f9
8 changed files with 38 additions and 34 deletions

View File

@ -35,8 +35,8 @@ public class AcrobaticsCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canDodge = Permissions.isSubSkillEnabled(player, SubSkillType.ACROBATICS_DODGE); canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
canRoll = Permissions.isSubSkillEnabled(player, SubSkillType.ACROBATICS_ROLL); canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
} }
@Override @Override

View File

@ -61,8 +61,8 @@ public class AlchemyCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canCatalysis = Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS); canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS);
canConcoctions = Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS); canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
} }
@Override @Override
@ -85,21 +85,12 @@ public class AlchemyCommand extends SkillCommand {
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<String>();
if (canCatalysis) { if (canCatalysis) {
int unlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel(); messages.add(LocaleLoader.getString("Alchemy.Catalysis.Speed", brewSpeed) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : ""));
if (skillValue < unlockLevel) {
//messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Alchemy.Ability.Locked.0", unlockLevel)));
}
else {
messages.add(LocaleLoader.getString("Alchemy.Catalysis.Speed", brewSpeed) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : ""));
}
} }
if (canConcoctions) { if (canConcoctions) {
if(RankUtils.hasUnlockedSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS)) { messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, Tier.values().length));
messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, Tier.values().length)); messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList));
messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList));
}
} }
return messages; return messages;

View File

@ -53,9 +53,9 @@ public class ArcheryCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSkillShot = Permissions.isSubSkillEnabled(player, SubSkillType.ARCHERY_SKILL_SHOT) && RankUtils.hasUnlockedSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT); canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT);
canDaze = Permissions.isSubSkillEnabled(player, SubSkillType.ARCHERY_DAZE); canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE);
canRetrieve = Permissions.isSubSkillEnabled(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
} }
@Override @Override

View File

@ -62,10 +62,10 @@ public class AxesCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER); canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
canCritical = Permissions.isSubSkillEnabled(player, SubSkillType.AXES_CRITICAL_STRIKES); canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES);
canAxeMastery = Permissions.isSubSkillEnabled(player, SubSkillType.AXES_AXE_MASTERY) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_AXE_MASTERY); canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY);
canImpact = Permissions.isSubSkillEnabled(player, SubSkillType.AXES_ARMOR_IMPACT) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_ARMOR_IMPACT); canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT);
canGreaterImpact = Permissions.isSubSkillEnabled(player, SubSkillType.AXES_GREATER_IMPACT); canGreaterImpact = canUseSubskill(player, SubSkillType.AXES_GREATER_IMPACT);
} }
@Override @Override

View File

@ -36,7 +36,7 @@ public class ExcavationCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER); canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
canTreasureHunt = Permissions.isSubSkillEnabled(player, SubSkillType.EXCAVATION_TREASURE_HUNTER) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_TREASURE_HUNTER); canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_TREASURE_HUNTER);
} }
@Override @Override

View File

@ -12,6 +12,7 @@ import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.RankUtils;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -112,12 +113,12 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canTreasureHunt = Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER); canTreasureHunt = canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
canMagicHunt = Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_MAGIC_HUNTER); canMagicHunt = canUseSubskill(player, SubSkillType.FISHING_MAGIC_HUNTER);
canShake = Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_SHAKE); canShake = canUseSubskill(player, SubSkillType.FISHING_SHAKE);
canFishermansDiet = Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET); canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET);
canMasterAngler = Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_MASTER_ANGLER); canMasterAngler = canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER);
canIceFish = Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_ICE_FISHING); canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING);
} }
@Override @Override

View File

@ -14,6 +14,7 @@ import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.PerksUtils; import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
@ -219,4 +220,15 @@ public abstract class SkillCommand implements TabExecutor {
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky); protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
protected abstract List<TextComponent> getTextComponents(Player player); protected abstract List<TextComponent> getTextComponents(Player player);
/**
* Checks if a player can use a skill
* @param player target player
* @param subSkillType target subskill
* @return true if the player has permission and has the skill unlocked
*/
protected boolean canUseSubskill(Player player, SubSkillType subSkillType)
{
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
}
} }

View File

@ -31,11 +31,11 @@ public enum SubSkillType {
EXCAVATION_GIGA_DRILL_BREAKER(1), EXCAVATION_GIGA_DRILL_BREAKER(1),
/* Fishing */ /* Fishing */
FISHING_FISHERMANS_DIET, FISHING_FISHERMANS_DIET(5),
FISHING_TREASURE_HUNTER, FISHING_TREASURE_HUNTER(8),
FISHING_ICE_FISHING, FISHING_ICE_FISHING(1),
FISHING_MAGIC_HUNTER, FISHING_MAGIC_HUNTER,
FISHING_MASTER_ANGLER, FISHING_MASTER_ANGLER(1),
FISHING_SHAKE, FISHING_SHAKE,
/* Herbalism */ /* Herbalism */