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 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 custom tools not properly respecting the Ability_Enabled flag.
Version 1.3.09
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)

View File

@ -207,14 +207,7 @@ public class BlockListener implements Listener {
}
if (PP.getAbilityMode(AbilityType.TREE_FELLER) && permInstance.treeFeller(player) && ItemChecks.isAxe(inHand)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
WoodCutting.treeFeller(event);
}
}
else {
WoodCutting.treeFeller(event);
}
WoodCutting.treeFeller(event);
}
}
@ -309,29 +302,12 @@ public class BlockListener implements Listener {
* ABILITY TRIGGER CHECKS
*/
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);
}
}
else {
Herbalism.greenTerra(player, block);
}
Herbalism.greenTerra(player, block);
}
else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
if (configInstance.getExcavationRequiresTool()) {
if (ItemChecks.isShovel(inHand)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block);
}
}
else {
event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block);
}
}
if (configInstance.getExcavationRequiresTool() && ItemChecks.isShovel(inHand)) {
event.setInstaBreak(true);
Excavation.gigaDrillBreaker(player, block);
}
else {
event.setInstaBreak(true);
@ -351,19 +327,9 @@ public class BlockListener implements Listener {
}
}
else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
if (configInstance.getMiningRequiresTool()) {
if (ItemChecks.isPickaxe(inHand)) {
if (ModChecks.isCustomTool(inHand)) {
if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
event.setInstaBreak(true);
Mining.superBreakerBlockCheck(player, block);
}
}
else {
event.setInstaBreak(true);
Mining.superBreakerBlockCheck(player, block);
}
}
if (configInstance.getMiningRequiresTool() && ItemChecks.isPickaxe(inHand)) {
event.setInstaBreak(true);
Mining.superBreakerBlockCheck(player, block);
}
else {
event.setInstaBreak(true);

View File

@ -323,12 +323,6 @@ public class Combat {
* @param type The type of skill being used
*/
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 damageAmount = damage;

View File

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