From d48295bd72aa19254b59673f5b6c8590be3490a4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 15 Jan 2019 03:31:34 -0800 Subject: [PATCH] Mining & Herbalism stats are hidden until unlock --- .../nossr50/commands/skills/HerbalismCommand.java | 13 +++++++------ .../nossr50/commands/skills/MiningCommand.java | 9 +++++---- .../com/gmail/nossr50/datatypes/json/McMMOUrl.java | 2 -- .../skills => datatypes/json}/McMMOWebLinks.java | 2 +- .../gmail/nossr50/util/TextComponentFactory.java | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) rename src/main/java/com/gmail/nossr50/{commands/skills => datatypes/json}/McMMOWebLinks.java (96%) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index a0a7b5996..97c891c35 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.herbalism.Herbalism; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; +import com.gmail.nossr50.util.skills.RankUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -86,13 +87,13 @@ public class HerbalismCommand extends SkillCommand { @Override protected void permissionsCheck(Player player) { - hasHylianLuck = Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_HYLIAN_LUCK); + hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK); canGreenTerra = Permissions.greenTerra(player); - canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA); - canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS); - canFarmersDiet = Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET); - canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); - canShroomThumb = Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB); + canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA); + canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS); + canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET); + canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); + canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index 2aa9a0ba7..86c203b71 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -10,6 +10,7 @@ import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.RankUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -70,11 +71,11 @@ public class MiningCommand extends SkillCommand { @Override protected void permissionsCheck(Player player) { - canBiggerBombs = Permissions.biggerBombs(player); - canBlast = Permissions.remoteDetonation(player); - canDemoExpert = Permissions.demolitionsExpertise(player); + canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.biggerBombs(player); + canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player); + canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.demolitionsExpertise(player); canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkillType.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); - canSuperBreaker = Permissions.superBreaker(player); + canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player); } @Override diff --git a/src/main/java/com/gmail/nossr50/datatypes/json/McMMOUrl.java b/src/main/java/com/gmail/nossr50/datatypes/json/McMMOUrl.java index 9ca9888df..4f4886aeb 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/json/McMMOUrl.java +++ b/src/main/java/com/gmail/nossr50/datatypes/json/McMMOUrl.java @@ -1,7 +1,5 @@ package com.gmail.nossr50.datatypes.json; -import com.gmail.nossr50.commands.skills.McMMOWebLinks; - public class McMMOUrl { public static final String urlWebsite = "https://www.mcmmo.org"; public static final String urlDiscord = "https://discord.gg/bJ7pFS9"; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/McMMOWebLinks.java b/src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java similarity index 96% rename from src/main/java/com/gmail/nossr50/commands/skills/McMMOWebLinks.java rename to src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java index a6918ac4d..d09bf5030 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/McMMOWebLinks.java +++ b/src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java @@ -1,4 +1,4 @@ -package com.gmail.nossr50.commands.skills; +package com.gmail.nossr50.datatypes.json; import com.gmail.nossr50.datatypes.json.McMMOUrl; import com.gmail.nossr50.locale.LocaleLoader; diff --git a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java index 74a8a31be..f97cf7b1a 100644 --- a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.util; -import com.gmail.nossr50.commands.skills.McMMOWebLinks; +import com.gmail.nossr50.datatypes.json.McMMOWebLinks; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.RankConfig;