Optimize ArrowStopper #282
@ -65,13 +65,13 @@ public class ArrowStopper {
|
||||
|
||||
while (!cursor.getLocation().equals(end.getLocation())) {
|
||||
BlockFace nearest = BlockFace.SELF;
|
||||
double nearestDistance = getSquareDistance(cursor.getLocation(), end.getLocation());
|
||||
double nearestDistance = cursor.getLocation().distanceSquared(end.getLocation());
|
||||
for (BlockFace face : BLOCK_FACES) {
|
||||
if(face == from) {
|
||||
continue;
|
||||
}
|
||||
Block relative = cursor.getRelative(face);
|
||||
double distance = getSquareDistance(relative.getLocation(), end.getLocation());
|
||||
double distance = relative.getLocation().distanceSquared(end.getLocation());
|
||||
if(distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = face;
|
||||
@ -86,10 +86,6 @@ public class ArrowStopper {
|
||||
return false;
|
||||
}
|
||||
|
||||
private double getSquareDistance(Location loc1, Location loc2) {
|
||||
return loc1.getX() * loc2.getX() + loc1.getY() * loc2.getY() + loc1.getZ() * loc2.getZ();
|
||||
}
|
||||
|
||||
private boolean checkBlock(Block block) {
|
||||
return Config.HiddenBlocks.contains(block.getType().name().toLowerCase());
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren