Fixed custom tools not handling the Ability_Enabled flag properly.

This commit is contained in:
GJ 2012-06-28 11:20:53 -04:00
parent 9789143c6d
commit 189f23f407
4 changed files with 14 additions and 49 deletions

View File

@ -18,6 +18,7 @@ Version 1.3.10-dev
= Fixed admin chat being seen by everyone = Fixed admin chat being seen by everyone
= Fixed issue with UTFDataFormatException occurring on occasion when trying to load Chunklets = Fixed issue with UTFDataFormatException occurring on occasion when trying to load Chunklets
= Fixed ArrayIndexOutOfBounds error caused when trying to use /xplock after logging in but before gaining XP = Fixed ArrayIndexOutOfBounds error caused when trying to use /xplock after logging in but before gaining XP
= Fixed custom tools not properly respecting the Ability_Enabled flag.
Version 1.3.09 Version 1.3.09
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating) + Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)

View File

@ -207,16 +207,9 @@ public class BlockListener implements Listener {
} }
if (PP.getAbilityMode(AbilityType.TREE_FELLER) && permInstance.treeFeller(player) && ItemChecks.isAxe(inHand)) { if (PP.getAbilityMode(AbilityType.TREE_FELLER) && permInstance.treeFeller(player) && ItemChecks.isAxe(inHand)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
WoodCutting.treeFeller(event); WoodCutting.treeFeller(event);
} }
} }
else {
WoodCutting.treeFeller(event);
}
}
}
/* EXCAVATION */ /* EXCAVATION */
else if (BlockChecks.canBeGigaDrillBroken(block) && permInstance.excavation(player) && !mcMMO.placeStore.isTrue(block)) { else if (BlockChecks.canBeGigaDrillBroken(block) && permInstance.excavation(player) && !mcMMO.placeStore.isTrue(block)) {
@ -309,30 +302,13 @@ public class BlockListener implements Listener {
* ABILITY TRIGGER CHECKS * ABILITY TRIGGER CHECKS
*/ */
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && permInstance.greenTerra(player) && BlockChecks.makeMossy(block)) { if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && permInstance.greenTerra(player) && BlockChecks.makeMossy(block)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
Herbalism.greenTerra(player, block); Herbalism.greenTerra(player, block);
} }
}
else {
Herbalism.greenTerra(player, block);
}
}
else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) { else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
if (configInstance.getExcavationRequiresTool()) { if (configInstance.getExcavationRequiresTool() && ItemChecks.isShovel(inHand)) {
if (ItemChecks.isShovel(inHand)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
event.setInstaBreak(true); event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block); Excavation.gigaDrillBreaker(player, block);
} }
}
else {
event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block);
}
}
}
else { else {
event.setInstaBreak(true); event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block); Excavation.gigaDrillBreaker(player, block);
@ -351,20 +327,10 @@ public class BlockListener implements Listener {
} }
} }
else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) { else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
if (configInstance.getMiningRequiresTool()) { if (configInstance.getMiningRequiresTool() && ItemChecks.isPickaxe(inHand)) {
if (ItemChecks.isPickaxe(inHand)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
event.setInstaBreak(true); event.setInstaBreak(true);
Mining.superBreakerBlockCheck(player, block); Mining.superBreakerBlockCheck(player, block);
} }
}
else {
event.setInstaBreak(true);
Mining.superBreakerBlockCheck(player, block);
}
}
}
else { else {
event.setInstaBreak(true); event.setInstaBreak(true);
Mining.superBreakerBlockCheck(player, block); Mining.superBreakerBlockCheck(player, block);

View File

@ -323,12 +323,6 @@ public class Combat {
* @param type The type of skill being used * @param type The type of skill being used
*/ */
public static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) { public static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) {
ItemStack inHand = attacker.getItemInHand();
if (ModChecks.isCustomTool(inHand) && !ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
return;
}
int numberOfTargets = Misc.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit int numberOfTargets = Misc.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
int damageAmount = damage; int damageAmount = damage;

View File

@ -101,6 +101,10 @@ public class Skills {
ToolType tool = skill.getTool(); ToolType tool = skill.getTool();
ItemStack inHand = player.getItemInHand(); ItemStack inHand = player.getItemInHand();
if (ModChecks.isCustomTool(inHand) && !ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
return;
}
/* Check if any abilities are active */ /* Check if any abilities are active */
if (!PP.getAbilityUse()) { if (!PP.getAbilityUse()) {
return; return;