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;
}
if (this.y != other.y)
{
return false;
}
return true;
return this.y == other.y;
}
}

View File

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

View File

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