mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2025-01-08 17:08:09 +01:00
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:
parent
40f6d4b725
commit
60e74901c6
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user