Another small fix for mcMMO compatibility, also updated to 1.2

This commit is contained in:
H31IX committed 2012-06-02 13:55:46 -04:00
1 parent 4e27dacab3
commit b57883e795
6 files changed
+12 -9

No files matched your search

@@ -86,7 +86,7 @@ public class BlockListener extends EventListener
if(checkManager.willCheck(player, CheckType.LONG_REACH))
{
Distance distance = new Distance(player.getLocation(),block.getLocation());
if(backend.checkLongReachBlock(distance.getXDifference(),distance.getYDifference(),distance.getZDifference()))
if(backend.checkLongReachBlock(player,distance.getXDifference(),distance.getYDifference(),distance.getZDifference()))
{
event.setCancelled(true);
log("tried to break a block of "+block.getType().name()+" that was too far away.",player,CheckType.LONG_REACH);
@@ -18,8 +18,11 @@
package net.h31ix.anticheat.event;
import net.h31ix.anticheat.manage.Backend;
import net.h31ix.anticheat.manage.CheckManager;
import net.h31ix.anticheat.manage.CheckType;
import net.h31ix.anticheat.manage.Distance;
import net.h31ix.anticheat.util.Utilities;
import net.h31ix.anticheat.manage.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -123,8 +126,8 @@ public class PlayerListener extends EventListener
}
if(event.getClickedBlock() != null)
{
Distance distance = new Distance(event.getPlayer().getLocation(), event.getClickedBlock().getLocation());
backend.checkLongReachBlock(distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
Distance distance = new Distance(player.getLocation(), event.getClickedBlock().getLocation());
backend.checkLongReachBlock(player,distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
}
}
@@ -140,9 +140,9 @@ public class Backend
micromanage = instance;
}
public boolean checkLongReachBlock(double x,double y,double z)
public boolean checkLongReachBlock(Player player,double x,double y,double z)
{
return x >= BLOCK_MAX_DISTANCE || y > BLOCK_MAX_DISTANCE || z > BLOCK_MAX_DISTANCE;
return !Utilities.isUsingMcMMOAbility(player) && (x >= BLOCK_MAX_DISTANCE || y > BLOCK_MAX_DISTANCE || z > BLOCK_MAX_DISTANCE);
}
public boolean checkLongReachDamage(double x,double y,double z)
@@ -98,7 +98,7 @@ public final class Utilities
boolean b = false;
if(player.getServer().getPluginManager().getPlugin("mcMMO") != null)
{
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER))
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK))
{
b = true;
}