Fixed probable ILocational NPEs.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2019-10-05 11:41:13 +00:00
parent df5b49e250
commit 23015a4ae5
15 changed files with 225 additions and 0 deletions

View File

@@ -76,6 +76,11 @@ public interface ILocational
*/
default boolean isInFrontOf(ILocational target)
{
if (target == null)
{
return false;
}
return Position.FRONT == Position.getPosition(this, target);
}
@@ -85,6 +90,11 @@ public interface ILocational
*/
default boolean isOnSideOf(ILocational target)
{
if (target == null)
{
return false;
}
return Position.SIDE == Position.getPosition(this, target);
}
@@ -94,6 +104,11 @@ public interface ILocational
*/
default boolean isBehind(ILocational target)
{
if (target == null)
{
return false;
}
return Position.BACK == Position.getPosition(this, target);
}
}