Make repair & salvage respect the sneaking settings. Fixes #1108

This commit is contained in:
GJ 2013-05-21 22:34:06 -04:00
parent 9a5f4b638f
commit f21fbe2d40

View File

@ -343,6 +343,7 @@ public class PlayerListener implements Listener {
case RIGHT_CLICK_BLOCK: case RIGHT_CLICK_BLOCK:
int blockID = block.getTypeId(); int blockID = block.getTypeId();
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
/* REPAIR CHECKS */ /* REPAIR CHECKS */
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) { if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager(); RepairManager repairManager = mcMMOPlayer.getRepairManager();
@ -365,6 +366,7 @@ public class PlayerListener implements Listener {
player.updateInventory(); player.updateInventory();
} }
} }
}
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
else if (miningManager.canDetonate()) { else if (miningManager.canDetonate()) {
if (blockID == Material.TNT.getId()) { if (blockID == Material.TNT.getId()) {
@ -380,6 +382,7 @@ public class PlayerListener implements Listener {
case LEFT_CLICK_BLOCK: case LEFT_CLICK_BLOCK:
blockID = block.getTypeId(); blockID = block.getTypeId();
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
/* REPAIR CHECKS */ /* REPAIR CHECKS */
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) { if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager(); RepairManager repairManager = mcMMOPlayer.getRepairManager();
@ -400,6 +403,7 @@ public class PlayerListener implements Listener {
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Salvage.Pretty.Name"))); player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Salvage.Pretty.Name")));
} }
} }
}
break; break;