mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-26 11:07:59 +01:00
Add null checks
This commit is contained in:
parent
897c511757
commit
89e06a3e67
@ -151,8 +151,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
destVector.setZ(vector.getZ() + targetFace.getModZ());
|
||||
}
|
||||
}*/
|
||||
Location dest = Util.getCenterLocation(
|
||||
new Location(loc.getWorld(), vector.getX(), vector.getY(), vector.getZ()).getBlock());
|
||||
Location dest = Util.getCenterLocation(vector.toLocation(loc.getWorld()).getBlock());
|
||||
double dX = dest.getX() - loc.getX();
|
||||
double dZ = dest.getZ() - loc.getZ();
|
||||
double dY = dest.getY() - loc.getY();
|
||||
|
@ -154,6 +154,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
|
||||
@Override
|
||||
public Location getCurrentDestination() {
|
||||
if (strategy == null)
|
||||
return null;
|
||||
return strategy.getCurrentDestination();
|
||||
}
|
||||
|
||||
@ -221,6 +223,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
|
||||
@Override
|
||||
public Location getCurrentDestination() {
|
||||
if (active == null)
|
||||
return null;
|
||||
return active.getCurrentDestination();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user