From c1b12c027afc17c283760779485eac4c17611c93 Mon Sep 17 00:00:00 2001 From: shatteredbeam Date: Fri, 15 Feb 2013 13:32:23 -0800 Subject: [PATCH] Permissions class removed from Listeners --- .../nossr50/listeners/BlockListener.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index fe3df8f37..a6e8c8563 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -44,7 +44,6 @@ import com.gmail.nossr50.skills.woodcutting.Woodcutting; import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.ItemChecks; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; public class BlockListener implements Listener { @@ -152,7 +151,7 @@ public class BlockListener implements Listener { /* HERBALISM */ if (BlockChecks.canBeGreenTerra(block)) { /* Green Terra */ - if (profile.getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(player)) { + if (profile.getToolPreparationMode(ToolType.HOE) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) { SkillTools.abilityCheck(player, SkillType.HERBALISM); } @@ -160,7 +159,7 @@ public class BlockListener implements Listener { * 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 (Permissions.herbalism(player)) { + if (player.hasPermission("mcmmo.skills.herbalism")) { Herbalism.herbalismProcCheck(block, mcMMOPlayer, event, plugin); //Double drops if (profile.getAbilityMode(AbilityType.GREEN_TERRA)) { @@ -170,7 +169,7 @@ public class BlockListener implements Listener { } /* MINING */ - else if (BlockChecks.canBeSuperBroken(block) && Permissions.mining(player) && !mcMMO.placeStore.isTrue(block)) { + else if (BlockChecks.canBeSuperBroken(block) && player.hasPermission("mcmmo.skills.mining") && !mcMMO.placeStore.isTrue(block)) { if (Mining.requiresTool) { if (ItemChecks.isPickaxe(heldItem)) { MiningManager miningManager = new MiningManager(mcMMOPlayer); @@ -192,8 +191,8 @@ public class BlockListener implements Listener { } /* WOOD CUTTING */ - else if (BlockChecks.isLog(block) && Permissions.woodcutting(player) && !mcMMO.placeStore.isTrue(block)) { - if (profile.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(player) && ItemChecks.isAxe(heldItem)) { + else if (BlockChecks.isLog(block) && player.hasPermission("mcmmo.skills.woodcutting") && !mcMMO.placeStore.isTrue(block)) { + if (profile.getAbilityMode(AbilityType.TREE_FELLER) && player.hasPermission("mcmmo.ability.woodcutting.treefeller") && ItemChecks.isAxe(heldItem)) { Woodcutting.beginTreeFeller(mcMMOPlayer, block); } else { @@ -209,7 +208,7 @@ public class BlockListener implements Listener { } /* EXCAVATION */ - else if (BlockChecks.canBeGigaDrillBroken(block) && Permissions.excavation(player) && !mcMMO.placeStore.isTrue(block)) { + else if (BlockChecks.canBeGigaDrillBroken(block) && player.hasPermission("mcmmo.skills.excavation") && !mcMMO.placeStore.isTrue(block)) { if (Excavation.requiresTool) { if (ItemChecks.isShovel(heldItem)) { Excavation.excavationProcCheck(block, mcMMOPlayer); @@ -254,10 +253,10 @@ public class BlockListener implements Listener { Block block = event.getBlock(); ItemStack heldItem = player.getItemInHand(); - if (Permissions.hylianLuck(player) && ItemChecks.isSword(heldItem)) { + if (player.hasPermission("mcmmo.ability.herbalism.hylianluck") && ItemChecks.isSword(heldItem)) { Herbalism.hylianLuck(block, player, event); } - else if (BlockChecks.canBeFluxMined(block) && ItemChecks.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH) && Permissions.fluxMining(player) && !mcMMO.placeStore.isTrue(block)) { + else if (BlockChecks.canBeFluxMined(block) && ItemChecks.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH) && player.hasPermission("mcmmo.ability.smelting.fluxmining") && !mcMMO.placeStore.isTrue(block)) { SmeltingManager smeltingManager = new SmeltingManager(Users.getPlayer(player)); smeltingManager.fluxMining(event); } @@ -291,19 +290,19 @@ public class BlockListener implements Listener { if (BlockChecks.canActivateAbilities(block)) { ItemStack heldItem = player.getItemInHand(); - if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && Permissions.greenTerra(player)) { + if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) { SkillTools.abilityCheck(player, SkillType.HERBALISM); } - else if (profile.getToolPreparationMode(ToolType.AXE) && ItemChecks.isAxe(heldItem) && BlockChecks.isLog(block) && Permissions.treeFeller(player)) { + else if (profile.getToolPreparationMode(ToolType.AXE) && ItemChecks.isAxe(heldItem) && BlockChecks.isLog(block) && player.hasPermission("mcmmo.ability.woodcutting.treefeller")) { SkillTools.abilityCheck(player, SkillType.WOODCUTTING); } - else if (profile.getToolPreparationMode(ToolType.PICKAXE) && ItemChecks.isPickaxe(heldItem) && BlockChecks.canBeSuperBroken(block) && Permissions.superBreaker(player)) { + else if (profile.getToolPreparationMode(ToolType.PICKAXE) && ItemChecks.isPickaxe(heldItem) && BlockChecks.canBeSuperBroken(block) && player.hasPermission("mcmmo.ability.mining.superbreaker")) { SkillTools.abilityCheck(player, SkillType.MINING); } - else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemChecks.isShovel(heldItem) && BlockChecks.canBeGigaDrillBroken(block) && Permissions.gigaDrillBreaker(player)) { + else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemChecks.isShovel(heldItem) && BlockChecks.canBeGigaDrillBroken(block) && player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker")) { SkillTools.abilityCheck(player, SkillType.EXCAVATION); } - else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW || (block.getType() == Material.SMOOTH_BRICK && block.getData() == 0x0)) && Permissions.berserk(player)) { + else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW || (block.getType() == Material.SMOOTH_BRICK && block.getData() == 0x0)) && player.hasPermission("mcmmo.ability.unarmed.berserk")) { SkillTools.abilityCheck(player, SkillType.UNARMED); } } @@ -346,7 +345,7 @@ public class BlockListener implements Listener { * We don't need to check permissions here because they've already been checked for the ability to even activate. */ // Except right here, which is for the Green Thumb activation, not the normal effect of Green Terra - if (profile.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canMakeMossy(block) && Permissions.greenThumbBlocks(player)) { + if (profile.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canMakeMossy(block) && player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks")) { Herbalism.greenTerra(player, block); } else if (profile.getAbilityMode(AbilityType.BERSERK)) {