Fix for potential problems caused by player location changing while border checking task is referencing it

Also explicit Vehicle cast necessarily added due to Bukkit changes
This commit is contained in:
Brettflan 2012-03-03 07:02:03 -06:00
parent 40f6d4b725
commit 60e74901c6
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ public class BorderCheckTask implements Runnable
{
if (player == null || !player.isOnline()) return null;
Location loc = (targetLoc == null) ? player.getLocation() : targetLoc;
Location loc = (targetLoc == null) ? player.getLocation().clone() : targetLoc;
if (loc == null) return null;
World world = loc.getWorld();
@ -65,7 +65,7 @@ public class BorderCheckTask implements Runnable
player.teleport(newLoc);
else
{
Vehicle ride = player.getVehicle();
Vehicle ride = (Vehicle)player.getVehicle();
if (ride != null)
{ // vehicles need to be offset vertically and have velocity stopped
double vertOffset = ride.getLocation().getY() - loc.getY();