api: Simplify if statements

This commit is contained in:
sdburns1998
2019-07-08 18:07:09 +02:00
parent 727660fd49
commit 6c85d64fe9
3 changed files with 9 additions and 20 deletions

View File

@@ -104,10 +104,6 @@ public class Point
{ {
return false; return false;
} }
if (this.y != other.y) return this.y == other.y;
{
return false;
}
return true;
} }
} }

View File

@@ -427,11 +427,8 @@ public class WorldArea
} }
if (height == 1) if (height == 1)
{ {
if ((collisionDataFlags[checkX - dx][checkY] & yFlags) != 0 && return (collisionDataFlags[checkX - dx][checkY] & yFlags) == 0 ||
extraCondition.test(WorldPoint.fromScene(client, startX, checkY, client.getPlane()))) !extraCondition.test(WorldPoint.fromScene(client, startX, checkY, client.getPlane()));
{
return false;
}
} }
} }

View File

@@ -370,16 +370,12 @@ public class WorldPoint
*/ */
public static boolean isInZone(WorldPoint lowerBound, WorldPoint upperBound, WorldPoint userLocation) public static boolean isInZone(WorldPoint lowerBound, WorldPoint upperBound, WorldPoint userLocation)
{ {
if (userLocation.getX() < lowerBound.getX() return userLocation.getX() >= lowerBound.getX()
|| userLocation.getX() > upperBound.getX() && userLocation.getX() <= upperBound.getX()
|| userLocation.getY() < lowerBound.getY() && userLocation.getY() >= lowerBound.getY()
|| userLocation.getY() > upperBound.getY() && userLocation.getY() <= upperBound.getY()
|| userLocation.getPlane() < lowerBound.getPlane() && userLocation.getPlane() >= lowerBound.getPlane()
|| userLocation.getPlane() > upperBound.getPlane()) && userLocation.getPlane() <= upperBound.getPlane();
{
return false;
}
return true;
} }
/** /**