Permissions class removed from Listeners

This commit is contained in:
shatteredbeam 2013-02-15 13:32:23 -08:00
parent 476ea80c4e
commit c1b12c027a

View File

@ -44,7 +44,6 @@ import com.gmail.nossr50.skills.woodcutting.Woodcutting;
import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.ItemChecks; import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class BlockListener implements Listener { public class BlockListener implements Listener {
@ -152,7 +151,7 @@ public class BlockListener implements Listener {
/* HERBALISM */ /* HERBALISM */
if (BlockChecks.canBeGreenTerra(block)) { if (BlockChecks.canBeGreenTerra(block)) {
/* Green Terra */ /* 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); 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. * We don't check the block store here because herbalism has too many unusual edge cases.
* Instead, we check it inside the drops handler. * Instead, we check it inside the drops handler.
*/ */
if (Permissions.herbalism(player)) { if (player.hasPermission("mcmmo.skills.herbalism")) {
Herbalism.herbalismProcCheck(block, mcMMOPlayer, event, plugin); //Double drops Herbalism.herbalismProcCheck(block, mcMMOPlayer, event, plugin); //Double drops
if (profile.getAbilityMode(AbilityType.GREEN_TERRA)) { if (profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
@ -170,7 +169,7 @@ public class BlockListener implements Listener {
} }
/* MINING */ /* 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 (Mining.requiresTool) {
if (ItemChecks.isPickaxe(heldItem)) { if (ItemChecks.isPickaxe(heldItem)) {
MiningManager miningManager = new MiningManager(mcMMOPlayer); MiningManager miningManager = new MiningManager(mcMMOPlayer);
@ -192,8 +191,8 @@ public class BlockListener implements Listener {
} }
/* WOOD CUTTING */ /* WOOD CUTTING */
else if (BlockChecks.isLog(block) && Permissions.woodcutting(player) && !mcMMO.placeStore.isTrue(block)) { else if (BlockChecks.isLog(block) && player.hasPermission("mcmmo.skills.woodcutting") && !mcMMO.placeStore.isTrue(block)) {
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(player) && ItemChecks.isAxe(heldItem)) { if (profile.getAbilityMode(AbilityType.TREE_FELLER) && player.hasPermission("mcmmo.ability.woodcutting.treefeller") && ItemChecks.isAxe(heldItem)) {
Woodcutting.beginTreeFeller(mcMMOPlayer, block); Woodcutting.beginTreeFeller(mcMMOPlayer, block);
} }
else { else {
@ -209,7 +208,7 @@ public class BlockListener implements Listener {
} }
/* EXCAVATION */ /* 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 (Excavation.requiresTool) {
if (ItemChecks.isShovel(heldItem)) { if (ItemChecks.isShovel(heldItem)) {
Excavation.excavationProcCheck(block, mcMMOPlayer); Excavation.excavationProcCheck(block, mcMMOPlayer);
@ -254,10 +253,10 @@ public class BlockListener implements Listener {
Block block = event.getBlock(); Block block = event.getBlock();
ItemStack heldItem = player.getItemInHand(); 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); 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 smeltingManager = new SmeltingManager(Users.getPlayer(player));
smeltingManager.fluxMining(event); smeltingManager.fluxMining(event);
} }
@ -291,19 +290,19 @@ public class BlockListener implements Listener {
if (BlockChecks.canActivateAbilities(block)) { if (BlockChecks.canActivateAbilities(block)) {
ItemStack heldItem = player.getItemInHand(); 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); 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); 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); 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); 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); 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. * 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 // 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); Herbalism.greenTerra(player, block);
} }
else if (profile.getAbilityMode(AbilityType.BERSERK)) { else if (profile.getAbilityMode(AbilityType.BERSERK)) {