mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Compliance with Java standards via Sonar plus a few xray fixes.
This commit is contained in:
1 parent
46ec0d736d
commit
55eb3738f7
23 files changed
+463
-483
No files matched your search
@@ -6,15 +6,17 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class EyeCheck {
|
||||
private static final int EYE_DISTANCE = 20;
|
||||
|
||||
public EyeCheck()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean canSee(Player player, Block block)
|
||||
{
|
||||
//TODO: The logic here is NOT concrete, especially when looking down at an angle.
|
||||
List<Block> blocks = player.getLineOfSight(null, 20);
|
||||
List<Block> blocks = player.getLineOfSight(null, EYE_DISTANCE);
|
||||
Location bloc = block.getLocation();
|
||||
boolean see = false;
|
||||
for(Block b : blocks)
|
||||
@@ -26,13 +28,6 @@ public class EyeCheck {
|
||||
see = true;
|
||||
}
|
||||
}
|
||||
if(see)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return see;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package net.h31ix.anticheat.checks;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class LengthCheck {
|
||||
Location l1, l2;
|
||||
//Used for checking how far a player travels on an event and how far they are from another location
|
||||
private Location l1, l2;
|
||||
|
||||
public LengthCheck(Location l1, Location l2)
|
||||
{
|
||||
this.l1 = l1;
|
||||
@@ -13,26 +13,17 @@ public class LengthCheck {
|
||||
|
||||
public double getXDifference()
|
||||
{
|
||||
double bx = l1.getX();
|
||||
double px = l2.getX();
|
||||
double xdiff = Math.abs(bx-px);
|
||||
return xdiff;
|
||||
return Math.abs(l1.getX()-l2.getX());
|
||||
}
|
||||
|
||||
public double getZDifference()
|
||||
{
|
||||
double bz = l1.getZ();
|
||||
double pz = l2.getZ();
|
||||
double zdiff = Math.abs(bz-pz);
|
||||
return zdiff;
|
||||
return Math.abs(l1.getZ()-l2.getZ());
|
||||
}
|
||||
|
||||
public double getYDifference()
|
||||
{
|
||||
double by = l1.getY();
|
||||
double py = l2.getY();
|
||||
double ydiff = Math.abs(by-py);
|
||||
return ydiff;
|
||||
return Math.abs(l1.getY()-l2.getY());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user